Skip to main content

Running Tests

Runnings Your Tests

  1. First you need to start your server.
yarn && yarn e2e:<brand>
  1. Now start your simulator/emulator in a separate terminal to run the apps in their e2e configuration. Tip: Android has been found to run Maestro tests more efficiently and is a common choice for initially developing your test.
yarn run:e2e:<platform>:<brand>
  1. Now you can run your tests. You can either run a single test or a group of tests by supplying a 'tag'. See below for examples.
yarn test:e2e:<platform>:<brand> <relative-path-to-test-file>

Or running a suite of tests with a tag:

yarn test:e2e:<platform>:<brand>:tag "tag"

CI Pipeline

  • Every time you push your changes to the remote repository, the CI pipeline will run your tests for all brands (excluding TabNZ for the moment) and platforms. You can utilise this to your advtantage and save time by avoiding having to switch brands and platforms locally. Note: We are not yet running platforms in parallel due to current work implenting different users for each platform on the same brand. See Test Users for more information.
  • If you want to run the CI Pipeline locally, you can do so by following the steps outlined below.

Running the CI Pipeline Tests Locally

To run the pipeline locally, follow these steps, for example:

  • Shut down existing e2e servers.
  • Next run this command.
BRAND=ladbrokes sh e2e/scripts/launch_e2e_bundler.sh
  • Add executable permissions to your local 'prepare-merge-request-e2e-testing.sh' script.
chmod +x e2e/scripts/prepare-merge-request-e2e-tests.sh
  • Get the most recent commit SHA from your merge request and replace the env var CI_ COMMIT_SHA with yours.
    • "${CI_COMMIT_SHA}" → "your-commit-sha"
  • Then run it to move the changed files.
sh e2e/scripts/prepare-merge-request-e2e-tests.sh
  • Run the tests, change the brand and platform with what you wish to test.
BRAND=ladbrokes PLATFORM=ios sh e2e/scripts/run_tests.sh
  • Or if you want to run the tests that fall under a certain tag.
TEST_TAGS="debug" BRAND=ladbrokes PLATFORM=ios sh e2e/scripts/run_tests.sh

Debugging CI Pipeline Tests

If your pipeline fails. We save logs and a screenshot to the artifacts section of the pipeline. You can access this by:

  • clicking on the MR pipeline,
  • clicking on the failed test,
  • on the right, under the heading 'Job Artifacts', click 'Browse',
  • click e2e_artifacts,
  • <brand>.

Download these files to inspect why your test failed.