Test Configuration

Run your tests against multiple device configurations

Changing configuration

You can change the configuration for a test suite with test.use. Note that config changes will start a new session when used within a test.describe.

See Playwright documentation for more details on test.use.

import { test, expect } from '@appetize/playwright'

test.use({
  config: {
    publicKey: '<buildId|publicKey>'
    device: 'nexus5'
  },
});

test('app works on nexus5', async ({ session }) => {
  ...
})

Getting configuration

The current configuration can be accessed with the config argument in the test

You can also use this to skip tests

Projects

Projects allow you to run your entire test suite with different configurations. This is useful if you have a cross platform app or wish to test against a set of devices and/or osVersions.

Below are some examples that may fit your use case.

Examples

Test Android and iOS apps

Runs tests under tests/ios for the iOS configuration, and tests/android for the Android configuration

Test iOS app against multiple iOS Versions

Runs the test suite against iOS 16 and iOS 15

Test Android against multiple devices

Runs the test suite against a Pixel 7 and a Pixel 6

During tests

You can reference the current project configuration in your tests. This is useful if you need to change or skip a test based on a certain device

Last updated