Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
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
testarmada-nightwatch-extra
can inject async js for a faster element detection. However this feature isn't supported by all browsers (especially those latest ones that still don't fully support selenium protocol).
To use this feature, add following syncModeBrowserList
into globals
of nightwatch.json
"globals": {
"syncModeBrowserList": [
"safari:10",
"ipad
]
}Ï
Syntax of each item in the list
nightwatch-extra
to run in sync mode for safari@10nightwatch-extra
to run in sync mode for all versio of chromeIf 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 97 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
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.