Skip to content

Tests: Make Navigation-object-properties test deterministic#8902

Open
officialasishkumar wants to merge 1 commit intoLadybirdBrowser:masterfrom
officialasishkumar:navigation-test-deterministic
Open

Tests: Make Navigation-object-properties test deterministic#8902
officialasishkumar wants to merge 1 commit intoLadybirdBrowser:masterfrom
officialasishkumar:navigation-test-deterministic

Conversation

@officialasishkumar
Copy link
Copy Markdown

The test previously read window.navigation.canGoBack directly. Since
multiple tests share the same WebContent process, canGoBack reflected
how many tests had been run before this one: it was false when run first,
but true when run after any test that generated a navigation entry.

This made the expected output fragile. The file was checked in with
canGoBack: true (the value observed in CI, where many tests precede
this one), but running the test in isolation locally would produce a
different result.

As suggested in the linked issue, move the assertions into an iframe.
Each iframe starts with its own fresh Navigation API instance and an
empty history, so canGoBack and canGoForward are always false
regardless of what ran before.

Update the expected output accordingly.

Fixes #7931.

@ladybird-bot
Copy link
Copy Markdown
Collaborator

Hello!

One or more of the commit messages in this PR do not match the Ladybird code submission policy, please check the lint_commits CI job for more details on which commits were flagged and why.
Please do not close this PR and open another, instead modify your commit message(s) with git commit --amend and force push those changes to update this PR.

The test previously accessed window.navigation directly, so canGoBack
reflected the accumulated history of all earlier tests run in the same
WebContent process. When run as the first test, canGoBack was false;
when run after other tests it was true, making the expected output
depend on test execution order.

Move the assertions into an iframe. Each iframe gets its own fresh
Navigation API instance with an empty history, so canGoBack and
canGoForward are always false regardless of which tests ran before.

Update the expected output to match.

Fixes LadybirdBrowser#7931.
@officialasishkumar officialasishkumar force-pushed the navigation-test-deterministic branch from 00a67dd to 1a3eebe Compare April 13, 2026 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Navigation-object-properties.html is a faulty test

2 participants