Document maintainer: Nikola Glumac, Marcus Hurney
Document status: Active
- Cucumber looks for files with a
.feature
file extension as the starting point for executingscenarios
defined within a given.feature
file. Eachscenario
contains one or moresteps
.scenarios
describe the broader context or purpose of a given set of steps while thesteps
themselves describe the intended functionality of the Javascript test executables. Together, the collectivescenarios
within a.feature
file comprise test coverage of at least one feature within the Daedalus UI.
- Each
step
in a.feature
file will match a JavaScriptstring
passed as the first parameter to astep-definition
function within a separate.js
file. Astep-definition
also contains the executable JavaScript function(s) that run the test logic itself. Thestep
's name written as text within a.feature
file must exactly match the associated JavaScriptstring
within astep-definition
in 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 git@github.com:input-output-hk/daedalus.git
) - Install dependencies from within Daedalus directory:
$ yarn install
Make sure Daedalus is properly installed (see above).
$ yarn test:unit
Unbound 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:e2e
If 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 test
While 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