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

How to slow down test execution in TestCafe?

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

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

关注documentation后找到答案:

TestCafe provides the capability to change test speed. Tests are executed at full speed with minimum delays between actions and assertions, which can make it hard to identify problems when a test is running.

To slow down the test, use the --speed CLI flag. You can use values from 1 to 0.01.

testcafe chrome ./my-tests --speed 0.1

另一种方法是在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 => {

});

我将在此处添加文档: Set Test Speed

数值1表示最快的仿真速度。这是默认的 speed 值。较低的 speed 可用于调试,因为它允许您在屏幕上观看模拟操作,但会减慢测试速度。

对于已经提供的相同示例:

testcafe chrome ./my-tests --speed 0.1