nightwatch-custom-commands-assertions icon indicating copy to clipboard operation
nightwatch-custom-commands-assertions copied to clipboard

waitForText default time

Open Arytas opened this issue 9 years ago • 4 comments

is there a defautl time set in waitForText() function?

if i dont set a max time i get this error Expression wasn't true in 10000 ms. - expected "expression true" but got: expression false

if i set a max time to 10000 the element was found after 49ms

Arytas avatar Aug 29 '16 11:08 Arytas

Yes there is, what you see in the output:

Expression wasn't true in 10000 ms. - expected "expression true" but got: expression false

is the variabile (timeoutInMilliseconds) that is used as timeout:

this.check(elementSelector, checker, (result, loadedTimeInMilliseconds) => {
    if (result) {
        var message = `waitForText: ${elementSelector}. Expression was true after ${loadedTimeInMilliseconds - this.startTimeInMilliseconds} ms.`;
    } else {
        var message = `waitForText: ${elementSelector}. Expression wasn't true in ${timeoutInMilliseconds} ms.`;
    }

    this.client.assertion(result, 'expression false', 'expression true', message, true);
    return this.emit('complete');
}, timeoutInMilliseconds);

Can you share your code?

maxgalbu avatar Aug 30 '16 08:08 maxgalbu

this was the code before i add my default waitForConditionTiemout

upgrade.waitForText('@deploy-status', (text) => {
    return text === 'done';
 });

there i get the error, and if i use

upgrade.waitForText('@deploy-status', (text) => {
      return text === 'done';
}client.globals.waitForConditionTimeout);

it works fine for me

Arytas avatar Aug 30 '16 09:08 Arytas

Does it work if you're not using page objects?

maxgalbu avatar Aug 30 '16 10:08 maxgalbu

yes without page object it is working

i called now this

  upgradeall.waitForText('div.dialog__content div:nth-child(1).grid__row div:last-child span', (text) => {
      return text === 'done';
    });
    upgradeall.waitForText('@download-status', (text) => {
      return text === 'done';
    });

it is the same selector and the first (with out page object call) is working and the second not

Arytas avatar Aug 30 '16 11:08 Arytas