before async launches multiple browser windows
See original GitHub issueStrange behaviour I am experiencing when using before. I have to always use the async version as otherwise my tests timeout. But as soon as I do use the async version it opens two browsers, one is blank.
I’m following the docs here: http://nightwatchjs.org/guide#using-before-each-and-after-each-hooks which says that I can indeed use it without a callback,
// Lanuches a single browser but times out because done() has not been called.
// "Error: timeout of 20000ms exceeded. Ensure the done() callback is being called in this test."
before(client => {
client.url('http://google.com');
});
// Launches two browser windows and the first `it` fails because
// it runs on the second window which has not navigated to the right URL.
before((client, done) => {
client.url('http://google.com');
done();
});
node v4.2.3 nightwatch 0.9.3 with mocha test runner
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Multiple Browser Windows | Advanced Guides - TestCafe
Multiple Browser Windows. The TestCafe API includes methods that open, close, and switch between browser windows. You can test websites with pop-up windows...
Read more >Puppeteer: How to handle multiple tabs? - node.js
browser.pages() · Override the window.open function: await page. · Go to your first page and perform some actions: await page.goto(PAGE1_URL) // .
Read more >Walkthrough: Accessing the Web by Using Async and Await
This walkthrough starts with a synchronous Windows Presentation Foundation (WPF) application that sums the number of bytes in a list of websites ...
Read more >Process asynchronous tasks as they complete (C#)
By using Task.WhenAny, you can start multiple tasks at the same time and process them one by one as they're completed rather than...
Read more >Asynchronous Programming with Async and Await - Visual Basic
Asynchrony proves especially valuable for applications that access the UI thread because all UI-related activity usually shares one thread.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I had this problem as well - that two windows were opened with browser.url inside beforeEach and only one of the browsers loads up the url provided.
I was able to solve it by pushing the steps inside browser.status as follows:
@beatfactor is this correct? Should this be added maybe as a comment inside the example at link: https://github.com/nightwatchjs/nightwatch-docs/blob/master/guide/using-nightwatch/external-globals.md
This issue has been automatically marked as stale because it has not had any recent activity. If possible, please retry using the latest Nightwatch version and update the issue with any relevant details. If no further activity occurs, it will be closed. Thank you for your contribution.