-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
beforeEach does not run if test doesn't contain any lifecycle hooks #3847
Comments
+1 |
A workaround for this is to define The following would work fine even without a // globals.js
module.exports = {
async beforeEach(browser, done) {
browser.window.maximize();
done();
}
}
// nightwatch.conf.js
module.exports = {
// ...
globals_path: 'globals.js',
// ...
} So, the actual issue here is that the EDITThe main issue here is that the global hooks (only looked at the working of The fact that it runs if defined with But because this is all dependent on the bug, if that bug is fixed, the value of To be clear, if the Now, the root cause of this issue is this line. For global hooks, the NOTE: When fixing the above root cause, also fix #4325 for global hooks. |
This is not an issue when using |
A temporary fix for this has been added in #4381 after which mandatorily using the |
Description of the bug/issue
When I write a command in
beforeEach
hook inglobals.js
and don't write anybefore
orafter
hooks in the test suite, I expected that command to be executed but nightwatch skips it instead.Steps to reproduce
npm nightwatch init
command.duckDuckGo.js
test from examples usingnpx nightwatch nightwatch/examples/basic/duckDuckGo.js
.ecosia.js
test from examples usingnpx nightwatch nightwatch/examples/basic/ecosia.js
.Sample test
No response
Command to run
No response
Verbose Output
No response
Nightwatch Configuration
No response
Nightwatch.js Version
3.1.1
Node Version
18.17.0
Browser
Chrome 115.0.0
Operating System
Windows 11 Pro version 10.0.22621
Additional Information
No response
The text was updated successfully, but these errors were encountered: