3

Is it possible to run some tests in quarantine mode and run others without the mode? For example, we have some lightweight tests and we don't need 3 tries for them, but for others it can be necessary

Alex Skorkin
  • 4,264
  • 3
  • 25
  • 47
Maksim
  • 260
  • 4
  • 11

1 Answers1

4

You can run two testcafe runners in series with different filters. One of them may be with the quarantine mode.

For example:

const createTestCafe = require('testcafe');

let testcafe = null;

const runTests = (testFiles, quarantineMode, testPrefix) => {
    const runner = testcafe.createRunner();
    return runner
        .src(testFiles)
        .filter((testName) => testName.startsWith(testPrefix))
        .browsers(['chrome'])
        .run({ quarantineMode });
};

createTestCafe('localhost', 1337, 1338)
    .then(tc => {
        testcafe = tc;
        return runTests(['test.js'], false, 'Simple')
            .then(() => runTests(['test.js'], true, 'Complex'));
    })
    .then(() => testcafe.close());

tests:

test('Simple Test', async t => {
    //...
});

test('Complex Test', async t => {
    //...
});
Dmitry Ostashev
  • 2,305
  • 1
  • 5
  • 21