devDAO guide to set up automated e2e testing with Kwenta
Automated end-2-end (e2e) testing for functional scenarios of the Kwenta dApp is essential for detecting regressions in functionality after updates. To reduce technical debt, the devDAO is assisting the Core Contributors in developing an e2e testing framework for the Kwenta dApp.
At the moment, two e2e test for UI features are available:
- Wallet login:
Bounty hunters of the devDAO are currently working on improving and adding additional e2e tests for all other major UI features. If you're interested in helping out, don't be shy to drop a line in the
#community-devchannel on our Discord!
The current e2e tests are written to be run on Optimistic Kovan using Chrome as the browser.
- Download and install Google Chrome
- Setup a test wallet on Optimistic Kovan and fund it with plenty of ETH (to pay for gas) and sUSD
- Prior to running the tests you must set the environment variables below in the shell from which npm is started. Unfortunately, at this time other methods to set said environment variables (eg. through
.env.local) don't work in conjunction with Synpress.
- Open bash
- Copy the private key of the test wallet into the file
SYNPRESS_PRIVATEKEYinto the same folder location as the script. While using this method, please don't forget to update your .gitignore file to prevent your private key to be leaked.
- Run the following command
npm run build
npm run test:e2e:only:tests