Skip to content

Commit

Permalink
[bidi][js] Enable tests for Edge and Chrome (#13790)
Browse files Browse the repository at this point in the history
  • Loading branch information
pujagani authored Apr 10, 2024
1 parent 9f8e0b8 commit d142ce0
Show file tree
Hide file tree
Showing 17 changed files with 94 additions and 96 deletions.
5 changes: 4 additions & 1 deletion javascript/node/selenium-webdriver/bidi/scriptManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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 () {
Expand Down Expand Up @@ -106,5 +105,5 @@ suite(
})
})
},
{ browsers: [Browser.FIREFOX] },
{ browsers: [Browser.FIREFOX, Browser.CHROME, Browser.EDGE] },
)
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
'use strict'

const assert = require('assert')
const firefox = require('../../firefox')
const { Browser } = require('../../')
const { suite } = require('../../lib/test')

Expand All @@ -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 () {
Expand All @@ -44,5 +43,5 @@ suite(
})
})
},
{ browsers: [Browser.FIREFOX] },
{ browsers: [Browser.FIREFOX, Browser.CHROME, Browser.EDGE] },
)
3 changes: 1 addition & 2 deletions javascript/node/selenium-webdriver/test/bidi/bidi_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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 () {
Expand Down
11 changes: 5 additions & 6 deletions javascript/node/selenium-webdriver/test/bidi/browser_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand All @@ -81,5 +80,5 @@ suite(
})
})
},
{ browsers: [Browser.FIREFOX] },
{ browsers: [Browser.FIREFOX, Browser.CHROME, Browser.EDGE] },
)
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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 () {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -204,5 +206,5 @@ suite(
})
})
},
{ browsers: [Browser.FIREFOX] },
{ browsers: [Browser.FIREFOX, Browser.CHROME, Browser.EDGE] },
)
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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 () {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -462,5 +461,5 @@ suite(
})
})
},
{ browsers: [Browser.FIREFOX] },
{ browsers: [Browser.FIREFOX, Browser.CHROME, Browser.EDGE] },
)
9 changes: 4 additions & 5 deletions javascript/node/selenium-webdriver/test/bidi/input_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('../..')
Expand All @@ -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 () {
Expand Down Expand Up @@ -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'))
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -323,5 +322,5 @@ suite(
}
})
},
{ browsers: [Browser.FIREFOX] },
{ browsers: [Browser.FIREFOX, Browser.CHROME, Browser.EDGE] },
)
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
'use strict'

const assert = require('assert')
const firefox = require('../../firefox')
const { Browser } = require('../../')
const { suite } = require('../../lib/test')

Expand All @@ -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 () {
Expand Down Expand Up @@ -418,5 +417,5 @@ suite(
})
})
},
{ browsers: [Browser.FIREFOX] },
{ browsers: [Browser.FIREFOX, Browser.CHROME, Browser.EDGE] },
)
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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, {
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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 () {
Expand Down
Loading

0 comments on commit d142ce0

Please sign in to comment.