From d142ce0cd5c40282b36515226fba4f16fb642cc3 Mon Sep 17 00:00:00 2001 From: Puja Jagani Date: Wed, 10 Apr 2024 15:56:40 +0530 Subject: [PATCH] [bidi][js] Enable tests for Edge and Chrome (#13790) --- .../selenium-webdriver/bidi/scriptManager.js | 5 ++- .../bidi/add_intercept_parameters_test.js | 5 ++- .../test/bidi/bidi_session_test.js | 5 ++- .../selenium-webdriver/test/bidi/bidi_test.js | 3 +- .../test/bidi/browser_test.js | 11 +++--- .../bidi/browsingcontext_inspector_test.js | 36 ++++++++++--------- .../test/bidi/browsingcontext_test.js | 11 +++--- .../test/bidi/input_test.js | 9 +++-- .../test/bidi/local_value_test.js | 5 ++- .../test/bidi/locate_nodes_test.js | 16 ++++----- .../test/bidi/log_inspector_test.js | 3 +- .../test/bidi/network_commands_test.js | 21 ++++++----- .../test/bidi/network_test.js | 15 ++++---- .../test/bidi/script_test.js | 13 ++++--- .../test/bidi/setFiles_command_test.js | 10 +++--- .../test/bidi/storage_test.js | 17 +++++---- .../node/selenium-webdriver/testing/index.js | 5 +++ 17 files changed, 94 insertions(+), 96 deletions(-) diff --git a/javascript/node/selenium-webdriver/bidi/scriptManager.js b/javascript/node/selenium-webdriver/bidi/scriptManager.js index 4f0a680d971bf..bc4db03ba5ada 100644 --- a/javascript/node/selenium-webdriver/bidi/scriptManager.js +++ b/javascript/node/selenium-webdriver/bidi/scriptManager.js @@ -237,7 +237,10 @@ class ScriptManager { const params = { functionDeclaration: functionDeclaration, arguments: argumentValueList, - sandbox: sandbox, + } + + if (sandbox !== null) { + params.sandbox = sandbox } if (Array.isArray(this._browsingContextIds) && this._browsingContextIds.length > 0) { diff --git a/javascript/node/selenium-webdriver/test/bidi/add_intercept_parameters_test.js b/javascript/node/selenium-webdriver/test/bidi/add_intercept_parameters_test.js index 226b04b0f867b..c032c827e1e14 100644 --- a/javascript/node/selenium-webdriver/test/bidi/add_intercept_parameters_test.js +++ b/javascript/node/selenium-webdriver/test/bidi/add_intercept_parameters_test.js @@ -18,7 +18,6 @@ 'use strict' const assert = require('assert') -const firefox = require('../../firefox') const { Browser } = require('../../') const { suite } = require('../../lib/test') const Network = require('../../bidi/network') @@ -31,7 +30,7 @@ suite( let driver beforeEach(async function () { - driver = await env.builder().setFirefoxOptions(new firefox.Options().enableBidi()).build() + driver = await env.builder().build() }) afterEach(async function () { @@ -106,5 +105,5 @@ suite( }) }) }, - { browsers: [Browser.FIREFOX] }, + { browsers: [Browser.FIREFOX, Browser.CHROME, Browser.EDGE] }, ) diff --git a/javascript/node/selenium-webdriver/test/bidi/bidi_session_test.js b/javascript/node/selenium-webdriver/test/bidi/bidi_session_test.js index 33ec81522c774..dab88285c33d0 100644 --- a/javascript/node/selenium-webdriver/test/bidi/bidi_session_test.js +++ b/javascript/node/selenium-webdriver/test/bidi/bidi_session_test.js @@ -18,7 +18,6 @@ 'use strict' const assert = require('assert') -const firefox = require('../../firefox') const { Browser } = require('../../') const { suite } = require('../../lib/test') @@ -27,7 +26,7 @@ suite( let driver beforeEach(async function () { - driver = await env.builder().setFirefoxOptions(new firefox.Options().enableBidi()).build() + driver = await env.builder().build() }) afterEach(async function () { @@ -44,5 +43,5 @@ suite( }) }) }, - { browsers: [Browser.FIREFOX] }, + { browsers: [Browser.FIREFOX, Browser.CHROME, Browser.EDGE] }, ) diff --git a/javascript/node/selenium-webdriver/test/bidi/bidi_test.js b/javascript/node/selenium-webdriver/test/bidi/bidi_test.js index 9de9fcf836349..e4e158b497f20 100644 --- a/javascript/node/selenium-webdriver/test/bidi/bidi_test.js +++ b/javascript/node/selenium-webdriver/test/bidi/bidi_test.js @@ -18,7 +18,6 @@ 'use strict' const assert = require('assert') -const firefox = require('../../firefox') const { Browser } = require('../../') const { Pages, suite } = require('../../lib/test') const logInspector = require('../../bidi/logInspector') @@ -30,7 +29,7 @@ suite( let driver beforeEach(async function () { - driver = await env.builder().setFirefoxOptions(new firefox.Options().enableBidi()).build() + driver = await env.builder().build() }) afterEach(async function () { diff --git a/javascript/node/selenium-webdriver/test/bidi/browser_test.js b/javascript/node/selenium-webdriver/test/bidi/browser_test.js index fd06b7cdb80c2..5b2cb9f345fdf 100644 --- a/javascript/node/selenium-webdriver/test/bidi/browser_test.js +++ b/javascript/node/selenium-webdriver/test/bidi/browser_test.js @@ -18,7 +18,6 @@ 'use strict' const assert = require('assert') -const firefox = require('../../firefox') const { suite } = require('../../lib/test') const { Browser } = require('../..') const BrowserBiDi = require('../../bidi/browser') @@ -29,14 +28,14 @@ suite( let driver beforeEach(async function () { - driver = await env.builder().setFirefoxOptions(new firefox.Options().enableBidi()).build() + driver = await env.builder().build() }) afterEach(function () { return driver.quit() }) - xit('can create a user context', async function () { + it('can create a user context', async function () { const browser = await BrowserBiDi(driver) const userContext = await browser.createUserContext() @@ -46,7 +45,7 @@ suite( await browser.removeUserContext(userContext) }) - xit('can get user contexts', async function () { + it('can get user contexts', async function () { const browser = await BrowserBiDi(driver) const userContext1 = await browser.createUserContext() @@ -60,7 +59,7 @@ suite( await browser.removeUserContext(userContext2) }) - xit('can remove user context', async function () { + it('can remove user context', async function () { const browser = await BrowserBiDi(driver) const userContext1 = await browser.createUserContext() @@ -81,5 +80,5 @@ suite( }) }) }, - { browsers: [Browser.FIREFOX] }, + { browsers: [Browser.FIREFOX, Browser.CHROME, Browser.EDGE] }, ) diff --git a/javascript/node/selenium-webdriver/test/bidi/browsingcontext_inspector_test.js b/javascript/node/selenium-webdriver/test/bidi/browsingcontext_inspector_test.js index 5ba31ce6fbbc4..b6be32635e42e 100644 --- a/javascript/node/selenium-webdriver/test/bidi/browsingcontext_inspector_test.js +++ b/javascript/node/selenium-webdriver/test/bidi/browsingcontext_inspector_test.js @@ -18,9 +18,8 @@ 'use strict' const assert = require('assert') -const firefox = require('../../firefox') const { Browser, By } = require('../../') -const { Pages, suite } = require('../../lib/test') +const { Pages, suite, ignore } = require('../../lib/test') const BrowsingContext = require('../../bidi/browsingContext') const BrowsingContextInspector = require('../../bidi/browsingContextInspector') const until = require('../../lib/until') @@ -30,7 +29,7 @@ suite( let driver beforeEach(async function () { - driver = await env.builder().setFirefoxOptions(new firefox.Options().enableBidi()).build() + driver = await env.builder().build() }) afterEach(async function () { @@ -119,23 +118,26 @@ suite( assert(navigationInfo.url.includes('/bidi/logEntryAdded.html')) }) - xit('can listen to navigation started event', async function () { - let navigationInfo = null - const browsingConextInspector = await BrowsingContextInspector(driver) + ignore(env.browsers(Browser.CHROME, Browser.EDGE)).it( + 'can listen to navigation started event', + async function () { + let navigationInfo = null + const browsingConextInspector = await BrowsingContextInspector(driver) - await browsingConextInspector.onNavigationStarted((entry) => { - navigationInfo = entry - }) + await browsingConextInspector.onNavigationStarted((entry) => { + navigationInfo = entry + }) - const browsingContext = await BrowsingContext(driver, { - browsingContextId: await driver.getWindowHandle(), - }) + const browsingContext = await BrowsingContext(driver, { + browsingContextId: await driver.getWindowHandle(), + }) - await browsingContext.navigate(Pages.logEntryAdded, 'complete') + await browsingContext.navigate(Pages.logEntryAdded, 'complete') - assert.equal(navigationInfo.browsingContextId, browsingContext.id) - assert(navigationInfo.url.includes('/bidi/logEntryAdded.html')) - }) + assert.equal(navigationInfo.browsingContextId, browsingContext.id) + assert(navigationInfo.url.includes('/bidi/logEntryAdded.html')) + }, + ) it('can listen to fragment navigated event', async function () { let navigationInfo = null @@ -204,5 +206,5 @@ suite( }) }) }, - { browsers: [Browser.FIREFOX] }, + { browsers: [Browser.FIREFOX, Browser.CHROME, Browser.EDGE] }, ) diff --git a/javascript/node/selenium-webdriver/test/bidi/browsingcontext_test.js b/javascript/node/selenium-webdriver/test/bidi/browsingcontext_test.js index 1ba8dfe6e7300..97e147459776c 100644 --- a/javascript/node/selenium-webdriver/test/bidi/browsingcontext_test.js +++ b/javascript/node/selenium-webdriver/test/bidi/browsingcontext_test.js @@ -18,9 +18,8 @@ 'use strict' const assert = require('assert') -const firefox = require('../../firefox') const { Browser, By } = require('../../') -const { Pages, suite } = require('../../lib/test') +const { Pages, suite, ignore } = require('../../lib/test') const BrowsingContext = require('../../bidi/browsingContext') const until = require('../../lib/until') const { Origin, CaptureScreenshotParameters } = require('../../bidi/captureScreenshotParameters') @@ -31,7 +30,7 @@ suite( let driver beforeEach(async function () { - driver = await env.builder().setFirefoxOptions(new firefox.Options().enableBidi()).build() + driver = await env.builder().build() }) afterEach(async function () { @@ -403,7 +402,7 @@ suite( assert(result.url.includes('/bidi/logEntryAdded.html')) }) - xit('can reload with readiness state', async function () { + it('can reload with readiness state', async function () { const id = await driver.getWindowHandle() const browsingContext = await BrowsingContext(driver, { browsingContextId: id, @@ -431,7 +430,7 @@ suite( assert.equal(result[1], 300) }) - xit('can set viewport with device pixel ratio', async function () { + ignore(env.browsers(Browser.FIREFOX)).it('can set viewport with device pixel ratio', async function () { const id = await driver.getWindowHandle() const browsingContext = await BrowsingContext(driver, { browsingContextId: id, @@ -462,5 +461,5 @@ suite( }) }) }, - { browsers: [Browser.FIREFOX] }, + { browsers: [Browser.FIREFOX, Browser.CHROME, Browser.EDGE] }, ) diff --git a/javascript/node/selenium-webdriver/test/bidi/input_test.js b/javascript/node/selenium-webdriver/test/bidi/input_test.js index edf15f0f7d210..75c88f160668b 100644 --- a/javascript/node/selenium-webdriver/test/bidi/input_test.js +++ b/javascript/node/selenium-webdriver/test/bidi/input_test.js @@ -19,7 +19,6 @@ const assert = require('assert') const fileServer = require('../../lib/test/fileserver') -const firefox = require('../../firefox') const { ignore, Pages, suite } = require('../../lib/test') const { Key, Origin } = require('../../lib/input') const { Browser, By, until } = require('../..') @@ -31,7 +30,7 @@ suite( let driver beforeEach(async function () { - driver = await env.builder().setFirefoxOptions(new firefox.Options().enableBidi()).build() + driver = await env.builder().build() }) afterEach(function () { @@ -168,7 +167,7 @@ suite( assert.strictEqual(await slide.getCssValue('left'), '101px') }) - ignore(env.browsers(Browser.FIREFOX)).it('can move to and click element in an iframe', async function () { + xit('can move to and click element in an iframe', async function () { const browsingContextId = await driver.getWindowHandle() const input = await Input(driver) await driver.get(fileServer.whereIs('click_tests/click_in_iframe.html')) @@ -275,7 +274,7 @@ suite( assert.strictEqual(await el.getAttribute('value'), 'foobar') }) - ignore(env.browsers(Browser.SAFARI)).it('can scroll with the wheel input', async function () { + it('can scroll with the wheel input', async function () { const browsingContextId = await driver.getWindowHandle() const input = await Input(driver) await driver.get(Pages.scrollingPage) @@ -323,5 +322,5 @@ suite( } }) }, - { browsers: [Browser.FIREFOX] }, + { browsers: [Browser.FIREFOX, Browser.CHROME, Browser.EDGE] }, ) diff --git a/javascript/node/selenium-webdriver/test/bidi/local_value_test.js b/javascript/node/selenium-webdriver/test/bidi/local_value_test.js index 4bac98c1b6c5f..e3d4fcfeea3cf 100644 --- a/javascript/node/selenium-webdriver/test/bidi/local_value_test.js +++ b/javascript/node/selenium-webdriver/test/bidi/local_value_test.js @@ -18,7 +18,6 @@ 'use strict' const assert = require('assert') -const firefox = require('../../firefox') const { Browser } = require('../../') const { suite } = require('../../lib/test') @@ -33,7 +32,7 @@ suite( let driver beforeEach(async function () { - driver = await env.builder().setFirefoxOptions(new firefox.Options().enableBidi()).build() + driver = await env.builder().build() }) afterEach(async function () { @@ -418,5 +417,5 @@ suite( }) }) }, - { browsers: [Browser.FIREFOX] }, + { browsers: [Browser.FIREFOX, Browser.CHROME, Browser.EDGE] }, ) diff --git a/javascript/node/selenium-webdriver/test/bidi/locate_nodes_test.js b/javascript/node/selenium-webdriver/test/bidi/locate_nodes_test.js index b111ea6573346..c0e7a8a7aada8 100644 --- a/javascript/node/selenium-webdriver/test/bidi/locate_nodes_test.js +++ b/javascript/node/selenium-webdriver/test/bidi/locate_nodes_test.js @@ -41,7 +41,7 @@ suite( }) describe('Locate Nodes', function () { - xit('can locate nodes', async function () { + it('can locate nodes', async function () { const id = await driver.getWindowHandle() const browsingContext = await BrowsingContext(driver, { browsingContextId: id, @@ -53,7 +53,7 @@ suite( assert.strictEqual(element.length, 13) }) - xit('can locate node', async function () { + it('can locate node', async function () { const id = await driver.getWindowHandle() const browsingContext = await BrowsingContext(driver, { browsingContextId: id, @@ -65,7 +65,7 @@ suite( assert.strictEqual(element.type, 'node') }) - xit('can locate node with css locator', async function () { + it('can locate node with css locator', async function () { const id = await driver.getWindowHandle() const browsingContext = await BrowsingContext(driver, { browsingContextId: id, @@ -128,7 +128,7 @@ suite( assert.strictEqual(elements.length, 4) }) - xit('can locate node with none ownership value', async function () { + it('can locate node with none ownership value', async function () { const id = await driver.getWindowHandle() const browsingContext = await BrowsingContext(driver, { browsingContextId: id, @@ -141,7 +141,7 @@ suite( assert.strictEqual(elements[0].handle, null) }) - xit('can locate node with root ownership value', async function () { + it('can locate node with root ownership value', async function () { const id = await driver.getWindowHandle() const browsingContext = await BrowsingContext(driver, { browsingContextId: id, @@ -195,7 +195,7 @@ suite( assert.strictEqual(elements.length, 35) }) - xit('can locate nodes in a given sandbox', async function () { + it('can locate nodes in a given sandbox', async function () { const sandbox = 'sandbox' const id = await driver.getWindowHandle() const browsingContext = await BrowsingContext(driver, { @@ -234,7 +234,7 @@ suite( assert.strictEqual(sharedId.value, nodeId) }) - xit('can find element', async function () { + it('can find element', async function () { const id = await driver.getWindowHandle() const browsingContext = await BrowsingContext(driver, { browsingContextId: id, @@ -247,7 +247,7 @@ suite( assert.strictEqual(elementText, 'Open new window') }) - xit('can find elements', async function () { + it('can find elements', async function () { const id = await driver.getWindowHandle() const browsingContext = await BrowsingContext(driver, { browsingContextId: id, diff --git a/javascript/node/selenium-webdriver/test/bidi/log_inspector_test.js b/javascript/node/selenium-webdriver/test/bidi/log_inspector_test.js index 7a9c2ea4165d0..f96d49b10ceb9 100644 --- a/javascript/node/selenium-webdriver/test/bidi/log_inspector_test.js +++ b/javascript/node/selenium-webdriver/test/bidi/log_inspector_test.js @@ -18,7 +18,6 @@ 'use strict' const assert = require('assert') -const firefox = require('../../firefox') const { Browser } = require('../../') const { Pages, suite } = require('../../lib/test') const logInspector = require('../../bidi/logInspector') @@ -29,7 +28,7 @@ suite( let driver beforeEach(async function () { - driver = await env.builder().setFirefoxOptions(new firefox.Options().enableBidi()).build() + driver = await env.builder().build() }) afterEach(async function () { diff --git a/javascript/node/selenium-webdriver/test/bidi/network_commands_test.js b/javascript/node/selenium-webdriver/test/bidi/network_commands_test.js index 8e8831ebf8294..a8a389bf259c3 100644 --- a/javascript/node/selenium-webdriver/test/bidi/network_commands_test.js +++ b/javascript/node/selenium-webdriver/test/bidi/network_commands_test.js @@ -18,7 +18,6 @@ 'use strict' const assert = require('assert') -const firefox = require('../../firefox') const { Browser, By } = require('../../') const { Pages, suite } = require('../../lib/test') const Network = require('../../bidi/network') @@ -35,7 +34,7 @@ suite( let network beforeEach(async function () { - driver = await env.builder().setFirefoxOptions(new firefox.Options().enableBidi()).build() + driver = await env.builder().build() network = await Network(driver) }) @@ -46,12 +45,12 @@ suite( }) describe('Network commands', function () { - xit('can add intercept', async function () { + it('can add intercept', async function () { const intercept = await network.addIntercept(new AddInterceptParameters(InterceptPhase.BEFORE_REQUEST_SENT)) assert.notEqual(intercept, null) }) - xit('can remove intercept', async function () { + it('can remove intercept', async function () { const network = await Network(driver) const intercept = await network.addIntercept(new AddInterceptParameters(InterceptPhase.BEFORE_REQUEST_SENT)) assert.notEqual(intercept, null) @@ -59,7 +58,7 @@ suite( await network.removeIntercept(intercept) }) - xit('can continue with auth credentials ', async function () { + it('can continue with auth credentials ', async function () { await network.addIntercept(new AddInterceptParameters(InterceptPhase.AUTH_REQUIRED)) await network.authRequired(async (event) => { @@ -72,7 +71,7 @@ suite( assert.equal(source.includes('Access granted'), true) }) - xit('can continue without auth credentials ', async function () { + it('can continue without auth credentials ', async function () { await network.addIntercept(new AddInterceptParameters(InterceptPhase.AUTH_REQUIRED)) await network.authRequired(async (event) => { @@ -88,7 +87,7 @@ suite( assert.equal(source.includes('Access denied'), true) }) - xit('can cancel auth ', async function () { + it('can cancel auth ', async function () { await network.addIntercept(new AddInterceptParameters(InterceptPhase.AUTH_REQUIRED)) await network.authRequired(async (event) => { @@ -102,7 +101,7 @@ suite( } }) - xit('can fail request', async function () { + it('can fail request', async function () { await network.addIntercept(new AddInterceptParameters(InterceptPhase.BEFORE_REQUEST_SENT)) await network.beforeRequestSent(async (event) => { @@ -119,7 +118,7 @@ suite( } }) - xit('can continue request', async function () { + it('can continue request', async function () { await network.addIntercept(new AddInterceptParameters(InterceptPhase.BEFORE_REQUEST_SENT)) let counter = 0 @@ -134,7 +133,7 @@ suite( assert.strictEqual(counter, 1) }) - xit('can continue response', async function () { + it('can continue response', async function () { await network.addIntercept(new AddInterceptParameters(InterceptPhase.RESPONSE_STARTED)) let counter = 0 @@ -149,7 +148,7 @@ suite( assert.strictEqual(counter, 1) }) - xit('can provide response', async function () { + it('can provide response', async function () { await network.addIntercept(new AddInterceptParameters(InterceptPhase.BEFORE_REQUEST_SENT)) let counter = 0 diff --git a/javascript/node/selenium-webdriver/test/bidi/network_test.js b/javascript/node/selenium-webdriver/test/bidi/network_test.js index 0bc8077b7cc1b..b2edfd778698c 100644 --- a/javascript/node/selenium-webdriver/test/bidi/network_test.js +++ b/javascript/node/selenium-webdriver/test/bidi/network_test.js @@ -18,9 +18,8 @@ 'use strict' const assert = require('assert') -const firefox = require('../../firefox') const { Browser } = require('../../') -const { Pages, suite } = require('../../lib/test') +const { Pages, suite, ignore } = require('../../lib/test') const Network = require('../../bidi/network') const until = require('../../lib/until') @@ -29,7 +28,7 @@ suite( let driver beforeEach(async function () { - driver = await env.builder().setFirefoxOptions(new firefox.Options().enableBidi()).build() + driver = await env.builder().build() }) afterEach(async function () { @@ -81,7 +80,7 @@ suite( assert.equal(beforeRequestEvent.request.cookies[1].value.value, 'dosa') }) - it('can redirect http equiv', async function () { + ignore(env.browsers(Browser.CHROME, Browser.EDGE)).it('can redirect http equiv', async function () { let beforeRequestEvent = [] const network = await Network(driver) await network.beforeRequestSent(function (event) { @@ -155,7 +154,7 @@ suite( assert.equal(onResponseCompleted[0].redirectCount, 0) }) - xit('can listen to auth required event', async function () { + ignore(env.browsers(Browser.CHROME, Browser.EDGE)).it('can listen to auth required event', async function () { let authRequiredEvent = null const network = await Network(driver) await network.authRequired(function (event) { @@ -174,7 +173,7 @@ suite( assert.equal(authRequiredEvent.response.url.includes('basicAuth'), true) }) - xit('can listen to fetch error event', async function () { + it('can listen to fetch error event', async function () { let fetchErrorEvent = null const network = await Network(driver) await network.fetchError(function (event) { @@ -192,7 +191,7 @@ suite( assert.equal(fetchErrorEvent.request.method, 'GET') assert.equal(url.includes('valid_url'), true) assert.equal(fetchErrorEvent.request.headers.length > 1, true) - assert.equal(fetchErrorEvent.errorText, 'NS_ERROR_UNKNOWN_HOST') + assert.notEqual(fetchErrorEvent.errorText, null) }) it('test response completed mime type', async function () { @@ -217,5 +216,5 @@ suite( }) }) }, - { browsers: [Browser.FIREFOX] }, + { browsers: [Browser.FIREFOX, Browser.CHROME, Browser.EDGE] }, ) diff --git a/javascript/node/selenium-webdriver/test/bidi/script_test.js b/javascript/node/selenium-webdriver/test/bidi/script_test.js index 8f64270704d6c..a3ec2104c2356 100644 --- a/javascript/node/selenium-webdriver/test/bidi/script_test.js +++ b/javascript/node/selenium-webdriver/test/bidi/script_test.js @@ -18,7 +18,6 @@ 'use strict' const assert = require('assert') -const firefox = require('../../firefox') const { Browser } = require('../../') const { Pages, suite } = require('../../lib/test') const BrowsingContext = require('../../bidi/browsingContext') @@ -35,7 +34,7 @@ suite( let driver beforeEach(async function () { - driver = await env.builder().setFirefoxOptions(new firefox.Options().enableBidi()).build() + driver = await env.builder().build() }) afterEach(async function () { @@ -215,8 +214,8 @@ suite( assert.notEqual(result.realmId, null) assert.equal(result.exceptionDetails.exception.type, 'error') - assert.equal(result.exceptionDetails.text, "SyntaxError: expected expression, got ')'") - assert.equal(result.exceptionDetails.columnNumber, 39) + assert.equal(result.exceptionDetails.text.includes('SyntaxError:'), true) + assert.notEqual(result.exceptionDetails.columnNumber, null) assert.equal(result.exceptionDetails.stackTrace.callFrames.length, 0) }) @@ -320,8 +319,8 @@ suite( assert.notEqual(result.realmId, null) assert.equal(result.exceptionDetails.exception.type, 'error') - assert.equal(result.exceptionDetails.text, "SyntaxError: expected expression, got ')'") - assert.equal(result.exceptionDetails.columnNumber, 39) + assert.equal(result.exceptionDetails.text.includes('SyntaxError:'), true) + assert.notEqual(result.exceptionDetails.columnNumber, null) assert.equal(result.exceptionDetails.stackTrace.callFrames.length, 0) }) @@ -819,5 +818,5 @@ suite( }) }) }, - { browsers: [Browser.FIREFOX] }, + { browsers: [Browser.FIREFOX, Browser.CHROME, Browser.EDGE] }, ) diff --git a/javascript/node/selenium-webdriver/test/bidi/setFiles_command_test.js b/javascript/node/selenium-webdriver/test/bidi/setFiles_command_test.js index 185bfec99c840..63f3cef74f04d 100644 --- a/javascript/node/selenium-webdriver/test/bidi/setFiles_command_test.js +++ b/javascript/node/selenium-webdriver/test/bidi/setFiles_command_test.js @@ -19,13 +19,13 @@ const assert = require('assert') require('../../lib/test/fileserver') -const firefox = require('../../firefox') const { Pages, suite } = require('../../lib/test') const { Browser, By } = require('../..') const Input = require('../../bidi/input') const io = require('../../io') const { ReferenceValue, RemoteReferenceType } = require('../../bidi/protocolValue') const fs = require('fs') +const { ignore } = require('../../testing') suite( function (env) { @@ -42,14 +42,14 @@ suite( }) beforeEach(async function () { - driver = await env.builder().setFirefoxOptions(new firefox.Options().enableBidi()).build() + driver = await env.builder().build() }) afterEach(function () { return driver.quit() }) - xit('can set files', async function () { + ignore(env.browsers(Browser.FIREFOX)).it('can set files', async function () { const browsingContextId = await driver.getWindowHandle() const input = await Input(driver) await driver.get(Pages.formPage) @@ -72,7 +72,7 @@ suite( assert.notEqual(await webElement.getAttribute('value'), '') }) - xit('can set files with element id', async function () { + ignore(env.browsers(Browser.FIREFOX)).it('can set files with element id', async function () { const browsingContextId = await driver.getWindowHandle() const input = await Input(driver) await driver.get(Pages.formPage) @@ -94,5 +94,5 @@ suite( }) }) }, - { browsers: [Browser.FIREFOX] }, + { browsers: [Browser.FIREFOX, Browser.CHROME, Browser.EDGE] }, ) diff --git a/javascript/node/selenium-webdriver/test/bidi/storage_test.js b/javascript/node/selenium-webdriver/test/bidi/storage_test.js index 8c4fac523fb38..358981563a616 100644 --- a/javascript/node/selenium-webdriver/test/bidi/storage_test.js +++ b/javascript/node/selenium-webdriver/test/bidi/storage_test.js @@ -19,7 +19,6 @@ const assert = require('assert') require('../../lib/test/fileserver') -const firefox = require('../../firefox') const { suite } = require('../../lib/test') const { Browser } = require('../..') const Storage = require('../../bidi/storage') @@ -35,7 +34,7 @@ suite( let driver beforeEach(async function () { - driver = await env.builder().setFirefoxOptions(new firefox.Options().enableBidi()).build() + driver = await env.builder().build() await driver.get(fileserver.Pages.ajaxyPage) await driver.manage().deleteAllCookies() return assertHasCookies() @@ -45,7 +44,7 @@ suite( return driver.quit() }) - xit('can get cookie by name', async function () { + it('can get cookie by name', async function () { const cookie = createCookieSpec() await driver.manage().addCookie(cookie) @@ -94,7 +93,7 @@ suite( assert.strictEqual(partitionKey.userContext, 'default') }) - xit('can add cookie', async function () { + it('can add cookie', async function () { const cookie = createCookieSpec() const storage = await Storage(driver) @@ -112,7 +111,7 @@ suite( assert.strictEqual(result.cookies[0].value.value, cookie.value) }) - xit('can add and get cookie with all parameters', async function () { + it('can add and get cookie with all parameters', async function () { const cookie = createCookieSpec() const storage = await Storage(driver) @@ -144,16 +143,16 @@ suite( assert.strictEqual(resultCookie.name, cookie.name) assert.strictEqual(resultCookie.value.value, cookie.value) - assert.strictEqual(resultCookie.domain, fileserver.whereIs('/')) + assert.strictEqual(resultCookie.domain.includes('http'), true) assert.strictEqual(resultCookie.path, '/ajaxy_page.html') assert.strictEqual(resultCookie.size > 0, true) assert.strictEqual(resultCookie.httpOnly, true) assert.strictEqual(resultCookie.secure, false) assert.strictEqual(resultCookie.sameSite, SameSite.LAX) - assert.strictEqual(resultCookie.expires, expiry) + assert.notEqual(resultCookie.expires, null) }) - xit('can get all cookies', async function () { + it('can get all cookies', async function () { const cookie1 = createCookieSpec() const cookie2 = createCookieSpec() @@ -249,5 +248,5 @@ suite( } }) }, - { browsers: [Browser.FIREFOX] }, + { browsers: [Browser.FIREFOX, Browser.CHROME, Browser.EDGE] }, ) diff --git a/javascript/node/selenium-webdriver/testing/index.js b/javascript/node/selenium-webdriver/testing/index.js index e379d14aa3551..7fbadee62d0c3 100644 --- a/javascript/node/selenium-webdriver/testing/index.js +++ b/javascript/node/selenium-webdriver/testing/index.js @@ -302,6 +302,11 @@ class Environment { builder.setCapability('moz:debuggerAddress', true) } + // Enable BiDi for supporting browsers. + if (browser.name === Browser.FIREFOX || browser.name === Browser.CHROME || browser.name === Browser.EDGE) { + builder.setCapability('webSocketUrl', true) + } + if (typeof urlOrServer === 'string') { builder.usingServer(urlOrServer) } else if (urlOrServer) {