Questions tagged [nightwatch.js]

Nightwatch.js is an easy to use Node.js based End-to-End (E2E) testing solution for browser based apps and websites.

Nightwatch.js is an easy to use Node.js based End-to-End (E2E) testing solution for browser based apps and websites. It uses the powerful Selenium WebDriver API to perform commands and assertions on DOM elements.


Resources


See Also

1449 questions
52
votes
2 answers

What is the difference between NightwatchJS and WebdriverIO?

As the title states, what is the difference between Nightwatch.js and Webdriver.io? It seems like they have kind of the same syntax and do almost the same thing. How are they different? I need to choose between them.
Presidenten
  • 5,917
  • 11
  • 43
  • 52
41
votes
6 answers

How to run a single test in nightwatch

How do I run only Test 3 from the following tests? module.exports = { 'Test 1':function(){}, 'Test 2':function(){} 'Test 3':function(){} }
Mohamed El Mahallawy
  • 11,102
  • 12
  • 44
  • 77
35
votes
6 answers

Correct way to get a count of matching elements in Nightwatch?

I'm trying to test if a todo app has the right number of elements. The docs seem to deal almost exclusively with single elements, so I had to use the Selenium Protocol functions. Would this be the right way to test the count of matching selectors…
Tev
  • 660
  • 1
  • 6
  • 13
33
votes
2 answers

What are the differences between using Nightwatch.js vs Protractor

What are the differences? What are the advantages of using one over the other for an Angular project? Nightwatch.js vs Protractor
Atav32
  • 1,488
  • 3
  • 23
  • 30
29
votes
0 answers

Nightwatch.js - Use the same browser session

We would love to adopt Nightwatch.js for testing on browsers, but we're stuck on one major caveat: at the time of this writing, Nightwatchjs does not support running different tests using the same browser session. In short, it means that: Creating…
Wallace Sidhrée
  • 9,305
  • 6
  • 43
  • 55
27
votes
5 answers

Protractor, mocking backend with angular2 on api request

I could use some help to find a solution for my problem. I need to mock some data to my angular2 application when it makes a request to an api, I need to do something like: $httpBackend.when('GET', '/userbookings/').respond(my json file data); The…
Mandersen
  • 785
  • 3
  • 13
  • 22
20
votes
2 answers

Save console messages for debugging in nightwatch.js

How can I get all console messages on nightwatch.js debugging? At phantom it's possible to use page.onError handler. Can I do the same with nightwatch? I know about window.onerror but is there way to save all console messages? Can anyone share…
Vasiliy Vanchuk
  • 6,280
  • 2
  • 18
  • 39
19
votes
4 answers

Nightwatchjs: how to check if element exists without creating an error/failure/exception

In the page I'm testing, two buttons may be displayed: BASIC or ADVANCED. I want to be able to tell if the ADVANCED button is showing -- and if so, click it. If the BASIC button is showing, I want to do nothing and continue with my test. All of the…
Aaron Kuehn
  • 191
  • 1
  • 1
  • 3
18
votes
3 answers

Can I create reusable test steps in nightwatch.js?

I am looking to create reusable components within my nightwatch.js tests. ie. login to the web app, logout of the web app What is the best method / pattern for creating these steps in a reusable way?
chrisphilton
  • 459
  • 3
  • 7
18
votes
3 answers

File Upload Testing in Nightwatch.js

I'd like to reopen the question posed here and here about testing file uploading within Nightwatch.js which uses selenium. Both links have the recommended solution of setting the value of the file input element as the url. In my use case, I've…
timaw
  • 583
  • 1
  • 4
  • 12
16
votes
4 answers

Should e2e tests persist data in real databases?

I've been reading a lot about e2e testing and one thing I cannot understand is how "real" should e2e tests be. Regardless of the tools I use for the e2e tests, I've seen that most of the time they hit either local, development or alpha…
16
votes
5 answers

How to scroll to element using Nightwatch?

I am using nightwatch for e2etesting my app. One of the tests fails because it cannot scroll to the element that it is testing I suspect. Question do I need to scroll or is there another way to do it? This is the element I am testing: return…
bier hier
  • 13,692
  • 28
  • 72
  • 140
16
votes
5 answers

Nightwatch to select option from select box

I am trying to use nightwatch.js to select an option from a select box. I have the code: this.browser.click('select[name="month"]') .pause(1000) .click('option[value="3"]') .click('select[name="day"]') …
Brown A
  • 849
  • 3
  • 13
  • 21
14
votes
3 answers

Chromedriver error "Chrome version must be >= 52" using Nightwatch

I'm trying to setup Nightwatch, and am using the latest chromedriver which says it supports chrome v52-54. BUT, when I try to run the tests, it says 'Error: Chrome version must be >=52.0.2743.' Here's everything that I'm using: ChromeDriver…
Katie
  • 37,767
  • 18
  • 80
  • 110
14
votes
1 answer

Nightwatch: Better way than `.pause(1000)` to avoid brittle tests?

Is .pause(1000) really the best-practice there is to wait for form submission? I'm looking for a way to reliably submit a form without having to know details about the page appearing as a result of the form submission. The example from the home page…
Peter V. Mørch
  • 9,433
  • 5
  • 46
  • 65
1
2 3
96 97