5afe / safe-react

Deprecated! New repo – https://github.com/safe-global/web-core
MIT License
332 stars 364 forks source link

Integration Testing with Cypress #1210

Closed coreyshirk closed 4 years ago

coreyshirk commented 4 years ago

What is this feature about? (1 sentence)

Create an example integration test with Cypress

Why is it needed? What is the value? For whom do we build it?

Integration tests will allow automated testing of how the user interacts (clicking, typing, etc.. ) with the app. This becomes valuable at ensuring that the expected user flow remains the same when changes are made to the codebase.

High-level overview of the feature

Screens

Screen Shot 2020-08-05 at 1 04 20 PM

Other things

coreyshirk commented 4 years ago

@mikheevm any thoughts on this?

francovenica commented 4 years ago

The problem comes with the connection with the wallet.

Right now we are using a puppeteer library that loads the Metamask extension in the browser, opens it in a new tab and handle everything in there (loading accounts, signing)

For what I was able to check in cypress is possible to load the browser with the extension, but since cypress cannot handle 2 tabs or 2 superdomains then it cannot handle that MM extension, so you won't be able to connect with it.

The other wallets aren't that promising either, since all of the other (that are not physical or require a phone), require you to login or validate credentials in another superdomain and again cypress won't allow that.

If you are able to somehow connect to the site using a wallet with cypress I'd glad to give it a try

coreyshirk commented 4 years ago

@francovenica thanks for the response, the Metamask extension will be an issue as you stated above; if I am able to find an alternative I'll reach out. Where are the puppeteer tests located for the project? I'd love to contribute to unit testing or integration testing if you recommend a good first issue.

francovenica commented 4 years ago

@coreyshirk Hi there. This is the repo. Only the "develop" branch has some functional tests. https://github.com/francovenica/AutomGnosisSafe/tree/develop Clone the repo. Do a yarn install Go to the file "testSetup" and change the line 7 to "ENVIRONMENT.stg" To run a test run the command "yarn test [FILE_NAME]"

Right now only the test load safe and copy_create_safe are working because I'm in the middle of passing everything from Xpath to selectors to do the test, so there is a lot of things broken Also we are changing the site layout so test like send_funds and reject_tx are fixed, but in the staging environment the selectors I added were not pushed yet so the test are not working.