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

[docs] How to test an application with Playwright? #1607

Open
mlenser opened this issue Feb 22, 2024 · 10 comments
Open

[docs] How to test an application with Playwright? #1607

mlenser opened this issue Feb 22, 2024 · 10 comments
Labels
Docs Docs update for improved clarity

Comments

@mlenser
Copy link

mlenser commented Feb 22, 2024

Summary

Firstly thank you for your amazing work on this project. The migration to v4 (wagmi 2 and viem 2) was very straightforward which is a testament to the effort that has been put into this project. Thank you very much!

Documentation question:
I have some playwright tests and I want to go e2e with them. Therefore I need to connect and interact with a wallet. I'm using Playwright. I tried using https://github.com/Synthetixio/synpress, but I can't even get to the MetaMask interaction as web3modal can't find MetaMask:
image

For reference: I'm building a NextJS app using web3modal via the const { open } = useWeb3Modal(); hook.

Is there a recommended way for apps to interact with web3modal and wallets, specifically with Playwright?

Thank you

Link to the related docs page

New docs section for testing

@mlenser mlenser added the Docs Docs update for improved clarity label Feb 22, 2024
@arein
Copy link
Member

arein commented Feb 23, 2024

See our own Playwright tests in the lab folder

@arein arein closed this as completed Feb 23, 2024
@arein
Copy link
Member

arein commented Feb 23, 2024

@mlenser please share back when done or write a blog post - we want more dapp developers writing UI tests!

@arein
Copy link
Member

arein commented Feb 23, 2024

Bonus points if you add a PR to our example wallet for testnet fund mining :)

@mlenser
Copy link
Author

mlenser commented Feb 23, 2024

I checked those, but those are internal tests. There doesn't seem to be any examples of an app interacting with web3modal and then a wallet.

@mlenser
Copy link
Author

mlenser commented Mar 4, 2024

@arein I've looked again and the lab tests are very specific for web3modal itself to be tested. There are no examples of how to connect with a wagmi app for example. Can you point me in the right direction?

@arein
Copy link
Member

arein commented Mar 4, 2024

@mlenser our example app is the app we're testing. It uses wagmi. But that's an implementation detail that your tests shouldn't care about.

@mlenser
Copy link
Author

mlenser commented Mar 5, 2024

Sorry to bother, but the tests in that repo are not clear/extensible. There is a lot of abstraction and a lot of fixtures/pages, none of which is importable from an app using web3modal. Is the expectation that every app that wants to UI test copies a bunch of boilerplate from that repo and makes it work somehow? Or is there a more clear path forward?
Thanks for your time.

@mlenser
Copy link
Author

mlenser commented Mar 8, 2024

@arein Is the expectation that every app that wants to UI test copies a bunch of boilerplate from that repo and makes it work somehow? Or is there a more clear path forward?

@glitch-txs glitch-txs reopened this Mar 9, 2024
@mlenser
Copy link
Author

mlenser commented Mar 12, 2024

@glitch-txs I saw you reopened this. Is this something you guys will look into?

I've been hoping for some clarity else I'll probably end up biting the bullet and manually copy&pasting all the boilerplate and probably setting up scripts to copy&paste it into our app. It's a fair amount of files that seem to be updated regularly so it seems there must be a better way?

@gittygoo
Copy link

Having the same problems here, unable to test with synpress at all

@glitch-txs glitch-txs transferred this issue from reown-com/appkit Jun 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs Docs update for improved clarity
Projects
None yet
Development

No branches or pull requests

4 participants