nightwatch.js

How can I run multiple tests in parallel with JS/nightwatchjs?

旧街凉风 提交于 2019-12-04 13:34:35
Can I execute multiple test cases in parallel through Nightwatch ?Is it Possible? I am searching for ability of threading capability in java for parallel test case execution. Also what do you guys think about moving from Selenium to Nightwatch? You can see the thread for parallelism: nightwatchjs also take a look into parallel run Nightwatch is using the same selenium webdriver protocol but with some extra additions. Yes you can leverage the parallel mode of nightwatch js using following configuration: test_workers: { enabled: true, workers: 'auto' } To execute tests in multiple browsers, you

Nightwatch Mock HTTP Requests

天涯浪子 提交于 2019-12-04 12:21:04
问题 I try mocking HTTP requests with nock and other libs like sinonjs but without success. import nock from "nock" const URL = "http://localhost:8080/" const SIGN_IN_PATH = "/fake/users/sign_in.json" export const signInRequest = (status, payload = {}) => { return nock(URL).get(SIGN_IN_PATH).reply(status, payload) } - import { signInRequest } from "./../../utils/fakeRequests" const doLogin = (browser) => { return browser .url("http://localhost:8080") .waitForElementVisible('form', 1000) .setValue(

NightwatchJS .elements returning string and not objects

孤街醉人 提交于 2019-12-04 05:01:53
I am using nightwatch and trying to iterate through a list of elements. However, when I don't get objects or elements, but I get an array of strings. CODE browser.elements("css selector", ele, function(r){ browser.perform(function(){ console.log("LIST", r); }) }) RETURN LIST { sessionId: 'b273b874-c084-4d17-8bbe-a911a170ef25', status: 0, state: 'success', value: [ { ELEMENT: '6' }, { ELEMENT: '7' }, { ELEMENT: '8' }, { ELEMENT: '9' }, { ELEMENT: '10' }, { ELEMENT: '11' } ], class: 'org.openqa.selenium.remote.Response', hCode: 995684858 } The value should be returning an object of webElements

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

旧时模样 提交于 2019-12-04 03:48:01
Say I have these elements on my web page. <a href="/dynamic1">One</a> <a href="/dynamic2">Two</a> <a href="/dynamic3">Three</a> I want to click on the link with text Two . How to identify or click that element using the Link Text without any unique attributes like id or class. In .Net I can use driver.findElement(By.linkText("Images")).click(); . What is the equivalent in nightwatch.js The locator By.linkText uses an XPath internally. So to click the second link from your example with an XPath : .useXpath() // every selector now must be XPath .click("//a[text()='Two']") .useCss() // we're back

Browserstack reports successful even when test fails in Nightwatchjs

无人久伴 提交于 2019-12-04 03:17:46
问题 I just started using nightwatch with browserstack and I'm noticing that when we get a failed test, nightwatch registers the failure, but browserstack does not. sample test I am using. Also I am using free trial version of BrowserStack. My question is: Are there any ideas how to tell browserstack when a test run failed ? From BrowserStack doc: REST API It is possible to mark tests as either a pass or a fail, using the following snippet: var request = require("request"); request({ uri: "https:/

How can I run Nightwatch tests in a specific order?

99封情书 提交于 2019-12-04 03:02:56
I have several tests which test the UI and also serve to create data along the way. A separate set of tests rely on this data, meaning that these must run only after the first set have run. I know about running a group of them, or running them with tags, but how can I run them in a specific order? Nightwatch will run each test within a particular file in order, so one (naive) solution would be to put every test in the same file, in the order you want them to run. This will get unwieldy if you have too many tests for a single file. To get around this, you can take advantage of Nightwatch

Use of Selenium for AngularJS based Web Applications

試著忘記壹切 提交于 2019-12-03 08:20:23
I have come to know that Selenium is the father of UI testing. Now my question is why then Angular team has developed Protractor. Can't the same job (that Protractor does) be done with Selenium for AngularJS based web applications? Further, people are talking about Nightwatch.js too. So why there are so many E2E testing libraries/frameworks like Protracor or Nightwatch. Protractor combines powerful tools and technologies such as NodeJS, Selenium, webDriver, Jasmine, Cucumber and Mocha. Has a bunch of customizations from Selenium to easily create tests for AngularJS applications. Speeds up your

Nightwatch Mock HTTP Requests

与世无争的帅哥 提交于 2019-12-03 07:51:28
I try mocking HTTP requests with nock and other libs like sinonjs but without success. import nock from "nock" const URL = "http://localhost:8080/" const SIGN_IN_PATH = "/fake/users/sign_in.json" export const signInRequest = (status, payload = {}) => { return nock(URL).get(SIGN_IN_PATH).reply(status, payload) } - import { signInRequest } from "./../../utils/fakeRequests" const doLogin = (browser) => { return browser .url("http://localhost:8080") .waitForElementVisible('form', 1000) .setValue('input[name=email]', 'foo@foo.com') .setValue('input[name=password]', 'somepass') .click('button[type

What are the differences between using Nightwatch.js vs Protractor

给你一囗甜甜゛ 提交于 2019-12-03 06:23:37
问题 What are the differences? What are the advantages of using one over the other for an Angular project? Nightwatch.js vs Protractor 回答1: If you are working on an AngularJS project, the choice is simple - Protractor: it is being made specifically for angular apps (though it can be used for non-angular apps also) supports angular-specific locator strategies (like by.model , by.repeater etc) waits for angular to start up during the page load (sync) it is being actively maintained and improved

How to run a single test in nightwatch

心不动则不痛 提交于 2019-12-03 04:43:56
问题 How do I run only Test 3 from the following tests? module.exports = { 'Test 1':function(){}, 'Test 2':function(){} 'Test 3':function(){} } 回答1: A new parameter --testcase has been added to run a specified testcase. nightwatch.js --test tests\demo.js --testcase "Test 1" It's a new feature since the v0.6.0 https://github.com/beatfactor/nightwatch/releases/tag/v0.6.0 回答2: You must use specific tags before function and separate all functions in diferent files under tests directory, and then call