End-to-end testing framework written in Node.js and using the Webdriver API

Overview

Nightwatch.js

Homepage | Getting Started | Developer Guide | API Reference | About


Automated end-to-end testing framework powered by Node.js and using W3C Webdriver (formerly Selenium).

Nightwatch is a complete and integrated solution for end-to-end testing of web applications and websites, and also for Node.js unit and integration testing.

npm Build Status Coverage Status npm package Join the chat at https://gitter.im/nightwatchjs/nightwatch Twitter Follow

Changelog | Github Discussions


Nightwatch v1.5

We're delighted to announce the release of Nightwatch v1.5. Please see the upgrade guide if you are upgrading from a pre v1.0 version.

Up & Running in 2 Minutes:

1. Install Nightwatch from NPM

$ npm install nightwatch --save-dev

2. Install Browser Drivers:

Geckodriver (Firefox):

Geckodriver is the WebDriver service used to drive the Mozilla Firefox Browser.

$ npm install geckodriver --save-dev
Chromedriver:

Chromedriver is the WebDriver service used to drive the Google Chrome Browser.

$ npm install chromedriver --save-dev

or install everything with one line:

$ npm i nightwatch geckodriver chromedriver --save-dev

3. Run a Demo Test:

Nightwatch comes with an examples folder containing a few sample tests.

Below will run a basic test which opens the search engine Ecosia.org, searches for the term "nightwatch", and verifies if the term first result is the Nightwatch.js website.

$ npx nightwatch node_modules/nightwatch/examples/tests/ecosia.js

Windows users might need to run node node_modules/.bin/nightwatch.


Manually Download Browser Drivers

Nightwatch uses a WebDriver compatible server to control the browser. WebDriver is a W3C specification and industry standard which provides a platform and HTTP protocol to interact with a browser.

Nightwatch includes support for automatically managing the following services:

ChromeDriver

Starting with version 75, Chromedriver has W3C Webdriver protocol enabled by default. If you'd like to stick to the JSONWire for now adjust the chromeOptions:

desiredCapabilities : {
  browserName : 'chrome',
  chromeOptions: {
    w3c: false
  }
}

GeckoDriver

Selenium Standalone Server

It's important to note that, while the Selenium Server was required with older Nightwatch versions (v0.9 and prior), starting with version 1.0 Selenium is no longer necessary.

Specific WebDriver setup guides can be found on the Docs website. Legacy Selenium drivers setup guides along with debugging instructions can be found on the Wiki.

Examples

Example tests are included in the examples folder which demonstrate the usage of several Nightwatch features.

You can also check out the nightwatch-website-tests repo for example tests against the nightwatchjs.org website.

Nightwatch unit tests

The tests for Nightwatch are written using Mocha.

1. Clone the project

$ git clone https://github.com/nightwatchjs/nightwatch.git
$ cd nightwatch
$ npm install

2. Run tests

To run the complete test suite:

$ npm test

To check test coverage, run the command:

$ npm run mocha-coverage

and then open the generated coverage/index.html file in your browser.

Support Nightwatch

Nightwatch is built by @pineviewlabs - an independent software consultancy based in Oslo, Norway, with help from our contributors.

Please consider supporting Nightwatch by becoming a backer or sponsor on the OpenCollective platform.

