Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

143
Views
Failed to run tests with more than 3 users with testcafe

There is an example of a multi-user scenario on testcafe's github.

https://github.com/DevExpress/testcafe-example-multiuser-scenario

I'm trying to extend it and make sure it works fine with 3 users.

https://github.com/touka-tt/testcafe-example-multiuser-scenario

  • third-user-test.js
const { Selector } = require('testcafe');

const { getScenario } = require('..');

const scenario = getScenario('An example of synchronizing multiple tests');
const stage    = scenario.initUser('Third user');

fixture`Third fixture`
    .page('http://localhost:3000');

const input = Selector('input');
const h1    = Selector('h1');

test('test', async t => {
    await stage('Check page load');

    await t.expect(input.exists).ok();

    await stage('Type a color and send it');

    await t
        .typeText(input, 'red')
        .pressKey('enter');

    await stage('Check result');

    await t.expect(h1.innerText).eql('Not ok!');

    await stage('End');
});
  • scenario-gist.js
const { Scenario } = require('..');

module.exports = async () => {
    const scenario = new Scenario('An example of synchronizing multiple tests');

    const [user1, user2, user3] = await Promise.all([
        scenario.createUser('First user', 'test/first-user-test.js', 'chrome'),
        scenario.createUser('Second user', 'test/second-user-test.js', 'chrome --incognito'),
        scenario.createUser('Third user', 'test/third-user-test.js', 'chrome --incognito')
    ]);

    await Promise.all([
        user1.runStage('Check page load'),
        user2.runStage('Check page load'),
        user3.runStage('Check page load')
    ]);

    await user1.runStage('Type a color and send it');
    await user1.runStage('Check result');

    await user2.runStage('Type a color and send it');
    await user2.runStage('Check result');

    await user3.runStage('Type a color and send it');
    await user3.runStage('Check result');

    user1.runStage('End');
    user2.runStage('End');
    user3.runStage('End');
};

At first look, this test seems to work well. However, the first time the test is run, it succeeds fine, but on the second and later runs, it gets stalled at the first createUser.

Please tell me how to develop an e2e test using testcafe that can be repeated by multiple users.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I found the cause of the breakdown. The fact is that starting from v1.15.3, TestCafe resets the cache of modules requested in test files. Because of this, getScenario sometimes tries to find a script in an object that has been overwritten.

I have fixed this bug in the repository: https://github.com/DevExpress/testcafe-example-multiuser-scenario.

The changes were made in the PR: https://github.com/DevExpress/testcafe-example-multiuser-scenario/pull/3.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!