简体   繁体   中英

fluent wait in nightwatch.js

please help me with implementing FluentWait using nightwatch.js how can I use it??

in my project I have global.js containing:

waitForConditionPollInterval : 300,
    waitForConditionTimeout : 5000,

but this is not FluentWait??

And the second question is how to use variables from global.js in test scripts ?? for example, if I have code like this:

this.typeLoginAndSubmit = function() {
        browser
            .waitForElementVisible(loginPageSelectors.loginField, 5000)
            .setValue(loginPageSelectors.loginField, 'login')
            .waitForElementVisible(loginPageSelectors.loginSubmit, 5000)
            .click(loginPageSelectors.loginSubmit)
        return browser;

the nightwatch methods like "waitForElementVisible" has forced me to give ms value ?? so how and when I can use global.js configuration??

You have to assign a variable to the js.

 var global=require('global.js');

 browser
        .waitForElementVisible(loginPageSelectors.loginField, global.timeout); 

or

just assign var timeout=5000; before all actions as the script you run is javascript

then use it

browser.waitForElementVisible(loginPageSelectors.loginField,timeout); 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM