Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect Page URL visited when running tests in parallel in one file #6041

Closed
alexmi256 opened this issue Mar 11, 2021 · 1 comment · Fixed by #6782
Closed

Incorrect Page URL visited when running tests in parallel in one file #6041

alexmi256 opened this issue Mar 11, 2021 · 1 comment · Fixed by #6782
Assignees
Labels
FREQUENCY: level 1 SYSTEM: API TYPE: bug The described behavior is considered as wrong (bug).

Comments

@alexmi256
Copy link

alexmi256 commented Mar 11, 2021

What is your Test Scenario?

With a concurrency >1, running multiple fixtures / tests in one file that have different page URLs will fail due to the incorrect URL being visited.

Issue seems to have been introduced in 1.9.2-rc.1 as 1.9.1 does not exhibit this bug.

What is the Current behavior?

Tests are visiting wrong page URLs

What is the Expected behavior?

Tests should visit page URLs they are given.

What is your web application and your TestCafe test code?

import { ClientFunction, Role, Selector, t } from "testcafe";

const setAuthCookie = ClientFunction(auth => {
  return new Promise(resolve => {
    document.cookie = `demo_auth=${auth}; path=/`;
    resolve();
  });
});

const roleWrapper = USER => {
  return Role(
    'https://en.wikipedia.org/',
    async () => {
      await setAuthCookie(USER.auth);
      await t.eval(() => window.location.reload());
      await t.expect(Selector('.mp-topbanner').exists).notOk();
    },
    t,
    { preserveUrl: false, USER }
  );
};

const DEMO_ROLE = roleWrapper({auth: '123456'});

fixture`F1`
  .page('https://en.wikipedia.org/wiki/United_States')
  .beforeEach(async t => {
    await t.useRole(DEMO_ROLE).wait(1000);
  });

test('T1', async t => {
  const location = await t.eval(() => window.location.pathname)
  await t.expect(location).eql('/wiki/United_States');
});

fixture`F2`
  .page('https://en.wikipedia.org/wiki/Canada')
  .beforeEach(async t => {
    await t.useRole(DEMO_ROLE).wait(1000);
  });

test('T2', async t => {
  const location = await t.eval(() => window.location.pathname)
  await t.expect(location).eql('/wiki/Canada');
});

Steps to Reproduce:

npx testcafe 'chrome' -c 2 examples/testURLCollisions.js

Your Environment details:

  • testcafe version: 1.12.0
  • node.js version: v14.15.5
  • command-line arguments: 'chrome' -c 2 examples/testURLCollisions.js
  • browser name and version: Chrome 88
  • platform and version: Linux
  • other:
@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Mar 11, 2021
@viktoria2506
Copy link

I reproduced the problem, and now we need some time to figure out what is wrong. Please stay tuned. In the meantime, you can use a workaround and split the fixtures into 2 different files, and run both using concurrency.

@need-response-app need-response-app bot removed the STATE: Need response An issue that requires a response or attention from the team. label Mar 12, 2021
@viktoria2506 viktoria2506 added TYPE: bug The described behavior is considered as wrong (bug). SYSTEM: API FREQUENCY: level 1 labels Mar 12, 2021
@Aleksey28 Aleksey28 self-assigned this Dec 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FREQUENCY: level 1 SYSTEM: API TYPE: bug The described behavior is considered as wrong (bug).
Projects
None yet
3 participants