Title: [285924] trunk/LayoutTests
Revision
285924
Author
[email protected]
Date
2021-11-17 04:50:39 -0800 (Wed, 17 Nov 2021)

Log Message

Fix for accessibility/notification-listeners.html in isolated tree mode.
https://bugs.webkit.org/show_bug.cgi?id=233228
<rdar://problem/85484341>

Reviewed by Chris Fleizach.

Made this test async in order to pass in isolated tree mode.
The first accessible element needs to be retrieved with waitForElementById,
otherwise if we use accessibilityController.accessibleElementById, the
test would fail randomly (~10 out of 1000 flakiness). It requires
further investigation to determine if this is an issue with the <select>
element or with the first accessible element the test retrieves.

* accessibility/notification-listeners.html:
* platform/mac/accessibility/notification-listeners-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (285923 => 285924)


--- trunk/LayoutTests/ChangeLog	2021-11-17 12:31:09 UTC (rev 285923)
+++ trunk/LayoutTests/ChangeLog	2021-11-17 12:50:39 UTC (rev 285924)
@@ -1,3 +1,21 @@
+2021-11-17  Andres Gonzalez  <[email protected]>
+
+        Fix for accessibility/notification-listeners.html in isolated tree mode.
+        https://bugs.webkit.org/show_bug.cgi?id=233228
+        <rdar://problem/85484341>
+
+        Reviewed by Chris Fleizach.
+
+        Made this test async in order to pass in isolated tree mode.
+        The first accessible element needs to be retrieved with waitForElementById,
+        otherwise if we use accessibilityController.accessibleElementById, the
+        test would fail randomly (~10 out of 1000 flakiness). It requires
+        further investigation to determine if this is an issue with the <select>
+        element or with the first accessible element the test retrieves.
+
+        * accessibility/notification-listeners.html:
+        * platform/mac/accessibility/notification-listeners-expected.txt:
+
 2021-11-17  Rob Buis  <[email protected]>
 
         Limit logical width over-constrained direction check

Modified: trunk/LayoutTests/accessibility/notification-listeners.html (285923 => 285924)


--- trunk/LayoutTests/accessibility/notification-listeners.html	2021-11-17 12:31:09 UTC (rev 285923)
+++ trunk/LayoutTests/accessibility/notification-listeners.html	2021-11-17 12:50:39 UTC (rev 285924)
@@ -1,79 +1,60 @@
 <html>
 <head>
-<script src=""
+<script src=""
+<script src=""
 </head>
 <body>
 
-<p id="description"></p>
-
 <select id="select" value="Select"></select>
 
 <div id="slider" tabindex="0" role="slider" aria-valuenow="5">Slider</div>
 
-<div id="console"></div>
-
 <script>
-description("This tests that a notification listener on an element only listens to that one element, and that a global notification listener listens to all notifications.");
+    description("This tests that a notification listener on an element only listens to that one element, and that a global notification listener listens to all notifications.");
 
-function runTest() {
-    window.jsTestIsAsync = true;
+    if (window.accessibilityController) {
+        window.jsTestIsAsync = true;
 
-    window.selectNotificationCount = 0;
-    window.sliderNotificationCount = 0;
-    window.globalNotificationCount = 0;
+        setTimeout(async () => {
+            window.selectNotificationCount = 0;
+            window.sliderNotificationCount = 0;
+            window.globalNotificationCount = 0;
 
-    if (window.accessibilityController) {
-        document.getElementById("select").focus();
-        window.select = accessibilityController.focusedElement;
-        select.addNotificationListener(function(notification) {
-            selectNotificationCount++;
-            debug("SELECT " + notification);
-        });
+            let select = await waitForElementById("select");
+            select.addNotificationListener((notification) => {
+                selectNotificationCount++;
+                debug(`SELECT ${notification}`);
+            });
 
-        document.getElementById("slider").focus();
-        window.slider = accessibilityController.focusedElement;
-        slider.addNotificationListener(function(notification) {
-            sliderNotificationCount++;
-            debug("SLIDER " + notification);
-        });
+            let slider = accessibilityController.accessibleElementById("slider");
+            slider.addNotificationListener((notification) => {
+                sliderNotificationCount++;
+                debug(`SLIDER ${notification}`);
+            });
 
-        accessibilityController.addNotificationListener(function(element, notification) {
-            if (element.isEqual(slider) || element.isEqual(select)) {
-                globalNotificationCount++;
-                debug("GLOBAL " + notification + " on element with role " + element.role);
-            }
-        });
-    }
+            accessibilityController.addNotificationListener((element, notification) => {
+                if (element.isEqual(slider) || element.isEqual(select)) {
+                    globalNotificationCount++;
+                    debug(`GLOBAL ${notification} on element with role ${element.role}`);
+                }
+            });
 
-    // Ensure these elements exist in the AX tree otherwise notifications won't be generated.
-    accessibilityController.accessibleElementById("select");
-    accessibilityController.accessibleElementById("slider");
+            // This should trigger a "invalid status changed" notification on the select.
+            document.getElementById("select").setAttribute("aria-invalid", "true");
+            await expectAsyncExpression("selectNotificationCount", 1);
 
-    // This should trigger a "invalid status changed" notification on the select.
-    document.getElementById("select").setAttribute("aria-invalid", "true");
+            // This should trigger a "value changed" notification on the slider.
+            document.getElementById("slider").setAttribute("aria-valuenow", "6");
+            await expectAsyncExpression("sliderNotificationCount", 1);
 
-    // This should trigger a "value changed" notification on the slider.
-    document.getElementById("slider").setAttribute("aria-valuenow", "6");
+            await expectAsyncExpression("globalNotificationCount", 2);
 
-    window.setTimeout(function() {
-        shouldBe("selectNotificationCount", "1");
-        shouldBe("sliderNotificationCount", "1");
-        shouldBe("globalNotificationCount", "2");
-
-        if (window.accessibilityController) {
             accessibilityController.removeNotificationListener();
             select.removeNotificationListener();
             slider.removeNotificationListener();
-        }
-
-        finishJSTest();
-    }, 10);
-}
-
-runTest();
-
+            finishJSTest();
+        }, 0);
+    }
 </script>
-
-<script src=""
 </body>
 </html>

Modified: trunk/LayoutTests/platform/mac/accessibility/notification-listeners-expected.txt (285923 => 285924)


--- trunk/LayoutTests/platform/mac/accessibility/notification-listeners-expected.txt	2021-11-17 12:31:09 UTC (rev 285923)
+++ trunk/LayoutTests/platform/mac/accessibility/notification-listeners-expected.txt	2021-11-17 12:50:39 UTC (rev 285924)
@@ -3,16 +3,15 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-
-Slider
 SELECT AXInvalidStatusChanged
 GLOBAL AXInvalidStatusChanged on element with role AXRole: AXPopUpButton
+PASS selectNotificationCount === 1
 SLIDER AXValueChanged
 GLOBAL AXValueChanged on element with role AXRole: AXSlider
-PASS selectNotificationCount is 1
-PASS sliderNotificationCount is 1
-PASS globalNotificationCount is 2
+PASS sliderNotificationCount === 1
+PASS globalNotificationCount === 2
 PASS successfullyParsed is true
 
 TEST COMPLETE
 
+Slider
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to