Reputation: 340
I am basically stuck between a rock and sort of a hard place. I’m writing some automation scripts using TestCafe and I need some help on best practices. Basically I would like to know the best way to create an assertion that waits a brief period of time until an element appears before executing.
My Current implementation:
const setTimeout = 5000;
await t
.expect(this.papernote.exists, { timeout: setTimeout })
.ok('The trail is not visible');
When the test executes, it seems like the timeout does not get respected. Meaning TestCafe will wait the default time (3 seconds I believe) then the assertion will fail
Upvotes: 0
Views: 615
Reputation: 2348
If you need to define a timeout for a particular assertion, pass the options object to the ok
method:
await t
.expect(this.papernote.exists)
.ok('The trail is not visible', { timeout: setTimeout });
See the documentation article for details: https://devexpress.github.io/testcafe/documentation/test-api/assertions/assertion-api.html#ok
Upvotes: 3
Reputation: 567
I hope you want to increase the selector timeout. Try using this flag
--selector-timeout 500000
and you can also try
--assertion-timeout 10000
or you can try waiting for the element,
await element.with({ visibilityCheck: true }).with({timeout: 10000});
https://devexpress.github.io/testcafe/documentation/using-testcafe/command-line-interface.html
Upvotes: 3