Skip to content
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

Add e2e tests #157

Open
2 of 4 tasks
andtos90 opened this issue Feb 10, 2024 · 0 comments
Open
2 of 4 tasks

Add e2e tests #157

andtos90 opened this issue Feb 10, 2024 · 0 comments
Assignees

Comments

@andtos90
Copy link
Contributor

andtos90 commented Feb 10, 2024

The app has no e2e tests and it's difficult to validate the correctness of each change and avoid regressions. We should investigate how to add e2e tests. I suggest trying Playwright

@andtos90 andtos90 self-assigned this Feb 14, 2024
andtos90 added a commit that referenced this issue Feb 22, 2024
# Description
Part of #157 

Add Playwrigh and add the first few tests. The main goals are:

- [x] Add Playwright and make it work locally
- [x] Add a few tests and confirm they are working correctly (with
localhost)
- [x] Support connection to Metamask
- [x] Add a test with API mocks, specifically for subgraph
- [x] Add a test with Odoo and Wallet connection
- [x] Make the API mocks typesafe
- [x] Add documentation

⚠️ There is an issue with how the wallet is handled after being cached
for the e2e test: Synthetixio/synpress#1103

### A few notes:

I started mocking with MSW but it was a painful experience. First,
Playwright doesn't work well with libraries that [override their service
worker
](https://playwright.dev/docs/network#missing-network-events-and-service-workers).
Then, the most promising plugin to support graphql-codegen with MSW and
Playwright does not support multiple endpoints, which is an issue for
testing the legacy flow (like the resolutions).

In the end, I'm fairly happy with the final solution. It's not a lot of
code and it doesn't use new libraries but reuses what we have without
sacrificing functionalities.

---------

Co-authored-by: Andrea Tosatto <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant