简体   繁体   中英

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.

You can use a regular condition for this purpose; eg:

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);
    });
}

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

Reg the above Answer:

  1. how do we run the test using command line for QA and PROD mode. Pls help with the command.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM