@viraxslot I'm not sure how the approach suggested doesn't meet your requirement. For example for this page:
<html>
<body>
<div>Hello 0</div>
<div>Hello 1</div>
<div>Hello 4</div>
</body>
</html>
And this test file (I used a global variable to simplify the example):
import { Selector } from "testcafe";
let idx = 0;
fixture("Test") // declare the fixture
.page(<url>)
for(var i = 0; i < 3 ; i++){
test('test no. ' + i, async t => {
await t
.expect(Selector("div").nth(idx).innerText).eql("Hello " + idx++)
});
}
I get intelligible output:
Running tests in:
- Chrome 66.0.3359 / Windows 8.1.0.0
Test
√ test no. 0
√ test no. 1
× test no. 2
1) AssertionError: expected 'Hello 4' to deeply equal 'Hello 2'
Browser: Chrome 66.0.3359 / Windows 8.1.0.0
.
.
.
1/3 failed (4s)