nightwatch.js

Reuse the browser session for Selenium WebDriver for Nightwatch.js tests

守給你的承諾、 提交于 2019-11-28 08:30:04
问题 I need to write multiple tests (e.g. login test, use application once logged in tests, logout test, etc.) and need them all to be in separate files. The issue I run into is after each test, at the beginning of the next test being run, a new browser session start and it is no longer logged in due to the new session, so all my tests will fail except the login test. So, is there a way to use the same browser session to run all of my tests sequentially without having to duplicate my login code?

Nightwatch to select option from select box

…衆ロ難τιáo~ 提交于 2019-11-28 07:36:04
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"]') .pause(1000) .click('option[value="6"]') .click('select[name="year"]') .pause(1000) .click('option[value="1989"]'); It selects the correct month, year on the page but not the day. Here's the HTML for the select box for the day: <select aria-label="Day" id="day" name="day" data-validatorGroup="bday" data-component="selectbox"> <option selected="selected" value="" aria-label="Date of birth"> Day<

Uploading an image file with Nightwatch.js

試著忘記壹切 提交于 2019-11-28 07:13:27
问题 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 be done using sendKeys method of the Selenium Web Driver. How can you accomplish this using javascript and nightwatch.js? Can you access the Selenium webdriver or an interface with it? 回答1: Use this for uploading image from local desktop .setValue(

watch network with nightwatch

寵の児 提交于 2019-11-28 04:24:20
问题 I'm using nightwatch to test the frontend of an application. I'm testing that some buttons are clickable or not. Is it possible with nightwatch, to know if there was a network request made by the click, or more generally, to watch the network. 回答1: Yes, you can use https://www.npmjs.com/package/nightwatch-xhr in order to watch for Ajax requests from Nightwatch.js. (I'm one of the maintainers) 回答2: Is it possible with nightwatch, to know if there was a network request made by the click, or

Testing download links with Nightwatch.js

不问归期 提交于 2019-11-28 00:48:53
问题 I'm attempting to build an automated test with Nightwatch.js in order to verify that software download links are working correctly. I don't want to download the files, as they are quite large, I just want to verify that the corresponding link is returning a 200 HTTP response to make sure the links are pointing to the proper place. Any idea for ways to test links to downloadable files with Nightwatch.js? Here's what I currently have: /** * Test Software Downloads * * Verify that software

Protractor, mocking backend with angular2 on api request

江枫思渺然 提交于 2019-11-27 20:44:53
问题 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 problem is that all I can find on google, using the $httpBackend which is used for angularJS (angular 1). Does any know how I can get this to work in my E2E test (The application is an angular2 applciation)? I'm trying to do this with both

'Connection refused! Is selenium server started?\n' while running Nightwatch.js tests against Selenium Grid

随声附和 提交于 2019-11-27 19:35:25
问题 I use Nightwatch-Cucumber based on Nightwatch.js to automate my tests. And now I want to use Selenium Grid with a Selenium hub and several Selenium nodes to execute my tests. These are my current dependencies I actually use: "devDependencies": { "chromedriver": "2.37.0", "cucumber": "3.0.2", "geckodriver": "1.11.0", "nightwatch": "0.9.19", "nightwatch-cucumber": "9.0.0", "selenium-server-standalone-jar": "3.9.1", }, And this is my nightwatch.conf.js : const config = { globals_path: "globals

'Connection refused! Is selenium server started?\\n' while running Nightwatch.js tests against Selenium Grid

爷,独闯天下 提交于 2019-11-27 16:22:37
I use Nightwatch-Cucumber based on Nightwatch.js to automate my tests. And now I want to use Selenium Grid with a Selenium hub and several Selenium nodes to execute my tests. These are my current dependencies I actually use: "devDependencies": { "chromedriver": "2.37.0", "cucumber": "3.0.2", "geckodriver": "1.11.0", "nightwatch": "0.9.19", "nightwatch-cucumber": "9.0.0", "selenium-server-standalone-jar": "3.9.1", }, And this is my nightwatch.conf.js : const config = { globals_path: "globals.js", output_folder: "reports", custom_commands_path: "commands", // custom_assertions_path: 'assertions'

Chromedriver error “Chrome version must be >= 52” using Nightwatch

删除回忆录丶 提交于 2019-11-27 03:24:01
问题 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 2.24 Selenium 2.53.1 Nightwatch v0.9.8 Node v6.5.0 Java v1.7.0_111 Project Structure |-- nightwatch.json |-- bin/ | |-- chromedriver | |-- selenium-server-standalone-2.53.1.jar |-- tests/ | |-- sample.js |-- results/ |-- screens/ |-- node_modules/ | |--

How do I enable WebGL in headless chrome in Ubuntu?

半城伤御伤魂 提交于 2019-11-27 02:01:41
How do I enable webgl or install webgl in headless chrome in Ubuntu 14? I tried installing libosmesa6, but that did not help. Can someone please point me in the right direction? I want to use webgl to work with headless chrome and selenium tests? I am using nightwatch to run the tests. This worked for me to get chrome to use osmesa sudo apt-get install libosmesa sudo ln -s /usr/lib/x86_64-linux-gnu/libOSMesa.so.6 /opt/google/chrome/libosmesa.so google-chrome --no-first-run --user-data-dir=~/chrome-stuff --use-gl=osmesa Warning: When running with osmesa the entire page is rendered with osmesa