Smitha Hebbar
Smitha Hebbar

Reputation: 11

skip test based on the environment testcafe

I have been trying to skip the tests based on the environment. TestCafe doesn't have skipif feature. which would be pretty easy to exclude tests if the env=qa. I tried using .filter but it was not solving my problem. Please consider this as a feature request.

Upvotes: 0

Views: 998

Answers (1)

Alex Skorkin
Alex Skorkin

Reputation: 4274

You can use a regular condition for this purpose; e.g.:

import { Selector } from 'testcafe';

fixture `My fixture`
    .page `http://devexpress.github.io/testcafe/example/`;

if (process.env.QA_MODE) {
    test('QA_MODE_ON', async t => {
        await t.wait(500);
    });
}
else {
    test('QA_MODE_OFF', async t => {    
        await t.wait(5000);
    });
}

P.S. StackOverflow is not the best place for making feature requests. It is better to make them in the testcafe repository.

Upvotes: 2

Related Questions