Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 450
ioseph Avatar asked Sep 05 '18 00:09

ioseph


People also ask

What is assertion in TestCafe?

Use Assertions to verify page action results. Assertions are comparisons that help you determine if the page state is correct. Assertions compare the actual value of a page-related variable to the value you expect it to have. If an assertion fails, the test fails too.

Can TestCafe do API testing?

TestCafe includes a comprehensive set of server-side API testing tools. You can add dedicated API tests to your test suite, or include API testing methods in existing functional tests.

How do you use TestCafe runner?

Use the testCafe. createRunner method to create a Runner . Specifies the browsers in which tests run. Configures the test runner to run tests from the specified locations.


1 Answers

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.

like image 164
Andrey Belym Avatar answered Oct 05 '22 10:10

Andrey Belym