Skip to content

Latest commit

 

History

History
135 lines (85 loc) · 4.23 KB

testing.md

File metadata and controls

135 lines (85 loc) · 4.23 KB

Running Tests

Unit Tests

yarn test:unit

E2E Tests

Platforms

For both iOS and Android platforms, our chosen E2E test framework is Detox. We also utilize Appium for Android (wdio folder).

Test wallet

E2E tests use a wallet able to access testnet and mainnet. On Bitrise CI, the wallet is created using the secret recovery phrase from secret env var. For local testing, the wallet is created using the secret recovery phrase from the .e2e.env file.

Detox

All tests live within the e2e/specs folder.

iOS

Prerequisites for running tests

  • Before running tests:
    • Homebrew is a pre-requisite for applesimutils, please ensure that homebrew is installed. Read more here.

    • Ensure that the applesimutils is installed on your machine by typing applesimutils command in your terminal. Please note that applesimutils is essential for running the iOS tests. If you don't have applesimutils installed, please use the guidelines provided here to install it.

    • To ensure that the detox-cli is properly installed, please verify its presence by running the command detox in your terminal. The detox-cli serves as a convenient script that facilitates running commands through a local Detox executable located at node_modules/.bin/detox. Its purpose is to simplify the operation of Detox from the command line. For example, you can execute commands like detox test -c ios.sim.debug with ease using detox-cli. In case the detox-cli is not installed, please refer to the instructions provided here for detailed guidance.

  • The default device for iOS is the iPhone 13 Pro and Android the Pixel 5. Ensure you have these set up. You can change the default devices at anytime by updating the device.type in the detox config e2e/.detoxrc.js
  • Make sure that Metro is running. Use this command to launch the metro server:
yarn watch

You can trigger the tests against a release or debug build. It recommended that you trigger the tests against a debug build.

To build the app for testing on an iOS debug build run this command:

yarn test:e2e:ios:debug:build

To build the app for testing on an android debug build run this command:

yarn test:e2e:android:debug:build

To run the tests on a debug build run this command:

For iOS

yarn test:e2e:ios:debug:run

and on Android:

yarn test:e2e:android:debug:run

If you choose to run tests against a release build, you can do so by running this command:

For iOS

yarn test:e2e:ios

and on Android:

yarn test:e2e:android

If you have already built the application for Detox and want to run a specific test from the test folder, you can use this command:

For iOS

yarn test:e2e:ios:debug:run e2e/specs/TEST_NAME.spec.js

and on Android:

yarn test:e2e:android:debug:run e2e/specs/TEST_NAME.spec.js

To run tests associated with a certain tag, you can do so using the --testNamePattern flag. For example:

yarn test:e2e:ios:debug:run --testNamePattern="Smoke"
yarn test:e2e:android:debug:run --testNamePattern="Smoke"

This runs all tests that are tagged "Smoke"

Appium

The appium tests lives within the wdio/feature folder.

By default the tests use an avd named Android 11 - Pixel 4a API 31, with API Level 30 (Android 11). You can modify the emulator and platform version by navigating to wdio/config/android.config.debug.js and adjusting the values of deviceName to match your emulator's name, and platformVersion to match your operating system's version. Make sure to verify that the config file accurately represents your emulator settings before executing any tests.

The sequence in which you should run tests:

create a test build using this command:

yarn start:android:qa

Then run tests using this command:

yarn test:wdio:android

If you want to run a specific test, you can include the --spec flag in the aforementioned command. For example:

yarn test:wdio:android --spec ./wdio/features/Onboarding/CreateNewWallet.feature