Comments
  • "socket hang up" on Nightwatch v1.0.14 mid-test

    I am getting this error in 1.0.14. It seems mostly similar to #1788.

       POST  /wd/hub/session/d9ab872e5e220f21392bea9998a366e7/elements - ECONNRESET
           Error: socket hang up
         at createHangUpError (_http_client.js:322:15)
         at Socket.socketCloseListener (_http_client.js:363:25)
           Error while running .locateMultipleElements() protocol action: An unknown error has occurred.
    

    The error always appears mid-test, after many instructions have been completed sucessfully. It appears at a random point during the test, and at that point all following nightwatch instructions fail with this error.

    I am using [email protected], [email protected], [email protected] on Windows 10 Enterprise (1709 Build 16299.785).

    Edit: My nightwatch config looks like this: https://gist.github.com/lukasbach/f121ec9a4b7a7c337d2ebb0140476d37

    stale 
    opened by lukasbach 59
  • CoffeeScript support?

    CoffeeScript support?

    Hi!

    I'm trying to make my tests run with coffeescript, but it seems to append .js to the end of the file so test.coffee.js can't be run for obvious reasons. How does one use coffeescript with nightwatch?

    P.S. I'm following the documentation, after creating nightwatch file and trying to run it here's what I get:

    screen shot 2014-08-05 at 12 27 36 pm

    It looks like it doesn't work with the default configuration you have there out of the box

    Thanks!

    enhancement 
    opened by suprMax 53
  • Question about conditional test parts

    Question about conditional test parts

    Assuming I have a workflow like this:

    1. vist page A
    2. check if element B is on the page
      1. yes: go to 3
      2. no: go to 4
    3. do something and go back to 2.
    4. other steps

    To implement something like this in a clean way, I'd need something like this:

    waitForElementVisible(myElementSelector, waitTime, false, function (visible) {
        if(visible) {
            doSomething();
        }
    });
    

    The main difference is the boolean visible for the callback, which enables me to react according to this condition.

    Is this already possible with another method that I missed? Using e.g. getValue and this sort of methods has the disadvantage that they don't have the waiting behavior.

    opened by lxanders 50
  • Add timeout and retry logic for session creation

    Add timeout and retry logic for session creation

    This never happens locally, but in CI environments, the HTTP request that gets a session between selenium and nightwatch, may hang indefinitely. This was happening to me at least 1 to 3 times across 20 test group every single run on CI.

    related: https://github.com/nightwatchjs/nightwatch/issues/1223

    Why:

    • Without a timeout, nigthwatch can hang for 10minutes+ trying to get a session
    • Merely failing on the timeout, is unnecessary, because the selenium server is actually still responsive!

    Changes:

    • add the node.js timeout event listener to lib/http/request and emit an event called timeout.
    • add a listener for a timeout event on Nightwatch.startSession.
    • converted existing anonymous callbacks to named functions, and re-pass them to a recursive retry function
    • retries are limited to 5. timeout for session is set at 15000.
    • this timeout does not affect when selenium is off_. It only affects when the server is alive, but just hanging on response. I cannot imagine how 15000 would be too short for an existing consumer of this library.
     var retries = 5;
     /* ... */
     function createRequest(){
        if (retries > 0){
          retries = retries - 1;
          var request = new HttpRequest(options);
          request
          .on('success', createSuccessCb(request))
          .on('error', errorCb)
          .on('timeout', createRequest) 
          .send();
        } else {
          self.emit('error', {});
        }
      }
    
      createRequest();
    
    opened by NickStefan 48
  • Nightwatch: Error retrieving a new session from the selenium server

    Nightwatch: Error retrieving a new session from the selenium server

    i have 2 PC: server with Redhat 7.2 and my local PC with Ubuntu 15.10. When i run tests in Ubuntu (test work on remote machine with windows OS) all it's OK. But if i run in Redhat 7.2 i get this error:

    Error retrieving a new session from the selenium server Error: connect ETIMEDOUT 54...*:4444 at Object.exports._errnoException (util.js:856:11) at exports._exceptionWithHostPort (util.js:879:20) at TCPConnectWrap.afterConnect as oncomplete Selenium server is not running. Connection refused! Is selenium server started?

    my json file:

    {
      "src_folders" : ["tests"],
      "output_folder" : "logs",
    
      "selenium" : {
        "start_process" : true,
        "log_path" : "logs",
        "port" : 4444
      },
    
      "test_settings" : {
        "default" : {
          "launch_url" : "http://localhost",
          "selenium_port"  : 4444,
          "selenium_host"  : "54.*.*.*",
          "silent": true,
          "screenshots" : {
            "enabled" : false,
            "path" : ""
          },
          "desiredCapabilities": {
            "browserName": "firefox",
            "javascriptEnabled": true,
            "acceptSslCerts": true
          }
        }
      }
    }
    
    
    opened by serejajar 45
  • switchWindow not working

    switchWindow not working

    
    var host = 'www.google.com';
    module.exports = {
        'some test': function(client) {
            client
                .url(host)
                .waitForElementVisible('body', 1000)
                .execute(function(newWindow){
                    window.open(newWindow, null, "height=1024,width=768");
                }, [host])
                .waitForElementVisible('body', 1000)
                .window_handles(function(result) {
                    var temp = result.value[0];
                    this.switchWindow(temp);
                })
               .end();
        }
    };
    

    Doesn't work with result.value[0] or result.value[1].

    opened by amarpatel 41
  • Waiting for element text to equal a specific value

    Waiting for element text to equal a specific value

    I need to do something like this:

    client.waitForText('.total-price', '$15.00')

    This is a pattern I have used all over my tests in the past but doesn't seem to be available in Nightwatch.

    The reason I can't just use waitForElementVisible() and then getText() is because the element is initially visible with a value of $0.00 (ie. empty shopping cart) and then the value changes to $15.00 when an AJAX request finishes processing that adds an item to the cart.

    I can see a similar usefulness in AJAX applications for waiting on: form element values, attribute values, CSS class presence, etc.

    In the past, I've used Geb which does a great job of this by allowing you to wrap any content lookup in a waitFor block: http://www.gebish.org/async

    Any thoughts? How are other people handling this today?

    enhancement 
    opened by dkoo761 40
  • "socket hang up" error immediately on running nightwatch 1.0.4

    I tried upgrading to 1.0.4 and immediately on running nightwatch I get:

       connect ECONNREFUSED 127.0.0.1:4444
    
       socket hang up
           at createHangUpError (_http_client.js:302:15)
           at Socket.socketCloseListener (_http_client.js:334:23)
    

    Meaning I can't run the tests at all. This is on Mac with the following config:

      "webdriver": {
        "start_process": true,
        "server_path": "./bin/mac/chromedriver-v2.37",
        "port": 4444,
        "host": "localhost"
      }
    
    bug 
    opened by dtaub 38
  • SetValue appends text instead of replacing on subsequent tests

    SetValue appends text instead of replacing on subsequent tests

    I'm running a series of tests on a login page including all of the usual suspects (missing username/password, wrong username/password, etc.) I've found that instead of overriding the previous value in the textbox when a test uses setValue it's appending the value to the existing value. My tests:

    module.exports = {
        "Bad Password": function (browser) {
            browser
              .url("http://localhost")
              .waitForElementVisible('body', 5000)
              .setValue('input[name=UserName]', 'user')
              .setValue('input[name=Password]', 'bob')
              .click('#Login')
              .pause(5000)
              .assert.containsText('div[role=input]', 'The Username or password provided is incorrect.')
              .click('a.x-btn-noicon')
        },
        "Bad Username": function (browser) {
            browser
              .setValue('input[name=UserName]', 'steve')
              .setValue('input[name=Password]', 'bob')
              .click('#Login')
              .pause(5000)
              .assert.containsText('div[role=input]', 'The Username or password provided is incorrect.')
              .click('a.x-btn-noicon')
              .end();
        }
    };
    

    [Abbreviated for simplicity]

    Not sure if this is the intended functionality or not. If so is there a method to clear an input?

    bug 
    opened by neuhoffm 37
  • Upgrading from 0.9.x to 1.0.8 throws an error on waitForElementVisible

    Upgrading from 0.9.x to 1.0.8 throws an error on waitForElementVisible

    My current scenario is that I am in the process of upgrading our test repository from 0.9 -> 1.0 however after following the wiki and getting the tests to start, some basic actions are performed correctly, such as navigating to the right page and providing feedback on that. However when the tests hit a waitForElementVisible the console reports the error Error while running .isElementDisplayed() protocol action: undefined.

    The test steps are as follows:

    var page = browser.page.testPage();
    
    page.navigate();
    
    page.waitForElementVisible('@testPanel');
    

    Running the command with --verbose reports:

    Running command: waitForElementVisible
       Request POST  /session/0d03be1f5a8319f7565664c337a0c881/elements
       { using: 'css selector', value: '#test-panel' }
       Response 200 POST /session/0d03be1f5a8319f7565664c337a0c881/elements (18ms)
       { sessionId: '0d03be1f5a8319f7565664c337a0c881',
         status: 0,
         value: [ { ELEMENT: '0.03954989682254517-1' } ] }
     Error while running .isElementDisplayed() protocol action: undefined
    
    bug 
    opened by gregoryduckworth 34
  • Advanced CSS selectors eg. :contains('John')

    Advanced CSS selectors eg. :contains('John')

    @beatfactor - I would like to suggest to add support for extended CSS selector for selecting elements with specific text. Similar to JQuery http://api.jquery.com/contains-selector/. It would be usefull for testing worflow. Eg. for testing of creating / updating / deleting records.

    browser.click("ul li a:contains('Record')");

    or

    browser.click("ul li a[text='Record']");

    Maybe XPath selectors could handle it? Thank you! Btw. Nightwatch.js is cool :-)

    wontfix 
    opened by petrvojta 34
  • Support for loading commands from plugins onto a defined namespace

    Support for loading commands from plugins onto a defined namespace

    Description

    When loading a plugin via the plugins config section, there should be a way of defining the namespace as well, since the plugin commands could potentially cause naming collision with existing commands.

    For example, say we have a plugin called 'react-testing' which is loaded using:

    plugins: [
      'react-testing',
      'another-plugin'
    ]
    

    Another way of loading it which would also allow us to define a namespace would be:

    plugins: [
      {
        plugin:  'react-testing',
        namespace: 'react',
        options: {} // options which would be passed to the plugin instance and would also be loaded onto the main settings objet
      }, 
      'another-plugin'
    ]
    

    Suggested solution

    No response

    Alternatives / Workarounds

    No response

    Additional Information

    No response

    enhancement 
    opened by beatfactor 1
  • Can't override types with Nightwatch versions that added ts-node support

    Can't override types with Nightwatch versions that added ts-node support

    Description of the bug/issue

    When I use nightwatch.d.ts to extend Nightwatch types I expect to be able to use those types during test runtime

    In versions of Nightwatch prior to adding direct .ts file execution (ts-node) I could create a nightwatch.d.ts file in my tests directory to make available custom commands on NightwatchBrowser. For example,

    // nightwatch.d.ts
    declare module "nightwatch" {
      export interface NightwatchCustomCommands {
        helloWorld(): Awaitable<NightwatchAPI>;
      }
    }
    
    // myTestFile.ts
    'hello world test': async (browser: NightwatchBrowser) => {
      browser.helloWorld(); // would not give me any errors about the property not existing on Nightwatch browser
    }
    

    But in newer versions of Nightwatch when I try to execute the tests it attempts to load the nightwatch.d.ts file which causes this error

    
    ┌ ────────────────── ✖  local: nightwatch.d.ts  ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
    │                                                                                                                                                                                          │
    │     ✖ TypeError                                                                                                                                                                          │
    │       Unable to require file: tests/nightwatch.d.ts                                                                                                                                      │
    │    This is usually the result of a faulty configuration or import. Make sure there is a `.js`, `.json` or other executable extension with loader attached before `ts-node` available.    │
    │        Stack Trace :                                                                                                                                                                     │
    │        at getOutput (redacted/node_modules/ts-node/src/index.ts:1085:17)                                                                 │
    │        at Object.compile (redacted/node_modules/ts-node/src/index.ts:1433:41)                                                            │
    │        at Module.m._compile (redacted/node_modules/ts-node/src/index.ts:1617:30)                                                         │
    │        at Module._extensions..js (node:internal/modules/cjs/loader:1180:10)                                                                                                              │
    │        at Object.require.extensions.<computed> [as .ts] (redacted/node_modules/ts-node/src/index.ts:1621:12)                             │
    │        at Module.load (node:internal/modules/cjs/loader:1004:32)                                                                                                                         │
    │        at Function.Module._load (node:internal/modules/cjs/loader:839:12)                                                                                                                │
    │        at Module.require (node:internal/modules/cjs/loader:1028:19)                                                                                                                      │
    │        at require (node:internal/modules/cjs/helpers:102:18)                                                                                                                             │
    │        at Function.module.exports [as requireModule] (/redactednode_modules/nightwatch/lib/utils/requireModule.js:4:16)                  │
    

    Followed by

    
    ┌ ────────────────── ✖  local: helloWorldTest.ts  ──────────────────────────────────────────────────────────────────────────┐
    │                                                                                                                             │
    │     TSError                                                                                                                 │
    │       ⨯ Unable to compile TypeScript:                                                                                       │
    │    tests/helloWorldTest.ts(10,38): error TS2339: Property 'helloWorld' does not exist on type 'NightwatchBrowser'.    │
    │                                                                                                                             │
    │                                                                                                                             │
    │                                                                                                                             │
    └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
    

    Steps to reproduce

    1. Create a nightwatch.d.ts file to add types not part of @types/nightwatch and put it inside your tests folder
    // nightwatch.d.ts
    declare module "nightwatch" {
      export interface NightwatchCustomCommands {
        helloWorld(): Awaitable<NightwatchAPI>;
      }
    }
    
    1. In your test IDE those commands should be available in the intellisense, but if you try to execute the test using nightwatch --test yourTestHere.ts it will complain that Property 'helloWorld' does not exist on type 'NightwatchBrowser'.
    // myTestFile.ts
    'hello world test': async (browser: NightwatchBrowser) => {
      browser.helloWorld(); // IDE will not give me any errors about the property not existing on Nightwatch browser
    }
    

    If you try to run all your tests you'll notice Nightwatch tries to execute the nightwatch.d.ts file as a test as well.

    If I go back to the older style of using tsc to transpile everything to .js in a separate test directory everything works fine still. It would be nice to leverage the direct execution capability while retaining the ability to extend/override the built in types to allow use of custom commands not part of the @types/nightwatch definitions

    Sample test

    No response

    Command to run

    No response

    Verbose Output

    No response

    Nightwatch Configuration

    No response

    Nightwatch.js Version

    2.6.4

    Node Version

    16.17.1

    Browser

    No response

    Operating System

    Mac

    Additional Information

    No response

    opened by literallyMello 0
  • Nightwatch + Cucumber.js, waitFor-type commands abort execution when failing inside a custom command

    Nightwatch + Cucumber.js, waitFor-type commands abort execution when failing inside a custom command

    Description of the bug/issue

    Cucumber 8.10.0, Chromedriver 108.0.0.

    When browser.waitForElementVisible()/waitForElementPresent() fail inside a custom command, Nightwatch process aborts with an unhandledRejection error.

    Steps to reproduce

    1. Init Nightwatch with cucumber.js and chromedriver
    2. define a custom command containing a .waitForElementVisible() step
    3. define a cucumber step that calls the custom command
    4. pass a non-existent selector
    5. Nightwatch returns a unhandledRejection error, the process terminates and the browser stays open

    Sample test

    // features/test.feature
    Feature: load wiki
      Scenario: Check the homepage
        Given I navigate to the homepage
        Then an element on the homepage is visible
    
    
    
    // customCommands/customWait.js
    module.exports = class customWait {
      async command(selector) {
        await browser.waitForElementVisible(selector)
      }
    }
    
    
    
    // stepDefinitions/nightwatch.js
    const { Given, Then } = require('@cucumber/cucumber')
    
    Given(/^I navigate to the homepage$/, async function () {
      await browser.navigateTo(
        'https://en.wikipedia.org/wiki/Main_Page'
      )
    })
    
    Then(/^an element on the homepage is visible$/, async function () {
      await browser.customWait('#mp-tfa-h2_ERROR') // non-existent selector
    })
    

    Command to run

    npx nightwatch --verbose
    

    Verbose Output

    ⠋ Starting ChromeDriver on port 9515...
     Starting ChromeDriver with server_path=C:\Users\Public\nightwatch\node_modules\chromedriver\lib\chromedriver\chromedriver.exe...
       Request POST /session  
       {
         capabilities: {
           firstMatch: [ {} ],
           alwaysMatch: { browserName: 'chrome', 'goog:chromeOptions': {} }
         }
    ⠼ Starting ChromeDriver on port 9515...
    
    ⠇ Starting ChromeDriver on port 9515...
       Response 200 POST /session (782ms)
       {
         value: {
           capabilities: {
             acceptInsecureCerts: false,
             browserName: 'chrome',
             browserVersion: '108.0.5359.125',
             chrome: {
               chromedriverVersion: '108.0.5359.71 (1e0e3868ee06e91ad636a874420e3ca3ae3756ac-refs/branch-heads/5359@{#1016})',
               userDataDir: 'C:\\Users\\SAVERI~1.CUT\\AppData\\Local\\Temp\\scoped_dir1016_1541866121'
             },
             'goog:chromeOptions': { debuggerAddress: 'localhost:53913' },
             networkConnectionEnabled: false,
             pageLoadStrategy: 'normal',
             platformName: 'windows',
             proxy: {},
             setWindowRect: true,
             strictFileInteractability: false,
             timeouts: { implicit: 0, pageLoad: 300000, script: 30000 },
             unhandledPromptBehavior: 'dismiss and notify',
             'webauthn:extension:credBlob': true,
             'webauthn:extension:largeBlob': true,
             'webauthn:virtualAuthenticators': true
           },
           sessionId: '42b25824715f3e4c43c318c4f93d4bc6'
         }
    ℹ Connected to ChromeDriver on port 9515 (888ms).
      Using: chrome (108.0.5359.125) on WINDOWS.
    
     Received session with ID: 42b25824715f3e4c43c318c4f93d4bc6
    
    . 
     → Running command: navigateTo ('https://en.wikipedia.org/wiki/Main_Page')
       Request POST /session/42b25824715f3e4c43c318c4f93d4bc6/url  
       { url: 'https://en.wikipedia.org/wiki/Main_Page' }
       Response 200 POST /session/42b25824715f3e4c43c318c4f93d4bc6/url (1011ms)
       { value: null }
      → Completed command: navigateTo ('https://en.wikipedia.org/wiki/Main_Page') (1015ms)
    . 
     → Running command: customWait ('#mp-tfa-h2_ERROR')
    
     → Running command: waitForElementVisible ('#mp-tfa-h2_ERROR')
       Request POST /session/42b25824715f3e4c43c318c4f93d4bc6/elements  
       { using: 'css selector', value: '#mp-tfa-h2_ERROR' }
       Response 200 POST /session/42b25824715f3e4c43c318c4f93d4bc6/elements (29ms)
       { value: [] }
       Request POST /session/42b25824715f3e4c43c318c4f93d4bc6/elements  
       { using: 'css selector', value: '#mp-tfa-h2_ERROR' }
       Response 200 POST /session/42b25824715f3e4c43c318c4f93d4bc6/elements (6ms)
       { value: [] }
       Request POST /session/42b25824715f3e4c43c318c4f93d4bc6/elements  
       { using: 'css selector', value: '#mp-tfa-h2_ERROR' }
       Response 200 POST /session/42b25824715f3e4c43c318c4f93d4bc6/elements (9ms)
       { value: [] }
       Request POST /session/42b25824715f3e4c43c318c4f93d4bc6/elements  
       { using: 'css selector', value: '#mp-tfa-h2_ERROR' }
       Response 200 POST /session/42b25824715f3e4c43c318c4f93d4bc6/elements (9ms)
       { value: [] }
    [8708:9960:0103/112055.797:ERROR:device_event_log_impl.cc(215)] [11:20:55.796] USB: usb_device_handle_win.cc:1045 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
    [8708:9960:0103/112055.797:ERROR:device_event_log_impl.cc(215)] [11:20:55.797] USB: usb_device_handle_win.cc:1045 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
       Request POST /session/42b25824715f3e4c43c318c4f93d4bc6/elements  
       { using: 'css selector', value: '#mp-tfa-h2_ERROR' }
       Response 200 POST /session/42b25824715f3e4c43c318c4f93d4bc6/elements (9ms)
       { value: [] }
       Request POST /session/42b25824715f3e4c43c318c4f93d4bc6/elements  
       { using: 'css selector', value: '#mp-tfa-h2_ERROR' }
       Response 200 POST /session/42b25824715f3e4c43c318c4f93d4bc6/elements (7ms)
       { value: [] }
       Request POST /session/42b25824715f3e4c43c318c4f93d4bc6/elements  
       { using: 'css selector', value: '#mp-tfa-h2_ERROR' }
       Response 200 POST /session/42b25824715f3e4c43c318c4f93d4bc6/elements (8ms)
       { value: [] }
       Request POST /session/42b25824715f3e4c43c318c4f93d4bc6/elements  
       { using: 'css selector', value: '#mp-tfa-h2_ERROR' }
       Response 200 POST /session/42b25824715f3e4c43c318c4f93d4bc6/elements (8ms)
       { value: [] }
       Request POST /session/42b25824715f3e4c43c318c4f93d4bc6/elements  
       { using: 'css selector', value: '#mp-tfa-h2_ERROR' }
       Response 200 POST /session/42b25824715f3e4c43c318c4f93d4bc6/elements (8ms)
       { value: [] }
       Request POST /session/42b25824715f3e4c43c318c4f93d4bc6/elements  
       { using: 'css selector', value: '#mp-tfa-h2_ERROR' }
       Response 200 POST /session/42b25824715f3e4c43c318c4f93d4bc6/elements (9ms)
       { value: [] }
       Request POST /session/42b25824715f3e4c43c318c4f93d4bc6/elements  
       { using: 'css selector', value: '#mp-tfa-h2_ERROR' }
       Response 200 POST /session/42b25824715f3e4c43c318c4f93d4bc6/elements (10ms)
       { value: [] }
      ✖ NightwatchAssertError
       Timed out while waiting for element <#mp-tfa-h2_ERROR> to be present for 5000 milliseconds. - expected "visible" but got: "not found" (5210ms)
    
        Error location:
        C:\Users\Public\nightwatch\customCommands\customWait.js:
        –––––––––––––––––––––––––––––––––––––––––––––––––––––––––
         1 | module.exports = class customWait {
         2 |   async command(selector) {
         3 |     await browser.waitForElementVisible(selector) 
         4 |   }
         5 | }
        –––––––––––––––––––––––––––––––––––––––––––––––––––––––––
    
      → Completed command: waitForElementVisible ('#mp-tfa-h2_ERROR') (5217ms)
      → Completed command: customWait ('#mp-tfa-h2_ERROR') (5222ms)
      Error
       unhandledRejection: Timed out while waiting for element <#mp-tfa-h2_ERROR> to be present for 5000 milliseconds. - expected "visible" but got: "not found" (5210ms)
        at World.<anonymous> (C:\Users\Public\nightwatch\stepDefinitions\nightwatch.js:8:17)
        at Object.run (C:\Users\Public\nightwatch\node_modules\@cucumber\cucumber\lib\user_code_runner.js:24:27)
        at Object.run (C:\Users\Public\nightwatch\node_modules\@cucumber\cucumber\lib\runtime\step_runner.js:52:59)
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
        at async TestCaseRunner.invokeStep (C:\Users\Public\nightwatch\node_modules\@cucumber\cucumber\lib\runtime\test_case_runner.js:94:16)
        at async TestCaseRunner.runStep (C:\Users\Public\nightwatch\node_modules\@cucumber\cucumber\lib\runtime\test_case_runner.js:243:26)
        at async C:\Users\Public\nightwatch\node_modules\@cucumber\cucumber\lib\runtime\test_case_runner.js:174:44
        at async TestCaseRunner.aroundTestStep (C:\Users\Public\nightwatch\node_modules\@cucumber\cucumber\lib\runtime\test_case_runner.js:119:32)
        at async TestCaseRunner.runAttempt (C:\Users\Public\nightwatch\node_modules\@cucumber\cucumber\lib\runtime\test_case_runner.js:157:13)
        at async TestCaseRunner.run (C:\Users\Public\nightwatch\node_modules\@cucumber\cucumber\lib\runtime\test_case_runner.js:135:35)   
    
    ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────
    
      ️TEST FAILURE (8.218s):
       - 1 error during execution;
       - 0 tests failed;
       - 0/NA tests passed
    

    Nightwatch Configuration

    module.exports = {
      src_folders: ['stepDefinitions'],
    
      custom_commands_path: ['customCommands'],
    
      test_settings: {
        default: {
          disable_error_log: false,
          launch_url: 'https://en.wikipedia.org/',
    
          desiredCapabilities: {
            browserName: 'chrome'
          },
    
          webdriver: { start_process: true },
    
          test_runner: {
            type: 'cucumber',
    
            options: {
              feature_path: 'features'
            }
          }
        },
    
        chrome: {
          desiredCapabilities: {
            'browserName': 'chrome',
            'goog:chromeOptions': { w3c: true }
          },
    
          webdriver: { start_process: true }
        }
      }
    }
    

    Nightwatch.js Version

    2.6.4

    Node Version

    18.4.0

    Browser

    Chrome Version 108.0.5359.125

    Operating System

    Windows 10 Enterprise

    Additional Information

    No response

    opened by asos-saveriocutrupi 1
  • resolve overlapping testnames issue

    resolve overlapping testnames issue

    Thanks in advance for your contribution. Please follow the below steps in submitting a pull request, as it will help us with reviewing it quicker.

    • [x] Create a new branch from master (e.g. features/my-new-feature or issue/123-my-bugfix);
    • [x] If you're fixing a bug also create an issue if one doesn't exist yet;
    • [x] If it's a new feature explain why do you think it's necessary. Please check with the maintainers beforehand to make sure it is something that we will accept. Usually we only accept new features if we feel that they will benefit the entire community;
    • [x] Please avoid sending PRs which contain drastic or low level changes. If you are certain that the changes are needed, please discuss them beforehand and indicate what the impact will be;
    • [x] If your change is based on existing functionality please consider refactoring first. Pull requests that duplicate code will most likely be ignored;
    • [x] Do not include changes that are not related to the issue at hand;
    • [x] Follow the same coding style with regards to spaces, semicolons, variable naming etc.;
    • [x] Always add unit tests - PRs without tests are most of the times ignored.
    opened by AlaaSayed794 3
  • Section commands ignore 'use_xpath: true' locateStrategy for simple string selectors.

    Section commands ignore 'use_xpath: true' locateStrategy for simple string selectors.

    Description of the bug/issue

    When I use xpath selectors string in section commands, for example, this.click('//div'), and I have set use_xpath: true in nightwatch config, I expect the section command to resolve the selector as nested under the section selector normally using corresponding locateStrategy. Instead it defaults to 'css selector' as locateStrategy for xpath selector string and throws error.

    Error while running .locateMultipleElementsByElementId() protocol action: invalid selector: An invalid or illegal selector was specified.

    Steps to reproduce

    1. Set use_xpath: true in nightwatch config.
    2. Use the provided page object pages/ecosia.js.
    3. Run the provided sample test.
    4. See error.

    Page Object

    pages/ecosia.js

    module.exports = {
      elements: {
        navMenu: '//*[@data-test-id="main-nav-toggle"]',
        heading: '//*[@data-test-id="layout-content"]//*[contains(@class,"heading")]',
      },
      sections: {
        navDropdown: {
          selector: '//*[@data-test-id="main-nav-dropdown"]',
          commands: {
            selectOption: function (option) {
              // Uses 'css selector' locateStrategy and doesn't respect 'use_xpath: true' in config.
              this.click(`//*[@data-track-id="menu" and normalize-space()="${option}"]`);
              return this;
            },
          },
        },
      },
      commands: {
        selectOption: function (option) {
          // Uses 'xpath' locateStrategy and respects 'use_xpath: true' in config.
          this.click(`//*[@data-test-id="main-nav-dropdown"]//*[@data-track-id="menu" and normalize-space()="${option}"]`);
          return this;
        },
      },
    };
    

    Sample test

    tests/ecosia.js

    describe("ecosia", function () {
    
      const option = "Settings";
    
      it("pass", function (browser) {
        const ecosia = browser.page.ecosia();
        browser.navigateTo("https://www.ecosia.org/");
        browser.setWindowSize(1920, 1080);
        ecosia.click("@navMenu");
        ecosia.selectOption(option); // <- No Error in 'Page'
        ecosia.expect.element("@heading").text.to.contain(option);
      });
    
      it("fail", function (browser) {
        const ecosia = browser.page.ecosia();
        browser.navigateTo("https://www.ecosia.org/");
        browser.setWindowSize(1920, 1080);
        ecosia.click("@navMenu");
        ecosia.expect.section("@navDropdown").to.be.visible;
        ecosia.section.navDropdown.selectOption(option); // <- Error in 'Section'
        ecosia.expect.element("@heading").text.to.contain(option);
      });
    });
    

    Command to run

    npx nightwatch tests/ecosia.js --verbose
    

    Verbose Output

    [ecosia] Test Suite
    ──────────────────────────────────────
    ⠋ Starting ChromeDriver on port 9515...
    ⠙ Starting ChromeDriver on port 9515...
       Request POST /session
       {
         capabilities: {
           firstMatch: [ {} ],
           alwaysMatch: { browserName: 'chrome', 'goog:chromeOptions': { w3c: true } }
         }
    ⠼ Starting ChromeDriver on port 9515...
    
    ⠇ Starting ChromeDriver on port 9515...
       Response 200 POST /session (659ms)
       {
         value: {
           capabilities: {
             acceptInsecureCerts: false,
             browserName: 'chrome',
             browserVersion: '108.0.5359.125',
             chrome: {
               chromedriverVersion: '108.0.5359.71 (1e0e3868ee06e91ad636a874420e3ca3ae3756ac-refs/branch-heads/5359@{#1016})',
               userDataDir: 'C:\\Users\\tester\\AppData\\Local\\Temp\\scoped_dir6252_1393781577'
             },
             'goog:chromeOptions': { debuggerAddress: 'localhost:60917' },
             networkConnectionEnabled: false,
             pageLoadStrategy: 'normal',
             platformName: 'windows',
             proxy: {},
             setWindowRect: true,
             strictFileInteractability: false,
             timeouts: { implicit: 0, pageLoad: 300000, script: 30000 },
             unhandledPromptBehavior: 'dismiss and notify',
             'webauthn:extension:credBlob': true,
             'webauthn:extension:largeBlob': true,
             'webauthn:virtualAuthenticators': true
           },
           sessionId: 'a34ce4d57461f14f4b5e1d4d4db98e83'
         }
    ℹ Connected to ChromeDriver on port 9515 (761ms).
      Using: chrome (108.0.5359.125) on WINDOWS.
    
     Received session with ID: a34ce4d57461f14f4b5e1d4d4db98e83
    
     → Running [before]:
     → Completed [before].
    
    
    
      Running pass:
    ───────────────────────────────────────────────────────────────────────────────────────────────────
     → Running [beforeEach]:
     → Completed [beforeEach].
    
     → Running command: navigateTo ('https://www.ecosia.org/')
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/url
       { url: 'https://www.ecosia.org/' }
       Response 200 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/url (2181ms)
       { value: null }
      → Completed command: navigateTo ('https://www.ecosia.org/') (2185ms)
    
     → Running command: setWindowSize (1920, 1080)
    
     → Running command: windowSize ('current', 1920, 1080, [Function])
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/window/rect
       { x: undefined, y: undefined, width: 1920, height: 1080 }
       Response 200 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/window/rect (146ms)
       { value: { height: 1080, width: 1920, x: 10, y: 10 } }
      → Completed command: setWindowSize (1920, 1080) (157ms)
      → Completed command: windowSize ('current', 1920, 1080, [Function]) (151ms)
    
     → Running command: click ({name, __index, __selector, locateStrategy, pseudoSelector, parent, resolvedElement, abortOnFailure, suppressNotFoundErrors, timeout...})
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements
       { using: 'xpath', value: '//*[@data-test-id="main-nav-toggle"]' }
       Response 200 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements (35ms)
       {
         value: [
           {
             'element-6066-11e4-a52e-4f735466cecf': '9eb6f39d-6ddb-4a85-bffa-1d251e5a787c'
           }
         ]
      }
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/element/9eb6f39d-6ddb-4a85-bffa-1d251e5a787c/click
    {}
       Response 200 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/element/9eb6f39d-6ddb-4a85-bffa-1d251e5a787c/click (80ms)
       { value: null }
      → Completed command: click ({name, __index, __selector, locateStrategy, pseudoSelector, parent, resolvedElement, abortOnFailure, suppressNotFoundErrors, timeout...}) (126ms)
    
     → Running command: click ('//*[@data-test-id="main-nav-dropdown"]//*[@data-track-id="menu" and normalize-space()="Settings"]')
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements
       {
         using: 'xpath',
         value: '//*[@data-test-id="main-nav-dropdown"]//*[@data-track-id="menu" and normalize-space()="Settings"]'
      }
       Response 200 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements (38ms)
       {
         value: [
           {
             'element-6066-11e4-a52e-4f735466cecf': 'ec5b5c5a-1620-4169-9d91-34d538fb7bf9'
           }
         ]
      }
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/element/ec5b5c5a-1620-4169-9d91-34d538fb7bf9/click
    {}
       Response 200 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/element/ec5b5c5a-1620-4169-9d91-34d538fb7bf9/click (4109ms)
       { value: null }
      → Completed command: click ('//*[@data-test-id="main-nav-dropdown"]//*[@data-track-id="menu" and normalize-space()="Settings"]') (4150ms)
    
     → Running command: expect.element ({name, __index, __selector, locateStrategy, pseudoSelector, parent, resolvedElement, abortOnFailure, suppressNotFoundErrors, timeout...})
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements
       {
         using: 'xpath',
         value: '//*[@data-test-id="layout-content"]//*[contains(@class,"heading")]'
      }
       Response 200 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements (17ms)
       {
         value: [
           {
             'element-6066-11e4-a52e-4f735466cecf': '8925ed2a-0129-4f3c-aba2-22177ccd22c3'
           }
         ]
      }
       Request GET /session/a34ce4d57461f14f4b5e1d4d4db98e83/element/8925ed2a-0129-4f3c-aba2-22177ccd22c3/text
    
       Response 200 GET /session/a34ce4d57461f14f4b5e1d4d4db98e83/element/8925ed2a-0129-4f3c-aba2-22177ccd22c3/text (20ms)
       { value: 'Settings' }
      √ Expected element @heading <//*[@data-test-id="layout-content"]//*[contains(@class,"heading")]> text to contain: "Settings" (41ms)
      → Completed command: expect.element ({name, __index, __selector, locateStrategy, pseudoSelector, parent, resolvedElement, abortOnFailure, suppressNotFoundErrors, timeout...}) (43ms)
     → Running [afterEach]:
     → Completed [afterEach].
    
      ✨ PASSED. 1 assertions. (6.698s)
    
    
    
      Running fail:
    ───────────────────────────────────────────────────────────────────────────────────────────────────
     → Running [beforeEach]:
     → Completed [beforeEach].
    
     → Running command: navigateTo ('https://www.ecosia.org/')
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/url
       { url: 'https://www.ecosia.org/' }
       Response 200 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/url (3001ms)
       { value: null }
      → Completed command: navigateTo ('https://www.ecosia.org/') (3002ms)
    
     → Running command: setWindowSize (1920, 1080)
    
     → Running command: windowSize ('current', 1920, 1080, [Function])
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/window/rect
       { x: undefined, y: undefined, width: 1920, height: 1080 }
       Response 200 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/window/rect (136ms)
       { value: { height: 1080, width: 1920, x: 10, y: 10 } }
      → Completed command: setWindowSize (1920, 1080) (145ms)
      → Completed command: windowSize ('current', 1920, 1080, [Function]) (141ms)
    
     → Running command: click ({name, __index, __selector, locateStrategy, pseudoSelector, parent, resolvedElement, abortOnFailure, suppressNotFoundErrors, timeout...})
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements
       { using: 'xpath', value: '//*[@data-test-id="main-nav-toggle"]' }
       Response 200 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements (65ms)
       {
         value: [
           {
             'element-6066-11e4-a52e-4f735466cecf': '88d40221-78f5-4266-8e95-a3b44b82e42d'
           }
         ]
      }
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/element/88d40221-78f5-4266-8e95-a3b44b82e42d/click
    {}
       Response 200 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/element/88d40221-78f5-4266-8e95-a3b44b82e42d/click (87ms)
       { value: null }
      → Completed command: click ({name, __index, __selector, locateStrategy, pseudoSelector, parent, resolvedElement, abortOnFailure, suppressNotFoundErrors, timeout...}) (158ms)
    
     → Running command: expect.element ({name, __index, __selector, locateStrategy, pseudoSelector, parent, resolvedElement, abortOnFailure, suppressNotFoundErrors, timeout...})
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements
       { using: 'xpath', value: '//*[@data-test-id="main-nav-dropdown"]' }
       Response 200 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements (32ms)
       {
         value: [
           {
             'element-6066-11e4-a52e-4f735466cecf': '6f00903d-8c35-41a8-857a-32ee6c01d480'
           }
         ]
      }
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/execute/sync
       {
         script: 'return (function(){return (function(){var k=this||self;function aa(a){return"string"==typeof a}function ba(a,b){a=a.split(".");var c=k;a[0]in c||"undefined"==typeof c.execScript||c.execScript("var "+a... (44027 characters)',
         args: [
           {
             'element-6066-11e4-a52e-4f735466cecf': '6f00903d-8c35-41a8-857a-32ee6c01d480',
             ELEMENT: '6f00903d-8c35-41a8-857a-32ee6c01d480'
           }
         ]
      }
       Response 200 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/execute/sync (22ms)
       { value: true }
      √ Expected element @navDropdown <//*[@data-test-id="main-nav-dropdown"]> to be visible (59ms)
      → Completed command: expect.element ({name, __index, __selector, locateStrategy, pseudoSelector, parent, resolvedElement, abortOnFailure, suppressNotFoundErrors, timeout...}) (60ms)
    
     → Running command: click ({name, __index, __selector, locateStrategy, pseudoSelector, parent, resolvedElement})
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements
       { using: 'xpath', value: '//*[@data-test-id="main-nav-dropdown"]' }
       Response 200 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements (25ms)
       {
         value: [
           {
             'element-6066-11e4-a52e-4f735466cecf': '6f00903d-8c35-41a8-857a-32ee6c01d480'
           }
         ]
      }
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/element/6f00903d-8c35-41a8-857a-32ee6c01d480/elements
       {
         using: 'css selector',
         value: '//*[@data-track-id="menu" and normalize-space()="Settings"]'
      }
       Response 400 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/element/6f00903d-8c35-41a8-857a-32ee6c01d480/elements (31ms)
       {
         value: {
           error: 'invalid selector',
           message: 'invalid selector: An invalid or illegal selector was specified\n' +
             '  (Session info: chrome=108.0.5359.125)',
           stacktrace: ''
         }
      }
        Error   Error while running .locateMultipleElementsByElementId() protocol action: invalid selector: An invalid or illegal selector was specified
      (Session info: chrome=108.0.5359.125)
    
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements
       { using: 'xpath', value: '//*[@data-test-id="main-nav-dropdown"]' }
       Response 200 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements (50ms)
       {
         value: [
           {
             'element-6066-11e4-a52e-4f735466cecf': '6f00903d-8c35-41a8-857a-32ee6c01d480'
           }
         ]
      }
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/element/6f00903d-8c35-41a8-857a-32ee6c01d480/elements
       {
         using: 'css selector',
         value: '//*[@data-track-id="menu" and normalize-space()="Settings"]'
      }
       Response 400 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/element/6f00903d-8c35-41a8-857a-32ee6c01d480/elements (48ms)
       {
         value: {
           error: 'invalid selector',
           message: 'invalid selector: An invalid or illegal selector was specified\n' +
             '  (Session info: chrome=108.0.5359.125)',
           stacktrace: ''
         }
      }
        Error   Error while running .locateMultipleElementsByElementId() protocol action: invalid selector: An invalid or illegal selector was specified
      (Session info: chrome=108.0.5359.125)
    
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements
       { using: 'xpath', value: '//*[@data-test-id="main-nav-dropdown"]' }
       Response 200 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements (39ms)
       {
         value: [
           {
             'element-6066-11e4-a52e-4f735466cecf': '6f00903d-8c35-41a8-857a-32ee6c01d480'
           }
         ]
      }
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/element/6f00903d-8c35-41a8-857a-32ee6c01d480/elements
       {
         using: 'css selector',
         value: '//*[@data-track-id="menu" and normalize-space()="Settings"]'
      }
       Response 400 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/element/6f00903d-8c35-41a8-857a-32ee6c01d480/elements (22ms)
       {
         value: {
           error: 'invalid selector',
           message: 'invalid selector: An invalid or illegal selector was specified\n' +
             '  (Session info: chrome=108.0.5359.125)',
           stacktrace: ''
         }
      }
        Error   Error while running .locateMultipleElementsByElementId() protocol action: invalid selector: An invalid or illegal selector was specified
      (Session info: chrome=108.0.5359.125)
    
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements
       { using: 'xpath', value: '//*[@data-test-id="main-nav-dropdown"]' }
       Response 200 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements (39ms)
       {
         value: [
           {
             'element-6066-11e4-a52e-4f735466cecf': '6f00903d-8c35-41a8-857a-32ee6c01d480'
           }
         ]
      }
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/element/6f00903d-8c35-41a8-857a-32ee6c01d480/elements
       {
         using: 'css selector',
         value: '//*[@data-track-id="menu" and normalize-space()="Settings"]'
      }
       Response 400 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/element/6f00903d-8c35-41a8-857a-32ee6c01d480/elements (19ms)
       {
         value: {
           error: 'invalid selector',
           message: 'invalid selector: An invalid or illegal selector was specified\n' +
             '  (Session info: chrome=108.0.5359.125)',
           stacktrace: ''
         }
      }
        Error   Error while running .locateMultipleElementsByElementId() protocol action: invalid selector: An invalid or illegal selector was specified
      (Session info: chrome=108.0.5359.125)
    
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements
       { using: 'xpath', value: '//*[@data-test-id="main-nav-dropdown"]' }
       Response 200 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements (39ms)
       {
         value: [
           {
             'element-6066-11e4-a52e-4f735466cecf': '6f00903d-8c35-41a8-857a-32ee6c01d480'
           }
         ]
      }
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/element/6f00903d-8c35-41a8-857a-32ee6c01d480/elements
       {
         using: 'css selector',
         value: '//*[@data-track-id="menu" and normalize-space()="Settings"]'
      }
       Response 400 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/element/6f00903d-8c35-41a8-857a-32ee6c01d480/elements (16ms)
       {
         value: {
           error: 'invalid selector',
           message: 'invalid selector: An invalid or illegal selector was specified\n' +
             '  (Session info: chrome=108.0.5359.125)',
           stacktrace: ''
         }
      }
        Error   Error while running .locateMultipleElementsByElementId() protocol action: invalid selector: An invalid or illegal selector was specified
      (Session info: chrome=108.0.5359.125)
    
    [2840:11120:1223/151438.756:ERROR:device_event_log_impl.cc(215)] [15:14:38.756] USB: usb_device_handle_win.cc:1045 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
    [2840:11120:1223/151438.756:ERROR:device_event_log_impl.cc(215)] [15:14:38.756] USB: usb_device_handle_win.cc:1045 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements
       { using: 'xpath', value: '//*[@data-test-id="main-nav-dropdown"]' }
       Response 200 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements (11ms)
       {
         value: [
           {
             'element-6066-11e4-a52e-4f735466cecf': '6f00903d-8c35-41a8-857a-32ee6c01d480'
           }
         ]
      }
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/element/6f00903d-8c35-41a8-857a-32ee6c01d480/elements
       {
         using: 'css selector',
         value: '//*[@data-track-id="menu" and normalize-space()="Settings"]'
      }
       Response 400 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/element/6f00903d-8c35-41a8-857a-32ee6c01d480/elements (13ms)
       {
         value: {
           error: 'invalid selector',
           message: 'invalid selector: An invalid or illegal selector was specified\n' +
             '  (Session info: chrome=108.0.5359.125)',
           stacktrace: ''
         }
      }
        Error   Error while running .locateMultipleElementsByElementId() protocol action: invalid selector: An invalid or illegal selector was specified
      (Session info: chrome=108.0.5359.125)
    
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements
       { using: 'xpath', value: '//*[@data-test-id="main-nav-dropdown"]' }
       Response 200 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements (9ms)
       {
         value: [
           {
             'element-6066-11e4-a52e-4f735466cecf': '6f00903d-8c35-41a8-857a-32ee6c01d480'
           }
         ]
      }
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/element/6f00903d-8c35-41a8-857a-32ee6c01d480/elements
       {
         using: 'css selector',
         value: '//*[@data-track-id="menu" and normalize-space()="Settings"]'
      }
       Response 400 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/element/6f00903d-8c35-41a8-857a-32ee6c01d480/elements (12ms)
       {
         value: {
           error: 'invalid selector',
           message: 'invalid selector: An invalid or illegal selector was specified\n' +
             '  (Session info: chrome=108.0.5359.125)',
           stacktrace: ''
         }
      }
        Error   Error while running .locateMultipleElementsByElementId() protocol action: invalid selector: An invalid or illegal selector was specified
      (Session info: chrome=108.0.5359.125)
    
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements
       { using: 'xpath', value: '//*[@data-test-id="main-nav-dropdown"]' }
       Response 200 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements (10ms)
       {
         value: [
           {
             'element-6066-11e4-a52e-4f735466cecf': '6f00903d-8c35-41a8-857a-32ee6c01d480'
           }
         ]
      }
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/element/6f00903d-8c35-41a8-857a-32ee6c01d480/elements
       {
         using: 'css selector',
         value: '//*[@data-track-id="menu" and normalize-space()="Settings"]'
      }
       Response 400 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/element/6f00903d-8c35-41a8-857a-32ee6c01d480/elements (13ms)
       {
         value: {
           error: 'invalid selector',
           message: 'invalid selector: An invalid or illegal selector was specified\n' +
             '  (Session info: chrome=108.0.5359.125)',
           stacktrace: ''
         }
      }
        Error   Error while running .locateMultipleElementsByElementId() protocol action: invalid selector: An invalid or illegal selector was specified
      (Session info: chrome=108.0.5359.125)
    
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements
       { using: 'xpath', value: '//*[@data-test-id="main-nav-dropdown"]' }
       Response 200 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements (10ms)
       {
         value: [
           {
             'element-6066-11e4-a52e-4f735466cecf': '6f00903d-8c35-41a8-857a-32ee6c01d480'
           }
         ]
      }
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/element/6f00903d-8c35-41a8-857a-32ee6c01d480/elements
       {
         using: 'css selector',
         value: '//*[@data-track-id="menu" and normalize-space()="Settings"]'
      }
       Response 400 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/element/6f00903d-8c35-41a8-857a-32ee6c01d480/elements (13ms)
       {
         value: {
           error: 'invalid selector',
           message: 'invalid selector: An invalid or illegal selector was specified\n' +
             '  (Session info: chrome=108.0.5359.125)',
           stacktrace: ''
         }
      }
        Error   Error while running .locateMultipleElementsByElementId() protocol action: invalid selector: An invalid or illegal selector was specified
      (Session info: chrome=108.0.5359.125)
    
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements
       { using: 'xpath', value: '//*[@data-test-id="main-nav-dropdown"]' }
       Response 200 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements (10ms)
       {
         value: [
           {
             'element-6066-11e4-a52e-4f735466cecf': '6f00903d-8c35-41a8-857a-32ee6c01d480'
           }
         ]
      }
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/element/6f00903d-8c35-41a8-857a-32ee6c01d480/elements
       {
         using: 'css selector',
         value: '//*[@data-track-id="menu" and normalize-space()="Settings"]'
      }
       Response 400 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/element/6f00903d-8c35-41a8-857a-32ee6c01d480/elements (12ms)
       {
         value: {
           error: 'invalid selector',
           message: 'invalid selector: An invalid or illegal selector was specified\n' +
             '  (Session info: chrome=108.0.5359.125)',
           stacktrace: ''
         }
      }
        Error   Error while running .locateMultipleElementsByElementId() protocol action: invalid selector: An invalid or illegal selector was specified
      (Session info: chrome=108.0.5359.125)
    
      NoSuchElementError
       An element could not be located on the page using the given search parameters.
        {"status":-1,"message":"Timed out while waiting for element \"Section [name=navDropdown],//*[@data-track-id=\"menu\" and normalize-space()=\"Settings\"]\" with \"recursion\" to be present for 5000 milliseconds.","stack":"NoSuchElementError: Timed out while waiting for element \"Section [name=navDropdown],//*[@data-track-id=\"menu\" and normalize-space()=\"Settings\"]\" with \"recursion\" to be present for 5000 milliseconds.\n    at ClickElement.noSuchElementError (C:\\Users\\tester\\projects\\learn-nightwatch\\node_modules\\nightwatch\\lib\\element\\command.js:417:12)\n    at ClickElement.findElement (C:\\Users\\tester\\projects\\learn-nightwatch\\node_modules\\nightwatch\\lib\\element\\command.js:221:18)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async PeriodicPromise.perform (C:\\Users\\tester\\projects\\learn-nightwatch\\node_modules\\nightwatch\\lib\\utils\\periodic-promise.js:81:23)"}
    
        Try fixing by :
        1. Please inspect the html before the step
        2. Verify if an element with the mentioned selector is present in the DOM tree
    
        Error location:
        C:\Users\tester\projects\learn-nightwatch\pages\ecosia.js:
        –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
         9 |       commands: [{
         10 |         selectOption: function (option) {
         11 |           this.click(`//*[@data-track-id="menu" and normalize-space()="${option}"]`);
         12 |           return this;
         13 |         }
        –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
    
      → Completed command: click ({name, __index, __selector, locateStrategy, pseudoSelector, parent, resolvedElement}) (5065ms)
    
     → Running command: expect.element ({name, __index, __selector, locateStrategy, pseudoSelector, parent, resolvedElement, abortOnFailure, suppressNotFoundErrors, timeout...})
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements
       {
         using: 'xpath',
         value: '//*[@data-test-id="layout-content"]//*[contains(@class,"heading")]'
      }
       Response 200 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements (12ms)
       { value: [] }
      Error
       Unexpected non-string or array result value returned for contains: undefined
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements
       {
         using: 'xpath',
         value: '//*[@data-test-id="layout-content"]//*[contains(@class,"heading")]'
      }
       Response 200 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements (10ms)
       { value: [] }
      Error
       Unexpected non-string or array result value returned for contains: null
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements
       {
         using: 'xpath',
         value: '//*[@data-test-id="layout-content"]//*[contains(@class,"heading")]'
      }
       Response 200 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements (10ms)
       { value: [] }
      Error
       Unexpected non-string or array result value returned for contains: null
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements
       {
         using: 'xpath',
         value: '//*[@data-test-id="layout-content"]//*[contains(@class,"heading")]'
      }
       Response 200 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements (10ms)
       { value: [] }
      Error
       Unexpected non-string or array result value returned for contains: null
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements
       {
         using: 'xpath',
         value: '//*[@data-test-id="layout-content"]//*[contains(@class,"heading")]'
      }
       Response 200 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements (9ms)
       { value: [] }
      Error
       Unexpected non-string or array result value returned for contains: null
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements
       {
         using: 'xpath',
         value: '//*[@data-test-id="layout-content"]//*[contains(@class,"heading")]'
      }
       Response 200 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements (12ms)
       { value: [] }
      Error
       Unexpected non-string or array result value returned for contains: null
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements
       {
         using: 'xpath',
         value: '//*[@data-test-id="layout-content"]//*[contains(@class,"heading")]'
      }
       Response 200 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements (10ms)
       { value: [] }
      Error
       Unexpected non-string or array result value returned for contains: null
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements
       {
         using: 'xpath',
         value: '//*[@data-test-id="layout-content"]//*[contains(@class,"heading")]'
      }
       Response 200 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements (9ms)
       { value: [] }
      Error
       Unexpected non-string or array result value returned for contains: null
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements
       {
         using: 'xpath',
         value: '//*[@data-test-id="layout-content"]//*[contains(@class,"heading")]'
      }
       Response 200 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements (25ms)
       { value: [] }
      Error
       Unexpected non-string or array result value returned for contains: null
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements
       {
         using: 'xpath',
         value: '//*[@data-test-id="layout-content"]//*[contains(@class,"heading")]'
      }
       Response 200 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements (20ms)
       { value: [] }
      Error
       Unexpected non-string or array result value returned for contains: null
       Request POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements
       {
         using: 'xpath',
         value: '//*[@data-test-id="layout-content"]//*[contains(@class,"heading")]'
      }
       Response 200 POST /session/a34ce4d57461f14f4b5e1d4d4db98e83/elements (10ms)
       { value: [] }
      Error
       Unexpected non-string or array result value returned for contains: null
      ✖ NightwatchAssertError
       Expected element @heading <//*[@data-test-id="layout-content"]//*[contains(@class,"heading")]> text to contain: "Settings" - element was not found - expected "contain 'Settings'" but got: "not present" (5215ms)
    
        Error location:
        C:\Users\tester\projects\learn-nightwatch\tests\ecosia.js:
        –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
         18 |               ecosia.expect.section("@navDropdown").to.be.visible;
         19 |               ecosia.section.navDropdown.selectOption("Settings"); // <- Error
         20 |               ecosia.expect.element("@heading").text.to.contain(option);
         21 |       });
         22 | });
        –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
    
      → Completed command: expect.element ({name, __index, __selector, locateStrategy, pseudoSelector, parent, resolvedElement, abortOnFailure, suppressNotFoundErrors, timeout...}) (5217ms)
     → Running [afterEach]:
     → Completed [afterEach].
    
      FAILED: 1 assertions failed, 2 errors and  1 passed (13.732s)
     → Running [after]:
     → Completed [after].
    
     → Running command: end (true)
    
     → Running command: session ('delete', [Function])
       Request DELETE /session/a34ce4d57461f14f4b5e1d4d4db98e83
    
       Response 200 DELETE /session/a34ce4d57461f14f4b5e1d4d4db98e83 (59ms)
       { value: null }
      → Completed command: end (true) (80ms)
      → Completed command: session ('delete', [Function]) (65ms)
    
    ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
    
      ️TEST FAILURE (21.557s):
       - 2 errors during execution;
       - 1 assertions failed; 2 passed
    
       × 1) ecosia
    
       – fail (13.732s)
    
       → ✖ NightwatchAssertError
       Expected element @heading <//*[@data-test-id="layout-content"]//*[contains(@class,"heading")]> text to contain: "Settings" - element was not found - expected "contain 'Settings'" but got: "not present" (5215ms)
    
        Error location:
        C:\Users\tester\projects\learn-nightwatch\tests\ecosia.js:
        –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
         18 |               ecosia.expect.section("@navDropdown").to.be.visible;
         19 |               ecosia.section.navDropdown.selectOption("Settings"); // <- Error
         20 |               ecosia.expect.element("@heading").text.to.contain(option);
         21 |       });
         22 | });
        –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
    
    
      - OTHER ERRORS:
      NoSuchElementError
       An element could not be located on the page using the given search parameters.
        {"status":-1,"message":"Timed out while waiting for element \"Section [name=navDropdown],//*[@data-track-id=\"menu\" and normalize-space()=\"Settings\"]\" with \"recursion\" to be present for 5000 milliseconds.","stack":"NoSuchElementError: Timed out while waiting for element \"Section [name=navDropdown],//*[@data-track-id=\"menu\" and normalize-space()=\"Settings\"]\" with \"recursion\" to be present for 5000 milliseconds.\n    at ClickElement.noSuchElementError (C:\\Users\\tester\\projects\\learn-nightwatch\\node_modules\\nightwatch\\lib\\element\\command.js:417:12)\n    at ClickElement.findElement (C:\\Users\\tester\\projects\\learn-nightwatch\\node_modules\\nightwatch\\lib\\element\\command.js:221:18)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async PeriodicPromise.perform (C:\\Users\\tester\\projects\\learn-nightwatch\\node_modules\\nightwatch\\lib\\utils\\periodic-promise.js:81:23)"}
    
        Try fixing by :
        1. Please inspect the html before the step
        2. Verify if an element with the mentioned selector is present in the DOM tree
    
        Error location:
        C:\Users\tester\projects\learn-nightwatch\tests\ecosia.js:
        –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
         17 |               ecosia.click("@navMenu");
         18 |               ecosia.expect.section("@navDropdown").to.be.visible;
         19 |               ecosia.section.navDropdown.selectOption("Settings"); // <- Error
         20 |               ecosia.expect.element("@heading").text.to.contain(option);
         21 |       });
        –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
    
      NoSuchElementError
       An element could not be located on the page using the given search parameters.
    
        Try fixing by :
        1. Please inspect the html before the step
        2. Verify if an element with the mentioned selector is present in the DOM tree
    
     Wrote JSON report file to: C:\Users\tester\projects\learn-nightwatch\tests_output\CHROME_108.0.5359.125__ecosia.json
     Wrote XML report file to: C:\Users\tester\projects\learn-nightwatch\tests_output\CHROME_108.0.5359.125__ecosia.xml
     Wrote HTML report file to: C:\Users\tester\projects\learn-nightwatch\tests_output\nightwatch-html-report\index.html
    

    Nightwatch Configuration

    module.exports = {
      src_folders: ['tests'],
      page_objects_path: ['pages'],
      custom_commands_path: [],
      custom_assertions_path: [],
      plugins: [],
      globals_path: '',
      use_xpath: true,
    
      test_settings: {
        default: {
          desiredCapabilities: {
            browserName: 'chrome',
            'goog:chromeOptions': {
              w3c: true
            }
          },
    
          webdriver: {
            start_process: true,
            server_path: require('chromedriver').path,
          },
    
        },
      },
    };
    

    Nightwatch.js Version

    2.5.4

    Node Version

    18.12.1

    Browser

    Chrome 108.0.5359.125

    Operating System

    Windows 10 Pro Build 19044.2364

    Additional Information

    No response

    bug p2 
    opened by kumarchandresh 0
