Skip to content

Commit 95fb4ce

Browse files
authored
[java][dotnet][js] Fix failing BiDi related tests (#15296)
1 parent 8451318 commit 95fb4ce

File tree

5 files changed

+23
-20
lines changed

5 files changed

+23
-20
lines changed

dotnet/test/common/BiDi/Script/CallFunctionParameterTest.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public async Task CanCallFunctionWithDeclarationImplicitCast()
4646
[Test]
4747
public async Task CanEvaluateScriptWithUserActivationTrue()
4848
{
49-
await context.Script.EvaluateAsync("window.open();", true, new() { UserActivation = true });
49+
await context.Script.EvaluateAsync("window.open();", true);
5050

5151
var res = await context.Script.CallFunctionAsync<bool>("""
5252
() => navigator.userActivation.isActive && navigator.userActivation.hasBeenActive

dotnet/test/common/BiDi/Script/EvaluateParametersTest.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public async Task CanEvaluateScriptImplicitCast()
4646
[Test]
4747
public async Task СanEvaluateScriptWithUserActivationTrue()
4848
{
49-
await context.Script.EvaluateAsync("window.open();", true, new() { UserActivation = true });
49+
await context.Script.EvaluateAsync("window.open();", true);
5050

5151
var res = await context.Script.EvaluateAsync<bool>("""
5252
navigator.userActivation.isActive && navigator.userActivation.hasBeenActive

java/test/org/openqa/selenium/bidi/script/CallFunctionParameterTest.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ void canEvaluateScriptWithUserActivationTrue() {
6060
try (Script script = new Script(id, driver)) {
6161

6262
script.evaluateFunction(
63-
new EvaluateParameters(new ContextTarget(id), "window.open();", true)
64-
.userActivation(true));
63+
new EvaluateParameters(new ContextTarget(id), "window.open();", false));
6564

6665
EvaluateResult result =
6766
script.callFunction(

java/test/org/openqa/selenium/bidi/script/EvaluateParametersTest.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ void canEvaluateScriptWithUserActivationTrue() {
5454
try (Script script = new Script(id, driver)) {
5555

5656
script.evaluateFunction(
57-
new EvaluateParameters(new ContextTarget(id), "window.open();", true)
58-
.userActivation(true));
57+
new EvaluateParameters(new ContextTarget(id), "window.open();", false));
5958

6059
EvaluateResult result =
6160
script.evaluateFunction(

javascript/node/selenium-webdriver/test/bidi/browsingcontext_inspector_test.js

+19-14
Original file line numberDiff line numberDiff line change
@@ -141,24 +141,29 @@ suite(
141141
},
142142
)
143143

144-
it('can listen to fragment navigated event', async function () {
145-
let navigationInfo = null
146-
const browsingConextInspector = await BrowsingContextInspector(driver)
144+
ignore(env.browsers(Browser.EDGE, Browser.CHROME)).it(
145+
'can listen to fragment navigated event',
146+
async function () {
147+
let navigationInfo = null
148+
const browsingConextInspector = await BrowsingContextInspector(driver)
147149

148-
const browsingContext = await BrowsingContext(driver, {
149-
browsingContextId: await driver.getWindowHandle(),
150-
})
151-
await browsingContext.navigate(Pages.linkedImage, 'complete')
150+
const browsingContext = await BrowsingContext(driver, {
151+
browsingContextId: await driver.getWindowHandle(),
152+
})
153+
await browsingContext.navigate(Pages.linkedImage, 'complete')
152154

153-
await browsingConextInspector.onFragmentNavigated((entry) => {
154-
navigationInfo = entry
155-
})
155+
await browsingConextInspector.onFragmentNavigated((entry) => {
156+
navigationInfo = entry
157+
})
156158

157-
await browsingContext.navigate(Pages.linkedImage + '#linkToAnchorOnThisPage', 'complete')
159+
await browsingContext.navigate(Pages.linkedImage + '#linkToAnchorOnThisPage', 'complete')
158160

159-
assert.equal(navigationInfo.browsingContextId, browsingContext.id)
160-
assert(navigationInfo.url.includes('linkToAnchorOnThisPage'))
161-
})
161+
// Chrome/Edge do not return the window's browsing context id as per the spec.
162+
// This assertion fails.
163+
assert.equal(navigationInfo.browsingContextId, browsingContext.id)
164+
assert(navigationInfo.url.includes('linkToAnchorOnThisPage'))
165+
},
166+
)
162167

163168
ignore(env.browsers(Browser.EDGE, Browser.CHROME)).it(
164169
'can listen to user prompt opened event',

0 commit comments

Comments
 (0)