nightwatch

Integrated end-to-end testing framework written in Node.js and using W3C Webdriver API. Developed at @browserstack

MIT License

Downloads
594.3K
Stars
11.7K
Committers
158

Bot releases are hidden (Show)

nightwatch - v2.1.7

Published by beatfactor over 2 years ago

  • Upgraded the global package to fix an issue on windows
nightwatch - v2.1.6

Published by beatfactor over 2 years ago

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.

nightwatch - v2.1.5

Published by beatfactor over 2 years ago

  • 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)
nightwatch - v2.1.4

Published by beatfactor over 2 years ago

  • Fixed #3033 – global element() was ignoring the global locate strategy
  • Fixed #3138 -- Unhandled rejection while using expect assertions in an async test step
nightwatch - v2.1.3

Published by beatfactor over 2 years ago

  • Fixed #3159 - updated ejs to avoid a high severity vulnerability
  • Fixed #3154 - updated peer dependency version of chromedriver
nightwatch - v2.1.0

Published by beatfactor over 2 years ago

The Nightwatch 2.1 release adds a few important fixes and several improvements, including upgrade to Selenium 4.1.1. Here's the full list:

Improvements

describe('sample with relative locators', function () {
  before(browser => browser.navigateTo('https://archive.org/account/login'));
  
  it('locates password input', function (browser) {
    const passwordElement = locateWith(By.tagName('input')).below(By.css('input[type=email]'));

    browser
      .waitForElementVisible(passwordElement)
      .expect.element(passwordElement).to.be.an('input');

    browser.expect.element(passwordElement).attribute('type').equal('password');
  });
});
  • New error stack trace output which parses and highlights the source code line – #3071

