简体   繁体   中英

TestCafe - Can selectors / assertions be run in parallel?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM