This is an automated email from the ASF dual-hosted git repository.

snoopdave pushed a commit to branch ui-test-publish-time-wait
in repository https://gitbox.apache.org/repos/asf/roller.git

commit 88009dbfc04fe1217da853baa38a18a7d4b899ae
Author: David M. Johnson <[email protected]>
AuthorDate: Wed Oct 28 22:38:26 2026 -0400

    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.
---
 .../test/java/org/apache/roller/playwright/BaseIT.java    | 15 ++++++++++++---
 1 file changed, 12 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..cd78d00c7 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,19 @@ 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;
+        @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);

Reply via email to