Skip to content

Commit

Permalink
test: added condition for running test Should run tests concurrently …
Browse files Browse the repository at this point in the history
…with Role
  • Loading branch information
Aleksey28 committed Dec 21, 2021
1 parent 03c64c5 commit 043bf98
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 25 deletions.
2 changes: 1 addition & 1 deletion test/functional/fixtures/concurrency/pages/first-page.html
Expand Up @@ -5,6 +5,6 @@
<title>Title</title>
</head>
<body>
<div id="someDiv">Hey</div>
<h1>First page</h1>
</body>
</html>
Expand Up @@ -5,6 +5,6 @@
<title>Title</title>
</head>
<body>
<div id="someDiv">Hey</div>
<h1>Second page</h1>
</body>
</html>
14 changes: 8 additions & 6 deletions test/functional/fixtures/concurrency/test.js
Expand Up @@ -114,12 +114,14 @@ if (config.useLocalBrowsers) {
});
}

it('Should run tests concurrently with Role', function () {
return run('chrome:headless --no-sandbox', 2, './testcafe-fixtures/role-test.js')
.then(() => {
expect(timeline.getData()).eql(['/fixtures/concurrency/pages/first-page.html', '/fixtures/concurrency/pages/second-page.html']);
});
});
if (!config.proxyless) {
it('Should run tests concurrently with Role', function () {
return run('chrome:headless --no-sandbox', 2, './testcafe-fixtures/role-test.js')
.then(() => {
expect(timeline.getData()).eql(['/fixtures/concurrency/pages/first-page.html', '/fixtures/concurrency/pages/second-page.html']);
});
});
}

it('Should report fixture start correctly if second fixture finishes before first', function () {
return run('chrome:headless --no-sandbox', 2, ['./testcafe-fixtures/multifixture-test-a.js', './testcafe-fixtures/multifixture-test-b.js'], customReporter)
Expand Down
Expand Up @@ -5,7 +5,6 @@ const DEMO_ROLE = Role('http://localhost:3000/fixtures/concurrency/pages/index.h
});

fixture`F1`
.page('http://localhost:3000/fixtures/concurrency/pages/first-page.html')
.beforeEach(async t => {
await t.useRole(DEMO_ROLE);
})
Expand All @@ -14,20 +13,10 @@ fixture`F1`
timeline.clear();
});

test('T1', async t => {
const location = await t.eval(() => window.location.pathname);
test('T1', async (t) => {
timeline.add(await t.eval(() => window.location.pathname));
}).page('http://localhost:3000/fixtures/concurrency/pages/first-page.html');

timeline.add(location);
});

fixture`F2`
.page('http://localhost:3000/fixtures/concurrency/pages/second-page.html')
.beforeEach(async t => {
await t.useRole(DEMO_ROLE);
});

test('T2', async t => {
const location = await t.eval(() => window.location.pathname);

timeline.add(location);
});
test('T2', async (t) => {
timeline.add(await t.eval(() => window.location.pathname));
}).page('http://localhost:3000/fixtures/concurrency/pages/second-page.html');

0 comments on commit 043bf98

Please sign in to comment.