如何从testcafe框架自定义testRunner?

列夫·博伊琴科(Lev Boichenko)
I have my testRunner for tests.
But the problem is -> how i can add the browser resolution in test 

跑步者,因为我不想将此添加到我的测试中。感谢帮助。

      runner
        .src(testFiles)
        .browsers('chrome')
        .reporter('html', stream)
        .run()
        .then(failedCount => {
          console.log(failedCount);
          testcafe.close();
亚历克斯·卡马耶夫(Alex Kamaev)

您可以通过cmd参数管理浏览器的分辨率。由于Chrome支持--window-size参数,因此您可以将其传递给运行程序的.browsers方法。请参见以下示例:

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

createTestCafe('localhost', 1337, 1338)
    .then(tc => {
        testcafe     = tc;
        const runner = testcafe.createRunner();

        return runner
            .src('my-tests.js')
            .browsers(['chrome --window-size=1000,500', 'chrome --window-size=500,200'])
            .run();
    })
    .then(failedCount => {
        console.log('Tests failed: ' + failedCount);
        testcafe.close();
    });

在这里,我在两个Chrome实例中运行测试,但窗口大小不同

另请参阅以下文章https://devexpress.github.io/testcafe/documentation/using-testcafe/programming-interface/runner.html#browsers以了解使用该.browsers方法的不同方法

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章