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

[test:e2e] Check if playwright offers a quicker/more reliable framework for web3 testing #1022

Open
0xJem opened this issue Dec 27, 2021 · 9 comments
Assignees
Labels
good first issue Good for newcomers help wanted Extra attention is needed test suite

Comments

@0xJem
Copy link
Contributor

0xJem commented Dec 27, 2021

No description provided.

@0xJem 0xJem assigned 0xJem and unassigned 0xJem Dec 27, 2021
@ivelin
Copy link
Contributor

ivelin commented Dec 27, 2021

Docs on using playwright with chrome extensions:
https://playwright.dev/docs/chrome-extensions

Online monitoring service for playwritght and puppeteer in case we want to consider running our e2e tests periodically from multiple locations around the world:
https://www.checklyhq.com/

@0xJem
Copy link
Contributor Author

0xJem commented Jan 3, 2022

@ivelin Were you able to test whether playwright and metamask would play nicely together?

@ivelin ivelin added good first issue Good for newcomers help wanted Extra attention is needed test suite labels Jan 3, 2022
@ivelin
Copy link
Contributor

ivelin commented Jan 3, 2022

@ivelin Were you able to test whether playwright and metamask would play nicely together?

@0xJem Not yet. Marking this as a Good First Issue.

BTW, I am waiting on feedback for this test/base PR:
#1026

@ivelin
Copy link
Contributor

ivelin commented Jan 3, 2022

@0xJem FYI, playing with this Playwright setup for Gitpod today:
https://github.com/4DvAnCeBoY/pw-test

@ivelin
Copy link
Contributor

ivelin commented Jan 3, 2022

0xJem

UPDATE: I found a gitpod image that works well with both puppeteer and playwright. Also includes a debug tool for both:
https://github.com/testimio/root-cause-interactive-demo

When it comes to MetaMask, I think we have two options with pros and cons:

  1. Use Puppeteer with dappeteer on chome only. Lock in MetaMask version to avoid brittleness. Downside here is lack of multi-browser testing.
  2. Use Playwright and stub-out/mock wallet interactions. This will allow us to test on multiple browser targets. Downside is we can't replay e2e user paths through wallet interactions.

Since we use the WalletConnect API as a wallet connector on mobile apps and direct MetaMask conncetion on Desktop, it might be better to work with wallet abstractions and mockups for now until we get a stable e2e API from WalletConnect and/or MetaMask. Looks like both projects are interested in working on this in 2022.

Thoughts?

@0xJem
Copy link
Contributor Author

0xJem commented Jan 12, 2022

Puppeteer supports Firefox, Chromium and Chrome as testing targets, by the way. But that does exclude others.

If we can abstract the wallet client out and have specific tests to ensure that wallet X works, I think that would be ideal. I assume that mocking the WalletConnect API is non-trivial, so is this something that we can tackle now?

Assuming the mocking is trivial, how much easier is it to use playwright?

@ivelin
Copy link
Contributor

ivelin commented Jan 15, 2022

Puppeteer supports Firefox, Chromium and Chrome as testing targets, by the way. But that does exclude others.

Correct. Does not support webkit based browsers like Safari. Playwright does.

If we can abstract the wallet client out and have specific tests to ensure that wallet X works, I think that would be ideal. I assume that mocking the WalletConnect API is non-trivial, so is this something that we can tackle now?

Yes, I agree. Even though wallet vendors responded positively to the idea, none committed to an action plan so far. Stubbing out the WalletConnect API seems like our best bet for the time being. I believe its possible and am happy to work on that.

Assuming the mocking is trivial, how much easier is it to use playwright?

Most of my experience is with cypress. From what I can tell, puppeteer and playwright are very similar and shouldn't be too hard to use either.

Related note:
We just got yarn test:unit in develop. I would suggest we get unit test coverage to 80% or above before we move on to e2e tests. Otherwise I am concerned we will end up with several dangling test branches for awhile longer.

@ivelin
Copy link
Contributor

ivelin commented Jan 15, 2022

@ivelin ivelin changed the title Check if playwright offers a quicker/more reliable framework for testing Check if playwright offers a quicker/more reliable framework for web3 testing Jan 15, 2022
@ivelin ivelin changed the title Check if playwright offers a quicker/more reliable framework for web3 testing [test:e2e] Check if playwright offers a quicker/more reliable framework for web3 testing Jan 16, 2022
@0xJem
Copy link
Contributor Author

0xJem commented Jan 17, 2022

We just got yarn test:unit in develop. I would suggest we get unit test coverage to 80% or above before we move on to e2e tests. Otherwise I am concerned we will end up with several dangling test branches for awhile longer.

That's fair. I would like to get the work I'm doing with the v2 contracts deployment and docker done (#655 ), even if we don't populate the e2e tests immediately afterwards, as it will be difficult to context-switch back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed test suite
Projects
None yet
Development

No branches or pull requests

2 participants