Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

147
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda