Hi,
after some research I noticed that you already have a option waitForConditionTimeout for global timeout on waitFor functions, but is not documented. I would like to add the documentation for it and any other global configuration present in the project.
Maybe add it to examples/globalModule.js. What do you think?
It is documented, see here: http://nightwatchjs.org/api/waitForElementVisible.html
All the waitFor commands mention it.
mentioning != documenting
mentioning well enough to understand how it's work == documenting
Similarly, a default timeout can be specified as a global waitForConditionTimeout property (in milliseconds).
@beatfactor, how?
@StephanBijzitter you can put it in a globalModules.js file. You can set the path to it in your config file here :
"globals_path" : "./nightwatch/globals/globalModules.js"
globalModules.js
module.exports = {
// this controls whether to abort the test execution when an assertion failed and skip the rest
// it's being used in waitFor commands and expect assertions
abortOnAssertionFailure : false,
// this will overwrite the default polling interval (currently 500ms) for waitFor commands
// and expect assertions that use retry
waitForConditionPollInterval : 300,
// default timeout value in milliseconds for waitFor commands and implicit waitFor value for
// expect assertions
waitForConditionTimeout : 5000,
// this will cause waitFor commands on elements to throw an error if multiple
// elements are found using the given locate strategy and selector
throwOnMultipleElementsReturned : false,
// controls the timeout time for async hooks. Expects the done() callback to be invoked within this time
// or an error is thrown
asyncHookTimeout : 10000
};
More compactly, you can also put it in nightwatch.json:
{
"page_objects_path": "./tests/e2e/page-objects",
"test_settings": {
"default": {
"globals": {
"waitForConditionTimeout": 5000
}
}
}
}
What caught me out, and I needed this issue thread to help me fix, was that the timeout needed to be inside a globals element in the test_settings environment. That wasn't clear to me from the docs.
Most helpful comment
mentioning != documenting