Releases(v2.6.6)
  • v2.6.6(Jan 4, 2023)

  • v2.6.5(Jan 4, 2023)

  • v2.6.4(Jan 2, 2023)

  • v2.6.3(Dec 29, 2022)

  • v2.6.1(Dec 28, 2022)

    • fixed an issue with .within() command for component tests
    • fixed an issue with expect.element().value – updated to use the getProperty('value') command;
    Source code(tar.gz)
    Source code(zip)
  • v2.6.0(Dec 23, 2022)

    New features

    • HTML Reporter V2 - the built-in HTML reporter for Nightwatch has been significantly upgraded and contains:
      • brand new UI with added functionality
      • support for DOM snapshots and built-in trace viewer (using the--trace cli flag)
      • integrated support for displaying reports from visual regression tests (via the official plugin @nightwatch/vrt)

    Fixes & improvements

    • Added global before/after test hooks for each test worker process (#3501)
    • Fixed #3495 an unhandled rejection was occurring in some cases when using cucumber as a test runner
    • Fixed #3451 - setGeolocation was not functional in headless mode
    • Fixed #3478 - click() fails for iOS native app testing
    Source code(tar.gz)
    Source code(zip)
  • v2.5.5(Dec 23, 2022)

  • v2.5.4(Dec 9, 2022)

  • v2.5.2(Nov 27, 2022)

    New features

    The v2.5.2 release adds API Testing capabilities to Nightwatch with the official plugin @nightwatch/apitesting which enables:

    • Perform API request testing
    • Setup a mock server which enables:
      • Assert on incoming requests
      • Assert on request headers
      • Assert on post data

    Other Improvements

    • Added new properties to results object #3494
    Source code(tar.gz)
    Source code(zip)
  • v2.5.1(Nov 16, 2022)

  • v2.5.0(Nov 11, 2022)

    New features

    • Run tests on Mobile web

      • end to end setup required to run tests on Mobile web using the @nightwatch/mobile-helper
      • test your website/web app on Android (Chrome & Firefox) & iOS (Safari)
    • Nx monorepo integration with the Nx plugin @nightwatch/nx

    Improvements

    • Added support for writing globals, page objects, and commands in ESM format c40f86

    Fixes

    • Fixed #3440 – socket hang up error when report_network_errors is enabled
    • Fixed #3465 – an issue with using testSuite retries with enable_fail_fast enabled
    • Fixed #3470 – issue with Actions API when passing async callback to browser.perform()

    Other

    • Upgraded selenium-webdriver to 4.5.0

    Release Walkthrough Video

    Mobile Helper, Nx support (monorepos), API Testing and more: Nightwatch Release Walkthrough v2.5.0

    Nightwatch Release Walkthrough v2.5.0 Source code(tar.gz)
    Source code(zip)
  • v2.4.2(Nov 3, 2022)

    • Added an improvement for error messages shown when running React component tests
    • Fixed --open cli argument wasn't working properly #3459
    • Added support for launching the local web server for component testing from the android emulator #3460
    • Fixed an issue with displaying the http output in the HTML reporter when running tests in parallel 3462
    Source code(tar.gz)
    Source code(zip)
  • v2.4.1(Oct 20, 2022)

  • v2.4.0(Oct 19, 2022)

    New features

    The v2.4.0 release brings improved support for Component Testing, which includes:

    • @nightwatch/storybook
      • new official plugin which integrates Nightwatch with Storybook
      • adds ability to run component stories directly from Nightwatch, including:
        • interaction tests using the play() function
        • run test hooks in the Nightwatch context
        • run test() function in the Nightwatch context
        • run configured accessibility rules automatically using the axe-core suite of commands
    • vite-plugin-nightwatch
      • upgraded plugin to use Vite 3
    • @nightwatch/vue
      • new dedicated Vue.js component testing plugin which includes Vite 3 and manages its own Vite dev server
    • @nightwatch/react

    New CLI flags

    • --serial to run tests in serial mode (disable parallelism)
    • --workers to specify the number of test workers to be used when running tests in parallel
    • --reuse-browser to reuse the browser session if running in serial mode

    component testing related

    • --debug – automatically pause the test execution after mounting the component and open the Nightwatch debug REPL interface.
    • --story - allows to specify which story to run from the current file (when using Storybook or JSX written in component story format)
    • --preview - used to preview a component story/test; automatically pause the test execution after mounting the component.

    Other Improvements

    • Added support to use --devtools CLI flag in Edge and Safari to open the Dev Tools automatically
    • Added support to enable running tests in parallel by default if not set PR #3364
    • Added support for using nightwatch.conf.ts as config file and a few other improvements for running typescript tests PR #3316

    Fixes

    • Fixed #3404 an issue with the moveTo command
    • Fixed #3256 .verify assertions do not resolve when called from within the .perform() command
    Source code(tar.gz)
    Source code(zip)
  • v2.3.9(Sep 24, 2022)

  • v2.3.8(Sep 23, 2022)

  • v2.3.7(Sep 16, 2022)

  • v2.3.6(Sep 15, 2022)

  • v2.3.5(Sep 14, 2022)

    • Added new CLI flag ``--report-filename` to specify the report file name for the JSON reporter d73a6f
    • Fixed #3361 -- expect.cookie always returning undefined value
    • Fixed an issue where the error thrown for using incorrect arguments for element commands was not reported if using async/await testcase e9e38c
    • Fixed #3372 -- chaining custom commands from page objects when imported through plugins interface
    • Added analytics feature to collect anonymous user metrics (opt in only) PR #3141
    Source code(tar.gz)
    Source code(zip)
  • v2.3.4(Sep 2, 2022)

    • Fixed #3284 – beforeEach hook was executed even it() / test() is marked as skipped
    • Fixed #3352 – a TypeError was thrown if a custom command is throwing an error
    Source code(tar.gz)
    Source code(zip)
  • v2.3.3(Aug 19, 2022)

    Improvements

    • Added support for using native mobile drivers (#3335)
    • Added new cli flag --list-files (#3246)
    • Added support to retain the html report between test runs (#3309)

    Fixes

    • Fixed #3304 - added buildname to settings when running on Browserstack
    • Fixed #3301 - awaited asserts used inside custom commands were hanging the test run
    • Fixed #3257 - expect.elements(..).count should be 0 if element not found
    Source code(tar.gz)
    Source code(zip)
  • v2.3.0(Jul 20, 2022)

    New feature

    • Added pause and debug capabilities - https://github.com/nightwatchjs/nightwatch/issues/3243

      Pause mode

      Add a pause() command to pause your tests indefinitely. In pause mode, you can check the state of your browser or use DevTools to debug. You can also see step-by-step execution from the paused state where the test automatically pauses at the next step.

      Note: The current pause command usage stays as is. You can pass the duration of the pause and the test will pause only for that duration on the mentioned devices.

      Debug mode

      Add a debug() command to pause your test at that step. The debug mode also allows you to check the state of the browser and use DevTools. Furthermore, it offers you an interface to try out nightwatch commands and assertions while your test is paused.

    Improvements & Fixes

    • Added actionable error messages - #3233 Redesigned error messages for improved context, relevant documentation and mitigation steps to fix the error.
    • Fixed #3177 – additional options in config does not getting passed to cucumber runner
    • Added support for waitUntil to use a custom message for timeout errors (https://github.com/nightwatchjs/nightwatch/commit/4b79d79fb01017b2ddc807a6e9cd74fb59cb6e71)

    Release Walkthrough

    Nightwatch release walkthough Nightwatch release walkthough

    Source code(tar.gz)
    Source code(zip)
  • v2.2.3(Jul 15, 2022)

    • Fixed #3183 – setting chromeOptions in older format didn't work
    • Fixed #3130 – an issue with setting the driver service port number in case of parallel runs with test workers
    • Fixed #3096 – an issue with session request redirection when using SauceLabs
    • Fixed #3264 – HTML reporter raw http logs were failing to escape html
    • Added support for .mockNetworkResponse() to accept relative urls (to launch_url setting)
    • Other – Upgraded selenium-webdriver version to 4.3.1 (#3278)
    Source code(tar.gz)
    Source code(zip)
  • v2.2.2(Jun 21, 2022)

    Important fixes

    • Fixed #2975 – expect.element().to.not.be.present throws error when the element is not present
    • Fixed – an issue with persisting http data for the HTML reporter

    New features

    The new Nightwatch init CLI tool is now available to use in order to kick-start a new Nightwatch test project in under 60 seconds.

    Simply run:

    npm init nightwatch
    
    Nightwatch CLI tool preview

    Release notes for create-nightwatch: https://github.com/nightwatchjs/create-nightwatch/releases/tag/v1.0.0

    Other

    • Downgraded selenium to 4.1.1 to mitigate a chromedriver startup issue
    Source code(tar.gz)
    Source code(zip)
  • v2.2.1(Jun 14, 2022)

    The latest release introduces a new built-in HTML reporter and several new API commands based on the Chrome Devtools Protocol for mocking network responses, capturing logs, and more.

    Improvements

    Other

    • Added support to find frame when passing argument as id or name - #3205
    • Upgraded selenium-webdriver to v4.2.0 - #3215
    Source code(tar.gz)
    Source code(zip)
  • v2.1.8(Jun 8, 2022)

    • Added - platform methods in case of Appium client (#3166)
    • Fixed - an issue with generating XML output for when running tests in parallel (#3163)
    Source code(tar.gz)
    Source code(zip)
  • v2.1.7(May 18, 2022)

  • v2.1.6(May 15, 2022)

    This release only contains a few dependency updates, such as the ejs package and the cucumber peer dependency version which was causing issues in newer version of NPM.

    Source code(tar.gz)
    Source code(zip)
  • v2.1.5(May 11, 2022)

    • Fixed #3127 -- skipped count was incorrect in global reporter results
    • Fixed #3163 -- a circular reference issue occurring sometimes when running tests in parallel
    • Added support to throw an error when passing undefined args in sendKeys command (#3045)
    • Added support to find frame when passing argument as id or name (#3097)
    • Added update to browserstack transport and built-in config (#3148)
    • Added support for marking test scenarios passed/failed and send reason to Browserstack while using Cucumber as a test-runner (#3132)
    Source code(tar.gz)
    Source code(zip)
  • v2.1.4(May 1, 2022)

    • Fixed #3033 – global element() was ignoring the global locate strategy
    • Fixed #3138 -- Unhandled rejection while using expect assertions in an async test step
    Source code(tar.gz)
    Source code(zip)
Owner
Nightwatch.js
Fully integrated, easy to use End-to-End testing framework for web applications and websites written in Node.js. Developed by @pineviewlabs.
Nightwatch.js
A node.js library for testing modern web applications

Taiko Docs | API reference A Node.js library for testing modern web applications What’s Taiko? Taiko is a free and open source browser automation tool

Gauge 3.2k Dec 30, 2022
CasperJS is no longer actively maintained. Navigation scripting and testing utility for PhantomJS and SlimerJS

CasperJS Important note: the master branch hosts the development version of CasperJS, which is now pretty stable and should be the right version to us

CasperJS 7.3k Dec 25, 2022
A simple and stable cross-browser testing tool. 简单稳定的跨浏览器测试工具。

totoro A simple and stable cross-browser testing tool. Latest stable version: v2.0 Change Log 中文版使用文档 0. Features Run in real browsers Support all tes

totoro 568 Dec 21, 2022
A next-generation code testing stack for JavaScript.

Intern Software testing for humans ⚠️ This documentation is for the development version of Intern. For the current release version, go here. Intern is

Intern: next-gen JavaScript testing 4.4k Jan 7, 2023
Next-gen browser and mobile automation test framework for Node.js

Next-gen browser and mobile automation test framework for Node.js. Homepage | Developer Guide | API Reference | Contribute | Changelog | Roadmap Webdr

WebdriverIO 7.9k Jan 3, 2023
Headless Chrome Node.js API

Puppeteer API | FAQ | Contributing | Troubleshooting Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over th

Puppeteer 81.4k Jan 1, 2023
⚡️The Fullstack React Framework — built on Next.js

The Fullstack React Framework "Zero-API" Data Layer — Built on Next.js — Inspired by Ruby on Rails Read the Documentation “Zero-API” data layer lets y

⚡️Blitz 12.5k Jan 4, 2023
A testing focused Remix Stack, that integrates E2E & Unit testing with Playwright, Vitest, MSW and Testing Library. Driven by Prisma ORM. Deploys to Fly.io

Live Demo · Twitter A testing focused Remix Stack, that integrates E2E & Unit testing with Playwright, Vitest, MSW and Testing Library. Driven by Pris

Remix Stacks 18 Oct 31, 2022
Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

?? Playwright Documentation | API reference Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit w

Microsoft 46.3k Jan 9, 2023
A Web end-to-end testing framework.

一款舒适的自动化测试框架 文档 XBell 站点 特性 基于 playwright 的异步测试框架 基于 TypeScript 提供多功能装饰器 多套数据环境支持 快速开始 # 初始化一个项目 $ npm create xbell # 进入项目 $ cd <your-project-name> #

X-Bell 10 Dec 15, 2022
A Node.js tool to automate end-to-end web testing.

A Node.js tool to automate end-to-end web testing. Write tests in JS or TypeScript, run them and view results. Homepage • Documentation • FAQ • Suppor

Developer Express Inc. 9.5k Jan 9, 2023
BDD / TDD assertion framework for node.js and the browser that can be paired with any testing framework.

chai Chai is a BDD / TDD assertion library for node and the browser that can be delightfully paired with any javascript testing framework. For more in

Chai.js Assertion Library 7.8k Dec 30, 2022
No-code test automation solution for end-to-end testing

No-code test automation tool for end-to-end testing Table of Contents About Features Installation Usage Creating tests Running tests Roadmap Our Team

OSLabs Beta 63 Oct 18, 2022
AREX: It is a “Differential Testing” and “Record and Replay Testing” Tool.

AREX: It is a “Differential Testing” and “Record and Replay Testing” Tool. Test restful API by record, replay and stub request/response. Differential

ArexTest 15 Nov 1, 2022
🐐 Simple and complete React DOM testing utilities that encourage good testing practices.

React Testing Library Simple and complete React DOM testing utilities that encourage good testing practices. Read The Docs | Edit the docs Table of Co

Testing Library 17.3k Jan 4, 2023
🐐 Simple and complete React DOM testing utilities that encourage good testing practices.

React Testing Library Simple and complete React DOM testing utilities that encourage good testing practices. Read The Docs | Edit the docs Table of Co

Testing Library 17.3k Jan 4, 2023
Harrison Njuguna 5 Nov 11, 2022
Javascript-testing-practical-approach-2021-course-v3 - Javascript Testing, a Practical Approach (v3)

Javascript Testing, a Practical Approach Description This is the reference repository with all the contents and the examples of the "Javascript Testin

Stefano Magni 2 Nov 14, 2022
SAP Community Code Challenge: This repository contains an empty OpenUI5 application and end-to-end tests written with wdi5. Take part in the challenge and develop an app that passes the tests.

SAP Community Code Challenge - UI5 The change log describes notable changes in this package. Description This repository is the starting point for the

SAP Samples 8 Oct 24, 2022
End-to-End type safety for REST APIs written in Fastify. Only problem is you have to explicity export and register route handlers. LOL

Chino intelligence in japaneese End-to-End type safety for REST APIs written in Fastify. Only problem is you have to explicity export and register rou

sambit sahoo 2 Sep 12, 2022