Skip to main content

Testing the app

Use the test command to run the app on the simulator, either comparing screenshots with the baseline images, or updating the baseline images.

Options

NameRequiredDefaultOptions/TypesDescription
--config, -cfalse./owl.config.jsonStringPath to the configuration file
--platform, -ptrue-ios,androidThe platform the app should be built on
--update, -utruefalseBooleanA flag about rewriting existing baseline images

When comparing images, any difference in the current vs baseline will fail the test.

info

The first time you will run the test command, react-native-owl will generate all your baseline images. It is very important to make sure these are correct before proceeding.

info

You will need to manually start the correct simulator before the tests are run.

First run

The baseline images will be automatically generated. To regenerate the baseline images, use the --update option.

Running tests

npx owl test --platform ios

Updating the baseline

Update the baseline images

npx owl test --platform ios --update

Using a custom config file

Update the baseline images

npx owl test --platform ios --config ./owl.config.json

Viewing the report

When the tests have failed any .toMatchBaseline() expectations, a report is generated, where you can view all the screenshots, where the differences in the current vs baseline screenshots will be highlighted.

The report uri is included in the test output.

Example:

The following will be included in the output of failed tests:

...
[OWL - CLI] Generating Report
[OWL - CLI] Report was built at /Users/username/Code/FormidableLabs/react-native-owl/example/.owl/report/index.html
...