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
Name | Required | Default | Options/Types | Description |
---|---|---|---|---|
--config , -c | false | ./owl.config.json | String | Path to the configuration file |
--platform , -p | true | - | ios ,android | The platform the app should be built on |
--update , -u | true | false | Boolean | A flag about rewriting existing baseline images |
--testNamePattern , -t | false | false | String | Run only tests with a name that matches the regex |
--testPathPattern , -tp | false | false | String | A regexp string matched against all tests path |
When comparing images, any difference in the current vs baseline will fail the test.
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.
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
- npm
- Yarn
npx owl test --platform ios
yarn owl test --platform ios
Updating the baseline
Update the baseline images
- npm
- Yarn
npx owl test --platform ios --update
yarn owl test --platform ios --update
Using a custom config file
Update the baseline images
- npm
- Yarn
npx owl test --platform ios --config ./owl.config.json
yarn 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
...