You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using BDD-style syntax for tests, if we pass an async callback to the before hook that does not return anything, the before hook never runs.
// does not work (returns nothing)before(asyncbrowser=>{browser.navigateTo('https://www.ecosia.org/');});// works (returns the result from `navigateTo`)before(asyncbrowser=>browser.navigateTo('https://www.ecosia.org/'););
Steps to reproduce
use the above mentioned before hook in ecosia.js test and then run the test.
Sample test
Command to run
Verbose Output
Nightwatch Configuration
Nightwatch.js Version
tested with 3.9.0 and 3.11.0
Node Version
No response
Browser
No response
Operating System
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered:
@garg3133navigateTo() returns a Promise(which is async), so we need to await it first to make sure the navigation completes before running the test.
adding await in the before hook worked for me
@ac-mmi You're right! But this is something Nightwatch offers, that you don't need to always use await with commands, even in async callbacks, unless you want to get a result back from the command.
Description of the bug/issue
When using BDD-style syntax for tests, if we pass an async callback to the
before
hook that does not return anything, thebefore
hook never runs.Steps to reproduce
use the above mentioned before hook in
ecosia.js
test and then run the test.Sample test
Command to run
Verbose Output
Nightwatch Configuration
Nightwatch.js Version
tested with 3.9.0 and 3.11.0
Node Version
No response
Browser
No response
Operating System
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: