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

1485 questions
13
votes
3 answers

check http status code using nightwatch

how do I check the HTTP status code using nightwatch.js? I tried browser.url(function (response) { browser.assert.equal(response.statusCode, 200); }); but of course that does not work.
Brown A
  • 929
  • 4
  • 14
  • 21
13
votes
4 answers

How can I check until an element is clickable using nightwatchjs?

How can I check until an element is clickable using nightwatch js? I want to click on an element but when I run nightwatch, selenium does not click on the element because it is not clickable yet.
Brown A
  • 929
  • 4
  • 14
  • 21
13
votes
3 answers

Nightwatch testing: Set browser to fixed size

Is there any way to ensure that the browser does not change from the initial window size. There are several things that are clicked during testing that are causing the window to maximize but i would like it to stay the same size throughout.
compsci45000
  • 379
  • 1
  • 5
  • 17
12
votes
2 answers

Using pages object in Nightwatch JS

I'm using nightwatch "0.8.6". Per the documentation on pages, I've created a pages/login.js file and add the directory to the config file with: module.exports = { url: function() { return this.launchUrl; } }; The documentation mentions…
Allyl Isocyanate
  • 13,306
  • 17
  • 79
  • 130
11
votes
3 answers

Hovering over a link in nightwatchjs

I have been using nightwatch.js and always clicked around elements. Is there a way we can hover over a link or button?
user461112
  • 3,811
  • 3
  • 20
  • 25
11
votes
3 answers

Nightwatch - Use chromedriver

So i saw a similar question on stack here but it did not have an accepted answer nor did it provide me with the information i needed.. I am trying to use 'chromedriver' because 'selenium-webdriver' requires a FF version <= 28. What i've done so…
chrismillah
  • 3,704
  • 2
  • 14
  • 20
11
votes
2 answers

Nightwatch js how to assert multiple elements

i'm trying to assert/verify multiple elements for an attribute with Nightwatch.js. I tried to use the "elements" command by selenium but it seems to not actually return a tag. browser.elements('css selector','icon_checkmark', function (result) { …
11
votes
6 answers

Uploading an image file with Nightwatch.js

I'm running front-end tests using nightwatch.js using the Chrome Driver. I need to test that image uploading works properly, presumably through the provided file input since there are callbacks that run on a successful post. I'm aware that this can…
Jeffpowrs
  • 4,430
  • 4
  • 30
  • 49
10
votes
1 answer

How to make es6 import/export works in Nightwatch test?

I want to import into my test file utility module, which is written in ES6 and exports several things I need. So what I do is import { module } from 'file' but it throws the 'SyntaxError: Unexpected token import' error. I tried to: add…
Evgeniy
  • 540
  • 4
  • 17
10
votes
4 answers

How to click a link using link text in nightwatch.js

Say I have these elements on my web page. One Two Three I want to click on the link with text Two. How to identify or click that element using the Link Text without any…
sithumc
  • 3,254
  • 8
  • 27
  • 46
10
votes
2 answers

Enable localStorage / webStorage in nightwatch.js

I am trying to test an app that relies on localStorage. Everything works fine when I interact with the browser manually. However, in nightwatch.js instead of the desired string I get a null response when requesting localStorage. This applies both in…
roktok
  • 101
  • 1
  • 6
10
votes
5 answers

Assert text value of list of webelements using nightwatch.js

I am new to using nightwatch.js. I want to get a list of elements and verify text value of each and every element with a given string. I have tried : function iter(elems) { elems.value.forEach(function(element) { …
vibhor
  • 181
  • 1
  • 2
  • 8
10
votes
3 answers

Nightwatch can't locate element via css id or class selectors

We're using Nightwatch to automate some of our UI testing. Some of the current tests are rather brittle, mostly having to do with weird CSS selectors, and I'm trying to simplify them. But some of the simple CSS selectors that I would expect to work…
Ken Smith
  • 20,305
  • 15
  • 100
  • 147
10
votes
1 answer

saving HTML source code for debugging in nightwatch.js

Suppose, I have a failing test in only one of the browsers, where one of the css/html elements is "not found". Screenshot looks okay. How can I get the html source of the current document to check?
Alexei Vinogradov
  • 1,548
  • 3
  • 15
  • 34
10
votes
6 answers

How to make a globally accessible variable?

How can I make a globally accessible variable in nightwatch.js? I'm using a variable to store a customized url (dependent on which store is loaded in our online product), but I need it to be accessible across several javascript functions. It appears…
tmacarthur
  • 141
  • 1
  • 1
  • 6
1
2
3
98 99