diff --git a/javascript/node/selenium-webdriver/chrome.js b/javascript/node/selenium-webdriver/chrome.js index ef23b7ba28974..872e79360916d 100644 --- a/javascript/node/selenium-webdriver/chrome.js +++ b/javascript/node/selenium-webdriver/chrome.js @@ -236,10 +236,9 @@ class Driver extends chromium.Driver { */ static createSession(opt_config, opt_serviceExecutor) { let caps = opt_config || new Options() - return /** @type {!Driver} */ (super.createSession( - caps, - opt_serviceExecutor - )) + return /** @type {!Driver} */ ( + super.createSession(caps, opt_serviceExecutor) + ) } } diff --git a/javascript/node/selenium-webdriver/chromium.js b/javascript/node/selenium-webdriver/chromium.js index 89bf3dce25a09..1df6ddf0aaae4 100644 --- a/javascript/node/selenium-webdriver/chromium.js +++ b/javascript/node/selenium-webdriver/chromium.js @@ -557,14 +557,13 @@ class Options extends Capabilities { * @return {!Options} A self reference. */ windowTypes(...args) { - let windowTypes = (this.options_.windowTypes || []).concat(...args); + let windowTypes = (this.options_.windowTypes || []).concat(...args) if (windowTypes.length) { - this.options_.windowTypes = windowTypes; + this.options_.windowTypes = windowTypes } - return this; + return this } - /** * Converts this instance to its JSON wire protocol representation. Note this * function is an implementation not intended for general use. @@ -581,7 +580,7 @@ class Options extends Capabilities { return extension.toString('base64') } return io - .read(/** @type {string} */(extension)) + .read(/** @type {string} */ (extension)) .then((buffer) => buffer.toString('base64')) }) } @@ -634,7 +633,7 @@ class Driver extends webdriver.WebDriver { * implementation. * @override */ - setFileDetector() { } + setFileDetector() {} /** * Schedules a command to launch Chrome App with given ID. diff --git a/javascript/node/selenium-webdriver/edge.js b/javascript/node/selenium-webdriver/edge.js index 75b36c3032f6a..5064c3c5c1a12 100644 --- a/javascript/node/selenium-webdriver/edge.js +++ b/javascript/node/selenium-webdriver/edge.js @@ -109,10 +109,10 @@ class ServiceBuilder extends chromium.ServiceBuilder { let exe = opt_exe || locateSynchronously() if (!exe) { throw Error( - `The WebDriver for Edge could not be found on the current PATH. Please download the `+ - `latest version of ${EDGEDRIVER_CHROMIUM_EXE} from `+ - `https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/ `+ - `and ensure it can be found on your PATH.` + `The WebDriver for Edge could not be found on the current PATH. Please download the ` + + `latest version of ${EDGEDRIVER_CHROMIUM_EXE} from ` + + `https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/ ` + + `and ensure it can be found on your PATH.` ) } super(exe) @@ -152,10 +152,9 @@ class Driver extends chromium.Driver { */ static createSession(opt_config, opt_serviceExecutor) { let caps = opt_config || new Options() - return /** @type {!Driver} */ (super.createSession( - caps, - opt_serviceExecutor - )) + return /** @type {!Driver} */ ( + super.createSession(caps, opt_serviceExecutor) + ) } /** @@ -175,7 +174,7 @@ function setDefaultService(service) { if (defaultService && defaultService.isRunning()) { throw Error( 'The previously configured EdgeDriver service is still running. ' + - 'You must shut it down before you may adjust its configuration.' + 'You must shut it down before you may adjust its configuration.' ) } defaultService = service @@ -194,7 +193,6 @@ function getDefaultService() { return defaultService } - /** * _Synchronously_ attempts to locate the chromedriver executable on the current * system. diff --git a/javascript/node/selenium-webdriver/firefox.js b/javascript/node/selenium-webdriver/firefox.js index b6c6f58e4d20d..086ff080589e4 100644 --- a/javascript/node/selenium-webdriver/firefox.js +++ b/javascript/node/selenium-webdriver/firefox.js @@ -222,7 +222,7 @@ async function buildProfile(template, extensions) { dir = await io.tmpDir() if (template) { await io.copyDir( - /** @type {string} */(template), + /** @type {string} */ (template), dir, /(parent\.lock|lock|\.parentlock)/ ) @@ -432,11 +432,11 @@ function findGeckoDriver() { if (!exe) { throw Error( 'The ' + - GECKO_DRIVER_EXE + - ' executable could not be found on the current ' + - 'PATH. Please download the latest version from ' + - 'https://github.com/mozilla/geckodriver/releases/ ' + - 'and ensure it can be found on your PATH.' + GECKO_DRIVER_EXE + + ' executable could not be found on the current ' + + 'PATH. Please download the latest version from ' + + 'https://github.com/mozilla/geckodriver/releases/ ' + + 'and ensure it can be found on your PATH.' ) } return exe @@ -457,8 +457,8 @@ function findInProgramFiles(file) { return exists ? files[0] : io.exists(files[1]).then(function (exists) { - return exists ? files[1] : null - }) + return exists ? files[1] : null + }) }) } @@ -592,7 +592,7 @@ class Driver extends webdriver.WebDriver { * implementation. * @override */ - setFileDetector() { } + setFileDetector() {} /** * Get the context that is currently in effect. diff --git a/javascript/node/selenium-webdriver/ie.js b/javascript/node/selenium-webdriver/ie.js index 398afc774d4bd..35df113a41994 100644 --- a/javascript/node/selenium-webdriver/ie.js +++ b/javascript/node/selenium-webdriver/ie.js @@ -478,9 +478,9 @@ class Driver extends webdriver.WebDriver { let client = service.start().then((url) => new http.HttpClient(url)) let executor = new http.Executor(client) - return /** @type {!Driver} */ (super.createSession(executor, options, () => - service.kill() - )) + return /** @type {!Driver} */ ( + super.createSession(executor, options, () => service.kill()) + ) } /** diff --git a/javascript/node/selenium-webdriver/io/exec.js b/javascript/node/selenium-webdriver/io/exec.js index 0803ff97884f1..d8b42dbab9143 100644 --- a/javascript/node/selenium-webdriver/io/exec.js +++ b/javascript/node/selenium-webdriver/io/exec.js @@ -76,7 +76,8 @@ class Result { } } -const COMMAND_RESULT = /** !WeakMap> */ new WeakMap() +const COMMAND_RESULT = + /** !WeakMap> */ new WeakMap() const KILL_HOOK = /** !WeakMap */ new WeakMap() /** diff --git a/javascript/node/selenium-webdriver/lib/capabilities.js b/javascript/node/selenium-webdriver/lib/capabilities.js index fb2cc43b060bb..e704559963316 100644 --- a/javascript/node/selenium-webdriver/lib/capabilities.js +++ b/javascript/node/selenium-webdriver/lib/capabilities.js @@ -83,7 +83,7 @@ const Platform = { * * @record */ -function Timeouts() { } +function Timeouts() {} /** * Defines when, in milliseconds, to interrupt a script that is being @@ -263,7 +263,9 @@ class Capabilities { * @return {!Capabilities} A basic set of capabilities for Firefox. */ static firefox() { - return new Capabilities().setBrowserName(Browser.FIREFOX).set("moz:debuggerAddress", true) + return new Capabilities() + .setBrowserName(Browser.FIREFOX) + .set('moz:debuggerAddress', true) } /** diff --git a/javascript/node/selenium-webdriver/lib/http.js b/javascript/node/selenium-webdriver/lib/http.js index c9aa021628000..1c41278848450 100644 --- a/javascript/node/selenium-webdriver/lib/http.js +++ b/javascript/node/selenium-webdriver/lib/http.js @@ -490,7 +490,8 @@ function buildRequest(customCommands, w3c, command) { } } -const CLIENTS = /** !WeakMap)> */ new WeakMap() +const CLIENTS = + /** !WeakMap)> */ new WeakMap() /** * A command executor that communicates with the server using JSON over HTTP. diff --git a/javascript/node/selenium-webdriver/lib/input.js b/javascript/node/selenium-webdriver/lib/input.js index db82e842c85d0..7b169a3a15335 100644 --- a/javascript/node/selenium-webdriver/lib/input.js +++ b/javascript/node/selenium-webdriver/lib/input.js @@ -21,9 +21,7 @@ * @fileoverview Defines types related to user input with the WebDriver API. */ const { Command, Name } = require('./command') -const { - InvalidArgumentError -} = require('./error') +const { InvalidArgumentError } = require('./error') /** * Enumeration of the buttons used in the advanced interactions API. @@ -499,7 +497,6 @@ class Actions { * sequence (see class description for details). */ constructor(executor, { async = false } = {}) { - /** @private @const */ this.executor_ = executor @@ -878,13 +875,9 @@ class Actions { return Promise.resolve() } - try { - await this.executor_.execute( - new Command(Name.ACTIONS).setParameter('actions', _actions) - ) - } catch (ex) { - throw ex - } + await this.executor_.execute( + new Command(Name.ACTIONS).setParameter('actions', _actions) + ) } } diff --git a/javascript/node/selenium-webdriver/lib/until.js b/javascript/node/selenium-webdriver/lib/until.js index 927134d2b3ac7..23c27f3abc5c2 100644 --- a/javascript/node/selenium-webdriver/lib/until.js +++ b/javascript/node/selenium-webdriver/lib/until.js @@ -137,14 +137,13 @@ exports.alertIsPresent = function alertIsPresent() { * @return {!Condition} The new condition. */ exports.titleIs = function titleIs(title) { - return new Condition( - 'for title to be ' + JSON.stringify(title), - function (driver) { - return driver.getTitle().then(function (t) { - return t === title - }) - } - ) + return new Condition('for title to be ' + JSON.stringify(title), function ( + driver + ) { + return driver.getTitle().then(function (t) { + return t === title + }) + }) } /** @@ -189,14 +188,13 @@ exports.titleMatches = function titleMatches(regex) { * @return {!Condition} The new condition. */ exports.urlIs = function urlIs(url) { - return new Condition( - 'for URL to be ' + JSON.stringify(url), - function (driver) { - return driver.getCurrentUrl().then(function (u) { - return u === url - }) - } - ) + return new Condition('for URL to be ' + JSON.stringify(url), function ( + driver + ) { + return driver.getCurrentUrl().then(function (u) { + return u === url + }) + }) } /** diff --git a/javascript/node/selenium-webdriver/opera.js b/javascript/node/selenium-webdriver/opera.js index a06c7477cc911..51a7b65a98c5a 100644 --- a/javascript/node/selenium-webdriver/opera.js +++ b/javascript/node/selenium-webdriver/opera.js @@ -383,9 +383,9 @@ class Driver extends webdriver.WebDriver { caps = options.toCapabilities(caps) } - return /** @type {!Driver} */ (super.createSession(executor, caps, () => - service.kill() - )) + return /** @type {!Driver} */ ( + super.createSession(executor, caps, () => service.kill()) + ) } /** diff --git a/javascript/node/selenium-webdriver/safari.js b/javascript/node/selenium-webdriver/safari.js index 00749a5089fae..aba902499c6bb 100644 --- a/javascript/node/selenium-webdriver/safari.js +++ b/javascript/node/selenium-webdriver/safari.js @@ -154,9 +154,9 @@ class Driver extends webdriver.WebDriver { service.start().then((url) => new http.HttpClient(url)) ) - return /** @type {!Driver} */ (super.createSession(executor, caps, () => - service.kill() - )) + return /** @type {!Driver} */ ( + super.createSession(executor, caps, () => service.kill()) + ) } } diff --git a/javascript/node/selenium-webdriver/test/chrome/devtools_test.js b/javascript/node/selenium-webdriver/test/chrome/devtools_test.js index bee148b0f889a..afa6b05a46834 100644 --- a/javascript/node/selenium-webdriver/test/chrome/devtools_test.js +++ b/javascript/node/selenium-webdriver/test/chrome/devtools_test.js @@ -109,7 +109,7 @@ test.suite( await driver.onLogException(cdpConnection, function (event) { assert.strictEqual( event['exceptionDetails']['stackTrace']['callFrames'][0][ - 'functionName' + 'functionName' ], 'onmouseover' ) @@ -139,7 +139,6 @@ test.suite( }) describe('Basic Auth Injection', function () { - it('denies entry if username and password do not match', async function () { const pageCdpConnection = await driver.createCDPConnection('page') diff --git a/javascript/node/selenium-webdriver/test/chrome/options_test.js b/javascript/node/selenium-webdriver/test/chrome/options_test.js index a20886113751d..e80e7e4dabc36 100644 --- a/javascript/node/selenium-webdriver/test/chrome/options_test.js +++ b/javascript/node/selenium-webdriver/test/chrome/options_test.js @@ -73,7 +73,14 @@ describe('chrome.Options', function () { assert.strictEqual(options.options_.extensions, undefined) options.addExtensions(['a', 'b'], 'c', [1, 2], 3) - assert.deepStrictEqual(options.options_.extensions, ['a', 'b', 'c', 1, 2, 3]) + assert.deepStrictEqual(options.options_.extensions, [ + 'a', + 'b', + 'c', + 1, + 2, + 3, + ]) }) }) @@ -92,21 +99,28 @@ describe('chrome.Options', function () { }) }) - describe('windowTypes', function() { - it('takes var_args', function() { - let options = new chrome.Options(); - assert.strictEqual(options.options_.windowTypes, undefined); - - options.windowTypes('a', 'b'); - assert.deepStrictEqual(options.options_.windowTypes, ['a', 'b']); + describe('windowTypes', function () { + it('takes var_args', function () { + let options = new chrome.Options() + assert.strictEqual(options.options_.windowTypes, undefined) + + options.windowTypes('a', 'b') + assert.deepStrictEqual(options.options_.windowTypes, ['a', 'b']) }) - - it('flattens input arrays', function() { - let options = new chrome.Options(); - assert.strictEqual(options.options_.windowTypes, undefined); - - options.windowTypes(['a', 'b'], 'c', [1, 2], 3); - assert.deepStrictEqual(options.options_.windowTypes, ['a', 'b', 'c', 1, 2, 3]); + + it('flattens input arrays', function () { + let options = new chrome.Options() + assert.strictEqual(options.options_.windowTypes, undefined) + + options.windowTypes(['a', 'b'], 'c', [1, 2], 3) + assert.deepStrictEqual(options.options_.windowTypes, [ + 'a', + 'b', + 'c', + 1, + 2, + 3, + ]) }) }) }) diff --git a/javascript/node/selenium-webdriver/test/cookie_test.js b/javascript/node/selenium-webdriver/test/cookie_test.js index 7147c4b759592..d8c68792e6d81 100644 --- a/javascript/node/selenium-webdriver/test/cookie_test.js +++ b/javascript/node/selenium-webdriver/test/cookie_test.js @@ -192,29 +192,27 @@ suite(function (env) { } ) - ignore(env.browsers(Browser.FIREFOX, Browser.INTERNET_EXPLORER, Browser.SAFARI)).it( - 'can add same site cookie property to `Strict`', - async function () { - let cookie = createSameSiteCookieSpec('Strict') - let childUrl = fileserver.whereIs('child/childPage.html') - await driver.get(childUrl) - await driver.manage().addCookie(cookie) - const actual = await driver.manage().getCookie(cookie.name) - assert.strictEqual(actual.sameSite, 'Strict') - } - ) + ignore( + env.browsers(Browser.FIREFOX, Browser.INTERNET_EXPLORER, Browser.SAFARI) + ).it('can add same site cookie property to `Strict`', async function () { + let cookie = createSameSiteCookieSpec('Strict') + let childUrl = fileserver.whereIs('child/childPage.html') + await driver.get(childUrl) + await driver.manage().addCookie(cookie) + const actual = await driver.manage().getCookie(cookie.name) + assert.strictEqual(actual.sameSite, 'Strict') + }) - ignore(env.browsers(Browser.FIREFOX, Browser.INTERNET_EXPLORER, Browser.SAFARI)).it( - 'can add same site cookie property to `Lax`', - async function () { - let cookie = createSameSiteCookieSpec('Lax') - let childUrl = fileserver.whereIs('child/childPage.html') - await driver.get(childUrl) - await driver.manage().addCookie(cookie) - const actualCookie = await driver.manage().getCookie(cookie.name) - assert.strictEqual(actualCookie.sameSite, 'Lax') - } - ) + ignore( + env.browsers(Browser.FIREFOX, Browser.INTERNET_EXPLORER, Browser.SAFARI) + ).it('can add same site cookie property to `Lax`', async function () { + let cookie = createSameSiteCookieSpec('Lax') + let childUrl = fileserver.whereIs('child/childPage.html') + await driver.get(childUrl) + await driver.manage().addCookie(cookie) + const actualCookie = await driver.manage().getCookie(cookie.name) + assert.strictEqual(actualCookie.sameSite, 'Lax') + }) ignore(env.browsers(Browser.INTERNET_EXPLORER, Browser.SAFARI)).it( 'can add same site cookie property to `None` when cookie is Secure', diff --git a/javascript/node/selenium-webdriver/test/devtools_test.js b/javascript/node/selenium-webdriver/test/devtools_test.js index 606ea1b464257..16e59d55223a7 100644 --- a/javascript/node/selenium-webdriver/test/devtools_test.js +++ b/javascript/node/selenium-webdriver/test/devtools_test.js @@ -28,9 +28,7 @@ test.suite( let driver before(async function () { - driver = await env - .builder() - .build() + driver = await env.builder().build() }) after(() => driver.quit()) @@ -71,7 +69,7 @@ test.suite( await driver.onLogException(cdpConnection, function (event) { assert.strictEqual( event['exceptionDetails']['stackTrace']['callFrames'][0][ - 'functionName' + 'functionName' ], 'onmouseover' ) @@ -101,14 +99,16 @@ test.suite( }) describe('Basic Auth Injection', function () { - it('denies entry if username and password do not match', async function () { const pageCdpConnection = await driver.createCDPConnection('page') 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.ok( + !source.includes('Access granted!'), + `The Source is \n ${source}` + ) }) it('grants access if username and password are a match', async function () { diff --git a/javascript/node/selenium-webdriver/test/edge/options_test.js b/javascript/node/selenium-webdriver/test/edge/options_test.js index 685cc2c3a02ba..f3d4990ef708f 100644 --- a/javascript/node/selenium-webdriver/test/edge/options_test.js +++ b/javascript/node/selenium-webdriver/test/edge/options_test.js @@ -73,7 +73,14 @@ describe('edge.Options', function () { assert.strictEqual(options.options_.extensions, undefined) options.addExtensions(['a', 'b'], 'c', [1, 2], 3) - assert.deepStrictEqual(options.options_.extensions, ['a', 'b', 'c', 1, 2, 3]) + assert.deepStrictEqual(options.options_.extensions, [ + 'a', + 'b', + 'c', + 1, + 2, + 3, + ]) }) }) @@ -85,28 +92,32 @@ describe('edge.Options', function () { [symbols.serialize]() assert.strictEqual(wire['ms:edgeOptions'].extensions.length, 1) - assert.strictEqual( - await wire['ms:edgeOptions'].extensions[0], - expected - ) + assert.strictEqual(await wire['ms:edgeOptions'].extensions[0], expected) }) }) - describe('windowTypes', function() { - it('takes var_args', function() { - let options = new edge.Options(); - assert.strictEqual(options.options_.windowTypes, undefined); + describe('windowTypes', function () { + it('takes var_args', function () { + let options = new edge.Options() + assert.strictEqual(options.options_.windowTypes, undefined) - options.windowTypes('a', 'b'); - assert.deepStrictEqual(options.options_.windowTypes, ['a', 'b']); + options.windowTypes('a', 'b') + assert.deepStrictEqual(options.options_.windowTypes, ['a', 'b']) }) - it('flattens input arrays', function() { - let options = new edge.Options(); - assert.strictEqual(options.options_.windowTypes, undefined); - - options.windowTypes(['a', 'b'], 'c', [1, 2], 3); - assert.deepStrictEqual(options.options_.windowTypes, ['a', 'b', 'c', 1, 2, 3]); + it('flattens input arrays', function () { + let options = new edge.Options() + assert.strictEqual(options.options_.windowTypes, undefined) + + options.windowTypes(['a', 'b'], 'c', [1, 2], 3) + assert.deepStrictEqual(options.options_.windowTypes, [ + 'a', + 'b', + 'c', + 1, + 2, + 3, + ]) }) }) }) @@ -134,22 +145,20 @@ test.suite( }) it('can start edge with network conditions set', async function () { - driver = await env.builder().build() await driver.get(test.Pages.ajaxyPage) await driver.setNetworkConditions({ offline: true, latency: 0, download_throughput: 0, - upload_throughput: 0 - }); - assert.deepStrictEqual(await driver.getNetworkConditions(), - { - download_throughput: 0, - latency: 0, - offline: true, - upload_throughput: 0 - }) + upload_throughput: 0, + }) + assert.deepStrictEqual(await driver.getNetworkConditions(), { + download_throughput: 0, + latency: 0, + offline: true, + upload_throughput: 0, + }) }) }) }, diff --git a/javascript/node/selenium-webdriver/test/element_finding_test.js b/javascript/node/selenium-webdriver/test/element_finding_test.js index f416e83104075..52211210ecf5c 100644 --- a/javascript/node/selenium-webdriver/test/element_finding_test.js +++ b/javascript/node/selenium-webdriver/test/element_finding_test.js @@ -439,7 +439,11 @@ suite(function (env) { for (let i = 0; i < elements.length; i++) { ids.push(await elements[i].getAttribute('id')) } - assert.notDeepStrictEqual(ids.indexOf('third'), -1, `Elements are ${ids}`) + assert.notDeepStrictEqual( + ids.indexOf('third'), + -1, + `Elements are ${ids}` + ) }) }) @@ -448,7 +452,7 @@ suite(function (env) { await driver.get(Pages.relativeLocators) let below = await driver.findElement(By.id('below')) let element = await driver.findElement(withTagName('p').above(below)) - assert.deepStrictEqual(await element.getAttribute('id'), `mid`) + assert.deepStrictEqual(await element.getAttribute('id'), `mid`) }) it('should combine filters', async function () { diff --git a/javascript/node/selenium-webdriver/test/io/io_test.js b/javascript/node/selenium-webdriver/test/io/io_test.js index bfa0ae2c23dfa..b17aeaef7bf1b 100644 --- a/javascript/node/selenium-webdriver/test/io/io_test.js +++ b/javascript/node/selenium-webdriver/test/io/io_test.js @@ -115,7 +115,10 @@ describe('io', function () { }) .then(function (p) { assert.strictEqual('sub', path.basename(p)) - assert.strictEqual('hi', fs.readFileSync(path.join(p, 'foo'), 'utf-8')) + assert.strictEqual( + 'hi', + fs.readFileSync(path.join(p, 'foo'), 'utf-8') + ) }) }) @@ -135,9 +138,18 @@ describe('io', function () { }) }) .then(function (dir) { - 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.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'))) @@ -164,9 +176,18 @@ describe('io', function () { }) }) .then(function (dir) { - 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.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'))) diff --git a/javascript/node/selenium-webdriver/test/lib/promise_test.js b/javascript/node/selenium-webdriver/test/lib/promise_test.js index 30dd9e18d3a63..73e1d8dd15ff7 100644 --- a/javascript/node/selenium-webdriver/test/lib/promise_test.js +++ b/javascript/node/selenium-webdriver/test/lib/promise_test.js @@ -60,22 +60,22 @@ describe('promise', function () { }) it('isPromise', () => { - const v = () => {}; - const x = new Promise(v, v); - const p = createRejectedPromise('reject'); - const q = Promise.resolve("resolved"); - assert.equal(true, promise.isPromise(x)); - assert.equal(true, promise.isPromise(p)); - assert.equal(true, promise.isPromise(q)); - assert.equal(false, promise.isPromise(0)); - assert.equal(false, promise.isPromise(false)); - assert.equal(false, promise.isPromise(true)); - assert.equal(false, promise.isPromise(null)); - assert.equal(false, promise.isPromise(undefined)); - assert.equal(false, promise.isPromise('')); - assert.equal(false, promise.isPromise('promise')); - assert.equal(false, promise.isPromise(v)); - }); + const v = () => {} + const x = new Promise(v, v) + const p = createRejectedPromise('reject') + const q = Promise.resolve('resolved') + assert.equal(true, promise.isPromise(x)) + assert.equal(true, promise.isPromise(p)) + assert.equal(true, promise.isPromise(q)) + assert.equal(false, promise.isPromise(0)) + assert.equal(false, promise.isPromise(false)) + assert.equal(false, promise.isPromise(true)) + assert.equal(false, promise.isPromise(null)) + assert.equal(false, promise.isPromise(undefined)) + assert.equal(false, promise.isPromise('')) + assert.equal(false, promise.isPromise('promise')) + assert.equal(false, promise.isPromise(v)) + }) function defer() { let d = {} diff --git a/javascript/node/selenium-webdriver/test/lib/webdriver_test.js b/javascript/node/selenium-webdriver/test/lib/webdriver_test.js index dbca7498986f6..81c095b1ea17a 100644 --- a/javascript/node/selenium-webdriver/test/lib/webdriver_test.js +++ b/javascript/node/selenium-webdriver/test/lib/webdriver_test.js @@ -209,12 +209,12 @@ describe('WebDriver', function () { .withParameters({ desiredCapabilities: { 'moz:debuggerAddress': true, - browserName: 'firefox' + browserName: 'firefox', }, capabilities: { alwaysMatch: { 'moz:debuggerAddress': true, - browserName: 'firefox' + browserName: 'firefox', }, }, }) @@ -333,7 +333,7 @@ describe('WebDriver', function () { let verifyError = expectedError( error.NoSuchSessionError, 'This driver instance does not have a valid session ID ' + - '(did you call WebDriver.quit()?) and may no longer be used.' + '(did you call WebDriver.quit()?) and may no longer be used.' ) let driver = executor.createDriver() @@ -521,14 +521,14 @@ describe('WebDriver', function () { let executor = new FakeExecutor() .expect(CName.EXECUTE_SCRIPT) .withParameters({ - script: 'return (' + function () { } + ').apply(null, arguments);', + script: 'return (' + function () {} + ').apply(null, arguments);', args: [], }) .andReturnSuccess(null) .end() var driver = executor.createDriver() - return driver.executeScript(function () { }) + return driver.executeScript(function () {}) }) it('simpleArgumentConversion', function () { @@ -628,11 +628,11 @@ describe('WebDriver', function () { let executor = new FakeExecutor() var arg = Promise.reject(new StubError()) - arg.catch(function () { }) // Suppress default handler. + arg.catch(function () {}) // Suppress default handler. var driver = executor.createDriver() return driver - .executeScript(function () { }, arg) + .executeScript(function () {}, arg) .then(fail, assertIsStubError) }) }) @@ -640,11 +640,11 @@ describe('WebDriver', function () { describe('executeAsyncScript', function () { it('failsIfArgumentIsARejectedPromise', function () { var arg = Promise.reject(new StubError()) - arg.catch(function () { }) // Suppress default handler. + arg.catch(function () {}) // Suppress default handler. var driver = new FakeExecutor().createDriver() return driver - .executeAsyncScript(function () { }, arg) + .executeAsyncScript(function () {}, arg) .then(fail, assertIsStubError) }) }) @@ -1908,7 +1908,7 @@ describe('WebDriver', function () { }) it('passes through function properties', function () { - function bar() { } + function bar() {} return runDeserializeTest( [{ foo: { bar: 123 }, func: bar }], [{ foo: { bar: 123 }, func: bar }] diff --git a/javascript/node/selenium-webdriver/test/logging_test.js b/javascript/node/selenium-webdriver/test/logging_test.js index 7ca116099fa6b..0f9200e52ff11 100644 --- a/javascript/node/selenium-webdriver/test/logging_test.js +++ b/javascript/node/selenium-webdriver/test/logging_test.js @@ -26,7 +26,9 @@ test.suite(function (env) { // Logging API not supported in Marionette. // Logging API not supported in Safari. test - .ignore(env.browsers(Browser.INTERNET_EXPLORER, Browser.SAFARI, Browser.FIREFOX)) + .ignore( + env.browsers(Browser.INTERNET_EXPLORER, Browser.SAFARI, Browser.FIREFOX) + ) .describe('logging', function () { var driver diff --git a/javascript/node/selenium-webdriver/test/proxy_test.js b/javascript/node/selenium-webdriver/test/proxy_test.js index de78e920925ef..4fd9c8e33a37c 100644 --- a/javascript/node/selenium-webdriver/test/proxy_test.js +++ b/javascript/node/selenium-webdriver/test/proxy_test.js @@ -124,7 +124,12 @@ test.suite(function (env) { // Proxy support not implemented. test .ignore( - env.browsers(Browser.CHROME, Browser.INTERNET_EXPLORER, Browser.SAFARI, Browser.FIREFOX) + env.browsers( + Browser.CHROME, + Browser.INTERNET_EXPLORER, + Browser.SAFARI, + Browser.FIREFOX + ) ) .describe('manual proxy settings', function () { it('can configure HTTP proxy host', async function () { @@ -175,7 +180,12 @@ test.suite(function (env) { // Safari does not support proxies. test .ignore( - env.browsers(Browser.INTERNET_EXPLORER, Browser.SAFARI, Browser.CHROME, Browser.FIREFOX) + env.browsers( + Browser.INTERNET_EXPLORER, + Browser.SAFARI, + Browser.CHROME, + Browser.FIREFOX + ) ) .describe('pac proxy settings', function () { it('can configure proxy through PAC file', async function () { diff --git a/javascript/node/selenium-webdriver/test/stale_element_test.js b/javascript/node/selenium-webdriver/test/stale_element_test.js index b738de205f78a..64a1adbc22b89 100644 --- a/javascript/node/selenium-webdriver/test/stale_element_test.js +++ b/javascript/node/selenium-webdriver/test/stale_element_test.js @@ -36,7 +36,7 @@ test.suite(function (env) { .ignore(env.browsers(Browser.SAFARI)) .it( 'dynamically removing elements from the DOM trigger a ' + - 'StaleElementReferenceError', + 'StaleElementReferenceError', async function () { await driver.get(Pages.javascriptPage) @@ -57,8 +57,10 @@ test.suite(function (env) { var el = await driver.findElement(By.id('oneline')) await driver.switchTo().defaultContent() return el.getText().then(assert.fail, function (e) { - assert.ok(e instanceof error.StaleElementReferenceError, - `The error is ${JSON.stringify(e)}`) + assert.ok( + e instanceof error.StaleElementReferenceError, + `The error is ${JSON.stringify(e)}` + ) }) }) }) diff --git a/javascript/node/selenium-webdriver/testing/index.js b/javascript/node/selenium-webdriver/testing/index.js index 86f55201d94cf..bde8300570e6f 100644 --- a/javascript/node/selenium-webdriver/testing/index.js +++ b/javascript/node/selenium-webdriver/testing/index.js @@ -47,7 +47,7 @@ const { Builder } = require('../index') * Describes a browser targeted by a {@linkplain suite test suite}. * @record */ -function TargetBrowser() { } +function TargetBrowser() {} /** * The {@linkplain Browser name} of the targeted browser. @@ -210,7 +210,7 @@ function init(force = false) { if (seleniumJar && seleniumUrl) { throw Error( 'Ambiguous test configuration: both SELENIUM_REMOTE_URL' + - ' && SELENIUM_SERVER_JAR environment variables are set' + ' && SELENIUM_SERVER_JAR environment variables are set' ) } @@ -218,8 +218,8 @@ function init(force = false) { if ((seleniumJar || seleniumUrl) && envBrowsers.length === 0) { throw Error( 'Ambiguous test configuration: when either the SELENIUM_REMOTE_URL or' + - ' SELENIUM_SERVER_JAR environment variable is set, the' + - ' SELENIUM_BROWSER variable must also be set.' + ' SELENIUM_SERVER_JAR environment variable is set, the' + + ' SELENIUM_BROWSER variable must also be set.' ) } @@ -236,7 +236,8 @@ function init(force = false) { } const TARGET_MAP = /** !WeakMap */ new WeakMap() -const URL_MAP = /** !WeakMap */ new WeakMap() +const URL_MAP = + /** !WeakMap */ new WeakMap() /** * Defines the environment a {@linkplain suite test suite} is running against. @@ -249,9 +250,9 @@ class Environment { * Selenium server to test against. */ constructor(browser, url = undefined) { - browser = /** @type {!TargetBrowser} */ (Object.seal( - Object.assign({}, browser) - )) + browser = /** @type {!TargetBrowser} */ ( + Object.seal(Object.assign({}, browser)) + ) TARGET_MAP.set(this, browser) URL_MAP.set(this, url || null) @@ -288,7 +289,6 @@ class Environment { const realBuild = builder.build builder.build = function () { - builder.forBrowser(browser.name, browser.version, browser.platform) if (browser.capabilities) { @@ -311,7 +311,7 @@ class Environment { * Configuration options for a {@linkplain ./index.suite test suite}. * @record */ -function SuiteOptions() { } +function SuiteOptions() {} /** * The browsers to run the test suite against. @@ -486,8 +486,8 @@ function getTestHook(name) { if (type !== 'function') { throw TypeError( `Expected global.${name} to be a function, but is ${type}.` + - ' This can happen if you try using this module when running with' + - ' node directly instead of using jasmine or mocha' + ' This can happen if you try using this module when running with' + + ' node directly instead of using jasmine or mocha' ) } return fn diff --git a/javascript/node/selenium-webdriver/tools/init_jasmine.js b/javascript/node/selenium-webdriver/tools/init_jasmine.js index 79abcb826ae78..4e8381d8ec8d8 100644 --- a/javascript/node/selenium-webdriver/tools/init_jasmine.js +++ b/javascript/node/selenium-webdriver/tools/init_jasmine.js @@ -15,8 +15,7 @@ // specific language governing permissions and limitations // under the License. -// eslint-disable-next-line node/no-missing-require -require('@bazel/jasmine').boot() +require('@bazel/jasmine').boot() // eslint-disable-line node/no-extraneous-require global.after = global.afterAll global.before = global.beforeAll