This is an automated email from the ASF dual-hosted git repository.
snoopdave pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/roller.git
The following commit(s) were added to refs/heads/master by this push:
new b258b18ae Wait for the advanced settings to open before checking the
publishing time layout (#230)
b258b18ae is described below
commit b258b18ae3c9b1185e52cb49c540b98ffa36a055
Author: David M. Johnson <[email protected]>
AuthorDate: Sat Oct 31 14:17:53 2026 -0400
Wait for the advanced settings to open before checking the publishing time
layout (#230)
* Wait for the advanced settings to open before checking the publishing
time layout
The check read the three select positions one at a time right after the
panel became visible, while its collapse animation could still move them.
Wait for shown.bs.collapse and read all three positions in one evaluate.
* Check the publishing time selects are visible before measuring them
---
.../java/org/apache/roller/playwright/BaseIT.java | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git
a/it-playwright/src/test/java/org/apache/roller/playwright/BaseIT.java
b/it-playwright/src/test/java/org/apache/roller/playwright/BaseIT.java
index 158f70f20..4f0584670 100644
--- a/it-playwright/src/test/java/org/apache/roller/playwright/BaseIT.java
+++ b/it-playwright/src/test/java/org/apache/roller/playwright/BaseIT.java
@@ -21,6 +21,7 @@ import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
+import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -349,11 +350,23 @@ abstract class BaseIT {
* stacked form rows.
*/
protected void assertPublishingTimeOnOneLine() {
+ // Wait for the collapse animation to end, then read all three
positions
+ // in one pass so the panel or page cannot move between readings.
+ page.evaluate("() =>
document.querySelector('#collapseAdvanced').addEventListener('shown.bs.collapse',"
+ + " () => window.rollerAdvancedShown = true, {once: true})");
page.locator("a[href='#collapseAdvanced']").click();
+ page.waitForFunction("() => window.rollerAdvancedShown === true");
assertThat(page.locator("#collapseAdvanced")).isVisible();
- double hours =
page.locator("select[name='bean.hours']").boundingBox().y;
- double minutes =
page.locator("select[name='bean.minutes']").boundingBox().y;
- double seconds =
page.locator("select[name='bean.seconds']").boundingBox().y;
+ // a hidden select reports top 0, so make sure all three are shown
+ for (String field : List.of("hours", "minutes", "seconds")) {
+ assertThat(page.locator("select[name='bean." + field +
"']")).isVisible();
+ }
+ @SuppressWarnings("unchecked")
+ List<Number> tops = (List<Number>) page.evaluate("() => ['hours',
'minutes', 'seconds'].map(n =>"
+ + "
document.querySelector(`select[name='bean.${n}']`).getBoundingClientRect().top)");
+ double hours = tops.get(0).doubleValue();
+ double minutes = tops.get(1).doubleValue();
+ double seconds = tops.get(2).doubleValue();
org.junit.jupiter.api.Assertions.assertTrue(
Math.abs(hours - minutes) < 2 && Math.abs(minutes - seconds) <
2,
"publishing time selects should share a line, but sit at y=" +
hours + ", " + minutes + ", " + seconds);