-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
[java] Add regression coverage for relative locators on collapsed table borders (#13642) #17827
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
titusfortner
merged 5 commits into
SeleniumHQ:trunk
from
MohabMohie:fix-13642-regression-coverage
Jul 27, 2026
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9e6f12a
[java] Add regression coverage for relative locators on collapsed tabβ¦
MohabMohie 356b0de
[java] Serve the new collapsed-border relative-locator test page in sβ¦
MohabMohie 31b6870
Merge branch 'trunk' into fix-13642-regression-coverage
MohabMohie d931828
[java] Replace brittle full-string assertion in PageTest with invariaβ¦
MohabMohie ea01e62
[java] Fix indexOf ordering false-pass in PageTest
MohabMohie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
65 changes: 65 additions & 0 deletions
65
java/test/org/openqa/selenium/environment/webserver/PageTest.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| // Licensed to the Software Freedom Conservancy (SFC) under one | ||
| // or more contributor license agreements. See the NOTICE file | ||
| // distributed with this work for additional information | ||
| // regarding copyright ownership. The SFC licenses this file | ||
| // to you under the Apache License, Version 2.0 (the | ||
| // "License"); you may not use this file except in compliance | ||
| // with the License. You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, | ||
| // software distributed under the License is distributed on an | ||
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| // KIND, either express or implied. See the License for the | ||
| // specific language governing permissions and limitations | ||
| // under the License. | ||
|
|
||
| package org.openqa.selenium.environment.webserver; | ||
|
|
||
| import static org.assertj.core.api.Assertions.assertThat; | ||
|
|
||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| class PageTest { | ||
|
|
||
| @Test | ||
| void defaultToStringHasNoDoctypeAndMatchesLegacyShape() { | ||
| String page = | ||
| new Page().withTitle("Legacy").withScripts("var a = 1;").withStyles("body { }").toString(); | ||
|
|
||
| // No doctype: default output stays in quirks mode for backward compatibility. | ||
| assertThat(page).doesNotContain("<!DOCTYPE"); | ||
|
|
||
| // Legacy shape/ordering contract: <script>/<style> sit after </head> closes, not inside it. | ||
| // containsSubsequence asserts presence AND order together, so a missing "</head>" fails here | ||
| // instead of silently passing the way raw indexOf().isLessThan() would (both return -1). | ||
| assertThat(page).containsSubsequence("</head>", "<script"); | ||
| assertThat(page).containsSubsequence("</head>", "<style"); | ||
|
|
||
| // Key content is still present, in the expected tag order, without pinning incidental | ||
| // whitespace (e.g. the exact "<body >" spacing or the blank line for an empty body). | ||
| assertThat(page) | ||
| .contains("<title>Legacy</title>") | ||
| .contains("var a = 1;") | ||
| .contains("body { }") | ||
| .contains("<body") | ||
| .contains("</body>") | ||
| .contains("</html>"); | ||
| } | ||
|
|
||
| @Test | ||
| void withDoctypeEmitsStandardsModeShapeWithScriptAndStyleInsideHead() { | ||
| String page = | ||
| new Page() | ||
| .withDoctype() | ||
| .withTitle("Standards") | ||
| .withScripts("var a = 1;") | ||
| .withStyles("body { }") | ||
| .toString(); | ||
|
|
||
| assertThat(page).startsWith("<!DOCTYPE html>"); | ||
| assertThat(page.indexOf("</style>")).isLessThan(page.indexOf("</head>")); | ||
| assertThat(page.indexOf("</script>")).isLessThan(page.indexOf("</head>")); | ||
| } | ||
| } |
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
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.
Uh oh!
There was an error while loading. Please reload this page.