Skip to main content

Usage

The Ionic E2E Test Runner comes with a number of commands that help you configure your local machine for running tests, generating new tests based on code in your project, building native app binaries for testing, and running tests using these binaries and your local configuration.

Configuring your Environment#

npm run ionic-e2e configure

Generating new Tests#

npm run ionic-e2e generate
npm run ionic-e2e generate page

Building App Binaries#

npm run ionic-e2e build [configurations]

Developing Tests#

While tests will ultimately run against a native app binary, it can be very useful to develop tests directly in the browser.

There are two ways to do this. The first will start an Ionic development server and then a test runner server in Chrome:

npm run ionic-e2e develop

However, this can be slow to start if your framework's development server is slow, so an alternative is to start your framework's development server separately, and then have the test runner connect to that port on localhost:

ionic serve # or npm start, etc.npm run ionic-e2e develop -- --port 8100

Note: the two dashes before --port are important as they enable the CLI arguments to be passed to the ionic-e2e command instead of the npm run command.

Running Tests#

Once the test runner is configured, tests developed, and native binaries built using the above commands, the tests are ready to be run natively:

npm run ionic-e2e run [configurations]