⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 285937 in webkit


Ignore:
Timestamp:
Nov 17, 2021, 10:50:01 AM (5 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by Tyler Wilcock <Tyler Wilcock> 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:
Location:
trunk/LayoutTests
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r285936 r285937  
     12021-11-17  Tyler Wilcock  <tyler_w@apple.com>
     2
     3        AX: Fix 5 tests in --release --accessibility-isolated-tree mode
     4        https://bugs.webkit.org/show_bug.cgi?id=233232
     5
     6        Reviewed by Chris Fleizach.
     7
     8        Fix all of these tests in --release --accessibility-isolated-tree
     9        mode by asynchronously waiting for document changes (when necessary).
     10        Some tests are changed to use accessibleElementById instead of
     11        element.focus() + accessibilityController.focusedElement for selecting
     12        elements in JS, as the former doesn't require asynchronous waiting for static elements.
     13
     14        * accessibility/add-children-pseudo-element-expected.txt:
     15        * accessibility/add-children-pseudo-element.html:
     16        * accessibility/aria-checkbox-checked.html:
     17        * accessibility/aria-checkbox-text.html:
     18        * accessibility/aria-toggle-button-with-title.html:
     19        * accessibility/auto-fill-types-expected.txt:
     20        * accessibility/auto-fill-types.html:
     21        * accessibility/ax-value-with-search-expected.txt:
     22        * accessibility/ax-value-with-search.html:
     23
    1242021-11-17  Dean Jackson  <dino@apple.com>
    225
  • trunk/LayoutTests/accessibility/add-children-pseudo-element-expected.txt

    r267644 r285937  
    1 Language Email
    21Make sure that we are updating the render block flow element's children correctly.
    32
     
    65
    76PASS element.childrenCount is 3
    8 PASS element.childrenCount is 2
     7PASS element.childrenCount === 2
    98PASS successfullyParsed is true
    109
  • trunk/LayoutTests/accessibility/add-children-pseudo-element.html

    r227151 r285937  
    22<html>
    33<head>
    4 <script src="../resources/js-test-pre.js"></script>
    5 </head>
    6 
     4<script src="../resources/js-test.js"></script>
     5<script src="../resources/accessibility-helper.js"></script>
    76<style>
    87.pseudo::after {
     
    1918}
    2019</style>
     20</head>
     21<body>
    2122
    22 <body id="body">
     23<div id="content">
     24  <div style="float: left;">
     25    <span>Language</span>
     26    <input>
     27  </div>
    2328
    24 <div id="container">
    25 <div id="test" style="float : left;">
    26 <span>Language</span>
    27 <input id="test">
     29  <div id="float" style="display: inline-block;" class="pseudo">
     30    <span required="" style="color: rgb(194, 0, 0);">Email</span>
     31    <input type="text" required="" aria-required="true" value="" onkeyup="hidePseudo();">
     32  </div>
    2833</div>
    29 
    30 <div id="float" style="display: inline-block;" class="pseudo">
    31 <span required="" style="color: rgb(194, 0, 0);">Email</span>
    32 <input type="text" required="" aria-required="true" value="" onkeyup="hidePseudo();">
    33 </div>
    34 
    35 </div>
    36 
    37 <p id="description"></p>
    38 <div id="console"></div>
    3934
    4035<script>
     
    4237    description("Make sure that we are updating the render block flow element's children correctly.");
    4338
    44     if (window.accessibilityController) {
    45         var element = accessibilityController.accessibleElementById("float");
    46         if (accessibilityController.platformName != "atk")
    47             shouldBe("element.childrenCount", "3");
    48         else
    49             shouldBe("element.childrenCount", "2");
    50        
    51         eventSender.keyDown('\t');
    52         eventSender.keyDown('\t');
    53        
    54         if (accessibilityController.platformName != "atk")
    55             shouldBe("element.childrenCount", "2");
    56         else
    57             shouldBe("element.childrenCount", "1");
    58         showPseudo();
    59        
    60         function hidePseudo() {
    61             document.getElementById("float").className += "hidden"
    62         }
    63        
    64         function showPseudo() {
    65             document.getElementById("float").className = "pseudo";
    66         }
    67                
    68         // Make sure getting the attributes of its children won't cause crash
    69         element.attributesOfChildren();
     39    function hidePseudo() {
     40        document.getElementById("float").className += "hidden"
    7041    }
    7142
     43    function showPseudo() {
     44        document.getElementById("float").className = "pseudo";
     45    }
     46
     47    if (window.accessibilityController) {
     48        window.jsTestIsAsync = true;
     49
     50        var element;
     51        setTimeout(async function() {
     52            element = accessibilityController.accessibleElementById("float");
     53            if (accessibilityController.platformName != "atk")
     54                shouldBe("element.childrenCount", "3");
     55            else
     56                shouldBe("element.childrenCount", "2");
     57
     58            eventSender.keyDown('\t');
     59            eventSender.keyDown('\t');
     60
     61            // Asynchronously wait for and verify the result of the onkeyup hidePseudo() invocation.
     62            if (accessibilityController.platformName != "atk")
     63                await expectAsyncExpression("element.childrenCount", "2");
     64            else
     65                await expectAsyncExpression("element.childrenCount", "1");
     66
     67            showPseudo();
     68
     69            // Make sure getting the attributes of its children won't cause crash.
     70            element.attributesOfChildren();
     71
     72            document.getElementById("content").style.visibility = "hidden";
     73
     74            finishJSTest();
     75        }, 0);
     76    }
    7277</script>
    73 
    74 <script src="../resources/js-test-post.js"></script>
    7578</body>
    7679</html>
     80
  • trunk/LayoutTests/accessibility/aria-checkbox-checked.html

    r155274 r285937  
    3636
    3737          for (var i = 0; i < answers.length; i++) {
    38                 var checkbox = document.getElementById(answers[i][0]);
    39                 checkbox.focus();
    40                 checkbox = accessibilityController.focusedElement;
     38                var checkbox = accessibilityController.accessibleElementById(answers[i][0]);
    4139                shouldBe("checkbox.isChecked", answers[i][1]);
    4240          }
  • trunk/LayoutTests/accessibility/aria-checkbox-text.html

    r155274 r285937  
    2020
    2121    if (window.accessibilityController) {
    22 
    23           var checkbox = document.getElementById("check1");
    24           checkbox.focus();
    25           checkbox = accessibilityController.focusedElement;
     22          var checkbox = accessibilityController.accessibleElementById("check1");
    2623          debug("checkbox.title is " + checkbox.title);
    2724
    28           checkbox = document.getElementById("check2");
    29           checkbox.focus();
    30           checkbox = accessibilityController.focusedElement;
     25          checkbox = accessibilityController.accessibleElementById("check2");
    3126          debug("checkbox.title is " + checkbox.title);
    3227
    33           checkbox = document.getElementById("check3");
    34           checkbox.focus();
    35           checkbox = accessibilityController.focusedElement;
     28          checkbox = accessibilityController.accessibleElementById("check3");
    3629          debug("checkbox.title is " + checkbox.title);
    3730    }
  • trunk/LayoutTests/accessibility/aria-toggle-button-with-title.html

    r182012 r285937  
    99  if (window.accessibilityController) {
    1010
    11     document.getElementById("tbutton").focus();
    12     tbutton1 = accessibilityController.focusedElement;
     11    tbutton1 = accessibilityController.accessibleElementById("tbutton");
    1312    debug("Role: " + tbutton1.role);
    1413    shouldBe("tbutton1.title", "'AXTitle: Toggle button'");
    1514
    16     document.getElementById("button").focus();
    17     button = accessibilityController.focusedElement;
     15    button = accessibilityController.accessibleElementById("button");
    1816    debug("Role: " + button.role);
    1917    shouldBe("button.title", "'AXTitle: Button title'");
  • trunk/LayoutTests/accessibility/auto-fill-types-expected.txt

    r238751 r285937  
    1 
    21This tests that the auto-filled buttons show up.
    32
  • trunk/LayoutTests/accessibility/auto-fill-types.html

    r225707 r285937  
    22<html>
    33<head>
    4 <meta charset="utf-8">
    5 <script src="../resources/js-test-pre.js"></script>
     4<script src="../resources/js-test.js"></script>
     5<script src="../resources/accessibility-helper.js"></script>
    66</head>
    7 <body id="body">
     7<body>
    88
    99<input type="text" value="hello" id="textfield">
    10 
    11 <p id="description"></p>
    12 <div id="console"></div>
    1310
    1411<script>
     
    1714
    1815    if (window.accessibilityController) {
    19         var textField = document.getElementById("textfield");
    20         var axTextField = accessibilityController.accessibleElementById("textfield");
    21         debug("Initial auto-fill available: " + axTextField.boolAttributeValue("AXValueAutofillAvailable"));
    22         debug("Auto-fill type: " + axTextField.stringAttributeValue("AXValueAutofillType"));
     16        window.jsTestIsAsync = true;
    2317
    24         window.internals.setShowAutoFillButton(document.getElementById("textfield"), "Contacts");
    25         var contactsButton = axTextField.childAtIndex(1);
    26         debug("Contact button role: " + contactsButton.role);
    27         debug("Contact button label: " + contactsButton.description);
    28         debug("Auto-fill type: " + axTextField.stringAttributeValue("AXValueAutofillType"));
     18        var textField, axTextField, contactsButton, credentialsButton;
     19        setTimeout(async function() {
     20            textField = document.getElementById("textfield");
     21            axTextField = accessibilityController.accessibleElementById("textfield");
     22            debug("Initial auto-fill available: " + axTextField.boolAttributeValue("AXValueAutofillAvailable"));
     23            debug("Auto-fill type: " + axTextField.stringAttributeValue("AXValueAutofillType"));
    2924
    30         window.internals.setShowAutoFillButton(document.getElementById("textfield"), "Credentials");
    31         var credentialsButton = axTextField.childAtIndex(1);
    32         debug("Credentials button role: " + credentialsButton.role);
    33         debug("Credentials button label: " + credentialsButton.description);
    34         debug("Auto-fill type: " + axTextField.stringAttributeValue("AXValueAutofillType"));
     25            window.internals.setShowAutoFillButton(document.getElementById("textfield"), "Contacts");
     26            // Wait for contacts autofill button to render.
     27            await waitFor(() => {
     28                contactsButton = axTextField.childAtIndex(1);
     29                return contactsButton && axTextField.stringAttributeValue("AXValueAutofillType") === "contacts";
     30            });
     31            debug("Contact button role: " + contactsButton.role);
     32            debug("Contact button label: " + contactsButton.description);
     33            debug("Auto-fill type: " + axTextField.stringAttributeValue("AXValueAutofillType"));
    3534
    36         debug("Post auto-fill available: " + axTextField.boolAttributeValue("AXValueAutofillAvailable"));
     35            window.internals.setShowAutoFillButton(document.getElementById("textfield"), "Credentials");
     36            // Wait for credentials autofill button to render.
     37            await waitFor(() => {
     38                credentialsButton = axTextField.childAtIndex(1);
     39                return credentialsButton && axTextField.stringAttributeValue("AXValueAutofillType") === "credentials";
     40            });
     41            debug("Credentials button role: " + credentialsButton.role);
     42            debug("Credentials button label: " + credentialsButton.description);
     43            debug("Auto-fill type: " + axTextField.stringAttributeValue("AXValueAutofillType"));
     44
     45            debug("Post auto-fill available: " + axTextField.boolAttributeValue("AXValueAutofillAvailable"));
     46
     47            finishJSTest();
     48        }, 0);
    3749    }
    38 
    3950</script>
    40 
    41 <script src="../resources/js-test-post.js"></script>
    4251</body>
    4352</html>
     53
  • trunk/LayoutTests/accessibility/ax-value-with-search-expected.txt

    r189862 r285937  
    1 
    21This tests that a search field is returns its accessibilityValue correctly.
    32
     
    54
    65
    7 PASS search.stringValue is 'AXValue: hello'
    8 PASS search.stringValue is 'AXValue: test'
     6PASS searchInput.stringValue is 'AXValue: hello'
     7PASS searchInput.stringValue === 'AXValue: test'
    98PASS successfullyParsed is true
    109
  • trunk/LayoutTests/accessibility/ax-value-with-search.html

    r189862 r285937  
    22<html>
    33<head>
    4 <script src="../resources/js-test-pre.js"></script>
     4<script src="../resources/js-test.js"></script>
     5<script src="../resources/accessibility-helper.js"></script>
    56</head>
    6 <body id="body">
     7<body>
    78
    8 <input type="search" value="hello" id="search">
    9 
    10 <p id="description"></p>
    11 <div id="console"></div>
     9<input type="search" value="hello" id="searchInput">
    1210
    1311<script>
     
    1614
    1715    if (window.accessibilityController) {
     16        window.jsTestIsAsync = true;
    1817
    19         var search = accessibilityController.accessibleElementById("search");
    20         shouldBe("search.stringValue", "'AXValue: hello'");
    21         document.getElementById('search').value = 'test';
    22         shouldBe("search.stringValue", "'AXValue: test'");
     18        var searchInput;
     19        setTimeout(async function() {
     20            searchInput = accessibilityController.accessibleElementById("searchInput");
     21            shouldBe("searchInput.stringValue", "'AXValue: hello'");
     22
     23            document.getElementById("searchInput").value = "test";
     24            await expectAsyncExpression("searchInput.stringValue", "'AXValue: test'");
     25
     26            finishJSTest();
     27        }, 0);
    2328    }
    24 
    2529</script>
    26 
    27 <script src="../resources/js-test-post.js"></script>
    2830</body>
    2931</html>
     32
Note: See TracChangeset for help on using the changeset viewer.