Reputation: 1
testcafe 2.6.1 nodejs 16.19.0
I have a following examples:
import moment from 'moment';
import { Selector } from 'testcafe';
fixture `A set of examples that illustrate how to use TestCafe API`
.page `https://devexpress.github.io/testcafe/example/`
.after(async ctx => {
console.log(`End: ${moment().format("HH:mm:ss:SSS")}`)
} )
// !!!!!!!!!!! "selectorTimeout": 15000,
// ~15 sec
test('Test Selector', async t => {
console.log(`Start: ${moment().format("HH:mm:ss:SSS")}`)
await t.click(Selector("asdasdasd"));
console.log(`End: ${moment().format("HH:mm:ss:SSS")}`)
});
// ~15 sec
test('Test expect', async t => {
console.log(`Start: ${moment().format("HH:mm:ss:SSS")}`)
await t.expect(Selector("asdasdasd").visible).ok("");
console.log(`End: ${moment().format("HH:mm:ss:SSS")}`)
});
// ~6 sec
test('Test expect with selector time out', async t => {
console.log(`Start: ${moment().format("HH:mm:ss:SSS")}`)
await t.expect(Selector("asdasdasd", {timeout: 6000}).visible).ok("");
console.log(`End: ${moment().format("HH:mm:ss:SSS")}`)
});
// ~15 sec
test('Test expect with time out', async t => {
console.log(`Start: ${moment().format("HH:mm:ss:SSS")}`)
await t.expect(Selector("asdasdasd").visible).ok("", {timeout: 6000});
console.log(`End: ${moment().format("HH:mm:ss:SSS")}`)
});
the outcome for the first 3 are clear to me, but what about 4th one? I would like to wait for 6 seconds instead of selectorTimeout. Why it does not pickup specified timeout and does not override the selector one? Another weird case is that testcafe(at the bottom of browser) shows green light, supposedly expect is passed, but the test fail.
Upvotes: 0
Views: 86
Reputation: 6318
These timeout options are different and do not affect each other:
The Selector Timeout waits while TestCafe is trying to retrieve the element using the specified Selector
The Assertion timeout waits while TestCafe is comparing expected and actual values.
In the fourth example, Assertion timeout and Selector timeout start simultaneously, so the overall time will be 10s - default value for Selector Timeout.
Upvotes: 0