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.
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 await
ed 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.