-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
E2E testing should be able to query the DB to work on actual data and not hard coded mocks. #6638
Comments
I'm working on it, please assign me to it |
Hey @lucasbordeau To address this, We can update the e2e testing configuration to include the GraphQL endpoint in the Can I work on this ? |
In #6644 I modified the .env.example file to contain GraphQL URL (as well as REST API URL), for now it's commented and directing to local instance but it can easily changed to any other URL like Demo instance. The bigger problem is with storing the token as it's generated per workspace (so it's unique) and can't be mocked (or I don't know any way how to mock it properly). The solution for this would be probably using the global setup which runs before any tests with API (or maybe even before all tests? To be decided) and stores the token in the process.ENV Reference: https://playwright.dev/docs/test-global-setup-teardown#teardown I'll take care of that as it's not really hard to do. |
@shwetd19 if you want, you can create all necessary GraphQL queries, it'll help a lot, just be aware how it's done as it's different compared to normal Web tests, I'm sending some documentation which I hope will help you understand. FYI, queries must be mashed into one line in order to send them to API (check the blog post in second link). Documentation: |
@BOHEUS Could we implement msw ? Like in stories ? |
@lucasbordeau could you explain what does "msw" stand for? I'm not sure about the meaning behind this abbreviation |
Sure ! We use https://mswjs.io/ for mocking our GraphQL API in stories, this way we don't have to bother with mocking anything in the frontend code, we just mock the response for a specific request. We use Also it would help to think about how we could re-use what we already wrote for stories in a shared folder of msw mocks. |
Scope & Context
E2E testing
Expected behavior
We want our e2e testing package to be able to launch graphQL Queries against the URL set in its .env.
That way we can for example test that when we login we see the first names that are in the DB for Companies.
And other tests that would require to know what's in the DB to make the relevant assertions.
For now we can set the authorization token in an env var.
The text was updated successfully, but these errors were encountered: