Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

testarmada-nightwatch-extra

Package Overview
Dependencies
Maintainers
1
Versions
124
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

testarmada-nightwatch-extra

extra useful nightwatch command and assertion

  • 1.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10
decreased by-37.5%
Maintainers
1
Weekly downloads
 
Created
Source

Nightwatch-Extra

Enhanced nightwatchjs commands and assertions.

Usage

In nightwatch.json add following content

  "custom_assertions_path": [
    "./node_modules/testarmada-nightwatch-extra/lib/assertions"
  ],
  "custom_commands_path": [
    "./node_modules/testarmada-nightwatch-extra/lib/commands"
  ]

If you're using this repo together with testarmada-magellan, your base test can inherit from the base test by

var BaseTest = require("testarmada-nightwatch-extra/lib/base-test-class");

For full example, please checkout boilerplate-nightwatch

Command vocabulary

If you're familiar with nightwatch or are looking to translate nightwatch examples into nightwatch-extra, refer to the tables below for equivalent enhanced (i.e. more reliable) versions of nightwatch commands and assertions. All commands and assertions are fully compatible with nightwatchjs page object.

Enhanced command list

Nightwatch-Extra EquivalentNightwatch Command
clickAutomationEl("mybutton")click("[data-automation-id="mybutton"])
clickEl(selector)click(selector)
getEl(selector)waitForElementPresent or waitForElementVisible
moveToEl(selector, xoffset, yoffset)moveToElement
setElValue(selector, value)setValue(selector, value)
getElValue(selector, callback)getValue(selector)
getEls(selector, callback)elements(using, value, callback)
setMaskedElValue(selector, value, [fieldLength])(no nightwatch equivalent)
getPerformance(url)Retrieves basic performance metrics using Navigation API (http://www.w3.org/TR/navigation-timing/)
waitForElNotPresent(selector)waitForElementNotPresent(selector)

Enhanced assertion list

Nightwatch-Extra EquivalentNightwatch Assertion
assert.elContainsText(selector, regex or text)assert.containsText(selector, text)
assert.elNotContainsText(selector, text)(no nightwatch equivalent)
assert.selectorHasLength(selector, expectedLength)(no nightwatch equivalent)
assert.elLengthGreaterThan(selector, selectUsing, lengthToCompare)(no nightwatch equivalent)

As-is Supported Nightwatch Vocabulary

All Nightwatch commands and assertions are supported out of the box.

Supported Nightwatch Commands
  • Please refer to Nightwatch Commands API for a list of supported Nightwatch commands
Supported Nightwatch Assertions
Supported Node Assertions
  • fail
  • equal
  • notEqual
  • deepEqual
  • notDeepEqual
  • strictEqual
  • notStrictEqual
  • throws
  • doesNotThrow
  • ifError

Important migration notice

If you're migrating from magellan-nightwatch to nightwatch-extra, please follow the steps

  1. Delete ./node_modules/testarmada-magellan-nightwatch from your project.
  2. In package.json
dependencies:{
    "testarmada-magellan-nightwatch: VERSION   <---- DELETE THIS LINE
    "testarmada-nightwatch-extra: "^1.0.0"     <---- ADD THIS LINE
}
  1. Run npm install again under your project root folder.
  2. Make sure your nightwatch.json file has the following changes
"custom_commands_path":[
    "./node_modules/testarmada-magellan-nightwatch/lib/commands"  <---- DELETE THIS LINE
    "./node_modules/testarmada-nightwatch-extra/lib/commands"     <---- ADD THIS LINE
],
"custom_assertions_path":[
    "./node_modules/testarmada-magellan-nightwatch/lib/assertions"  <---- DELETE THIS LINE
    "./node_modules/testarmada-nightwatch-extra/lib/assertions"     <---- ADD THIS LINE
]

  1. Change parent of your base test class (if there is)
require("testarmada-magellan-nightwatch/lib/base-test-class"); <---- DELETE THIS LINE
require("testarmada-nightwatch-extra/lib/base-test-class");    <---- ADD THIS LINE

FAQs

Package last updated on 15 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc