Skip to content

Commit

Permalink
Merge branch 'trunk' into trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
VietND96 authored Apr 10, 2024
2 parents 2d48305 + a0210e3 commit befb6cc
Show file tree
Hide file tree
Showing 20 changed files with 150 additions and 170 deletions.
2 changes: 1 addition & 1 deletion javascript/atoms/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down
3 changes: 3 additions & 0 deletions javascript/atoms/test/text_test.html
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -430,6 +432,7 @@
<a id="capitalized-6" style="text-transform: capitalize">ⓐⓑⓒ (ⓓⓔⓕ) —ⓖⓗⓘ— ⓙkl</a><br/>
<a id="capitalized-7" style="text-transform: capitalize">(this) “is” [a] –short– -test- «for» *the* _css_ ¿capitalize? ?¡transfor</a><br/>
<a id="capitalized-8" style="text-transform: capitalize">The Dutch word: "ijsland" starts with a digraph</a><br/>
<a id="capitalized-9" style="text-transform: capitalize">test_text</a><br/>
</div>

</body>
Expand Down
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] },
)
Loading

0 comments on commit befb6cc

Please sign in to comment.