How to override .testcaferc.json selector assertion parameters during test execution for only this specific test

36 views Asked by At

Hello I've got a little problem and I need to override default selector timeout coming from my .testcaferc.json file which has some properties that look like this =>

"selectorTimeout": 20000,
"pageLoadTimeout": 30000,
"assertionTimeout": 20000,

Now during test execution for visibility check to be precise it's waiting for 20 seconds even when element is not available in my DOM (I checked also by tweaking selector timeout and assertion timeout from .testcaferc.json to 5000 and seems to be working fine). Why can't I override those timeout properties during my test execution something like this =>

  await t.expect(await myTestPanel.saveButton.selector.visible).notOk('',  {timeout: 5000});

The current testcafe version I'm using is "testcafe": "2.5.0" and "testcafe-angular-selectors": "0.4.1". Any kind of help is highly appreciated. Thanks

1

There are 1 answers

0
Alexey Popov On

You can use the method with with the option timeout for a certain Selector. For example:

const headerSelector = Selector('#article-header');

await t.expect(headerSelector.with({ timeout: 100 }).innerText).eql('Thank you, John Smith!');