Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

beforeEach is not called. before is called. after is called afterEach is not called #362

Open
alex-chen-bridg opened this issue Mar 20, 2018 · 3 comments

Comments

@alex-chen-bridg
Copy link

It appears that beforeEach and afterEach are not getting called from with a Global.js file.
When a test fails, the afterEach method is skipped, which is not desirable since I am attempting to close a browser session and this affects subsequent tests within the same feature file/test implementation.

@icloudphil
Copy link

icloudphil commented Apr 14, 2018

I have the same issue, I was setting the code as following in nightwatch.conf.js, globals_path: "features/support/common.js"

with the following code, I can see before and after got executed via console.log, but can't see beforeEach or afterEach being executed.
module.exports = { before: function(done) { console.log('Starting test...'); // run this only for the local-env if (this.isLocal) { // start the local server App.startServer(function() { // server listening done(); }); } else { done(); } }, after : function() { console.log('Closing down...'); }, beforeEach: function(browser, done) { console.log('within before each'); // performing an async operation setTimeout(function() { // finished async duties done(); }, 100); }, afterEach: function(browser, done) { // performing an async operation console.log('within after each'); setTimeout(function() { // finished async duties done(); }, 200); } };

@praveenitgroup
Copy link

Any luck on this?

@icloudphil
Copy link

still looking, will update when i find a clue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants