Document maintainer: Nikola Glumac, Marcus Hurney
Document status: Active
- Cucumber looks for files with a
.featurefile extension as the starting point for executingscenariosdefined within a given.featurefile. Eachscenariocontains one or moresteps.scenariosdescribe the broader context or purpose of a given set of steps while thestepsthemselves describe the intended functionality of the Javascript test executables. Together, the collectivescenarioswithin a.featurefile comprise test coverage of at least one feature within the Daedalus UI.
- Each
stepin a.featurefile will match a JavaScriptstringpassed as the first parameter to astep-definitionfunction within a separate.jsfile. Astep-definitionalso contains the executable JavaScript function(s) that run the test logic itself. Thestep's name written as text within a.featurefile must exactly match the associated JavaScriptstringwithin astep-definitionin order for the executable to run.
- All the files comprising the Daedalus acceptance tests are divided into directories by domain. A test belongs to a domain depending on the category of functionality it's meant to test. Within Daedalus the domains
wallets,paper-wallets,addresses,transactions,navigation,nodes,settings, andcommon. These domains also constitute the top level directories of the Daedalus acceptance tests.
- Make sure you have node and yarn installed on your machine
- Clone Daedalus repository to your machine (
git clone [email protected]:input-output-hk/daedalus.git) - Install dependencies from within Daedalus directory:
$ yarn installMake sure Daedalus is properly installed (see above).
$ yarn test:unitUnbound tests run as long as you keep them running (never end except if an error occurs).
Example:
yarn test:unit:unbound --tags @mnemonics
generates and validates mnemonics as long as you keep it
running (the number of executions is updated in the terminal)
- Make sure Daedalus is properly installed (see above).
- Make sure your state directory is clean (
rm -rf ~/Library/Application\ Support/Daedalus\ Selfnode/) - Run Daedalus frontend tests:
$ cd daedalus/
$ yarn nix:selfnode
$ yarn build
$ yarn test:e2eIf one test case fails, it + all remaining test cases are immediately skipped and saved into tests/@rerun.txt.
This list can then be re-run with yarn test:unit:rerun or yarn test:e2e:rerun depending on what kind of test
failed. This way you don't have to re-run all the passing tests again just to see if the one that failed is
still broken.
- Mark the test or scenario you are working with @watch annotation
- Make sure you are in the nix console (
yarn nix:dev) - Make sure your state is clean (
rm -rf ~/Library/Application\ Support/Daedalus\ Selfnode/) - Run tests with
yarn test:e2e:watch:once
$ yarn test- Make sure you are in the nix console (
yarn nix:dev) - Make sure your state is clean (
rm -rf ~/Library/Application\ Support/Daedalus\ Selfnode/) - Run tests with
yarn test:e2e:byron
Once tests are complete you will get a summary of passed/failed tests in the Terminal window.
$ yarn testWhile working on the tests it's often useful to keep Daedalus alive after the tests have run (e.g: to inspect the app state). You can pass a special environment var to tell the test script not to close the app:
$ KEEP_APP_AFTER_TESTS=true yarn test:e2e