Concurrency
As Eyes tests are started by calling eyes.open()
and ended by calling eyes.close()
then when running Testcafe concurrently you should create an eyes instance per test, so you can call eyes.open()
and eyes.close()
on a per test basis.
Example
fixture `hello world`.page`https://www.example.com/hello.html`
test('test 1', async t => {
const eyes = new Eyes();
await eyes.open({appName: 'TestCafe', testName: 'test 1', t});
await eyes.checkWindow({tag: 'Page 1'});
await eyes.close()
await eyes.waitForResults()
});
test('test 2', async t => {
const eyes = new Eyes();
await eyes.open({appName: 'TestCafe', testName: 'test 2', t});
await eyes.checkWindow({tag: 'Page 2'});
await eyes.close()
await eyes.waitForResults()
});
Note that now each test would result in a different Applitools batch, if you want to keep all the tests in the same batch you can set batchId:
const batchId = `bid_${String(Math.random()).slice(2)}`
fixture `hello world`.page`https://www.example.com/hello.html`
test('test 1', async t => {
const eye = new Eyes();
await eyes.open({batchId, t ...});
...
});
test('test 2', async t => {
const eyes = new Eyes();
await eyes.open({batchId, t ...});
...
});