Skip to content

[java][dotnet][js] Fix failing BiDi related tests #15296

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public async Task CanCallFunctionWithDeclarationImplicitCast()
[Test]
public async Task CanEvaluateScriptWithUserActivationTrue()
{
await context.Script.EvaluateAsync("window.open();", true, new() { UserActivation = true });
await context.Script.EvaluateAsync("window.open();", true);

var res = await context.Script.CallFunctionAsync<bool>("""
() => navigator.userActivation.isActive && navigator.userActivation.hasBeenActive
Expand Down
2 changes: 1 addition & 1 deletion dotnet/test/common/BiDi/Script/EvaluateParametersTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public async Task CanEvaluateScriptImplicitCast()
[Test]
public async Task СanEvaluateScriptWithUserActivationTrue()
{
await context.Script.EvaluateAsync("window.open();", true, new() { UserActivation = true });
await context.Script.EvaluateAsync("window.open();", true);

var res = await context.Script.EvaluateAsync<bool>("""
navigator.userActivation.isActive && navigator.userActivation.hasBeenActive
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ void canEvaluateScriptWithUserActivationTrue() {
try (Script script = new Script(id, driver)) {

script.evaluateFunction(
new EvaluateParameters(new ContextTarget(id), "window.open();", true)
.userActivation(true));
new EvaluateParameters(new ContextTarget(id), "window.open();", false));

EvaluateResult result =
script.callFunction(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ void canEvaluateScriptWithUserActivationTrue() {
try (Script script = new Script(id, driver)) {

script.evaluateFunction(
new EvaluateParameters(new ContextTarget(id), "window.open();", true)
.userActivation(true));
new EvaluateParameters(new ContextTarget(id), "window.open();", false));

EvaluateResult result =
script.evaluateFunction(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,24 +141,29 @@ suite(
},
)

it('can listen to fragment navigated event', async function () {
let navigationInfo = null
const browsingConextInspector = await BrowsingContextInspector(driver)
ignore(env.browsers(Browser.EDGE, Browser.CHROME)).it(
'can listen to fragment navigated event',
async function () {
let navigationInfo = null
const browsingConextInspector = await BrowsingContextInspector(driver)

const browsingContext = await BrowsingContext(driver, {
browsingContextId: await driver.getWindowHandle(),
})
await browsingContext.navigate(Pages.linkedImage, 'complete')
const browsingContext = await BrowsingContext(driver, {
browsingContextId: await driver.getWindowHandle(),
})
await browsingContext.navigate(Pages.linkedImage, 'complete')

await browsingConextInspector.onFragmentNavigated((entry) => {
navigationInfo = entry
})
await browsingConextInspector.onFragmentNavigated((entry) => {
navigationInfo = entry
})

await browsingContext.navigate(Pages.linkedImage + '#linkToAnchorOnThisPage', 'complete')
await browsingContext.navigate(Pages.linkedImage + '#linkToAnchorOnThisPage', 'complete')

assert.equal(navigationInfo.browsingContextId, browsingContext.id)
assert(navigationInfo.url.includes('linkToAnchorOnThisPage'))
})
// Chrome/Edge do not return the window's browsing context id as per the spec.
// This assertion fails.
assert.equal(navigationInfo.browsingContextId, browsingContext.id)
assert(navigationInfo.url.includes('linkToAnchorOnThisPage'))
},
)

ignore(env.browsers(Browser.EDGE, Browser.CHROME)).it(
'can listen to user prompt opened event',
Expand Down
Loading