Mathew
Mathew

Reputation: 1

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??

Upvotes: 0

Views: 489

Answers (1)

Ray
Ray

Reputation: 1676

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); 

Upvotes: 0

Related Questions