From 84dd6109ce692788467432ccee55f481fe49f2bc Mon Sep 17 00:00:00 2001 From: Potapov Dmitriy Date: Wed, 24 Mar 2021 10:42:10 -0700 Subject: [PATCH] [nodejs] code cleanup first iteration (#9158) * code cleanup first iteration * [JS] Specifying encoding to read data in string Signed-off-by: Sri Harsha Co-authored-by: Sri Harsha --- javascript/node/selenium-webdriver/io/exec.js | 6 +- .../node/selenium-webdriver/io/index.js | 17 ++-- javascript/node/selenium-webdriver/io/zip.js | 11 ++- .../node/selenium-webdriver/lib/actions.js | 2 +- .../node/selenium-webdriver/lib/promise.js | 20 +---- .../node/selenium-webdriver/remote/index.js | 13 ++- .../selenium-webdriver/test/actions_test.js | 52 ++++++------ .../selenium-webdriver/test/builder_test.js | 2 +- .../test/chrome/devtools_test.js | 3 +- .../test/chrome/options_test.js | 5 +- .../selenium-webdriver/test/cookie_test.js | 17 ++-- .../test/elementAccessibleName_test.js | 16 ++-- .../test/elementAriaRole_test.js | 6 +- .../test/element_finding_test.js | 50 ++++++------ .../test/execute_script_test.js | 81 ++++++++++--------- .../selenium-webdriver/test/firefox_test.js | 15 ++-- .../selenium-webdriver/test/frame_test.js | 4 +- .../selenium-webdriver/test/http/http_test.js | 38 ++++----- .../selenium-webdriver/test/http/util_test.js | 4 +- .../test/ie/options_test.js | 6 +- .../selenium-webdriver/test/io/io_test.js | 39 ++++----- .../selenium-webdriver/test/io/zip_test.js | 2 +- .../test/lib/capabilities_test.js | 5 +- .../selenium-webdriver/test/lib/http_test.js | 4 +- .../selenium-webdriver/test/lib/input_test.js | 17 +++- .../test/lib/logging_test.js | 17 ++-- .../test/lib/promise_test.js | 9 ++- .../selenium-webdriver/test/lib/until_test.js | 6 +- .../test/lib/webdriver_test.js | 27 +++++-- .../selenium-webdriver/test/logging_test.js | 20 ++--- .../selenium-webdriver/test/net/index_test.js | 21 ++--- .../test/page_loading_test.js | 14 ++-- .../selenium-webdriver/test/print_pdf_test.js | 14 ++-- .../selenium-webdriver/test/proxy_test.js | 20 ++--- .../node/selenium-webdriver/test/rect_test.js | 2 +- .../selenium-webdriver/test/remote_test.js | 15 ++-- .../test/stale_element_test.js | 2 +- .../selenium-webdriver/test/upload_test.js | 2 +- .../selenium-webdriver/test/window_test.js | 6 +- 39 files changed, 334 insertions(+), 276 deletions(-) diff --git a/javascript/node/selenium-webdriver/io/exec.js b/javascript/node/selenium-webdriver/io/exec.js index 9418d59ca96b8..0803ff97884f1 100644 --- a/javascript/node/selenium-webdriver/io/exec.js +++ b/javascript/node/selenium-webdriver/io/exec.js @@ -121,9 +121,9 @@ class Command { * @return {!Command} The launched command. */ module.exports = function exec(command, opt_options) { - var options = opt_options || {} + const options = opt_options || {} - var proc = childProcess.spawn(command, options.args || [], { + let proc = childProcess.spawn(command, options.args || [], { env: options.env || process.env, stdio: options.stdio || 'ignore', }) @@ -133,7 +133,7 @@ module.exports = function exec(command, opt_options) { proc.unref() process.once('exit', onProcessExit) - let result = new Promise((resolve) => { + const result = new Promise((resolve) => { proc.once('exit', (code, signal) => { proc = null process.removeListener('exit', onProcessExit) diff --git a/javascript/node/selenium-webdriver/io/index.js b/javascript/node/selenium-webdriver/io/index.js index 98b6f497514a0..41dc9b0038ce9 100644 --- a/javascript/node/selenium-webdriver/io/index.js +++ b/javascript/node/selenium-webdriver/io/index.js @@ -204,13 +204,12 @@ exports.tmpDir = function () { */ exports.tmpFile = function (opt_options) { return checkedCall((callback) => { - // |tmp.file| checks arguments length to detect options rather than doing a - // truthy check, so we must only pass options if there are some to pass. - if (opt_options) { - tmp.file(opt_options, callback) - } else { - tmp.file(callback) - } + /** check fixed in v > 0.2.1 if + * (typeof options === 'function') { + * return [{}, options]; + * } + */ + tmp.file(opt_options, callback) }) } @@ -224,7 +223,7 @@ exports.tmpFile = function (opt_options) { * not be found. */ exports.findInPath = function (file, opt_checkCwd) { - let dirs = [] + const dirs = [] if (opt_checkCwd) { dirs.push(process.cwd()) } @@ -329,7 +328,7 @@ exports.mkdirp = function mkdirp(dir) { * will be relative to `rootPath`. */ exports.walkDir = function (rootPath) { - let seen = [] + const seen = [] return (function walk(dir) { return checkedCall((callback) => fs.readdir(dir, callback)).then((files) => Promise.all( diff --git a/javascript/node/selenium-webdriver/io/zip.js b/javascript/node/selenium-webdriver/io/zip.js index e83732e856fff..c95816945004b 100644 --- a/javascript/node/selenium-webdriver/io/zip.js +++ b/javascript/node/selenium-webdriver/io/zip.js @@ -180,8 +180,8 @@ function load(path) { */ function unzip(src, dst) { return load(src).then((zip) => { - let promisedDirs = new Map() - let promises = [] + const promisedDirs = new Map() + const promises = [] zip.z_.forEach((relPath, file) => { let p @@ -218,7 +218,6 @@ function unzip(src, dst) { } // PUBLIC API - -exports.Zip = Zip -exports.load = load -exports.unzip = unzip +module.exports.Zip = Zip +module.exports.load = load +module.exports.unzip = unzip diff --git a/javascript/node/selenium-webdriver/lib/actions.js b/javascript/node/selenium-webdriver/lib/actions.js index cc35e258d2e8c..6fd2491bec54e 100644 --- a/javascript/node/selenium-webdriver/lib/actions.js +++ b/javascript/node/selenium-webdriver/lib/actions.js @@ -342,7 +342,7 @@ class LegacyActionSequence { * @private */ scheduleKeyboardAction_(description, keys) { - let cmd = new command.Command( + const cmd = new command.Command( command.Name.LEGACY_ACTION_SEND_KEYS ).setParameter('value', keys) this.schedule_(description, cmd) diff --git a/javascript/node/selenium-webdriver/lib/promise.js b/javascript/node/selenium-webdriver/lib/promise.js index 45150a71e3ed1..9e130a5945329 100644 --- a/javascript/node/selenium-webdriver/lib/promise.js +++ b/javascript/node/selenium-webdriver/lib/promise.js @@ -30,17 +30,7 @@ * @return {boolean} Whether the value is a promise. */ function isPromise(value) { - try { - // Use array notation so the Closure compiler does not obfuscate away our - // contract. - return ( - value && - (typeof value === 'object' || typeof value === 'function') && - typeof value['then'] === 'function' - ) - } catch (ex) { - return false - } + return Object.prototype.toString.call(value) === '[object Promise]' } /** @@ -50,9 +40,7 @@ function isPromise(value) { * @return {!Promise} The promise. */ function delayed(ms) { - return new Promise((resolve) => { - setTimeout(resolve, ms) - }) + return new Promise((resolve) => setTimeout(resolve, ms)) } /** @@ -199,8 +187,8 @@ async function filter(array, fn, self = undefined) { for (let i = 0; i < n; i++) { if (i in arr) { - let value = arr[i] - let include = await fn.call(self, value, i, arr) + const value = arr[i] + const include = await fn.call(self, value, i, arr) if (include) { values[valuesLength++] = value } diff --git a/javascript/node/selenium-webdriver/remote/index.js b/javascript/node/selenium-webdriver/remote/index.js index 276354289f83b..cb6d97f48fb5a 100644 --- a/javascript/node/selenium-webdriver/remote/index.js +++ b/javascript/node/selenium-webdriver/remote/index.js @@ -210,7 +210,7 @@ class DriverService { } return resolveCommandLineFlags(this.args_).then((args) => { - var command = exec(self.executable_, { + const command = exec(self.executable_, { args: args, env: self.env_, stdio: self.stdio_, @@ -218,8 +218,8 @@ class DriverService { resolveCommand(command) - var earlyTermination = command.result().then(function (result) { - var error = + const earlyTermination = command.result().then(function (result) { + const error = result.code == null ? Error('Server was killed with ' + result.signal) : Error('Server terminated early with status ' + result.code) @@ -229,7 +229,7 @@ class DriverService { throw error }) - var hostname = self.hostname_ + let hostname = self.hostname_ if (!hostname) { hostname = (!self.loopbackOnly_ && net.getAddress()) || @@ -338,9 +338,8 @@ DriverService.Builder = class { * @this {THIS} * @template THIS */ - addArguments(var_args) { // eslint-disable-line - let args = Array.prototype.slice.call(arguments, 0) - this.options_.args = this.options_.args.concat(args) + addArguments(...arguments_) { + this.options_.args = this.options_.args.concat(arguments_) return this } diff --git a/javascript/node/selenium-webdriver/test/actions_test.js b/javascript/node/selenium-webdriver/test/actions_test.js index 10dc6ec227107..8d65b900b9e04 100644 --- a/javascript/node/selenium-webdriver/test/actions_test.js +++ b/javascript/node/selenium-webdriver/test/actions_test.js @@ -54,10 +54,10 @@ test.suite(function (env) { await driver.get(fileServer.whereIs('/data/actions/click.html')) let box = await driver.findElement(By.id('box')) - assert.equal(await box.getAttribute('class'), '') + assert.strictEqual(await box.getAttribute('class'), '') await driver.actions().click(box).perform() - assert.equal(await box.getAttribute('class'), 'green') + assert.strictEqual(await box.getAttribute('class'), 'green') }) it('click(element) clicks in center of element', async function () { @@ -65,12 +65,12 @@ test.suite(function (env) { const div = await driver.findElement(By.css('div')) const rect = await div.getRect() - assert.deepEqual(rect, { width: 500, height: 500, x: 0, y: 0 }) + assert.deepStrictEqual(rect, { width: 500, height: 500, x: 0, y: 0 }) await driver.actions().click(div).perform() const clicks = await driver.executeScript('return clicks') - assert.deepEqual(clicks, [[250, 250]]) + assert.deepStrictEqual(clicks, [[250, 250]]) }) it('can move relative to element center', async function () { @@ -78,7 +78,7 @@ test.suite(function (env) { const div = await driver.findElement(By.css('div')) const rect = await div.getRect() - assert.deepEqual(rect, { width: 500, height: 500, x: 0, y: 0 }) + assert.deepStrictEqual(rect, { width: 500, height: 500, x: 0, y: 0 }) await driver .actions() @@ -87,7 +87,7 @@ test.suite(function (env) { .perform() const clicks = await driver.executeScript('return clicks') - assert.deepEqual(clicks, [[260, 260]]) + assert.deepStrictEqual(clicks, [[260, 260]]) }) test @@ -96,10 +96,10 @@ test.suite(function (env) { await driver.get(fileServer.whereIs('/data/actions/click.html')) let box = await driver.findElement(By.id('box')) - assert.equal(await box.getAttribute('class'), '') + assert.strictEqual(await box.getAttribute('class'), '') await driver.actions().doubleClick(box).perform() - assert.equal(await box.getAttribute('class'), 'blue') + assert.strictEqual(await box.getAttribute('class'), 'blue') }) // For some reason for Chrome 75 we need to wrap this test in an extra @@ -112,18 +112,18 @@ test.suite(function (env) { await driver.get(fileServer.whereIs('/data/actions/drag.html')) let slide = await driver.findElement(By.id('slide')) - assert.equal(await slide.getCssValue('left'), '0px') - assert.equal(await slide.getCssValue('top'), '0px') + assert.strictEqual(await slide.getCssValue('left'), '0px') + assert.strictEqual(await slide.getCssValue('top'), '0px') let br = await driver.findElement(By.id('BR')) await driver.actions().dragAndDrop(slide, br).perform() - assert.equal(await slide.getCssValue('left'), '206px') - assert.equal(await slide.getCssValue('top'), '206px') + assert.strictEqual(await slide.getCssValue('left'), '206px') + assert.strictEqual(await slide.getCssValue('top'), '206px') let tr = await driver.findElement(By.id('TR')) await driver.actions().dragAndDrop(slide, tr).perform() - assert.equal(await slide.getCssValue('left'), '206px') - assert.equal(await slide.getCssValue('top'), '1px') + assert.strictEqual(await slide.getCssValue('left'), '206px') + assert.strictEqual(await slide.getCssValue('top'), '1px') }) }) @@ -131,8 +131,8 @@ test.suite(function (env) { await driver.get(fileServer.whereIs('/data/actions/drag.html')) let slide = await driver.findElement(By.id('slide')) - assert.equal(await slide.getCssValue('left'), '0px') - assert.equal(await slide.getCssValue('top'), '0px') + assert.strictEqual(await slide.getCssValue('left'), '0px') + assert.strictEqual(await slide.getCssValue('top'), '0px') await driver .actions() @@ -141,8 +141,8 @@ test.suite(function (env) { .move({ x: 100, y: 100, origin: Origin.POINTER }) .release() .perform() - assert.equal(await slide.getCssValue('left'), '101px') - assert.equal(await slide.getCssValue('top'), '101px') + assert.strictEqual(await slide.getCssValue('left'), '101px') + assert.strictEqual(await slide.getCssValue('top'), '101px') }) it('can move to and click element in an iframe', async function () { @@ -163,33 +163,33 @@ test.suite(function (env) { await driver.get(test.Pages.formPage) let el = await driver.findElement(By.id('email')) - assert.equal(await el.getAttribute('value'), '') + assert.strictEqual(await el.getAttribute('value'), '') await driver.executeScript('arguments[0].focus()', el) await driver.actions().sendKeys('foobar').perform() - assert.equal(await el.getAttribute('value'), 'foobar') + assert.strictEqual(await el.getAttribute('value'), 'foobar') }) it('can get the property of element', async function () { await driver.get(test.Pages.formPage) let el = await driver.findElement(By.id('email')) - assert.equal(await el.getProperty('value'), '') + assert.strictEqual(await el.getProperty('value'), '') await driver.executeScript('arguments[0].focus()', el) await driver.actions().sendKeys('foobar').perform() - assert.equal(await el.getProperty('value'), 'foobar') + assert.strictEqual(await el.getProperty('value'), 'foobar') }) it('can send keys to focused element (with modifiers)', async function () { await driver.get(test.Pages.formPage) let el = await driver.findElement(By.id('email')) - assert.equal(await el.getAttribute('value'), '') + assert.strictEqual(await el.getAttribute('value'), '') await driver.executeScript('arguments[0].focus()', el) @@ -202,18 +202,18 @@ test.suite(function (env) { .sendKeys('ar') .perform() - assert.equal(await el.getAttribute('value'), 'foOBar') + assert.strictEqual(await el.getAttribute('value'), 'foOBar') }) it('can interact with simple form elements', async function () { await driver.get(test.Pages.formPage) let el = await driver.findElement(By.id('email')) - assert.equal(await el.getAttribute('value'), '') + assert.strictEqual(await el.getAttribute('value'), '') await driver.actions().click(el).sendKeys('foobar').perform() - assert.equal(await el.getAttribute('value'), 'foobar') + assert.strictEqual(await el.getAttribute('value'), 'foobar') }) }) }) diff --git a/javascript/node/selenium-webdriver/test/builder_test.js b/javascript/node/selenium-webdriver/test/builder_test.js index 79fce6cf3c43e..ad64991603311 100644 --- a/javascript/node/selenium-webdriver/test/builder_test.js +++ b/javascript/node/selenium-webdriver/test/builder_test.js @@ -53,7 +53,7 @@ test.suite(function (env) { driver instanceof want, `want ${want.name}, but got ${driver.name}` ) - assert.equal(typeof driver.then, 'function') + assert.strictEqual(typeof driver.then, 'function') return ( driver diff --git a/javascript/node/selenium-webdriver/test/chrome/devtools_test.js b/javascript/node/selenium-webdriver/test/chrome/devtools_test.js index 04e7c922940c9..c4f63a8cc01f6 100644 --- a/javascript/node/selenium-webdriver/test/chrome/devtools_test.js +++ b/javascript/node/selenium-webdriver/test/chrome/devtools_test.js @@ -146,7 +146,7 @@ test.suite( await driver.register('random', 'random', pageCdpConnection) await driver.get(fileServer.Pages.basicAuth) let source = await driver.getPageSource() - assert.ok(!source.includes('Access granted!'), `The Source is \n ${source}`) + assert.strictEqual(source.includes('Access granted!'), false) }) it('grants access if username and password are a match', async function () { @@ -156,6 +156,7 @@ test.suite( await driver.get(fileServer.Pages.basicAuth) let source = await driver.getPageSource() assert.strictEqual(source.includes('Access granted!'), true) + await server.stop() }) }) diff --git a/javascript/node/selenium-webdriver/test/chrome/options_test.js b/javascript/node/selenium-webdriver/test/chrome/options_test.js index afd1b038cd3bd..352a7e4c0fa87 100644 --- a/javascript/node/selenium-webdriver/test/chrome/options_test.js +++ b/javascript/node/selenium-webdriver/test/chrome/options_test.js @@ -85,7 +85,10 @@ describe('chrome.Options', function () { [symbols.serialize]() assert.strictEqual(wire['goog:chromeOptions'].extensions.length, 1) - assert.strictEqual(await wire['goog:chromeOptions'].extensions[0], expected) + assert.strictEqual( + await wire['goog:chromeOptions'].extensions[0], + expected + ) }) }) }) diff --git a/javascript/node/selenium-webdriver/test/cookie_test.js b/javascript/node/selenium-webdriver/test/cookie_test.js index 85f6f076fbf6c..7147c4b759592 100644 --- a/javascript/node/selenium-webdriver/test/cookie_test.js +++ b/javascript/node/selenium-webdriver/test/cookie_test.js @@ -50,7 +50,7 @@ suite(function (env) { .manage() .getCookie(cookie.name) .then(function (actual) { - assert.equal(actual.value, cookie.value) + assert.strictEqual(actual.value, cookie.value) }) }) @@ -178,10 +178,13 @@ suite(function (env) { .manage() .getCookie(cookie.name) .then(function (actual) { - assert.equal(actual.value, cookie.value) + assert.strictEqual(actual.value, cookie.value) // expiry times should be in seconds since January 1, 1970 UTC - assert.equal(actual.expiry, Math.floor(expiry.getTime() / 1000)) + assert.strictEqual( + actual.expiry, + Math.floor(expiry.getTime() / 1000) + ) }) await driver.sleep(expirationDelay) @@ -197,7 +200,7 @@ suite(function (env) { await driver.get(childUrl) await driver.manage().addCookie(cookie) const actual = await driver.manage().getCookie(cookie.name) - assert.equal(actual.sameSite, 'Strict') + assert.strictEqual(actual.sameSite, 'Strict') } ) @@ -209,7 +212,7 @@ suite(function (env) { await driver.get(childUrl) await driver.manage().addCookie(cookie) const actualCookie = await driver.manage().getCookie(cookie.name) - assert.equal(actualCookie.sameSite, 'Lax') + assert.strictEqual(actualCookie.sameSite, 'Lax') } ) @@ -294,7 +297,7 @@ suite(function (env) { .manage() .getCookies() .then(function (cookies) { - assert.equal( + assert.strictEqual( cookies.length, expected.length, 'Wrong # of cookies.' + @@ -306,7 +309,7 @@ suite(function (env) { const map = buildCookieMap(cookies) for (let i = 0; i < expected.length; ++i) { - assert.equal(expected[i].value, map[expected[i].name].value) + assert.strictEqual(expected[i].value, map[expected[i].name].value) } }) } diff --git a/javascript/node/selenium-webdriver/test/elementAccessibleName_test.js b/javascript/node/selenium-webdriver/test/elementAccessibleName_test.js index 0313907ef2a7d..ff561d76f7e8d 100644 --- a/javascript/node/selenium-webdriver/test/elementAccessibleName_test.js +++ b/javascript/node/selenium-webdriver/test/elementAccessibleName_test.js @@ -35,14 +35,14 @@ test.suite( await driver.get(`data:text/html,

Level 1 Header

`) let header = driver.findElement(By.css('h1')) - assert.equal(await header.getAccessibleName(), 'Level 1 Header') + assert.strictEqual(await header.getAccessibleName(), 'Level 1 Header') }) it('Should return computed label for img', async function () { await driver.get(`data:text/html, Test Image`) let imgLabel = driver.findElement(By.css('img')) - assert.equal(await imgLabel.getAccessibleName(), 'Test Image') + assert.strictEqual(await imgLabel.getAccessibleName(), 'Test Image') }) it('Should return computed label for label', async function () { @@ -50,14 +50,17 @@ test.suite( `) let computedLabel = driver.findElement(By.css('input')) - assert.equal(await computedLabel.getAccessibleName(), 'Test Label') + assert.strictEqual( + await computedLabel.getAccessibleName(), + 'Test Label' + ) }) it('Should return computed label for aria-label', async function () { await driver.get(`data:text/html, `) let computedAriaLabel = driver.findElement(By.css('button')) - assert.equal( + assert.strictEqual( await computedAriaLabel.getAccessibleName(), 'Add sample button to cart' ) @@ -68,7 +71,10 @@ test.suite( `) let computedAriaLabel = driver.findElement(By.css('input')) - assert.equal(await computedAriaLabel.getAccessibleName(), 'Search') + assert.strictEqual( + await computedAriaLabel.getAccessibleName(), + 'Search' + ) }) }) }, diff --git a/javascript/node/selenium-webdriver/test/elementAriaRole_test.js b/javascript/node/selenium-webdriver/test/elementAriaRole_test.js index 470e2b21810b2..c61988f345eff 100644 --- a/javascript/node/selenium-webdriver/test/elementAriaRole_test.js +++ b/javascript/node/selenium-webdriver/test/elementAriaRole_test.js @@ -35,21 +35,21 @@ test.suite( await driver.get(`data:text/html,
Level 1 Header
`) let header = driver.findElement(By.css('div')) - assert.equal(await header.getAriaRole(), 'heading') + assert.strictEqual(await header.getAriaRole(), 'heading') }) it('Should return implicit role defined by tagName', async function () { await driver.get(`data:text/html,

Level 1 Header

`) let header = driver.findElement(By.css('h1')) - assert.equal(await header.getAriaRole(), 'heading') + assert.strictEqual(await header.getAriaRole(), 'heading') }) it('Should return explicit role even if it contradicts TagName', async function () { await driver.get(`data:text/html,

Level 1 Header

`) let header = driver.findElement(By.css('h1')) - assert.equal(await header.getAriaRole(), 'alert') + assert.strictEqual(await header.getAriaRole(), 'alert') }) }) }, diff --git a/javascript/node/selenium-webdriver/test/element_finding_test.js b/javascript/node/selenium-webdriver/test/element_finding_test.js index 4609f00fa4a79..58a7c28df0e8d 100644 --- a/javascript/node/selenium-webdriver/test/element_finding_test.js +++ b/javascript/node/selenium-webdriver/test/element_finding_test.js @@ -66,7 +66,7 @@ suite(function (env) { await driver.get(Pages.nestedPage) let elements = await driver.findElements(By.id('2')) - assert.equal(elements.length, 8) + assert.strictEqual(elements.length, 8) } ) }) @@ -89,7 +89,7 @@ suite(function (env) { let el = await driver.findElement(By.linkText('Link=equalssign')) let id = await el.getAttribute('id') - assert.equal(id, 'linkWithEqualsSign') + assert.strictEqual(id, 'linkWithEqualsSign') }) it('matches by partial text when containing equals sign', async function () { @@ -97,39 +97,39 @@ suite(function (env) { let link = await driver.findElement(By.partialLinkText('Link=')) let id = await link.getAttribute('id') - assert.equal(id, 'linkWithEqualsSign') + assert.strictEqual(id, 'linkWithEqualsSign') }) it('works when searching for multiple and text contains =', async function () { await driver.get(Pages.xhtmlTestPage) let elements = await driver.findElements(By.linkText('Link=equalssign')) - assert.equal(elements.length, 1) + assert.strictEqual(elements.length, 1) let id = await elements[0].getAttribute('id') - assert.equal(id, 'linkWithEqualsSign') + assert.strictEqual(id, 'linkWithEqualsSign') }) it('works when searching for multiple with partial text containing =', async function () { await driver.get(Pages.xhtmlTestPage) let elements = await driver.findElements(By.partialLinkText('Link=')) - assert.equal(elements.length, 1) + assert.strictEqual(elements.length, 1) let id = await elements[0].getAttribute('id') - assert.equal(id, 'linkWithEqualsSign') + assert.strictEqual(id, 'linkWithEqualsSign') }) it('should be able to find multiple exact matches', async function () { await driver.get(Pages.xhtmlTestPage) let elements = await driver.findElements(By.linkText('click me')) - assert.equal(elements.length, 2) + assert.strictEqual(elements.length, 2) }) it('should be able to find multiple partial matches', async function () { await driver.get(Pages.xhtmlTestPage) let elements = await driver.findElements(By.partialLinkText('ick me')) - assert.equal(elements.length, 2) + assert.strictEqual(elements.length, 2) }) ignore(browsers(Browser.SAFARI)).it( @@ -138,7 +138,7 @@ suite(function (env) { await driver.get(whereIs('actualXhtmlPage.xhtml')) let el = await driver.findElement(By.linkText('Foo')) - assert.equal(await el.getText(), 'Foo') + assert.strictEqual(await el.getText(), 'Foo') } ) }) @@ -148,7 +148,7 @@ suite(function (env) { await driver.get(Pages.formPage) let el = await driver.findElement(By.name('checky')) - assert.equal(await el.getAttribute('value'), 'furrfu') + assert.strictEqual(await el.getAttribute('value'), 'furrfu') }) it('should find multiple elements with same name', async function () { @@ -187,28 +187,28 @@ suite(function (env) { await driver.get(Pages.xhtmlTestPage) let el = await driver.findElement(By.className('nameA')) - assert.equal(await el.getText(), 'An H2 title') + assert.strictEqual(await el.getText(), 'An H2 title') }) it('should work when name is last name among many', async function () { await driver.get(Pages.xhtmlTestPage) let el = await driver.findElement(By.className('nameC')) - assert.equal(await el.getText(), 'An H2 title') + assert.strictEqual(await el.getText(), 'An H2 title') }) it('should work when name is middle of many', async function () { await driver.get(Pages.xhtmlTestPage) let el = await driver.findElement(By.className('nameBnoise')) - assert.equal(await el.getText(), 'An H2 title') + assert.strictEqual(await el.getText(), 'An H2 title') }) it('should work when name surrounded by whitespace', async function () { await driver.get(Pages.xhtmlTestPage) let el = await driver.findElement(By.className('spaceAround')) - assert.equal(await el.getText(), 'Spaced out') + assert.strictEqual(await el.getText(), 'Spaced out') }) it('should fail if queried name only partially matches', async function () { @@ -255,7 +255,7 @@ suite(function (env) { .get(Pages.xhtmlTestPage) .then(() => driver.findElement(By.className('nameA nameC'))) .then((el) => el.getText()) - .then((text) => assert.equal(text, 'An H2 title')) + .then((text) => assert.strictEqual(text, 'An H2 title')) }) }) @@ -278,7 +278,7 @@ suite(function (env) { await driver.get(Pages.formPage) let el = await driver.findElement(By.tagName('input')) - assert.equal((await el.getTagName()).toLowerCase(), 'input') + assert.strictEqual((await el.getTagName()).toLowerCase(), 'input') }) it('can find multiple elements', async function () { @@ -311,7 +311,7 @@ suite(function (env) { await driver.get(Pages.xhtmlTestPage) let el = await driver.findElement(By.css('div.extraDiv, div.content')) - assert.equal(await el.getAttribute('class'), 'content') + assert.strictEqual(await el.getAttribute('class'), 'content') } ) @@ -328,7 +328,7 @@ suite(function (env) { async function assertClassIs(el, expected) { let clazz = await el.getAttribute('class') - assert.equal(clazz, expected) + assert.strictEqual(clazz, expected) } }) @@ -343,7 +343,7 @@ suite(function (env) { let el = await driver.findElement( By.css('option[selected="selected"]') ) - assert.equal(await el.getAttribute('value'), 'two') + assert.strictEqual(await el.getAttribute('value'), 'two') } ) @@ -356,7 +356,7 @@ suite(function (env) { ) let el = await driver.findElement(By.css('option[selected]')) - assert.equal(await el.getAttribute('value'), 'two') + assert.strictEqual(await el.getAttribute('value'), 'two') } ) @@ -369,7 +369,7 @@ suite(function (env) { ) let el = await driver.findElement(By.css('option[selected]')) - assert.equal(await el.getAttribute('value'), 'two') + assert.strictEqual(await el.getAttribute('value'), 'two') } ) }) @@ -399,7 +399,7 @@ suite(function (env) { return driver.findElements(By.tagName('a')) }) - assert.equal(await link.getText(), 'Change the page title!') + assert.strictEqual(await link.getText(), 'Change the page title!') }) it('fails if locator returns non-webelement value', async function () { @@ -422,11 +422,11 @@ suite(function (env) { let below = await driver.findElement(By.id('below')) let elements = await driver.findElements(withTagName('p').above(below)) let ids = [] - assert.equal(elements.length, 2) + assert.strictEqual(elements.length, 2) for (let i = 0; i < elements.length; i++) { ids.push(await elements[i].getAttribute('id')) } - assert.deepEqual(ids, ['mid', 'above']) + assert.deepStrictEqual(ids, ['mid', 'above']) }) it('should combine filters', async function () { diff --git a/javascript/node/selenium-webdriver/test/execute_script_test.js b/javascript/node/selenium-webdriver/test/execute_script_test.js index 1fd16f9f66421..010dcf1668be4 100644 --- a/javascript/node/selenium-webdriver/test/execute_script_test.js +++ b/javascript/node/selenium-webdriver/test/execute_script_test.js @@ -67,19 +67,19 @@ suite(function (env) { describe('scripts;', function () { it('do not pollute the global scope', async function () { await execute('var x = 1;') - assert.equal(await execute('return typeof x;'), 'undefined') + assert.strictEqual(await execute('return typeof x;'), 'undefined') }) it('can set global variables', async function () { await execute('window.x = 1234;') - assert.equal(await execute('return x;'), 1234) + assert.strictEqual(await execute('return x;'), 1234) }) it('may be defined as a function expression', async function () { let result = await execute(function () { return 1234 + 'abc' }) - assert.equal(result, '1234abc') + assert.strictEqual(result, '1234abc') }) }) @@ -93,17 +93,17 @@ suite(function (env) { }) it('can return numbers', async function () { - assert.equal(await execute('return 1234'), 1234) - assert.equal(await execute('return 3.1456'), 3.1456) + assert.strictEqual(await execute('return 1234'), 1234) + assert.strictEqual(await execute('return 3.1456'), 3.1456) }) it('can return strings', async function () { - assert.equal(await execute('return "hello"'), 'hello') + assert.strictEqual(await execute('return "hello"'), 'hello') }) it('can return booleans', async function () { - assert.equal(await execute('return true'), true) - assert.equal(await execute('return false'), false) + assert.strictEqual(await execute('return true'), true) + assert.strictEqual(await execute('return false'), false) }) it('can return an array of primitives', function () { @@ -126,8 +126,8 @@ suite(function (env) { it('can return object literals', function () { return execute('return {a: 1, b: false, c: null}').then((result) => { verifyJson(['a', 'b', 'c'])(Object.keys(result).sort()) - assert.equal(result.a, 1) - assert.equal(result.b, false) + assert.strictEqual(result.a, 1) + assert.strictEqual(result.b, false) assert.strictEqual(result.c, null) }) }) @@ -153,7 +153,7 @@ suite(function (env) { 'var nodes = document.querySelectorAll(".request,.host");' + 'return [nodes[0], nodes[1]];' ) - assert.equal(result.length, 2) + assert.strictEqual(result.length, 2) assert.ok(result[0] instanceof WebElement) assert.ok((await result[0].getText()).startsWith('GET ')) @@ -167,7 +167,7 @@ suite(function (env) { 'return document.querySelectorAll(".request,.host");' ) - assert.equal(result.length, 2) + assert.strictEqual(result.length, 2) assert.ok(result[0] instanceof WebElement) assert.ok((await result[0].getText()).startsWith('GET ')) @@ -180,39 +180,48 @@ suite(function (env) { let result = await execute('return {a: document.body}') assert.ok(result.a instanceof WebElement) - assert.equal((await result.a.getTagName()).toLowerCase(), 'body') + assert.strictEqual((await result.a.getTagName()).toLowerCase(), 'body') }) }) describe('parameters;', function () { it('can pass numeric arguments', async function () { - assert.equal(await execute('return arguments[0]', 12), 12) - assert.equal(await execute('return arguments[0]', 3.14), 3.14) + assert.strictEqual(await execute('return arguments[0]', 12), 12) + assert.strictEqual(await execute('return arguments[0]', 3.14), 3.14) }) it('can pass boolean arguments', async function () { - assert.equal(await execute('return arguments[0]', true), true) - assert.equal(await execute('return arguments[0]', false), false) + assert.strictEqual(await execute('return arguments[0]', true), true) + assert.strictEqual(await execute('return arguments[0]', false), false) }) it('can pass string arguments', async function () { - assert.equal(await execute('return arguments[0]', 'hi'), 'hi') + assert.strictEqual(await execute('return arguments[0]', 'hi'), 'hi') }) it('can pass null arguments', async function () { - assert.equal(await execute('return arguments[0] === null', null), true) - assert.equal(await execute('return arguments[0]', null), null) + assert.strictEqual( + await execute('return arguments[0] === null', null), + true + ) + assert.strictEqual(await execute('return arguments[0]', null), null) }) it('passes undefined as a null argument', async function () { var x - assert.equal(await execute('return arguments[0] === null', x), true) - assert.equal(await execute('return arguments[0]', x), null) + assert.strictEqual( + await execute('return arguments[0] === null', x), + true + ) + assert.strictEqual(await execute('return arguments[0]', x), null) }) it('can pass multiple arguments', async function () { - assert.equal(await execute('return arguments.length'), 0) - assert.equal(await execute('return arguments.length', 1, 'a', false), 3) + assert.strictEqual(await execute('return arguments.length'), 0) + assert.strictEqual( + await execute('return arguments.length', 1, 'a', false), + 3 + ) }) ignore(env.browsers(Browser.FIREFOX, Browser.SAFARI)).it( @@ -220,10 +229,10 @@ suite(function (env) { async function () { let val = await execute('return arguments', 1, 'a', false) - assert.equal(val.length, 3) - assert.equal(val[0], 1) - assert.equal(val[1], 'a') - assert.equal(val[2], false) + assert.strictEqual(val.length, 3) + assert.strictEqual(val[0], 1) + assert.strictEqual(val[1], 'a') + assert.strictEqual(val[2], false) } ) @@ -232,8 +241,8 @@ suite(function (env) { 'return [typeof arguments[0], arguments[0].a]', { a: 'hello' } ) - assert.equal(result[0], 'object') - assert.equal(result[1], 'hello') + assert.strictEqual(result[0], 'object') + assert.strictEqual(result[1], 'hello') }) it('WebElement arguments are passed as DOM elements', async function () { @@ -242,13 +251,13 @@ suite(function (env) { 'return arguments[0].tagName.toLowerCase();', el ) - assert.equal(result, 'div') + assert.strictEqual(result, 'div') }) it('can pass array containing object literals', async function () { let result = await execute('return arguments[0]', [{ color: 'red' }]) - assert.equal(result.length, 1) - assert.equal(result[0].color, 'red') + assert.strictEqual(result.length, 1) + assert.strictEqual(result[0].color, 'red') }) it('does not modify object literal parameters', function () { @@ -351,9 +360,9 @@ suite(function (env) { }) .catch(function (e) { if (env.browser.name === Browser.SAFARI) { - assert.equal(e.name, error.TimeoutError.name) + assert.strictEqual(e.name, error.TimeoutError.name) } else { - assert.equal(e.name, error.ScriptTimeoutError.name) + assert.strictEqual(e.name, error.ScriptTimeoutError.name) } }) }) @@ -369,7 +378,7 @@ suite(function (env) { function verifyJson(expected) { return function (actual) { - assert.equal(JSON.stringify(actual), JSON.stringify(expected)) + assert.strictEqual(JSON.stringify(actual), JSON.stringify(expected)) } } diff --git a/javascript/node/selenium-webdriver/test/firefox_test.js b/javascript/node/selenium-webdriver/test/firefox_test.js index cb8eb2fa42983..0676de8cba1a0 100644 --- a/javascript/node/selenium-webdriver/test/firefox_test.js +++ b/javascript/node/selenium-webdriver/test/firefox_test.js @@ -192,17 +192,17 @@ suite( }) it('can get context', async function () { - assert.equal(await driver.getContext(), Context.CONTENT) + assert.strictEqual(await driver.getContext(), Context.CONTENT) }) it('can set context', async function () { await driver.setContext(Context.CHROME) let ctxt = await driver.getContext() - assert.equal(ctxt, Context.CHROME) + assert.strictEqual(ctxt, Context.CHROME) await driver.setContext(Context.CONTENT) ctxt = await driver.getContext() - assert.equal(ctxt, Context.CONTENT) + assert.strictEqual(ctxt, Context.CONTENT) }) it('throws on unknown context', function () { @@ -233,14 +233,14 @@ suite( let userAgent = await driver.executeScript( 'return window.navigator.userAgent' ) - assert.equal(userAgent, 'foo;bar') + assert.strictEqual(userAgent, 'foo;bar') } async function verifyWebExtensionNotInstalled() { let found = await driver.findElements({ id: 'webextensions-selenium-example', }) - assert.equal(found.length, 0) + assert.strictEqual(found.length, 0) } async function verifyWebExtensionWasInstalled() { @@ -248,7 +248,10 @@ suite( id: 'webextensions-selenium-example', }) let text = await footer.getText() - assert.equal(text, 'Content injected by webextensions-selenium-example') + assert.strictEqual( + text, + 'Content injected by webextensions-selenium-example' + ) } }) }, diff --git a/javascript/node/selenium-webdriver/test/frame_test.js b/javascript/node/selenium-webdriver/test/frame_test.js index 2216ed01bcf79..26bc6c1ae7d3c 100644 --- a/javascript/node/selenium-webdriver/test/frame_test.js +++ b/javascript/node/selenium-webdriver/test/frame_test.js @@ -40,12 +40,12 @@ test.suite(function (env) { let frame = await driver.findElement(By.name('iframe1-name')) await driver.switchTo().frame(frame) - assert.equal( + assert.strictEqual( await driver.executeScript('return document.title'), 'We Leave From Here' ) await driver.switchTo().parentFrame() - assert.equal( + assert.strictEqual( await driver.executeScript('return document.title'), 'This page has iframes' ) diff --git a/javascript/node/selenium-webdriver/test/http/http_test.js b/javascript/node/selenium-webdriver/test/http/http_test.js index 602a847c27d69..532c56bb22eb1 100644 --- a/javascript/node/selenium-webdriver/test/http/http_test.js +++ b/javascript/node/selenium-webdriver/test/http/http_test.js @@ -139,8 +139,8 @@ describe('HttpClient', function () { let client = new HttpClient(server.url()) return client.send(request).then((response) => { - assert.equal(200, response.status) - assert.equal(response.body, '

Hello, world!

') + assert.strictEqual(200, response.status) + assert.strictEqual(response.body, '

Hello, world!

') }) }) @@ -152,9 +152,9 @@ describe('HttpClient', function () { const client = new HttpClient(url.format(parsed)) const request = new HttpRequest('GET', '/protected') return client.send(request).then(function (response) { - assert.equal(200, response.status) - assert.equal(response.headers.get('content-type'), 'text/plain') - assert.equal(response.body, 'Access granted!') + assert.strictEqual(200, response.status) + assert.strictEqual(response.headers.get('content-type'), 'text/plain') + assert.strictEqual(response.body, 'Access granted!') }) }) @@ -162,8 +162,8 @@ describe('HttpClient', function () { const client = new HttpClient(server.url()) const request = new HttpRequest('GET', '/protected') return client.send(request).then(function (response) { - assert.equal(401, response.status) - assert.equal(response.body, 'Access denied') + assert.strictEqual(401, response.status) + assert.strictEqual(response.body, 'Access denied') }) }) @@ -171,9 +171,9 @@ describe('HttpClient', function () { const request = new HttpRequest('GET', '/redirect') const client = new HttpClient(server.url()) return client.send(request).then(function (response) { - assert.equal(200, response.status) - assert.equal(response.headers.get('content-type'), 'text/plain') - assert.equal(response.body, 'hello, world!') + assert.strictEqual(200, response.status) + assert.strictEqual(response.headers.get('content-type'), 'text/plain') + assert.strictEqual(response.body, 'hello, world!') }) }) @@ -197,9 +197,9 @@ describe('HttpClient', function () { server.url() ) return client.send(request).then(function (response) { - assert.equal(200, response.status) - assert.equal(response.headers.get('host'), 'another.server.com') - assert.equal( + assert.strictEqual(200, response.status) + assert.strictEqual(response.headers.get('host'), 'another.server.com') + assert.strictEqual( response.headers.get('x-proxy-request-uri'), 'http://another.server.com/proxy' ) @@ -214,9 +214,9 @@ describe('HttpClient', function () { server.url() ) return client.send(request).then(function (response) { - assert.equal(200, response.status) - assert.equal(response.headers.get('host'), 'another.server.com') - assert.equal( + assert.strictEqual(200, response.status) + assert.strictEqual(response.headers.get('host'), 'another.server.com') + assert.strictEqual( response.headers.get('x-proxy-request-uri'), 'http://another.server.com/proxy' ) @@ -231,9 +231,9 @@ describe('HttpClient', function () { server.url() ) return client.send(request).then(function (response) { - assert.equal(200, response.status) - assert.equal(response.headers.get('host'), 'another.server.com') - assert.equal( + assert.strictEqual(200, response.status) + assert.strictEqual(response.headers.get('host'), 'another.server.com') + assert.strictEqual( response.headers.get('x-proxy-request-uri'), 'http://another.server.com/proxy?foo#bar' ) diff --git a/javascript/node/selenium-webdriver/test/http/util_test.js b/javascript/node/selenium-webdriver/test/http/util_test.js index 5380566fee95d..b772881996e95 100644 --- a/javascript/node/selenium-webdriver/test/http/util_test.js +++ b/javascript/node/selenium-webdriver/test/http/util_test.js @@ -110,8 +110,8 @@ describe('selenium-webdriver/http/util', function () { }, function (err) { assert.ok(err instanceof error.WebDriverError) - assert.equal(err.code, error.WebDriverError.code) - assert.equal(err.message, value) + assert.strictEqual(err.code, error.WebDriverError.code) + assert.strictEqual(err.message, value) } ) }) diff --git a/javascript/node/selenium-webdriver/test/ie/options_test.js b/javascript/node/selenium-webdriver/test/ie/options_test.js index ca00f35708f51..baaf0a18c1442 100644 --- a/javascript/node/selenium-webdriver/test/ie/options_test.js +++ b/javascript/node/selenium-webdriver/test/ie/options_test.js @@ -37,7 +37,7 @@ test.suite( caps = caps.map_.get(ie.VENDOR_COMMAND_PREFIX)[ ie.Key.FILE_UPLOAD_DIALOG_TIMEOUT ] - assert.equal(caps, timeOut) + assert.strictEqual(caps, timeOut) await driver.quit() }) @@ -51,7 +51,7 @@ test.suite( caps = caps.map_.get(ie.VENDOR_COMMAND_PREFIX)[ ie.Key.BROWSER_ATTACH_TIMEOUT ] - assert.equal(caps, timeOut) + assert.strictEqual(caps, timeOut) await driver.quit() }) @@ -63,7 +63,7 @@ test.suite( caps = caps.map_.get(ie.VENDOR_COMMAND_PREFIX)[ ie.Key.ELEMENT_SCROLL_BEHAVIOR ] - assert.equal(caps, ie.Behavior.TOP) + assert.strictEqual(caps, ie.Behavior.TOP) await driver.quit() }) diff --git a/javascript/node/selenium-webdriver/test/io/io_test.js b/javascript/node/selenium-webdriver/test/io/io_test.js index 88b3cad22b596..bfa0ae2c23dfa 100644 --- a/javascript/node/selenium-webdriver/test/io/io_test.js +++ b/javascript/node/selenium-webdriver/test/io/io_test.js @@ -38,8 +38,8 @@ describe('io', function () { it('can copy one file to another', function () { return io.tmpFile().then(function (f) { return io.copy(path.join(tmpDir, 'foo'), f).then(function (p) { - assert.equal(p, f) - assert.equal('Hello, world', fs.readFileSync(p)) + assert.strictEqual(p, f) + assert.strictEqual('Hello, world', fs.readFileSync(p, 'utf-8')) }) }) }) @@ -56,8 +56,8 @@ describe('io', function () { return io .copy(path.join(tmpDir, 'symlinked-foo'), f) .then(function (p) { - assert.equal(p, f) - assert.equal('Hello, world', fs.readFileSync(p)) + assert.strictEqual(p, f) + assert.strictEqual('Hello, world', fs.readFileSync(p, 'utf-8')) }) }) }) @@ -89,12 +89,15 @@ describe('io', function () { return io.tmpDir().then(function (dst) { return io.copyDir(dir, dst).then(function (ret) { - assert.equal(dst, ret) + assert.strictEqual(dst, ret) - assert.equal('hello', fs.readFileSync(path.join(dst, 'file1'))) - assert.equal( + assert.strictEqual( + 'hello', + fs.readFileSync(path.join(dst, 'file1'), 'utf-8') + ) + assert.strictEqual( 'goodbye', - fs.readFileSync(path.join(dst, 'sub/folder/file2')) + fs.readFileSync(path.join(dst, 'sub/folder/file2'), 'utf-8') ) }) }) @@ -111,8 +114,8 @@ describe('io', function () { }) }) .then(function (p) { - assert.equal('sub', path.basename(p)) - assert.equal('hi', fs.readFileSync(path.join(p, 'foo'))) + assert.strictEqual('sub', path.basename(p)) + assert.strictEqual('hi', fs.readFileSync(path.join(p, 'foo'), 'utf-8')) }) }) @@ -132,9 +135,9 @@ describe('io', function () { }) }) .then(function (dir) { - assert.equal('a', fs.readFileSync(path.join(dir, 'foo'))) - assert.equal('c', fs.readFileSync(path.join(dir, 'baz'))) - assert.equal('e', fs.readFileSync(path.join(dir, 'sub/quot'))) + assert.strictEqual('a', fs.readFileSync(path.join(dir, 'foo'), 'utf-8')) + assert.strictEqual('c', fs.readFileSync(path.join(dir, 'baz'), 'utf-8')) + assert.strictEqual('e', fs.readFileSync(path.join(dir, 'sub/quot'), 'utf-8')) assert.ok(!fs.existsSync(path.join(dir, 'bar'))) assert.ok(!fs.existsSync(path.join(dir, 'sub/quux'))) @@ -161,9 +164,9 @@ describe('io', function () { }) }) .then(function (dir) { - assert.equal('b', fs.readFileSync(path.join(dir, 'bar'))) - assert.equal('c', fs.readFileSync(path.join(dir, 'baz'))) - assert.equal('d', fs.readFileSync(path.join(dir, 'sub/quux'))) + assert.strictEqual('b', fs.readFileSync(path.join(dir, 'bar'), 'utf-8')) + assert.strictEqual('c', fs.readFileSync(path.join(dir, 'baz'), 'utf-8')) + assert.strictEqual('d', fs.readFileSync(path.join(dir, 'sub/quux'), 'utf-8')) assert.ok(!fs.existsSync(path.join(dir, 'foo'))) assert.ok(!fs.existsSync(path.join(dir, 'sub/quot'))) @@ -328,7 +331,7 @@ describe('io', function () { it('can read a file', function () { return io.read(path.join(tmpDir, 'foo')).then((buff) => { assert.ok(buff instanceof Buffer) - assert.equal('Hello, world', buff.toString()) + assert.strictEqual('Hello, world', buff.toString()) }) }) @@ -342,7 +345,7 @@ describe('io', function () { it('rejects returned promise if file does not exist', function () { return io.read(path.join(tmpDir, 'not-there')).then( () => assert.fail('should have failed'), - (e) => assert.equal('ENOENT', e.code) + (e) => assert.strictEqual('ENOENT', e.code) ) }) }) diff --git a/javascript/node/selenium-webdriver/test/io/zip_test.js b/javascript/node/selenium-webdriver/test/io/zip_test.js index a327e4fdec972..280281414c9a7 100644 --- a/javascript/node/selenium-webdriver/test/io/zip_test.js +++ b/javascript/node/selenium-webdriver/test/io/zip_test.js @@ -120,7 +120,7 @@ describe('io/zip', function () { (e) => assert.strictEqual(e.constructor, InvalidArgumentError) ) .then(() => z.getFile('foo/aFile')) - .then((b) => assert.equal(b.toString('utf8'), 'hello, world!')) + .then((b) => assert.strictEqual(b.toString('utf8'), 'hello, world!')) }) }) }) diff --git a/javascript/node/selenium-webdriver/test/lib/capabilities_test.js b/javascript/node/selenium-webdriver/test/lib/capabilities_test.js index b63cb72ac39a2..e691535d7dc28 100644 --- a/javascript/node/selenium-webdriver/test/lib/capabilities_test.js +++ b/javascript/node/selenium-webdriver/test/lib/capabilities_test.js @@ -108,7 +108,10 @@ describe('Capabilities', function () { ['abc', 'def'], ]) let caps = new Capabilities(m) - assert.deepStrictEqual({ one: 123, abc: 'def' }, caps[Symbols.serialize]()) + assert.deepStrictEqual( + { one: 123, abc: 'def' }, + caps[Symbols.serialize]() + ) }) it('does not omit capabilities set to a false-like value', function () { diff --git a/javascript/node/selenium-webdriver/test/lib/http_test.js b/javascript/node/selenium-webdriver/test/lib/http_test.js index ac5d91f9dd3bd..2519f9f4e1a35 100644 --- a/javascript/node/selenium-webdriver/test/lib/http_test.js +++ b/javascript/node/selenium-webdriver/test/lib/http_test.js @@ -44,8 +44,8 @@ describe('http', function () { '/session/:sessionId/element/:id/click', parameters ) - assert.equal(finalPath, '/session/foo/element/bar/click') - assert.deepEqual(parameters, {}) + assert.strictEqual(finalPath, '/session/foo/element/bar/click') + assert.deepStrictEqual(parameters, {}) }) it('throws if missing a parameter', function () { diff --git a/javascript/node/selenium-webdriver/test/lib/input_test.js b/javascript/node/selenium-webdriver/test/lib/input_test.js index afd2ac41df8f5..53f03de70f03d 100644 --- a/javascript/node/selenium-webdriver/test/lib/input_test.js +++ b/javascript/node/selenium-webdriver/test/lib/input_test.js @@ -490,6 +490,21 @@ describe('input.Actions', function () { }, ]) }) + + it('string length > 500', async function () { + const executor = new StubExecutor(Promise.resolve()) + const actions = new input.Actions(executor, { async: true }) + let str = '' + for (let i = 0; i < 501; i++) { + str += i + } + const executionResult = await actions + .sendKeys(str) + .perform() + .then(() => true) + .catch(() => false) + assert.strictEqual(executionResult, true) + }) }) describe('click()', function () { @@ -859,7 +874,7 @@ describe('input.Actions', function () { .release(input.Button.LEFT) .perform() - assert.deepEqual(executor.commands, [ + assert.deepStrictEqual(executor.commands, [ { name: command.Name.ACTIONS, parameters: { diff --git a/javascript/node/selenium-webdriver/test/lib/logging_test.js b/javascript/node/selenium-webdriver/test/lib/logging_test.js index ba37119173de9..d683125611fa1 100644 --- a/javascript/node/selenium-webdriver/test/lib/logging_test.js +++ b/javascript/node/selenium-webdriver/test/lib/logging_test.js @@ -171,9 +171,9 @@ describe('logging', function () { log4.warning('this is a warning message') log4.severe('this is a severe message') - assert.equal(4, cb1.callCount) - assert.equal(4, cb2.callCount) - assert.equal(4, cb3.callCount) + assert.strictEqual(4, cb1.callCount) + assert.strictEqual(4, cb2.callCount) + assert.strictEqual(4, cb3.callCount) const entry1 = new logging.Entry( logging.Level.FINER, @@ -212,9 +212,9 @@ describe('logging', function () { check(cb3.getCall(3).args[0], entry4) function check(entry, expected) { - assert.equal(entry.level, expected.level, 'wrong level') - assert.equal(entry.message, expected.message, 'wrong message') - assert.equal(entry.timestamp, expected.timestamp, 'wrong time') + assert.strictEqual(entry.level, expected.level, 'wrong level') + assert.strictEqual(entry.message, expected.message, 'wrong message') + assert.strictEqual(entry.timestamp, expected.timestamp, 'wrong time') } }) @@ -274,7 +274,10 @@ describe('logging', function () { assert.strictEqual('{"foo":"DEBUG"}', JSON.stringify(prefs)) prefs.setLevel(logging.Type.BROWSER, logging.Level.FINE) - assert.strictEqual('{"foo":"DEBUG","browser":"FINE"}', JSON.stringify(prefs)) + assert.strictEqual( + '{"foo":"DEBUG","browser":"FINE"}', + JSON.stringify(prefs) + ) }) }) }) diff --git a/javascript/node/selenium-webdriver/test/lib/promise_test.js b/javascript/node/selenium-webdriver/test/lib/promise_test.js index f69ce034aaf25..b6fd3cdb6ad90 100644 --- a/javascript/node/selenium-webdriver/test/lib/promise_test.js +++ b/javascript/node/selenium-webdriver/test/lib/promise_test.js @@ -82,7 +82,7 @@ describe('promise', function () { function runTest(value) { return promise .fullyResolved(value) - .then((resolved) => assert.equal(value, resolved)) + .then((resolved) => assert.strictEqual(value, resolved)) } return runTest(true) .then(() => runTest(function () {})) @@ -97,7 +97,10 @@ describe('promise', function () { var array = [true, fn, null, 123, '', undefined, 1] return promise.fullyResolved(array).then(function (resolved) { assert.strictEqual(array, resolved) - assert.deepStrictEqual([true, fn, null, 123, '', undefined, 1], resolved) + assert.deepStrictEqual( + [true, fn, null, 123, '', undefined, 1], + resolved + ) }) }) @@ -122,7 +125,7 @@ describe('promise', function () { it('promiseResolvesToPrimitive', function () { return promise .fullyResolved(Promise.resolve(123)) - .then((resolved) => assert.equal(123, resolved)) + .then((resolved) => assert.strictEqual(123, resolved)) }) it('promiseResolvesToArray', function () { diff --git a/javascript/node/selenium-webdriver/test/lib/until_test.js b/javascript/node/selenium-webdriver/test/lib/until_test.js index 5d288965b9a77..84fa8ef4b82b4 100644 --- a/javascript/node/selenium-webdriver/test/lib/until_test.js +++ b/javascript/node/selenium-webdriver/test/lib/until_test.js @@ -77,7 +77,11 @@ describe('until', function () { if (typeof expectedId === 'string') { expectedId = WebElement.buildId(expectedId) } else { - assert.strictEqual(typeof expectedId, 'number', 'must be string or number') + assert.strictEqual( + typeof expectedId, + 'number', + 'must be string or number' + ) } return (cmd) => { assert.deepStrictEqual( diff --git a/javascript/node/selenium-webdriver/test/lib/webdriver_test.js b/javascript/node/selenium-webdriver/test/lib/webdriver_test.js index 0091716934a17..dbca7498986f6 100644 --- a/javascript/node/selenium-webdriver/test/lib/webdriver_test.js +++ b/javascript/node/selenium-webdriver/test/lib/webdriver_test.js @@ -408,7 +408,10 @@ describe('WebDriver', function () { el.resolve(new WebElement(driver, { ELEMENT: 'foo' })) return Promise.all(steps).then(function () { - assert.deepStrictEqual(['element resolved', 'wire value resolved'], messages) + assert.deepStrictEqual( + ['element resolved', 'wire value resolved'], + messages + ) }) }) @@ -735,7 +738,10 @@ describe('WebDriver', function () { .findElement(By.js('return 123')) .then(assert.fail, function (e) { assertIsInstance(TypeError, e) - assert.strictEqual('Custom locator did not return a WebElement', e.message) + assert.strictEqual( + 'Custom locator did not return a WebElement', + e.message + ) }) }) @@ -777,7 +783,10 @@ describe('WebDriver', function () { .findElement((_) => 1) .then(assert.fail, function (e) { assertIsInstance(TypeError, e) - assert.strictEqual('Custom locator did not return a WebElement', e.message) + assert.strictEqual( + 'Custom locator did not return a WebElement', + e.message + ) }) }) }) @@ -1041,7 +1050,7 @@ describe('WebDriver', function () { count++ return true } - return driver.wait(condition, 1).then(() => assert.equal(1, count)) + return driver.wait(condition, 1).then(() => assert.strictEqual(1, count)) }) it('on a simple counting condition', function () { @@ -1051,7 +1060,9 @@ describe('WebDriver', function () { function condition() { return ++count === 3 } - return driver.wait(condition, 250).then(() => assert.strictEqual(3, count)) + return driver + .wait(condition, 250) + .then(() => assert.strictEqual(3, count)) }) it('on a condition that returns a promise that resolves to true after a short timeout', function () { @@ -1320,7 +1331,7 @@ describe('WebDriver', function () { .then((els) => els.length > 0) }, 25) .then(fail, function (e) { - assert.equal( + assert.strictEqual( 'Wait timed out after ', e.message.substring(0, 'Wait timed out after '.length) ) @@ -1867,7 +1878,7 @@ describe('WebDriver', function () { .end() let driver = executor.createDriver() return driver.getCurrentUrl().then(function (got) { - assert.deepEqual(got, want) + assert.deepStrictEqual(got, want) }) } @@ -1876,7 +1887,7 @@ describe('WebDriver', function () { runDeserializeTest(1, 1), runDeserializeTest('', ''), runDeserializeTest(true, true), - runDeserializeTest(undefined, undefined), + runDeserializeTest(undefined, null), runDeserializeTest(null, null), ]) }) diff --git a/javascript/node/selenium-webdriver/test/logging_test.js b/javascript/node/selenium-webdriver/test/logging_test.js index 8d7632c5e6d8e..7ca116099fa6b 100644 --- a/javascript/node/selenium-webdriver/test/logging_test.js +++ b/javascript/node/selenium-webdriver/test/logging_test.js @@ -59,7 +59,7 @@ test.suite(function (env) { .manage() .logs() .get(logging.Type.BROWSER) - .then((entries) => assert.equal(entries.length, 0)) + .then((entries) => assert.strictEqual(entries.length, 0)) }) // Firefox does not capture JS error console log messages. @@ -85,8 +85,8 @@ test.suite(function (env) { .logs() .get(logging.Type.BROWSER) .then(function (entries) { - assert.equal(entries.length, 1) - assert.equal(entries[0].level.name, 'SEVERE') + assert.strictEqual(entries.length, 1) + assert.strictEqual(entries[0].level.name, 'SEVERE') // eslint-disable-next-line no-useless-escape assert.ok(/.*\"?and this is an error\"?/.test(entries[0].message)) }) @@ -115,16 +115,16 @@ test.suite(function (env) { .logs() .get(logging.Type.BROWSER) .then(function (entries) { - assert.equal(entries.length, 3) - assert.equal(entries[0].level.name, 'DEBUG') + assert.strictEqual(entries.length, 3) + assert.strictEqual(entries[0].level.name, 'DEBUG') // eslint-disable-next-line no-useless-escape assert.ok(/.*\"?hello\"?/.test(entries[0].message)) - assert.equal(entries[1].level.name, 'WARNING') + assert.strictEqual(entries[1].level.name, 'WARNING') // eslint-disable-next-line no-useless-escape assert.ok(/.*\"?this is a warning\"?/.test(entries[1].message)) - assert.equal(entries[2].level.name, 'SEVERE') + assert.strictEqual(entries[2].level.name, 'SEVERE') // eslint-disable-next-line no-useless-escape assert.ok(/.*\"?and this is an error\"?/.test(entries[2].message)) }) @@ -152,12 +152,12 @@ test.suite(function (env) { .manage() .logs() .get(logging.Type.BROWSER) - .then((entries) => assert.equal(entries.length, 3)) + .then((entries) => assert.strictEqual(entries.length, 3)) return driver .manage() .logs() .get(logging.Type.BROWSER) - .then((entries) => assert.equal(entries.length, 0)) + .then((entries) => assert.strictEqual(entries.length, 0)) }) it('does not mix log types', async function () { @@ -180,7 +180,7 @@ test.suite(function (env) { .manage() .logs() .get(logging.Type.DRIVER) - .then((entries) => assert.equal(entries.length, 0)) + .then((entries) => assert.strictEqual(entries.length, 0)) }) }) diff --git a/javascript/node/selenium-webdriver/test/net/index_test.js b/javascript/node/selenium-webdriver/test/net/index_test.js index ca9db2c097f25..c0c2037777ba9 100644 --- a/javascript/node/selenium-webdriver/test/net/index_test.js +++ b/javascript/node/selenium-webdriver/test/net/index_test.js @@ -22,42 +22,45 @@ var net = require('../../net') describe('net.splitHostAndPort', function () { it('hostname with no port', function () { - assert.deepEqual(net.splitHostAndPort('www.example.com'), { + assert.deepStrictEqual(net.splitHostAndPort('www.example.com'), { host: 'www.example.com', port: null, }) }) it('hostname with port', function () { - assert.deepEqual(net.splitHostAndPort('www.example.com:80'), { + assert.deepStrictEqual(net.splitHostAndPort('www.example.com:80'), { host: 'www.example.com', port: 80, }) }) it('IPv4 with no port', function () { - assert.deepEqual(net.splitHostAndPort('127.0.0.1'), { + assert.deepStrictEqual(net.splitHostAndPort('127.0.0.1'), { host: '127.0.0.1', port: null, }) }) it('IPv4 with port', function () { - assert.deepEqual(net.splitHostAndPort('127.0.0.1:1234'), { + assert.deepStrictEqual(net.splitHostAndPort('127.0.0.1:1234'), { host: '127.0.0.1', port: 1234, }) }) it('IPv6 with no port', function () { - assert.deepEqual(net.splitHostAndPort('1234:0:1000:5768:1234:5678:90'), { - host: '1234:0:1000:5768:1234:5678:90', - port: null, - }) + assert.deepStrictEqual( + net.splitHostAndPort('1234:0:1000:5768:1234:5678:90'), + { + host: '1234:0:1000:5768:1234:5678:90', + port: null, + } + ) }) it('IPv6 with port', function () { - assert.deepEqual( + assert.deepStrictEqual( net.splitHostAndPort('[1234:0:1000:5768:1234:5678:90]:1234'), { host: '1234:0:1000:5768:1234:5678:90', port: 1234 } ) diff --git a/javascript/node/selenium-webdriver/test/page_loading_test.js b/javascript/node/selenium-webdriver/test/page_loading_test.js index 7b80cbbb5363f..d8c1b3bed1cbf 100644 --- a/javascript/node/selenium-webdriver/test/page_loading_test.js +++ b/javascript/node/selenium-webdriver/test/page_loading_test.js @@ -43,12 +43,12 @@ test.suite(function (env) { it('should wait for document to be loaded', async function () { await driver.get(Pages.simpleTestPage) - assert.equal(await driver.getTitle(), 'Hello WebDriver') + assert.strictEqual(await driver.getTitle(), 'Hello WebDriver') }) it('should follow redirects sent in the http response headers', async function () { await driver.get(Pages.redirectPage) - assert.equal(await driver.getTitle(), 'We Arrive Here') + assert.strictEqual(await driver.getTitle(), 'We Arrive Here') }) it('should be able to get a fragment on the current page', async function () { @@ -62,13 +62,13 @@ test.suite(function (env) { await driver.switchTo().frame(0) let txt = await driver.findElement(By.css('span#pageNumber')).getText() - assert.equal(txt.trim(), '1') + assert.strictEqual(txt.trim(), '1') await driver.switchTo().defaultContent() await driver.switchTo().frame(1) txt = await driver.findElement(By.css('span#pageNumber')).getText() - assert.equal(txt.trim(), '2') + assert.strictEqual(txt.trim(), '2') // For safari, need to make sure browser is focused on the main frame or // subsequent tests will fail. @@ -115,15 +115,15 @@ test.suite(function (env) { await driver.navigate().refresh() - assert.equal(await driver.getTitle(), 'XHTML Test Page') + assert.strictEqual(await driver.getTitle(), 'XHTML Test Page') }) it('should return title of page if set', async function () { await driver.get(Pages.xhtmlTestPage) - assert.equal(await driver.getTitle(), 'XHTML Test Page') + assert.strictEqual(await driver.getTitle(), 'XHTML Test Page') await driver.get(Pages.simpleTestPage) - assert.equal(await driver.getTitle(), 'Hello WebDriver') + assert.strictEqual(await driver.getTitle(), 'Hello WebDriver') }) describe('timeouts', function () { diff --git a/javascript/node/selenium-webdriver/test/print_pdf_test.js b/javascript/node/selenium-webdriver/test/print_pdf_test.js index 2a9018ad67816..46197332704a5 100644 --- a/javascript/node/selenium-webdriver/test/print_pdf_test.js +++ b/javascript/node/selenium-webdriver/test/print_pdf_test.js @@ -41,7 +41,7 @@ test.suite( await driver.get(Pages.printPage) base64Code = await driver.printPage({ pageRanges: ['1-2'] }) base64Code = base64Code.slice(startIndex, endIndex) - assert.equal(base64Code, pdfMagicNumber) + assert.strictEqual(base64Code, pdfMagicNumber) }) it('Should Print pdf with total pages', async function () { @@ -49,7 +49,7 @@ test.suite( await driver.get(Pages.printPage) base64Code = await driver.printPage() base64Code = base64Code.slice(startIndex, endIndex) - assert.equal(base64Code, pdfMagicNumber) + assert.strictEqual(base64Code, pdfMagicNumber) }) it('Check with all valid params', async function () { @@ -69,7 +69,7 @@ test.suite( pageRanges: ['1-2'], }) base64Code = base64Code.slice(startIndex, endIndex) - assert.equal(base64Code, pdfMagicNumber) + assert.strictEqual(base64Code, pdfMagicNumber) }) it('Check with page params', async function () { @@ -77,7 +77,7 @@ test.suite( await driver.get(Pages.printPage) base64Code = await driver.printPage({ width: 30, height: 30 }) base64Code = base64Code.slice(startIndex, endIndex) - assert.equal(base64Code, pdfMagicNumber) + assert.strictEqual(base64Code, pdfMagicNumber) }) it('Check with margin params', async function () { @@ -90,7 +90,7 @@ test.suite( right: 1, }) base64Code = base64Code.slice(startIndex, endIndex) - assert.equal(base64Code, pdfMagicNumber) + assert.strictEqual(base64Code, pdfMagicNumber) }) }, { browsers: [Browser.FIREFOX] } @@ -114,7 +114,7 @@ test.suite( await driver.get(Pages.printPage) base64Code = await driver.printPage({ pageRanges: ['1-2'] }) base64Code = base64Code.slice(startIndex, endIndex) - assert.equal(base64Code, pdfMagicNumber) + assert.strictEqual(base64Code, pdfMagicNumber) }) it('Should Print pdf with total pages', async function () { @@ -122,7 +122,7 @@ test.suite( await driver.get(Pages.printPage) base64Code = await driver.printPage() base64Code = base64Code.slice(startIndex, endIndex) - assert.equal(base64Code, pdfMagicNumber) + assert.strictEqual(base64Code, pdfMagicNumber) }) }, { browsers: [Browser.CHROME] } diff --git a/javascript/node/selenium-webdriver/test/proxy_test.js b/javascript/node/selenium-webdriver/test/proxy_test.js index e6845477cf849..de78e920925ef 100644 --- a/javascript/node/selenium-webdriver/test/proxy_test.js +++ b/javascript/node/selenium-webdriver/test/proxy_test.js @@ -136,8 +136,8 @@ test.suite(function (env) { ) await driver.get(helloServer.url()) - assert.equal(await driver.getTitle(), 'Proxy page') - assert.equal( + assert.strictEqual(await driver.getTitle(), 'Proxy page') + assert.strictEqual( await driver.findElement({ tagName: 'h3' }).getText(), 'This is the proxy landing page' ) @@ -152,8 +152,8 @@ test.suite(function (env) { ) await driver.get(helloServer.url()) - assert.equal(await driver.getTitle(), 'Hello') - assert.equal( + assert.strictEqual(await driver.getTitle(), 'Hello') + assert.strictEqual( await driver.findElement({ tagName: 'h3' }).getText(), 'Hello, world!' ) @@ -161,8 +161,8 @@ test.suite(function (env) { // For firefox the no proxy settings appear to match on hostname only. let url = goodbyeServer.url().replace(/127\.0\.0\.1/, 'localhost') await driver.get(url) - assert.equal(await driver.getTitle(), 'Proxy page') - assert.equal( + assert.strictEqual(await driver.getTitle(), 'Proxy page') + assert.strictEqual( await driver.findElement({ tagName: 'h3' }).getText(), 'This is the proxy landing page' ) @@ -182,15 +182,15 @@ test.suite(function (env) { await createDriver(proxy.pac(proxyServer.url('/proxy.pac'))) await driver.get(helloServer.url()) - assert.equal(await driver.getTitle(), 'Proxy page') - assert.equal( + assert.strictEqual(await driver.getTitle(), 'Proxy page') + assert.strictEqual( await driver.findElement({ tagName: 'h3' }).getText(), 'This is the proxy landing page' ) await driver.get(goodbyeServer.url()) - assert.equal(await driver.getTitle(), 'Goodbye') - assert.equal( + assert.strictEqual(await driver.getTitle(), 'Goodbye') + assert.strictEqual( await driver.findElement({ tagName: 'h3' }).getText(), 'Goodbye, world!' ) diff --git a/javascript/node/selenium-webdriver/test/rect_test.js b/javascript/node/selenium-webdriver/test/rect_test.js index 7be764d0a535f..2030020e7b6b4 100644 --- a/javascript/node/selenium-webdriver/test/rect_test.js +++ b/javascript/node/selenium-webdriver/test/rect_test.js @@ -46,7 +46,7 @@ test.suite(function (env) { ) const el = await driver.findElement(By.css('div')) const rect = await el.getRect() - assert.deepEqual(rect, { width: 35, height: 25, x: 40, y: 50 }) + assert.deepStrictEqual(rect, { width: 35, height: 25, x: 40, y: 50 }) }) }) }) diff --git a/javascript/node/selenium-webdriver/test/remote_test.js b/javascript/node/selenium-webdriver/test/remote_test.js index 86a50ba10c7ff..0cb6fab0096a7 100644 --- a/javascript/node/selenium-webdriver/test/remote_test.js +++ b/javascript/node/selenium-webdriver/test/remote_test.js @@ -45,7 +45,7 @@ describe('DriverService', function () { function verifyFailure(e) { assert.ok(!(e instanceof CancellationError)) - assert.equal('Server terminated early with status 1', e.message) + assert.strictEqual('Server terminated early with status 1', e.message) } function expectFailure() { @@ -66,7 +66,7 @@ describe('FileDetector', function () { let theFile = path.join(dir, 'not-there') return new remote.FileDetector() .handleFile(new ExplodingDriver(), theFile) - .then((f) => assert.equal(f, theFile)) + .then((f) => assert.strictEqual(f, theFile)) }) }) @@ -74,7 +74,7 @@ describe('FileDetector', function () { return io.tmpDir().then((dir) => { return new remote.FileDetector() .handleFile(new ExplodingDriver(), dir) - .then((f) => assert.equal(f, dir)) + .then((f) => assert.strictEqual(f, dir)) }) }) @@ -84,14 +84,17 @@ describe('FileDetector', function () { .handleFile( new (class FakeDriver { execute(command) { - assert.equal(command.getName(), cmd.Name.UPLOAD_FILE) - assert.equal(typeof command.getParameters()['file'], 'string') + assert.strictEqual(command.getName(), cmd.Name.UPLOAD_FILE) + assert.strictEqual( + typeof command.getParameters()['file'], + 'string' + ) return Promise.resolve('success!') } })(), theFile ) - .then((f) => assert.equal(f, 'success!')) + .then((f) => assert.strictEqual(f, 'success!')) }) }) }) diff --git a/javascript/node/selenium-webdriver/test/stale_element_test.js b/javascript/node/selenium-webdriver/test/stale_element_test.js index 1809bd81405c6..b738de205f78a 100644 --- a/javascript/node/selenium-webdriver/test/stale_element_test.js +++ b/javascript/node/selenium-webdriver/test/stale_element_test.js @@ -41,7 +41,7 @@ test.suite(function (env) { await driver.get(Pages.javascriptPage) var toBeDeleted = await driver.findElement(By.id('deleted')) - assert.equal(await toBeDeleted.getTagName(), 'p') + assert.strictEqual(await toBeDeleted.getTagName(), 'p') await driver.findElement(By.id('delete')).click() await driver.wait(until.stalenessOf(toBeDeleted), 5000) diff --git a/javascript/node/selenium-webdriver/test/upload_test.js b/javascript/node/selenium-webdriver/test/upload_test.js index 5326098d23e00..f2c4749af9fd8 100644 --- a/javascript/node/selenium-webdriver/test/upload_test.js +++ b/javascript/node/selenium-webdriver/test/upload_test.js @@ -74,7 +74,7 @@ test.suite(function (env) { var frame = await driver.findElement(By.id('upload_target')) await driver.switchTo().frame(frame) - assert.equal( + assert.strictEqual( await driver.findElement(By.css('body')).getText(), LOREM_IPSUM_TEXT ) diff --git a/javascript/node/selenium-webdriver/test/window_test.js b/javascript/node/selenium-webdriver/test/window_test.js index b61780f0665d3..e434d9132cb85 100644 --- a/javascript/node/selenium-webdriver/test/window_test.js +++ b/javascript/node/selenium-webdriver/test/window_test.js @@ -65,12 +65,12 @@ test.suite(function (env) { await driver.findElement(By.linkText('Open new window')).click() await driver.wait(forNewWindowToBeOpened(originalHandles), 2000) - assert.equal(await driver.getTitle(), 'XHTML Test Page') + assert.strictEqual(await driver.getTitle(), 'XHTML Test Page') let newHandle = await getNewWindowHandle(originalHandles) await driver.switchTo().window(newHandle) - assert.equal(await driver.getTitle(), 'We Arrive Here') + assert.strictEqual(await driver.getTitle(), 'We Arrive Here') }) it('can set the window position of the current window', async function () { @@ -120,7 +120,7 @@ test.suite(function (env) { } } - assert.equal( + assert.strictEqual( (await driver.getAllWindowHandles()).length, originalHandles.length + 1 )