Title: [285937] trunk/LayoutTests
Revision
285937
Author
[email protected]
Date
2021-11-17 10:50:01 -0800 (Wed, 17 Nov 2021)

Log Message

AX: Fix 5 tests in --release --accessibility-isolated-tree mode
https://bugs.webkit.org/show_bug.cgi?id=233232

Patch by Tyler Wilcock <[email protected]> on 2021-11-17
Reviewed by Chris Fleizach.

Fix all of these tests in --release --accessibility-isolated-tree
mode by asynchronously waiting for document changes (when necessary).
Some tests are changed to use accessibleElementById instead of
element.focus() + accessibilityController.focusedElement for selecting
elements in JS, as the former doesn't require asynchronous waiting for static elements.

* accessibility/add-children-pseudo-element-expected.txt:
* accessibility/add-children-pseudo-element.html:
* accessibility/aria-checkbox-checked.html:
* accessibility/aria-checkbox-text.html:
* accessibility/aria-toggle-button-with-title.html:
* accessibility/auto-fill-types-expected.txt:
* accessibility/auto-fill-types.html:
* accessibility/ax-value-with-search-expected.txt:
* accessibility/ax-value-with-search.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (285936 => 285937)


--- trunk/LayoutTests/ChangeLog	2021-11-17 18:46:04 UTC (rev 285936)
+++ trunk/LayoutTests/ChangeLog	2021-11-17 18:50:01 UTC (rev 285937)
@@ -1,3 +1,26 @@
+2021-11-17  Tyler Wilcock  <[email protected]>
+
+        AX: Fix 5 tests in --release --accessibility-isolated-tree mode
+        https://bugs.webkit.org/show_bug.cgi?id=233232
+
+        Reviewed by Chris Fleizach.
+
+        Fix all of these tests in --release --accessibility-isolated-tree
+        mode by asynchronously waiting for document changes (when necessary).
+        Some tests are changed to use accessibleElementById instead of
+        element.focus() + accessibilityController.focusedElement for selecting
+        elements in JS, as the former doesn't require asynchronous waiting for static elements.
+
+        * accessibility/add-children-pseudo-element-expected.txt:
+        * accessibility/add-children-pseudo-element.html:
+        * accessibility/aria-checkbox-checked.html:
+        * accessibility/aria-checkbox-text.html:
+        * accessibility/aria-toggle-button-with-title.html:
+        * accessibility/auto-fill-types-expected.txt:
+        * accessibility/auto-fill-types.html:
+        * accessibility/ax-value-with-search-expected.txt:
+        * accessibility/ax-value-with-search.html:
+
 2021-11-17  Dean Jackson  <[email protected]>
 
         Add ModelDocument for directly showing content that can be handled by <model>

Modified: trunk/LayoutTests/accessibility/add-children-pseudo-element-expected.txt (285936 => 285937)


--- trunk/LayoutTests/accessibility/add-children-pseudo-element-expected.txt	2021-11-17 18:46:04 UTC (rev 285936)
+++ trunk/LayoutTests/accessibility/add-children-pseudo-element-expected.txt	2021-11-17 18:50:01 UTC (rev 285937)
@@ -1,4 +1,3 @@
-Language Email
 Make sure that we are updating the render block flow element's children correctly.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
@@ -5,7 +4,7 @@
 
 
 PASS element.childrenCount is 3
-PASS element.childrenCount is 2
+PASS element.childrenCount === 2
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/accessibility/add-children-pseudo-element.html (285936 => 285937)


--- trunk/LayoutTests/accessibility/add-children-pseudo-element.html	2021-11-17 18:46:04 UTC (rev 285936)
+++ trunk/LayoutTests/accessibility/add-children-pseudo-element.html	2021-11-17 18:50:01 UTC (rev 285937)
@@ -1,9 +1,8 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 <html>
 <head>
-<script src=""
-</head>
-
+<script src=""
+<script src=""
 <style>
 .pseudo::after {
   content: url(resources/svg-circle.svg);
@@ -18,59 +17,64 @@
     content: ' ';
 }
 </style>
+</head>
+<body>
 
-<body id="body">
+<div id="content">
+  <div style="float: left;">
+    <span>Language</span>
+    <input>
+  </div>
 
-<div id="container">
-<div id="test" style="float : left;">
-<span>Language</span>
-<input id="test">
+  <div id="float" style="display: inline-block;" class="pseudo">
+    <span required="" style="color: rgb(194, 0, 0);">Email</span>
+    <input type="text" required="" aria-required="true" value="" _onkeyup_="hidePseudo();">
+  </div>
 </div>
 
-<div id="float" style="display: inline-block;" class="pseudo">
-<span required="" style="color: rgb(194, 0, 0);">Email</span>
-<input type="text" required="" aria-required="true" value="" _onkeyup_="hidePseudo();">
-</div>
+<script>
 
-</div>
+    description("Make sure that we are updating the render block flow element's children correctly.");
 
-<p id="description"></p>
-<div id="console"></div>
+    function hidePseudo() {
+        document.getElementById("float").className += "hidden"
+    }
 
-<script>
+    function showPseudo() {
+        document.getElementById("float").className = "pseudo";
+    }
 
-    description("Make sure that we are updating the render block flow element's children correctly.");
+    if (window.accessibilityController) {
+        window.jsTestIsAsync = true;
 
-    if (window.accessibilityController) {
-        var element = accessibilityController.accessibleElementById("float");
-        if (accessibilityController.platformName != "atk")
-            shouldBe("element.childrenCount", "3");
-        else
-            shouldBe("element.childrenCount", "2");
-        
-        eventSender.keyDown('\t');
-        eventSender.keyDown('\t');
-        
-        if (accessibilityController.platformName != "atk")
-            shouldBe("element.childrenCount", "2");
-        else
-            shouldBe("element.childrenCount", "1");
-        showPseudo();
-        
-        function hidePseudo() {
-            document.getElementById("float").className += "hidden"
-        }
-        
-        function showPseudo() {
-            document.getElementById("float").className = "pseudo";
-        }
-                
-        // Make sure getting the attributes of its children won't cause crash
-        element.attributesOfChildren();
+        var element;
+        setTimeout(async function() {
+            element = accessibilityController.accessibleElementById("float");
+            if (accessibilityController.platformName != "atk")
+                shouldBe("element.childrenCount", "3");
+            else
+                shouldBe("element.childrenCount", "2");
+
+            eventSender.keyDown('\t');
+            eventSender.keyDown('\t');
+
+            // Asynchronously wait for and verify the result of the onkeyup hidePseudo() invocation.
+            if (accessibilityController.platformName != "atk")
+                await expectAsyncExpression("element.childrenCount", "2");
+            else
+                await expectAsyncExpression("element.childrenCount", "1");
+
+            showPseudo();
+
+            // Make sure getting the attributes of its children won't cause crash.
+            element.attributesOfChildren();
+
+            document.getElementById("content").style.visibility = "hidden";
+
+            finishJSTest();
+        }, 0);
     }
-
 </script>
-
-<script src=""
 </body>
 </html>
+

Modified: trunk/LayoutTests/accessibility/aria-checkbox-checked.html (285936 => 285937)


--- trunk/LayoutTests/accessibility/aria-checkbox-checked.html	2021-11-17 18:46:04 UTC (rev 285936)
+++ trunk/LayoutTests/accessibility/aria-checkbox-checked.html	2021-11-17 18:50:01 UTC (rev 285937)
@@ -35,9 +35,7 @@
                          [ "check8", "true" ]];
 
           for (var i = 0; i < answers.length; i++) {
-                var checkbox = document.getElementById(answers[i][0]);
-                checkbox.focus();
-                checkbox = accessibilityController.focusedElement;
+                var checkbox = accessibilityController.accessibleElementById(answers[i][0]);
                 shouldBe("checkbox.isChecked", answers[i][1]);
           }
     }

Modified: trunk/LayoutTests/accessibility/aria-checkbox-text.html (285936 => 285937)


--- trunk/LayoutTests/accessibility/aria-checkbox-text.html	2021-11-17 18:46:04 UTC (rev 285936)
+++ trunk/LayoutTests/accessibility/aria-checkbox-text.html	2021-11-17 18:50:01 UTC (rev 285937)
@@ -19,20 +19,13 @@
     description("This tests that ARIA checkboxes use accessible name computation.");
 
     if (window.accessibilityController) {
-
-          var checkbox = document.getElementById("check1");
-          checkbox.focus();
-          checkbox = accessibilityController.focusedElement;
+          var checkbox = accessibilityController.accessibleElementById("check1");
           debug("checkbox.title is " + checkbox.title);
 
-          checkbox = document.getElementById("check2");
-          checkbox.focus();
-          checkbox = accessibilityController.focusedElement;
+          checkbox = accessibilityController.accessibleElementById("check2");
           debug("checkbox.title is " + checkbox.title);
 
-          checkbox = document.getElementById("check3");
-          checkbox.focus();
-          checkbox = accessibilityController.focusedElement;
+          checkbox = accessibilityController.accessibleElementById("check3");
           debug("checkbox.title is " + checkbox.title);
     }
 

Modified: trunk/LayoutTests/accessibility/aria-toggle-button-with-title.html (285936 => 285937)


--- trunk/LayoutTests/accessibility/aria-toggle-button-with-title.html	2021-11-17 18:46:04 UTC (rev 285936)
+++ trunk/LayoutTests/accessibility/aria-toggle-button-with-title.html	2021-11-17 18:50:01 UTC (rev 285937)
@@ -8,13 +8,11 @@
 {
   if (window.accessibilityController) {
 
-    document.getElementById("tbutton").focus();
-    tbutton1 = accessibilityController.focusedElement;
+    tbutton1 = accessibilityController.accessibleElementById("tbutton");
     debug("Role: " + tbutton1.role);
     shouldBe("tbutton1.title", "'AXTitle: Toggle button'");
 
-    document.getElementById("button").focus();
-    button = accessibilityController.focusedElement;
+    button = accessibilityController.accessibleElementById("button");
     debug("Role: " + button.role);
     shouldBe("button.title", "'AXTitle: Button title'");
   }

Modified: trunk/LayoutTests/accessibility/auto-fill-types-expected.txt (285936 => 285937)


--- trunk/LayoutTests/accessibility/auto-fill-types-expected.txt	2021-11-17 18:46:04 UTC (rev 285936)
+++ trunk/LayoutTests/accessibility/auto-fill-types-expected.txt	2021-11-17 18:50:01 UTC (rev 285937)
@@ -1,4 +1,3 @@
-
 This tests that the auto-filled buttons show up.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".

Modified: trunk/LayoutTests/accessibility/auto-fill-types.html (285936 => 285937)


--- trunk/LayoutTests/accessibility/auto-fill-types.html	2021-11-17 18:46:04 UTC (rev 285936)
+++ trunk/LayoutTests/accessibility/auto-fill-types.html	2021-11-17 18:50:01 UTC (rev 285937)
@@ -1,43 +1,53 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 <html>
 <head>
-<meta charset="utf-8">
-<script src=""
+<script src=""
+<script src=""
 </head>
-<body id="body">
+<body>
 
 <input type="text" value="hello" id="textfield">
 
-<p id="description"></p>
-<div id="console"></div>
-
 <script>
 
     description("This tests that the auto-filled buttons show up.");
 
     if (window.accessibilityController) {
-        var textField = document.getElementById("textfield");
-        var axTextField = accessibilityController.accessibleElementById("textfield");
-        debug("Initial auto-fill available: " + axTextField.boolAttributeValue("AXValueAutofillAvailable"));
-        debug("Auto-fill type: " + axTextField.stringAttributeValue("AXValueAutofillType"));
+        window.jsTestIsAsync = true;
 
-        window.internals.setShowAutoFillButton(document.getElementById("textfield"), "Contacts");
-        var contactsButton = axTextField.childAtIndex(1);
-        debug("Contact button role: " + contactsButton.role);
-        debug("Contact button label: " + contactsButton.description);
-        debug("Auto-fill type: " + axTextField.stringAttributeValue("AXValueAutofillType"));
+        var textField, axTextField, contactsButton, credentialsButton;
+        setTimeout(async function() {
+            textField = document.getElementById("textfield");
+            axTextField = accessibilityController.accessibleElementById("textfield");
+            debug("Initial auto-fill available: " + axTextField.boolAttributeValue("AXValueAutofillAvailable"));
+            debug("Auto-fill type: " + axTextField.stringAttributeValue("AXValueAutofillType"));
 
-        window.internals.setShowAutoFillButton(document.getElementById("textfield"), "Credentials");
-        var credentialsButton = axTextField.childAtIndex(1);
-        debug("Credentials button role: " + credentialsButton.role);
-        debug("Credentials button label: " + credentialsButton.description);
-        debug("Auto-fill type: " + axTextField.stringAttributeValue("AXValueAutofillType"));
+            window.internals.setShowAutoFillButton(document.getElementById("textfield"), "Contacts");
+            // Wait for contacts autofill button to render.
+            await waitFor(() => {
+                contactsButton = axTextField.childAtIndex(1);
+                return contactsButton && axTextField.stringAttributeValue("AXValueAutofillType") === "contacts";
+            });
+            debug("Contact button role: " + contactsButton.role);
+            debug("Contact button label: " + contactsButton.description);
+            debug("Auto-fill type: " + axTextField.stringAttributeValue("AXValueAutofillType"));
 
-        debug("Post auto-fill available: " + axTextField.boolAttributeValue("AXValueAutofillAvailable"));
+            window.internals.setShowAutoFillButton(document.getElementById("textfield"), "Credentials");
+            // Wait for credentials autofill button to render.
+            await waitFor(() => {
+                credentialsButton = axTextField.childAtIndex(1);
+                return credentialsButton && axTextField.stringAttributeValue("AXValueAutofillType") === "credentials";
+            });
+            debug("Credentials button role: " + credentialsButton.role);
+            debug("Credentials button label: " + credentialsButton.description);
+            debug("Auto-fill type: " + axTextField.stringAttributeValue("AXValueAutofillType"));
+
+            debug("Post auto-fill available: " + axTextField.boolAttributeValue("AXValueAutofillAvailable"));
+
+            finishJSTest();
+        }, 0);
     }
-
 </script>
-
-<script src=""
 </body>
 </html>
+

Modified: trunk/LayoutTests/accessibility/ax-value-with-search-expected.txt (285936 => 285937)


--- trunk/LayoutTests/accessibility/ax-value-with-search-expected.txt	2021-11-17 18:46:04 UTC (rev 285936)
+++ trunk/LayoutTests/accessibility/ax-value-with-search-expected.txt	2021-11-17 18:50:01 UTC (rev 285937)
@@ -1,11 +1,10 @@
-
 This tests that a search field is returns its accessibilityValue correctly.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS search.stringValue is 'AXValue: hello'
-PASS search.stringValue is 'AXValue: test'
+PASS searchInput.stringValue is 'AXValue: hello'
+PASS searchInput.stringValue === 'AXValue: test'
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/accessibility/ax-value-with-search.html (285936 => 285937)


--- trunk/LayoutTests/accessibility/ax-value-with-search.html	2021-11-17 18:46:04 UTC (rev 285936)
+++ trunk/LayoutTests/accessibility/ax-value-with-search.html	2021-11-17 18:50:01 UTC (rev 285937)
@@ -1,29 +1,32 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 <html>
 <head>
-<script src=""
+<script src=""
+<script src=""
 </head>
-<body id="body">
+<body>
 
-<input type="search" value="hello" id="search">
+<input type="search" value="hello" id="searchInput">
 
-<p id="description"></p>
-<div id="console"></div>
-
 <script>
 
     description("This tests that a search field is returns its accessibilityValue correctly.");
 
     if (window.accessibilityController) {
+        window.jsTestIsAsync = true;
 
-        var search = accessibilityController.accessibleElementById("search");
-        shouldBe("search.stringValue", "'AXValue: hello'");
-        document.getElementById('search').value = 'test';
-        shouldBe("search.stringValue", "'AXValue: test'");
+        var searchInput;
+        setTimeout(async function() {
+            searchInput = accessibilityController.accessibleElementById("searchInput");
+            shouldBe("searchInput.stringValue", "'AXValue: hello'");
+
+            document.getElementById("searchInput").value = "test";
+            await expectAsyncExpression("searchInput.stringValue", "'AXValue: test'");
+
+            finishJSTest();
+        }, 0);
     }
-
 </script>
-
-<script src=""
 </body>
 </html>
+
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to