мастер бегун в тест-кафе для нескольких других бегунов? - PullRequest
1 голос
/ 23 сентября 2019

У меня есть несколько бегунов, которые используют обещание.race для завершения теста в определенное время. Скажем, у меня есть runner1.js, runner2.js runner3.js, как мне создать главного бегуна, чтобы я мог запустить все эти бегунавместе?

const createTestCafe = require('testcafe');
let testcafe = null;

// createTestCafe('localhost', 1337, 1338)
createTestCafe()
    .then(tc => {
        testcafe     = tc;
         //create test runner for configuring and launching test tasks
        const runner = testcafe.createRunner();



    return runner
        //run test from specified folders/files
        .src(['*the path to all runner.js*'])
        //configure the test runner to run tests in the specified browsers
        .browsers('chrome')
        .reporter('html-testrail')
        .run({skipJsErrors:true})             




    })


           .catch(failedCount => {
               console.log('Tests failed: ' + failedCount);
                testcafe.close();
            })

its not working this way , any suggestions?

1 Ответ

1 голос
/ 25 сентября 2019

TestCafe позволяет запускать несколько тестеров одновременно.Проверьте следующий код:

const createTestCafe = require('testcafe');

(async () => {
    const testCafe = await createTestCafe();

    const runner1 = testCafe
        .createRunner()
        .src('test1.js')
        .reporter([{ name: 'spec', output: 'report1.txt' }])
        .browsers('chrome');

    const runner2 = testCafe
        .createRunner()
        .src('test2.js')
        .reporter([{ name: 'spec', output: 'report2.txt' }])
        .browsers('firefox');

    await Promise.all([runner1, runner2].map(runner => runner.run()));

    await testCafe.close();
})();
...