Tests: Make Navigation-object-properties test deterministic#8902
Open
officialasishkumar wants to merge 1 commit intoLadybirdBrowser:masterfrom
Open
Tests: Make Navigation-object-properties test deterministic#8902officialasishkumar wants to merge 1 commit intoLadybirdBrowser:masterfrom
officialasishkumar wants to merge 1 commit intoLadybirdBrowser:masterfrom
Conversation
Collaborator
|
Hello! One or more of the commit messages in this PR do not match the Ladybird code submission policy, please check the |
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.
00a67dd to
1a3eebe
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The test previously read
window.navigation.canGoBackdirectly. Sincemultiple tests share the same WebContent process, canGoBack reflected
how many tests had been run before this one: it was
falsewhen run first,but
truewhen 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 precedethis 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
canGoBackandcanGoForwardare alwaysfalseregardless of what ran before.
Update the expected output accordingly.
Fixes #7931.