Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
testarmada-nightwatch-extra
Advanced tools
Enhanced nightwatchjs commands and assertions.
nightwatch-extra enhancement includes
:visible
pseudo) before executing every nightwatch command or assertion (done by injecting sizzlejs).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
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.
Nightwatch-extra Command | Example | Nightwatch Equivalent |
---|---|---|
clickAutomationEl(css selector) | clickAutomationEl("mybutton") | click("[data-automation-id='mybutton']") |
clickEl(css selector) | clickEl(".submitButton") | click(".submitButton") |
getEl(css selector) | getEl(".submitButton") | waitForElementPresent(".submitButton") or waitForElementVisible(".submitButton") |
moveToEl(css selector, xoffset, yoffset) | moveToEl(".submitButton", 10, 10) | moveToElement(".submitButton", 10, 10) |
setElValue(css selector, value) | setElValue(".username", "testarmada") | setValue(".username", "testarmada") |
getElValue(css selector, callback) | getElValue(".user-profile", function(profile){// use profile here}) | getValue(".user-profile", function(profile){// use profile here}) |
getEls(css selector, callback) | getEls(".state-options", function(stats){// use stats here}) | elements("css selector", ".state-options", function(stats){// use stats here}) |
setMaskedElValue(css selector, value, [fieldLength]) | setMaskedElValue(".phone-number", "123456789") | (no nightwatch equivalent) |
waitForElNotPresent(css selector) | waitForElNotPresent(".submitButton") | waitForElementNotPresent(".submitButton") |
getPerformance(url) | getPerformance("http://www.google.com") | Retrieves basic performance metrics using Navigation API (http://www.w3.org/TR/navigation-timing/) |
Nightwatch-extra Assertion | Example | Nightwatch Equivalent |
---|---|---|
assert.elContainsText(css selector, regex or text) | assert.elContainsText(".username", "testarmada") | assert.containsText(".username", "testarmada") |
assert.elNotContainsText(css selector, text) | assert.elNotContainsText(".username", "testarmada") | (no nightwatch equivalent) |
assert.selectorHasLength(css selector, expectedLength) | assert.selectorHasLength(".username", 10) | (no nightwatch equivalent) |
assert.elLengthGreaterThan(css selector, selectUsing, lengthToCompare) | assert.elLengthGreaterThan(".username", "text", 10) | (no nightwatch equivalent) |
All Nightwatch commands and assertions are supported out of the box.
fail
equal
notEqual
deepEqual
notDeepEqual
strictEqual
notStrictEqual
throws
doesNotThrow
ifError
If you're migrating from magellan-nightwatch to nightwatch-extra, please follow the steps
./node_modules/testarmada-magellan-nightwatch
from your project.package.json
dependencies:{
"testarmada-magellan-nightwatch: VERSION <---- DELETE THIS LINE
"testarmada-nightwatch-extra: "^1.0.0" <---- ADD THIS LINE
}
npm install
again under your project root folder.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
]
require("testarmada-magellan-nightwatch/lib/base-test-class"); <---- DELETE THIS LINE
require("testarmada-nightwatch-extra/lib/base-test-class"); <---- ADD THIS LINE
FAQs
extra useful nightwatch command and assertion
The npm package testarmada-nightwatch-extra receives a total of 138 weekly downloads. As such, testarmada-nightwatch-extra popularity was classified as not popular.
We found that testarmada-nightwatch-extra demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 10 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.