如何减慢TestCafe中的测试执行速度?

时间:2020-09-24 07:37:20

标签: testing automation automated-tests e2e-testing testcafe

我想检查其他开发人员编写的UI测试执行情况。对于我的眼睛和大脑来说,太快了,无法捕捉到正在发生的事情。

如何减慢TestCafe中测试的执行速度?

2 个答案:

答案 0 :(得分:3)

更加关注documentation后找到了答案:

TestCafe提供更改测试速度的功能。测试以全速执行,并且动作和声明之间的延迟最小,这使得在运行测试时很难识别问题。

要减慢测试速度,请使用--speed CLI标志。您可以使用1到0.01之间的值。

testcafe chrome ./my-tests --speed 0.1

答案 1 :(得分:2)

另一种方法是在beforeEach中使用setTestSpeed。这是一个代码段:

fixture`Test`
    .page`http://www.google.com`

    .before(async t => {
    })

    .beforeEach(async t => {
        await t.setTestSpeed(0.3)
        await t.maximizeWindow()
    })

test("hello", async t => {

});