nightwatch
Advanced tools
Comparing version 3.4.1 to 3.5.0
@@ -23,3 +23,2 @@ const ClientCommand = require('../_base-command.js'); | ||
* @param {function} [callback] Optional callback function to be called when the command finishes. | ||
* @exampleLink /api/acceptAlert.js | ||
* @see alerts.dismiss | ||
@@ -26,0 +25,0 @@ * @see alerts.getText |
@@ -9,4 +9,5 @@ /** | ||
* demoTest(browser: NightwatchAPI): void { | ||
* const result = browser.element('#main ul li a.first').getText(); | ||
* .assert.valueEquals('custom text'); | ||
* browser.element('#main ul li a.first') | ||
* .getText() | ||
* .assert.contains('custom text'); | ||
* }, | ||
@@ -13,0 +14,0 @@ * |
@@ -9,3 +9,3 @@ /** | ||
* screenshot.then((screenshotData) => { | ||
* require('fs').writeFile('out.png', screenshotData, 'base64'); | ||
* require('fs/promises').writeFile('out.png', screenshotData, 'base64'); | ||
* }); | ||
@@ -16,3 +16,3 @@ * }, | ||
* const screenshotData = await browser.element('#main').takeScreenshot(); | ||
* require('fs').writeFile('out.png', screenshotData, 'base64'); | ||
* require('fs/promises').writeFile('out.png', screenshotData, 'base64'); | ||
* } | ||
@@ -19,0 +19,0 @@ * } |
@@ -27,3 +27,4 @@ const fs = require('fs'); | ||
'getProperty': ['property'], | ||
'getCssProperty': ['css'] | ||
'getCssProperty': ['css'], | ||
'isVisible': ['isDisplayed'] | ||
}; | ||
@@ -30,0 +31,0 @@ } |
@@ -6,2 +6,3 @@ const EventEmitter = require('events'); | ||
const path = require('path'); | ||
const {Key} = require('selenium-webdriver'); | ||
@@ -130,3 +131,2 @@ const HttpUtil = require('./http.js'); | ||
this.retryAttempts = this.httpOpts.retry_attempts; | ||
this.redact = options.redact || false; | ||
@@ -258,9 +258,11 @@ return this; | ||
}); | ||
} else if (this.reqOptions.method === 'POST' && this.reqOptions.path.endsWith('/value') && params.text.startsWith(Key.NULL)) { | ||
params.text = '*******'; | ||
params.value = '*******'.split(''); | ||
} | ||
const content = ` Request ${[this.reqOptions.method, this.hostname + this.reqOptions.path, retryStr + ' '].join(' ')}`; | ||
const paramsStr = this.redact ? '<REDACTED>' : params; | ||
Logger.request(content, paramsStr); | ||
Logger.info(content, paramsStr); | ||
Logger.request(content, params); | ||
Logger.info(content, params); | ||
@@ -267,0 +269,0 @@ this.httpRequest.on('error', err => this.onRequestError(err)); |
@@ -296,3 +296,3 @@ const path = require('path'); | ||
plugins.forEach((plugin) => { | ||
if (plugin.globals && Utils.isFunction(plugin.globals.registerEventHandlers)){ | ||
if (plugin.globals && Utils.isFunction(plugin.globals.registerEventHandlers)) { | ||
plugin.globals.registerEventHandlers(NightwatchEventHub); | ||
@@ -454,3 +454,7 @@ } | ||
isTestWorkersEnabled() { | ||
const testWorkers = this.test_settings.testWorkersEnabled && !singleSourceFile(this.argv); | ||
if (this.testRunner.supportsParallelTestSuiteRun === false) { | ||
return false; | ||
} | ||
const testWorkers = this.test_settings.testWorkersEnabled && !singleSourceFile(this.argv); | ||
if (!testWorkers) { | ||
@@ -471,3 +475,3 @@ | ||
if (Concurrency.isWorker()) { | ||
if (Concurrency.isWorker()) { | ||
Logger.info('Disabling parallelism while running tests on mobile platform'); | ||
@@ -474,0 +478,0 @@ } |
@@ -249,2 +249,6 @@ const path = require('path'); | ||
get supportsConcurrency() { | ||
return true; | ||
} | ||
get supportsParallelTestSuiteRun() { | ||
return false; | ||
@@ -251,0 +255,0 @@ } |
@@ -65,2 +65,3 @@ const Utils = require('../../utils'); | ||
const timedCallback = this.createCallbackWrapper(resolve, reject, err => { | ||
err.help = ['You can increase the hooks timeout by setting "asyncHookTimeout" in the globals config to the required value.']; | ||
err.skipTestCases = this.skipTestcasesOnError; | ||
@@ -155,3 +156,3 @@ runnableDone && runnableDone(err); | ||
createCallbackWrapper(resolve, reject, timeoutExpired) { | ||
let timedCallback = new TimedCallback(function doneCallback(err) { | ||
const timedCallback = new TimedCallback(function doneCallback(err) { | ||
if (Utils.isErrorObject(err)) { | ||
@@ -158,0 +159,0 @@ return reject(err); |
@@ -1,2 +0,2 @@ | ||
const {WebElement, WebDriver, Origin, By, until, Condition} = require('selenium-webdriver'); | ||
const {WebElement, WebDriver, Origin, By, until, Condition, Key} = require('selenium-webdriver'); | ||
const {Locator} = require('../../element'); | ||
@@ -593,5 +593,6 @@ const NightwatchLocator = require('../../element/locator-factory.js'); | ||
setElementValueRedacted(...args) { | ||
// FIXME: redact password in verbose HTTP logs, it's only redacted in the command logs | ||
return this.methods.session.setElementValue.call(this, ...args); | ||
setElementValueRedacted(webElementOrId, value) { | ||
const modifiedValue = [Key.NULL].concat(value); | ||
return this.methods.session.setElementValue.call(this, webElementOrId, modifiedValue); | ||
}, | ||
@@ -598,0 +599,0 @@ |
{ | ||
"name": "nightwatch", | ||
"description": "Easy to use Node.js based end-to-end testing solution for web applications using the W3C WebDriver API.", | ||
"version": "3.4.1", | ||
"version": "3.5.0", | ||
"author": "Andrei Rusu", | ||
@@ -6,0 +6,0 @@ "homepage": "https://nightwatchjs.org", |
@@ -100,5 +100,9 @@ # Nightwatch.js | ||
```bash | ||
$ git clone https://github.com/nightwatchjs/nightwatch.git | ||
$ cd nightwatch | ||
$ npm install | ||
git clone https://github.com/nightwatchjs/nightwatch.git | ||
# change directory | ||
cd nightwatch | ||
# install the dependencies | ||
npm install | ||
``` | ||
@@ -111,3 +115,3 @@ | ||
```bash | ||
$ npm test | ||
npm test | ||
``` | ||
@@ -118,3 +122,3 @@ | ||
```bash | ||
$ npm run mocha-coverage | ||
npm run mocha-coverage | ||
``` | ||
@@ -121,0 +125,0 @@ |
@@ -143,2 +143,5 @@ import {expectAssignable, expectError, expectType} from "tsd"; | ||
expectType<ElementValue<string | null>>(elem.getValue()); | ||
expectType<ElementValue<boolean>>(elem.isEnabled()); | ||
expectType<ElementValue<boolean>>(elem.isVisible()); | ||
expectType<ElementValue<boolean>>(elem.isDisplayed()); | ||
@@ -167,2 +170,3 @@ expectType<ElementValue<ScopedElementRect>>(elem.getRect()); | ||
expectType<Promise<WebElement>>(elem.waitUntil('visible', {timeout: 5000})); | ||
expectType<ElementValue<boolean>>(elem.isSelected()); | ||
}); | ||
@@ -169,0 +173,0 @@ |
@@ -190,3 +190,10 @@ import { | ||
isSelected(): ElementValue<boolean>; | ||
waitUntil(signalOrOptions: WaitUntilActions | WaitUntilOptions, waitOptions?: WaitUntilOptions): Promise<WebElement>; | ||
isEnabled(): ElementValue<boolean>; | ||
isVisible(): ElementValue<boolean>; | ||
isDisplayed(): ElementValue<boolean>; | ||
} | ||
@@ -193,0 +200,0 @@ |
1863855
551
53272
162