Utility to integrate applitools screenshot testing in your detox tests
npm install detox-applitools-testing> This is a helper project which allows you to add screeshot tests for your Detox tests using Applitools.
``sh`
npm install detox-applitools-testingSetup
Inside your Detox entry (usually index.js file in e2e/index.js) add following lines:
`javascript
import {setup} from 'detox-applitools-testing';
before(async () => {
...
setup({
apiKey: 'EYES_API_KEY', //Your key from applitools,
appName: 'Your app Name',
batchId: 'Unique batch number, can simply be uuid.v4()',
serverUrl: 'applitools server url', //Optional, leave empty if not using custom server
branchName: 'YourBranchName', //Optional, run tests in specific branch. Learn more: https://help.applitools.com/hc/en-us/articles/360007528631-Branches
parentBranchName: 'YourParentBranchName', //Optional, compare tests against a specific baseline in a different branch. Learn more: https://help.applitools.com/hc/en-us/articles/360007528631-Branches
});
});
`
If you are using Jest, add this option to your Jest config to have faster global lookups (results in faster screenshot comparisons). Read more
`javascript`
"extraGlobals": ["Math"],
To use screenshot testing inside your tests:
`javascript
import {testScreenshot} from 'detox-applitools-testing';
describe('...', await () => {
it('...', () => {
...
await testScreenshot('Unique test case');
});
});
`
javascript
await testScreenshot('NAME_OF_TEST', {
ignoredTopHeight : 44, // Optional, pixels from top to ignore
screenshotPath: 'YOUR_PATH', // Optional, by default screenshot is taken by Detox
});
`By default testScreenshot cuts off top bar of the screenshot to hide the clock. You can disable it by using:
testScreenshot('TEST_ID', {ignoredTopHeight: 0})`This project is MIT licensed.