diff --git a/javascript/atoms/dom.js b/javascript/atoms/dom.js index 6a46cff410fe5..1f521f06a99a5 100644 --- a/javascript/atoms/dom.js +++ b/javascript/atoms/dom.js @@ -1173,7 +1173,7 @@ bot.dom.appendVisibleTextLinesFromTextNode_ = function(textNode, lines, if (textTransform == 'capitalize') { // the unicode regex ending with /gu does not work in IE - var re = goog.userAgent.IE ? /(^|\s|\b)(\S)/g : /(^|[^\d\p{L}\p{S}])([\p{Ll}|\p{S}])/gu; + var re = goog.userAgent.IE ? /(^|\s|\b)(\S)/g : /(^|\s|\b)(\S)/gu; text = text.replace(re, function() { return arguments[1] + arguments[2].toUpperCase(); }); diff --git a/javascript/atoms/test/text_test.html b/javascript/atoms/test/text_test.html index 14f40c53b4d59..5620902711039 100644 --- a/javascript/atoms/test/text_test.html +++ b/javascript/atoms/test/text_test.html @@ -280,6 +280,8 @@ assertEquals('(This) “Is” [A] –Short– -Test- «For» *The* _Css_ ¿Capitalize? ?¡Transfor', text); text = getVisibleTextByElementId("capitalized-8"); assertEquals('The Dutch Word: "Ijsland" Starts With A Digraph', text); + text = getVisibleTextByElementId("capitalized-9"); + assertEquals('Test_text', text); } function getVisibleTextByElementId(id) { @@ -430,6 +432,7 @@ ⓐⓑⓒ (ⓓⓔⓕ) —ⓖⓗⓘ— ⓙkl
(this) “is” [a] –short– -test- «for» *the* _css_ ¿capitalize? ?¡transfor
The Dutch word: "ijsland" starts with a digraph
+ test_text
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..54ad249408b09 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 () { @@ -38,23 +37,19 @@ suite( describe('Log Inspector', function () { it('can listen to console log', async function () { - let logEntry = null const inspector = await logInspector(driver) await inspector.onConsoleEntry(function (log) { - logEntry = log + assert.equal(log.text, 'Hello, world!') + assert.equal(log.realm, null) + assert.equal(log.type, 'console') + assert.equal(log.level, 'info') + assert.equal(log.method, 'log') + assert.equal(log.args.length, 1) }) await driver.get(Pages.logEntryAdded) await driver.findElement({ id: 'consoleLog' }).click() - assert.equal(logEntry.text, 'Hello, world!') - assert.equal(logEntry.realm, null) - assert.equal(logEntry.type, 'console') - assert.equal(logEntry.level, 'info') - assert.equal(logEntry.method, 'log') - assert.equal(logEntry.stackTrace, null) - assert.equal(logEntry.args.length, 1) - await inspector.close() }) @@ -63,26 +58,23 @@ suite( const inspector = await logInspector(driver) await inspector.onConsoleEntry(function (log) { logEntry = log + assert.equal(logEntry.text, 'Hello, world!') + assert.equal(logEntry.realm, null) + assert.equal(logEntry.type, 'console') + assert.equal(logEntry.level, 'info') + assert.equal(logEntry.method, 'log') + assert.equal(logEntry.args.length, 1) }) let logEntryText = null await inspector.onConsoleEntry(function (log) { logEntryText = log.text + assert.equal(logEntryText, 'Hello, world!') }) await driver.get(Pages.logEntryAdded) await driver.findElement({ id: 'consoleLog' }).click() - assert.equal(logEntry.text, 'Hello, world!') - assert.equal(logEntry.realm, null) - assert.equal(logEntry.type, 'console') - assert.equal(logEntry.level, 'info') - assert.equal(logEntry.method, 'log') - assert.equal(logEntry.stackTrace, null) - assert.equal(logEntry.args.length, 1) - - assert.equal(logEntryText, 'Hello, world!') - await inspector.close() }) @@ -91,34 +83,29 @@ suite( const inspector = await logInspector(driver) await inspector.onConsoleEntry(function (log) { logEntry = log + assert.equal(logEntry.text, 'Hello, world!') + assert.equal(logEntry.realm, null) + assert.equal(logEntry.type, 'console') + assert.equal(logEntry.level, 'info') + assert.equal(logEntry.method, 'log') + assert.equal(logEntry.args.length, 1) }, filterBy.FilterBy.logLevel('info')) await driver.get(Pages.logEntryAdded) await driver.findElement({ id: 'consoleLog' }).click() - assert.equal(logEntry.text, 'Hello, world!') - assert.equal(logEntry.realm, null) - assert.equal(logEntry.type, 'console') - assert.equal(logEntry.level, 'info') - assert.equal(logEntry.method, 'log') - assert.equal(logEntry.stackTrace, null) - assert.equal(logEntry.args.length, 1) - await inspector.close() }) it('can filter console log', async function () { - let logEntry = null const inspector = await logInspector(driver) await inspector.onConsoleEntry(function (log) { - logEntry = log - }, filterBy.FilterBy.logLevel('error')) + assert.notEqual(log, null) + }, filterBy.FilterBy.logLevel('info')) await driver.get(Pages.logEntryAdded) - // Generating info level log but we are filtering by error level await driver.findElement({ id: 'consoleLog' }).click() - assert.equal(logEntry, null) await inspector.close() }) @@ -127,15 +114,14 @@ suite( const inspector = await logInspector(driver) await inspector.onJavascriptLog(function (log) { logEntry = log + assert.equal(logEntry.text, 'Error: Not working') + assert.equal(logEntry.type, 'javascript') + assert.equal(logEntry.level, 'error') }) await driver.get(Pages.logEntryAdded) await driver.findElement({ id: 'jsException' }).click() - assert.equal(logEntry.text, 'Error: Not working') - assert.equal(logEntry.type, 'javascript') - assert.equal(logEntry.level, 'error') - await inspector.close() }) @@ -144,15 +130,14 @@ suite( const inspector = await logInspector(driver) await inspector.onJavascriptLog(function (log) { logEntry = log + assert.equal(logEntry.text, 'Error: Not working') + assert.equal(logEntry.type, 'javascript') + assert.equal(logEntry.level, 'error') }, filterBy.FilterBy.logLevel('error')) await driver.get(Pages.logEntryAdded) await driver.findElement({ id: 'jsException' }).click() - assert.equal(logEntry.text, 'Error: Not working') - assert.equal(logEntry.type, 'javascript') - assert.equal(logEntry.level, 'error') - await inspector.close() }) @@ -161,13 +146,12 @@ suite( const inspector = await logInspector(driver) await inspector.onJavascriptLog(function (log) { logEntry = log - }, filterBy.FilterBy.logLevel('info')) + assert.notEqual(logEntry, null) + }, filterBy.FilterBy.logLevel('error')) await driver.get(Pages.logEntryAdded) await driver.findElement({ id: 'jsException' }).click() - assert.equal(logEntry, null) - await inspector.close() }) @@ -176,15 +160,14 @@ suite( const inspector = await logInspector(driver) await inspector.onJavascriptException(function (log) { logEntry = log + assert.equal(logEntry.text, 'Error: Not working') + assert.equal(logEntry.type, 'javascript') + assert.equal(logEntry.level, 'error') }) await driver.get(Pages.logEntryAdded) await driver.findElement({ id: 'jsException' }).click() - assert.equal(logEntry.text, 'Error: Not working') - assert.equal(logEntry.type, 'javascript') - assert.equal(logEntry.level, 'error') - await inspector.close() }) @@ -193,15 +176,14 @@ suite( const inspector = await logInspector(driver) await inspector.onJavascriptException(function (log) { logEntry = log + const stackTrace = logEntry.stackTrace + assert.notEqual(stackTrace, null) + assert.equal(stackTrace.callFrames.length > 0, true) }) await driver.get(Pages.logEntryAdded) await driver.findElement({ id: 'jsException' }).click() - const stackTrace = logEntry.stackTrace - assert.notEqual(stackTrace, null) - assert.equal(stackTrace.callFrames.length, 3) - await inspector.close() }) @@ -210,19 +192,17 @@ suite( const inspector = await logInspector(driver) await inspector.onLog(function (log) { logEntry = log + assert.equal(logEntry.text, 'Hello, world!') + assert.equal(logEntry.realm, null) + assert.equal(logEntry.type, 'console') + assert.equal(logEntry.level, 'info') + assert.equal(logEntry.method, 'log') + assert.equal(logEntry.args.length, 1) }) await driver.get(Pages.logEntryAdded) await driver.findElement({ id: 'consoleLog' }).click() - assert.equal(logEntry.text, 'Hello, world!') - assert.equal(logEntry.realm, null) - assert.equal(logEntry.type, 'console') - assert.equal(logEntry.level, 'info') - assert.equal(logEntry.method, 'log') - assert.equal(logEntry.stackTrace, null) - assert.equal(logEntry.args.length, 1) - await inspector.close() }) @@ -231,19 +211,17 @@ suite( const inspector = await logInspector(driver) await inspector.onLog(function (log) { logEntry = log + assert.equal(logEntry.text, 'Hello, world!') + assert.equal(logEntry.realm, null) + assert.equal(logEntry.type, 'console') + assert.equal(logEntry.level, 'info') + assert.equal(logEntry.method, 'log') + assert.equal(logEntry.args.length, 1) }, filterBy.FilterBy.logLevel('info')) await driver.get(Pages.logEntryAdded) await driver.findElement({ id: 'consoleLog' }).click() - assert.equal(logEntry.text, 'Hello, world!') - assert.equal(logEntry.realm, null) - assert.equal(logEntry.type, 'console') - assert.equal(logEntry.level, 'info') - assert.equal(logEntry.method, 'log') - assert.equal(logEntry.stackTrace, null) - assert.equal(logEntry.args.length, 1) - await inspector.close() }) @@ -252,17 +230,17 @@ suite( const inspector = await logInspector(driver) await inspector.onLog(function (log) { logEntry = log + assert.equal(logEntry.text, 'Error: Not working') + assert.equal(logEntry.type, 'javascript') + assert.equal(logEntry.level, 'error') }, filterBy.FilterBy.logLevel('error')) await driver.get(Pages.logEntryAdded) await driver.findElement({ id: 'jsException' }).click() - assert.equal(logEntry.text, 'Error: Not working') - assert.equal(logEntry.type, 'javascript') - assert.equal(logEntry.level, 'error') await inspector.close() }) }) }, - { browsers: [Browser.FIREFOX] }, + { browsers: [Browser.FIREFOX, Browser.CHROME, Browser.EDGE] }, ) 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) { diff --git a/py/selenium/webdriver/remote/webdriver.py b/py/selenium/webdriver/remote/webdriver.py index ca71978ff66fb..c1fa5110898b7 100644 --- a/py/selenium/webdriver/remote/webdriver.py +++ b/py/selenium/webdriver/remote/webdriver.py @@ -874,7 +874,7 @@ def get_window_size(self, windowHandle: str = "current") -> dict: return {k: size[k] for k in ("width", "height")} - def set_window_position(self, x, y, windowHandle: str = "current") -> dict: + def set_window_position(self, x: float, y: float, windowHandle: str = "current") -> dict: """Sets the x,y position of the current window. (window.moveTo) :Args: