TestCafe - Can selectors / assertions be run in parallel?
Asked Answered
D

1

5

I attempted to benchmark running times but couldn't get a conclusive result.

Is there any difference between:

await t.expect(Selector('something').visible).ok()
await t.expect(Selector('something1').visible).ok()
await t.expect(Selector('something2').visible).ok()

and

Promise.all([
    t.expect(Selector('something1').visible).ok(),
    t.expect(Selector('something2').visible).ok(),
    t.expect(Selector('something3').visible).ok()
])

?

It appears as though in each case the assertions are run serially.

Note: I ask to see whether actions and assertions on multiple matching yet independent elements can be sped up, I understand in most cases we want tests to run synchronously.

Draftsman answered 5/9, 2018 at 0:39 Comment(0)
B
6

TestCafe has internal commands queue, which is used to form a chain of all test controller API calls. So you are right, there should be no difference between a set of serial awaited assertions and Promise.all. Currently you have to move all code that fetches data from the browser in a single ClientFunction to achieve parallel data acquisition for a number of elements.

Befuddle answered 5/9, 2018 at 14:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.