5

I want to check UI test execution written by another developer. It is too fast for my eyes and brain to catch what is happening.

How do I slow down the execution of tests in TestCafe?

Alex Skorkin
  • 4,264
  • 3
  • 25
  • 47
Mate Mrše
  • 7,997
  • 10
  • 40
  • 77

4 Answers4

8

Found the answer after paying more attention to the 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
Mate Mrše
  • 7,997
  • 10
  • 40
  • 77
3

Another way is to use setTestSpeed in beforeEach. Here is a code snippet:

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 => {

});
Janaaaa
  • 1,346
  • 1
  • 16
  • 34
0

I will just add the documentation here: Set Test Speed

A value of 1 represents the fastest emulation speed. This is the default speed value. A lower speed can be useful for debugging because it allows you to watch emulated actions on a screen, but it slows tests down.

For same example provided already:

testcafe chrome ./my-tests --speed 0.1
Cesar Celis
  • 166
  • 1
  • 4
  • 8
0

we can add the following command while executing the test

--speed 0.08 
surender pal
  • 447
  • 6
  • 15