image

  • Set network emulation settings in Chrome/Edge with the .setNetworkConditions() command (#2996)

browser.setNetworkConditions({ 
  offline: false, 
  latency: 5, // Additional latency (ms). 
  download_throughput: 500 * 1024, // Maximal aggregated download throughput. 
  upload_throughput: 500 * 1024 // Maximal aggregated upload throughput. 
});
  • Automate the input of basic auth credentials with the .registerBasicAuth() command (Chrome/Edge) (#3116)

browser
     .registerBasicAuth('test-username', 'test-password')
     .navigateTo('http://browserspy.dk/password-ok.php');

Important Fixes

  • Fixed #3079 – unable to clear element in setValue command
  • Fixed #3085 – failing waitFor commands did not failed the test when using the cucumber built-in runner
  • Fixed #3124 - multiple terminal windows opening when running in Chrome on Windows
  • Fixed #3086 - 'RangeError: Maximum call stack size exceeded' when requiring unknown modules
nightwatch - v2.0.10

Published by beatfactor over 2 years ago

Fixed an issue occurring when using the Mocha integrated test runner and a test failure was logged in an async testcases.

nightwatch - v2.0.9

Published by beatfactor over 2 years ago

  • Fixed #3077 - an issue with page navigate where the url was defined as a function
nightwatch - v2.0.8

Published by beatfactor over 2 years ago

This releases adds a few important fixes and improvements. We have made sure that Nightwatch works very well when using the Selenium 4 server in standalone mode and we've added several improvements and fixes for when using Mocha as a test runner.

Users of Selenium Server can now install our own jar download library from NPM and then use it in Nightwatch with no other config necessary. Make sure that chromedriver or geckodriver are also installed from NPM. You can install the Selenium Server with:

npm i @nightwatch/selenium-server

Fixes

  • Fixed #3054 – default port was not updated for some commands when running in parallel mode
  • Fixed #3052 – Running Nightwatch with Selenium Server 4 in standalone mode
  • Fixed #3055 – Missing error message in case of overwriting an existing command
  • Fixed #3050 – required definition of package.json in current directory
  • Fixed #3075 - an unhandledRejection was occurring when assertion fails while in async mode and if followed by other chained assertions
  • Fixed #3074 - chrome CDP commands loading was throwing an error

Improvements

nightwatch - v2.0.7

Published by beatfactor over 2 years ago

  • Fixed #3031 - unable to start selenium server from nightwatch on windows
nightwatch - v2.0.6

Published by beatfactor over 2 years ago

nightwatch - v2.0.5

Published by beatfactor over 2 years ago

  • Added several improvements to better support component testing (d8dec007ac5618d772af3a947c7c1dbef068dd89)
  • Added added an improvement for external globals to be persisted properly (af54791bdbf09efc622250658b4bf5e602e9c95b)
nightwatch - v2.0.4

Published by beatfactor over 2 years ago

  • Fixed an issue with expect not rejecting the promise correctly and causing an unhandledRejection (a17a7ac04f085895a3a27f9654a4e765973860fd)
  • Added support for expect.element().an() to accept case-insensitive tag names and regular expressions (efb6f109fb6475ef032359b04fb19b49940762ae)
nightwatch - v2.0.0

Published by beatfactor over 2 years ago

The public NPM release of Nightwatch 2.0 is here and can be installed directly with:

npm i nightwatch --save-dev

Over the past few weeks we have worked tirelessly to finalise the apis, add a few more examples, and try and smooth over any rough edges.

Important Changes

  • Added a new plugin API; check out the docs for how to create a Nightwatch plugin: nightwatchjs.org/guide/extending-nightwatch/plugin-api.html
  • Added support for using nightwatch.conf.cjs as config file for projects that use ES Modules
  • Upgraded chai expect to version 5 and added support for using regular chai browser.expect() assertions; this doesn't affect the existing expect.element(), expect.elements(), expect.cookie(), expect.title(), and expect.url().
    • Example:
    const infoElement = element('.info');
    expect(infoElement.property('innerHTML'))
      .to.be.a('string')
      .and.to.include('validation code');
    
    See examples/tests/shadowRootExample.js for the complete example.

Improvements

  • Added several new assertions:
    • titleEquals
    • titleMatches
    • urlMatches
    • textMatches
    • textEquals
    • domPropertyMatches
    • attributeMatches
    • valueEquals
    • hasClass
    • hasAttribute
    • elementsCount
  • Added new element commands:
    • getFirstElementChild
    • getNextSibling
    • getPreviousSibling
    • hasDescendants
    • isPresent
  • Added new API mouse actions:
    • clickAndHold
    • rightClick
    • releaseMouseButton
  • Added new --devtools CLI flag to open the Chrome Devtools automatically

Fixes

  • Fixed #2955 - an issue caused by missing the browserName capability
  • Fixed fixed an issue with creating the log folder for writing the webdriver logs (2cff6df2d06f02ef2ed853c89795d3210d2a35c0)
nightwatch - v2.0.0-beta.3

Published by beatfactor almost 3 years ago

  • Added more supporting CucumberJS cli options (#2978)
  • Fixed a compatibility issue caused by Selenium (#2999)
nightwatch - v2.0.0-beta.2

Published by beatfactor almost 3 years ago

  • Fixed Fixed a regression issue with using execute() command - #2970
  • Updated selenium-webdriver to v4.1 and other depedencies
nightwatch - v2.0.0-beta.1

Published by beatfactor almost 3 years ago

We're delighted to present the first beta version of Nightwatch v2.0! Upcoming beta releases will incrementally be made available in NPM under the next tag, so in order to install it you'll have to run the following:

npm i nightwatch@next

Over the coming weeks we will also finish updating the documentation website with more pages in the Guide section and documenting the new APIs.

Important Changes

Since the previous alpha release we have only added a few improvements and several fixes. The fixes are mainly concerning working with the new element() api and using cucumber-js.

Improvements

  • Added dragAndDrop element command which uses the new Actions API from Selenium – #2920;
  • Added support to use the config file as Promise – #2896
  • Added support to use glob patterns in config for src_folders, page_object_path, custom_commands_path, custom_assertion_path options – #2910;
  • Added new webdriver.log_file_name setting to specify the filename where webdriver server logs should be written – 127760130341328010b9001598812916ace92363
  • Added support to write individual webdriver server logs for each test suite – 127760130341328010b9001598812916ace92363
  • Added support to define page object commands as an ES6 class – example db03e68032c07c2c1321cf8e278016fb0c742c87;
  • Added support to use Selenium WebElement ids as arguments to element commands, such as .click(), e.g.:
// with async
const elements = await browser.findElements('input');
await browser.click(elements[1]);

// with callback
browser.findElements('input', function(result) {
  browser.click(result.value[1]);
});

Fixes

  • Reverted getAttribute command to use the W3C endpoint instead of the Selenium atom script - #2926;
  • Fixed an issue where the session was hanging after a failure when using suiteRetries – 127760130341328010b9001598812916ace92363

Examples

We've also updated the bundled examples so do make sure to check those out in order to get a better feel about the new Nightwatch 2 features.

Search for the term "Nightwatch.js" using:

Google search using page objects

ToDo App on AngularJs homepage

You can run any of the examples by simply referring to the examples folder like below:

npx nightwatch examples/tests/angularTest.js

CucumberJS examples

The bundled config file which is auto-generated by Nightwatch on the first run (only if one is not already present in the project), contains configuration and examples for running the CucumberJS examples immediately, using the following:

npx nightwatch --env cucumber-js
nightwatch - v2.0.0-alpha.4

Published by beatfactor about 3 years ago

New features

  • Added enable_fail_fast setting and --fail-fast cli argument to abort the test runner after a failed test suite

Important Changes

Below are notable changes from the previous alpha version (2.0.0-alpha.3):

  • Updated the integrated Cucumber test runner - see working with cucumber in Nightwatch for details;
  • Updated the new creatClient() external method for programmatic usage; the new client now contains the following methods:
    • client.settings - returns the current settings
    • client.updateCapabilities() - can be used to updated capabilities before starting a new Webdriver session (before calling .launchBrowser())
    • client.launchBrowser()
const Nightwatch = require('nightwatch');

const client = Nightwatch.createClient({
  browserName: 'firefox',
  headless: true
});

client.updateCapabilities({
  testCapability: 'one, two, three'
});
const browser = await client.launchBrowser();

Other Changes:

  • Improved terminal output in case of session create errors
  • Removed deprecated request dependency
  • Fixed an issue with making the browser object available as a global
  • Updated Mocha to v9.1.3 and added support for the mocha runner to use the disable_colors setting
nightwatch - v2.0.0-alpha.3

Published by beatfactor about 3 years ago

Nightwatch v2.0.0-alpha.3

New features

  • Added integrated test runner for Cucumber - more info on config and usage available in examples folder
  • Added new 'createClient()' programatic api exported on the main library; usage:
const Nightwatch = require('nightwatch');

const client = Nightwatch.createClient({
  headless: true,
  output: true,
  silent: true, // set to false to enable verbose logging
  browserName: 'firefox', // can be either: firefox, chrome, safari, or edge
  timeout: 10000, // set the global timeout to be used with waitFor commands and when retrying assertions/expects
  env: null, // set the current test environment from the nightwatch config
  desiredCapabilities: {
    // any additional capabilities needed
  },
  globals: {}, // can define/overwrite test globals here; when using a third-party test runner only the global hooks onBrowserNavigate/onBrowserQuit are supported
  parallel: false, // when the test runner used supports running tests in parallel; set to true if you need the webdriver port to be randomly generated
  // All other settings can be overwritten here, such as:
  disable_colors: false
});

const browser = await client.session();

Improvements

  • Updated the bundled Mocha test runner to use Mocha v9 and added other features supported by the default nightwatch test runner (such as using test tags, global hooks etc.); pending Mocha v9.1.3 which contains https://github.com/mochajs/mocha/issues/4760

  • New API commands:

    • browser.navigateTo(url, [callback]) - navigates to a new url. Accepts also relative urls if launchUrl is defined in the config and will execute onBrowserNavigate global hook after the url is loaded.

    • browser.getCurrentUrl([callback])

    • browser.quit([callback]) - ends the session and closes down the test WebDriver server, if one is running. This is similar to calling the .end() command, but the former doesn't quit the WebDriver session. It also executes the onBrowserQuit global hook before ending the session.

    • browser.setAttribute([using], selector, property, [callback]) - set the value of a specified DOM attribute for the given element.

Fixes

  • Fixed an issue with using moveToElement and moveTo api commands
  • Fixed isVisible() command to use the proper action from selenium-webdriver
  • Fixed an issue where the sink process used by the Webdriver child process was causing the runner to stop working on Windows
  • Renamed global object "Key" to "Keys"
nightwatch - v1.7.11

Published by beatfactor about 3 years ago

  • This version is only updating the proxy-agent dependency package to the latest version.