Title: [285778] trunk/LayoutTests
Revision
285778
Author
commit-qu...@webkit.org
Date
2021-11-13 13:57:32 -0800 (Sat, 13 Nov 2021)

Log Message

AX: Make 7 more layout tests async so that they pass in --release --accessibility-isolated-tree mode
https://bugs.webkit.org/show_bug.cgi?id=233085

Patch by Tyler Wilcock <tyle...@apple.com> on 2021-11-13
Reviewed by Chris Fleizach.

This patch makes 7 more tests async so that they pass in --release
--accessibility-isolated-tree mode. This patch also adds some helper
functions to accessibility-helper.js.

* accessibility/ancestor-computation.html:
Move `waitForElement` to accessibility-helpers.js and rename to
`waitForElementById`.

* accessibility/color-well-expected.txt:
* accessibility/color-well.html:
* accessibility/mac/scrollbars.html:
* accessibility/placeholder-expected.txt:
* accessibility/placeholder.html:
* accessibility/progressbar-expected.txt:
* accessibility/progressbar.html:
* accessibility/range-alter-by-percent-expected.txt:
* accessibility/range-alter-by-percent.html:
* accessibility/range-alter-by-step-expected.txt:
* accessibility/range-alter-by-step.html:
* accessibility/spinbutton-value-expected.txt:
* accessibility/spinbutton-value.html:
Make tests async so they pass in isolated tree mode.
Minor updates to expectations:
  - Some variables renamed for better readability
  - Sometimes there is one more or one less newline after the test rewrites

* resources/accessibility-helper.js:
(async waitForElementById): Added. Originally defined in
accessibility/ancestor-computation.html.
(async waitForExpression): Added.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (285777 => 285778)


--- trunk/LayoutTests/ChangeLog	2021-11-13 18:49:16 UTC (rev 285777)
+++ trunk/LayoutTests/ChangeLog	2021-11-13 21:57:32 UTC (rev 285778)
@@ -1,5 +1,43 @@
 2021-11-13  Tyler Wilcock  <tyle...@apple.com>
 
+        AX: Make 7 more layout tests async so that they pass in --release --accessibility-isolated-tree mode
+        https://bugs.webkit.org/show_bug.cgi?id=233085
+
+        Reviewed by Chris Fleizach.
+
+        This patch makes 7 more tests async so that they pass in --release
+        --accessibility-isolated-tree mode. This patch also adds some helper
+        functions to accessibility-helper.js.
+
+        * accessibility/ancestor-computation.html:
+        Move `waitForElement` to accessibility-helpers.js and rename to
+        `waitForElementById`.
+
+        * accessibility/color-well-expected.txt:
+        * accessibility/color-well.html:
+        * accessibility/mac/scrollbars.html:
+        * accessibility/placeholder-expected.txt:
+        * accessibility/placeholder.html:
+        * accessibility/progressbar-expected.txt:
+        * accessibility/progressbar.html:
+        * accessibility/range-alter-by-percent-expected.txt:
+        * accessibility/range-alter-by-percent.html:
+        * accessibility/range-alter-by-step-expected.txt:
+        * accessibility/range-alter-by-step.html:
+        * accessibility/spinbutton-value-expected.txt:
+        * accessibility/spinbutton-value.html:
+        Make tests async so they pass in isolated tree mode.
+        Minor updates to expectations:
+          - Some variables renamed for better readability
+          - Sometimes there is one more or one less newline after the test rewrites
+
+        * resources/accessibility-helper.js:
+        (async waitForElementById): Added. Originally defined in
+        accessibility/ancestor-computation.html.
+        (async waitForExpression): Added.
+
+2021-11-13  Tyler Wilcock  <tyle...@apple.com>
+
         AX: Make accessibility/mac/header.html test async to fix it for isolated tree mode
         https://bugs.webkit.org/show_bug.cgi?id=233017
 

Modified: trunk/LayoutTests/accessibility/ancestor-computation.html (285777 => 285778)


--- trunk/LayoutTests/accessibility/ancestor-computation.html	2021-11-13 18:49:16 UTC (rev 285777)
+++ trunk/LayoutTests/accessibility/ancestor-computation.html	2021-11-13 21:57:32 UTC (rev 285778)
@@ -53,19 +53,10 @@
     description("This test ensures accessibility elements properly track their ancestor types.");
     var element;
 
-    async function waitForElement(id) {
-        let returnElement;
-        await waitFor(() => {
-            returnElement = accessibilityController.accessibleElementById(id);
-            return returnElement;
-        });
-        return returnElement;
-    }
-
     async function shouldBeForAllDescendants(startElementId, expectedPropertyValues) {
         debug(`Verifying ${JSON.stringify(expectedPropertyValues)} for all descendants of ${startElementId}.`);
 
-        let elementsToCheck = [await waitForElement(startElementId)];
+        let elementsToCheck = [await waitForElementById(startElementId)];
         while (elementsToCheck.length) {
             element = elementsToCheck.pop();
             if (!element)

Modified: trunk/LayoutTests/accessibility/color-well-expected.txt (285777 => 285778)


--- trunk/LayoutTests/accessibility/color-well-expected.txt	2021-11-13 18:49:16 UTC (rev 285777)
+++ trunk/LayoutTests/accessibility/color-well-expected.txt	2021-11-13 21:57:32 UTC (rev 285778)
@@ -1,4 +1,3 @@
-
 This test checks the role of ColorWellRolean input with type=color
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".

Modified: trunk/LayoutTests/accessibility/color-well.html (285777 => 285778)


--- trunk/LayoutTests/accessibility/color-well.html	2021-11-13 18:49:16 UTC (rev 285777)
+++ trunk/LayoutTests/accessibility/color-well.html	2021-11-13 21:57:32 UTC (rev 285778)
@@ -1,38 +1,36 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 <html>
-<html>
 <head>
-<script src=""
+<script src=""
+<script src=""
 </head>
-<body id="body">
+<body>
 
-    <input id="empty_colorwell" type="color">
-    <input id="good_colorwell" type="color" value="#ff0000">
-    <input id="bad_colorwell" type="color" value="purple">
+<input id="empty_colorwell" type="color">
+<input id="good_colorwell" type="color" value="#ff0000">
+<input id="bad_colorwell" type="color" value="purple">
     
-    <p id="description"></p>
-    <div id="console"></div>
-     
-    <script>
-        if (window.accessibilityController) {
-            description("This test checks the role of ColorWellRolean input with type=color");
+<script>
+    description("This test checks the role of ColorWellRolean input with type=color");
 
-            var colorwell = document.getElementById("empty_colorwell").focus();
-            var axColorwell = accessibilityController.focusedElement;
+    if (window.accessibilityController) {
+        window.jsTestIsAsync = true;
+
+        setTimeout(async function() {
+            let axColorwell = await waitForElementById("empty_colorwell");
             debug("Role of input type=color is: " + axColorwell.role);
-
             debug("Value of empty color well: " + axColorwell.stringValue);
 
-            colorwell = document.getElementById("good_colorwell").focus();
-            axColorwell = accessibilityController.focusedElement;
+            axColorwell = await waitForElementById("good_colorwell");
             debug("Value of good color well: " + axColorwell.stringValue);
 
-            colorwell = document.getElementById("bad_colorwell").focus();
-            axColorwell = accessibilityController.focusedElement;
+            axColorwell = await waitForElementById("bad_colorwell");
             debug("Value of bad color well: " + axColorwell.stringValue);
-        }
-    </script>
 
-<script src=""
+            finishJSTest();
+        }, 0);
+    }
+</script>
+</body>
+</html>
 
-</body> 
-</html>

Modified: trunk/LayoutTests/accessibility/mac/scrollbars.html (285777 => 285778)


--- trunk/LayoutTests/accessibility/mac/scrollbars.html	2021-11-13 18:49:16 UTC (rev 285777)
+++ trunk/LayoutTests/accessibility/mac/scrollbars.html	2021-11-13 21:57:32 UTC (rev 285778)
@@ -1,44 +1,43 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 <html>
 <head>
-<script>
-var successfullyParsed = false;
-</script>
-<script src=""
+<script src=""
+<script src=""
 </head>
-<body id="body" tabindex="0">
+<body id="body" role="group">
 
-<p id="description"></p>
-<div id="console"></div>
-
-<div role="textbox" id="iframeGroup"></div>
-
 <script>
-
     description("This tests that a scroll area will return scroll bars when asked.");
 
-   if (window.accessibilityController) {
-        document.getElementById("body").focus();
-        var body = accessibilityController.focusedElement;
-    }
-
     // Cause the web page to gain scrollbars.
     for (var k = 0; k < 100; k++) {
        document.getElementById("body").innerHTML += "<br><br><br>";
     }
 
-     if (window.accessibilityController) {
-          document.getElementById("body").focus();
-          var body = accessibilityController.focusedElement;
+    var scrollArea;
+    if (window.accessibilityController) {
+        window.jsTestIsAsync = true;
 
-          var scrollArea = body.parentElement();
-          shouldBe("scrollArea.role", "'AXRole: AXScrollArea'");
-          shouldBe("scrollArea.verticalScrollbar.role", "'AXRole: AXScrollBar'");
+        setTimeout(async function() {
+            // Iterate up from the body AX element to the scrollarea AX element.
+            let maybeScrollArea = (await waitForElementById("body")).parentElement();
+            await waitFor(() => {
+                if (maybeScrollArea && maybeScrollArea.role === "AXRole: AXScrollArea") {
+                    scrollArea = maybeScrollArea;
+                    return true;
+                }
+
+                maybeScrollArea = maybeScrollArea.parentElement();
+                return false;
+            });
+
+            shouldBe("scrollArea.role", "'AXRole: AXScrollArea'");
+            shouldBe("scrollArea.verticalScrollbar.role", "'AXRole: AXScrollBar'");
+
+            finishJSTest();
+        }, 0);
     }
-
-    successfullyParsed = true;
 </script>
-
-<script src=""
 </body>
 </html>
+

Modified: trunk/LayoutTests/accessibility/placeholder-expected.txt (285777 => 285778)


--- trunk/LayoutTests/accessibility/placeholder-expected.txt	2021-11-13 18:49:16 UTC (rev 285777)
+++ trunk/LayoutTests/accessibility/placeholder-expected.txt	2021-11-13 21:57:32 UTC (rev 285778)
@@ -1,6 +1,3 @@
-   Birthday:
-03-14-1879
-
 This test makes sure that the placeholder is returned as the correct attribute
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
@@ -7,10 +4,12 @@
 
 
 PASS fieldElement.stringAttributeValue('AXPlaceholderValue') is 'search'
-PASS pass.stringAttributeValue('AXPlaceholderValue') is 'Password'
-PASS search.stringAttributeValue('AXPlaceholderValue') is 'MM-DD-YYYY'
-PASS input.stringAttributeValue('AXPlaceholderValue') is 'Fill in the blank'
+PASS passwordElement.stringAttributeValue('AXPlaceholderValue') is 'Password'
+PASS searchElement.stringAttributeValue('AXPlaceholderValue') is 'MM-DD-YYYY'
+PASS textInput.stringAttributeValue('AXPlaceholderValue') is 'Fill in the blank'
 PASS successfullyParsed is true
 
 TEST COMPLETE
+   Birthday:
+03-14-1879
 

Modified: trunk/LayoutTests/accessibility/placeholder.html (285777 => 285778)


--- trunk/LayoutTests/accessibility/placeholder.html	2021-11-13 18:49:16 UTC (rev 285777)
+++ trunk/LayoutTests/accessibility/placeholder.html	2021-11-13 21:57:32 UTC (rev 285778)
@@ -1,44 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 <html>
-<html>
 <head>
-<script src=""
+<script src=""
+<script src=""
 </head>
-<body id="body">
- 
-    <input placeholder="search" type="text" name="q" size="15" maxlength="255" id="searchterm" />
+<body>
 
-    <input id="password" class="field" type="password" name="sc1798" value="" placeholder="Password" spellcheck="true" maxlength="5096">
+<input placeholder="search" type="text" name="q" size="15" maxlength="255" id="searchterm" />
+
+<input id="password" class="field" type="password" name="sc1798" value="" placeholder="Password" spellcheck="true" maxlength="5096">
+
+<span id="label">Birthday:</span>
+<div id="search" role="searchbox" aria-labelledby="label" aria-placeholder="MM-DD-YYYY">03-14-1879</div>
+
+<input type="text" id="input" placeholder="Fill in the blank" aria-placeholder="aria placeholder">
     
-    <span id="label">Birthday:</span>
-    <div id="search" role="searchbox" aria-labelledby="label" aria-placeholder="MM-DD-YYYY">03-14-1879</div>
-    
-    <input type="text" id="input" placeholder="Fill in the blank" aria-placeholder="aria placeholder">
-    
-    <p id="description"></p>
-    <div id="console"></div>
-     
-    <script>
-        if (window.accessibilityController) {
-            description("This test makes sure that the placeholder is returned as the correct attribute");
+<script>
+    description("This test makes sure that the placeholder is returned as the correct attribute");
 
-            var field = document.getElementById("searchterm").focus();
-            var fieldElement = accessibilityController.focusedElement;
+    var fieldElement, passwordElement, searchElement, textInput;
+    if (window.accessibilityController) {
+        window.jsTestIsAsync = true;
+
+        setTimeout(async function() {
+            fieldElement = await waitForElementById("searchterm");
             shouldBe("fieldElement.stringAttributeValue('AXPlaceholderValue')", "'search'");
 
-            document.getElementById("password").focus();
-            var pass = accessibilityController.focusedElement;
-            shouldBe("pass.stringAttributeValue('AXPlaceholderValue')", "'Password'");
+            passwordElement = await waitForElementById("password");
+            shouldBe("passwordElement.stringAttributeValue('AXPlaceholderValue')", "'Password'");
             
-            var search = accessibilityController.accessibleElementById("search");
-            shouldBe("search.stringAttributeValue('AXPlaceholderValue')", "'MM-DD-YYYY'");
+            searchElement = await waitForElementById("search");
+            shouldBe("searchElement.stringAttributeValue('AXPlaceholderValue')", "'MM-DD-YYYY'");
             
             // When the placeholder and aria-placeholder attributes are both present, use the placeholder
             // attribute's value.
-            var input = accessibilityController.accessibleElementById("input");
-            shouldBe("input.stringAttributeValue('AXPlaceholderValue')", "'Fill in the blank'");
-        }
-    </script>
+            textInput = await waitForElementById("input");
+            shouldBe("textInput.stringAttributeValue('AXPlaceholderValue')", "'Fill in the blank'");
 
-<script src=""
+            finishJSTest();
+        }, 0);
+    }
+</script>
 </body>
-</html>
\ No newline at end of file
+</html>
+

Modified: trunk/LayoutTests/accessibility/progressbar-expected.txt (285777 => 285778)


--- trunk/LayoutTests/accessibility/progressbar-expected.txt	2021-11-13 18:49:16 UTC (rev 285777)
+++ trunk/LayoutTests/accessibility/progressbar-expected.txt	2021-11-13 21:57:32 UTC (rev 285778)
@@ -1,16 +1,15 @@
-X X
 This test makes sure that progress element can be accessed by Accessibility FW.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS obj.intValue is 7
-PASS obj.intValue is 5
-PASS obj.intValue is 7
-PASS obj.role is 'AXRole: AXProgressIndicator'
-PASS obj.intValue is 0
-PASS obj.role is 'AXRole: AXProgressIndicator'
+PASS progressbar1.intValue is 7
+PASS progressbar2.intValue is 5
+PASS progressbar3.intValue is 7
+PASS progressbar3.role is 'AXRole: AXProgressIndicator'
+PASS progressbar4.intValue is 0
+PASS progressbar4.role is 'AXRole: AXProgressIndicator'
 PASS successfullyParsed is true
 
 TEST COMPLETE
-
+X X

Modified: trunk/LayoutTests/accessibility/progressbar.html (285777 => 285778)


--- trunk/LayoutTests/accessibility/progressbar.html	2021-11-13 18:49:16 UTC (rev 285777)
+++ trunk/LayoutTests/accessibility/progressbar.html	2021-11-13 21:57:32 UTC (rev 285778)
@@ -1,9 +1,10 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 <html>
 <head>
-<script src=""
+<script src=""
+<script src=""
 </head>
-<body id="body">
+<body>
 
 <span tabindex="0" role="progressbar" id="progressbar1" aria-valuenow=7 aria-valuemin=0 aria-valuemax=10>X</span>
 <span tabindex="0" role="progressbar" id="progressbar2" aria-valuemax=10>X</span>
@@ -11,44 +12,42 @@
 <progress tabindex="0" id="progressbar3" value=7 max=10></progress>
 <progress tabindex="0" id="progressbar4"></progress>
 
-<p id="description"></p>
-<div id="console"></div>
-
 <script>
-
     description("This test makes sure that progress element can be accessed by Accessibility FW.");
 
+    var progressbar1, progressbar2, progressbar3, progressbar4;
     if (window.accessibilityController) {
+        window.jsTestIsAsync = true;
 
-          // ARIA determinate progressbar
-          document.getElementById("progressbar1").focus();
-          var obj = accessibilityController.focusedElement;
+        setTimeout(async function() {
+            // ARIA determinate progressbar
+            progressbar1 = await waitForElementById("progressbar1");
+            await waitForExpression(progressbar1, "intValue", 7);
+            shouldBe("progressbar1.intValue", "7");
 
-          shouldBe("obj.intValue", "7");
+            // ARIA indeterminate progressbar
+            progressbar2 = await waitForElementById("progressbar2");
+            await waitForExpression(progressbar2, "intValue", 5);
+            shouldBe("progressbar2.intValue", "5");
 
-          // ARIA indeterminate progressbar 
-          document.getElementById("progressbar2").focus();
-          var obj = accessibilityController.focusedElement;
+            // Determinate progress element
+            progressbar3 = await waitForElementById("progressbar3");
+            await waitForExpression(progressbar3, "intValue", 7);
+            shouldBe("progressbar3.intValue", "7");
+            shouldBe("progressbar3.role", "'AXRole: AXProgressIndicator'");
 
-          shouldBe("obj.intValue", "5");
+            // Indeterminate progress element
+            progressbar4 = await waitForElementById("progressbar4");
+            await waitForExpression(progressbar4, "intValue", 0);
+            shouldBe("progressbar4.intValue", "0");
+            shouldBe("progressbar4.role", "'AXRole: AXProgressIndicator'");
 
-          // determinate progress element
-          document.getElementById("progressbar3").focus();
-          var obj = accessibilityController.focusedElement;
-
-          shouldBe("obj.intValue", "7");
-          shouldBe("obj.role", "'AXRole: AXProgressIndicator'");
-
-          // indeterminate progress element
-          document.getElementById("progressbar4").focus();
-          var obj = accessibilityController.focusedElement;
-
-          shouldBe("obj.intValue", "0");
-          shouldBe("obj.role", "'AXRole: AXProgressIndicator'");
+            finishJSTest();
+        }, 0);
     }
-
 </script>
-
-<script src=""
 </body>
 </html>
+
+
+

Modified: trunk/LayoutTests/accessibility/range-alter-by-percent-expected.txt (285777 => 285778)


--- trunk/LayoutTests/accessibility/range-alter-by-percent-expected.txt	2021-11-13 18:49:16 UTC (rev 285777)
+++ trunk/LayoutTests/accessibility/range-alter-by-percent-expected.txt	2021-11-13 21:57:32 UTC (rev 285778)
@@ -1,4 +1,3 @@
-
 This tests that decrement and increment alter a range type input element by five percent or one (whichever is larger) when no step is specified.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".

Modified: trunk/LayoutTests/accessibility/range-alter-by-percent.html (285777 => 285778)


--- trunk/LayoutTests/accessibility/range-alter-by-percent.html	2021-11-13 18:49:16 UTC (rev 285777)
+++ trunk/LayoutTests/accessibility/range-alter-by-percent.html	2021-11-13 21:57:32 UTC (rev 285778)
@@ -1,7 +1,9 @@
-<!DOCTYPE html>
+
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 <html>
 <head>
-<script src=""
+<script src=""
+<script src=""
 <title>Range Alter by Percent</title>
 </head>
 <body>
@@ -13,39 +15,49 @@
 <!-- Implicit step size of one when decrement/increment is called (because five percent would give us less than one). -->
 <input id="smallRange" max="10" min="0" type="range" value="5">
 
-<p id="description"></p>
-<div id="console"></div>
-
 <script>
     description("This tests that decrement and increment alter a range type input element by five percent or one (whichever is larger) when no step is specified.");
-    
+
+    var smallRange, largeRange;
     if (window.accessibilityController) {
-        // Large range.
-        var largeRange = accessibilityController.accessibleElementById("largeRange");
-        shouldBe("largeRange.intValue", "50");
-        largeRange.increment();
-        shouldBe("largeRange.intValue", "55");
-        largeRange.increment();
-        shouldBe("largeRange.intValue", "60");
-        largeRange.decrement();
-        shouldBe("largeRange.intValue", "55");
-        largeRange.decrement();
-        shouldBe("largeRange.intValue", "50");
-        
-        // Small range.
-        var smallRange = accessibilityController.accessibleElementById("smallRange");
-        shouldBe("smallRange.intValue", "5");
-        smallRange.increment();
-        shouldBe("smallRange.intValue", "6");
-        smallRange.increment();
-        shouldBe("smallRange.intValue", "7");
-        smallRange.decrement();
-        shouldBe("smallRange.intValue", "6");
-        smallRange.decrement();
-        shouldBe("smallRange.intValue", "5");
+        window.jsTestIsAsync = true;
+
+        setTimeout(async function() {
+            largeRange = await waitForElementById("largeRange");
+            await waitForExpression(largeRange, "intValue", 50);
+            shouldBe("largeRange.intValue", "50");
+            largeRange.increment();
+            await waitForExpression(largeRange, "intValue", 55);
+            shouldBe("largeRange.intValue", "55");
+            largeRange.increment();
+            await waitForExpression(largeRange, "intValue", 60);
+            shouldBe("largeRange.intValue", "60");
+            largeRange.decrement();
+            await waitForExpression(largeRange, "intValue", 55);
+            shouldBe("largeRange.intValue", "55");
+            largeRange.decrement();
+            await waitForExpression(largeRange, "intValue", 50);
+            shouldBe("largeRange.intValue", "50");
+
+            smallRange = await waitForElementById("smallRange");
+            await waitForExpression(smallRange, "intValue", 5);
+            shouldBe("smallRange.intValue", "5");
+            smallRange.increment();
+            await waitForExpression(smallRange, "intValue", 6);
+            shouldBe("smallRange.intValue", "6");
+            smallRange.increment();
+            await waitForExpression(smallRange, "intValue", 7);
+            shouldBe("smallRange.intValue", "7");
+            smallRange.decrement();
+            await waitForExpression(smallRange, "intValue", 6);
+            shouldBe("smallRange.intValue", "6");
+            smallRange.decrement();
+            await waitForExpression(smallRange, "intValue", 5);
+            shouldBe("smallRange.intValue", "5");
+
+            finishJSTest();
+        }, 0);
     }
 </script>
-
-<script src=""
 </body>
 </html>

Modified: trunk/LayoutTests/accessibility/range-alter-by-step-expected.txt (285777 => 285778)


--- trunk/LayoutTests/accessibility/range-alter-by-step-expected.txt	2021-11-13 18:49:16 UTC (rev 285777)
+++ trunk/LayoutTests/accessibility/range-alter-by-step-expected.txt	2021-11-13 21:57:32 UTC (rev 285778)
@@ -1,19 +1,18 @@
-
 This test makes sure that if a range type has a step value, that increment and decrement work.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS obj.intValue is 25
-PASS obj.intValue is 50
-PASS obj.intValue is 75
-PASS obj.intValue is 100
-PASS obj.intValue is 100
-PASS obj.intValue is 75
-PASS obj.intValue is 50
-PASS obj.intValue is 25
-PASS obj.intValue is 0
-PASS obj.intValue is 0
+PASS rangeInput.intValue is 25
+PASS rangeInput.intValue is 50
+PASS rangeInput.intValue is 75
+PASS rangeInput.intValue is 100
+PASS rangeInput.intValue is 100
+PASS rangeInput.intValue is 75
+PASS rangeInput.intValue is 50
+PASS rangeInput.intValue is 25
+PASS rangeInput.intValue is 0
+PASS rangeInput.intValue is 0
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/accessibility/range-alter-by-step.html (285777 => 285778)


--- trunk/LayoutTests/accessibility/range-alter-by-step.html	2021-11-13 18:49:16 UTC (rev 285777)
+++ trunk/LayoutTests/accessibility/range-alter-by-step.html	2021-11-13 21:57:32 UTC (rev 285778)
@@ -1,57 +1,61 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 <html>
 <head>
-<script src=""
+<script src=""
+<script src=""
 </head>
-<body id="body">
+<body>
 
-<input type="range" min="0" max="100" value="25" step="25" id="range1"/>
+<input type="range" min="0" max="100" value="25" step="25" id="rangeInput"/>
 
-<p id="description"></p>
-<div id="console"></div>
-
 <script>
-
     description("This test makes sure that if a range type has a step value, that increment and decrement work.");
 
+    var rangeInput;
+    async function waitForAndExpectIntValue(expectedIntValue) {
+        await waitForExpression(rangeInput, "intValue", expectedIntValue);
+        shouldBe("rangeInput.intValue", `${expectedIntValue}`)
+    }
+
     if (window.accessibilityController) {
+        window.jsTestIsAsync = true;
 
-          // ARIA determinate progressbar
-          document.getElementById("range1").focus();
-          var obj = accessibilityController.focusedElement;
-          
-          shouldBe("obj.intValue", "25");
+        setTimeout(async function() {
+            // ARIA determinate progressbar
+            rangeInput = await waitForElementById("rangeInput");
+            await waitForAndExpectIntValue(25);
 
-          obj.increment();
-          shouldBe("obj.intValue", "50");
+            rangeInput.increment();
+            await waitForAndExpectIntValue(50);
 
-          obj.increment();
-          shouldBe("obj.intValue", "75");
+            rangeInput.increment();
+            await waitForAndExpectIntValue(75);
 
-          obj.increment();
-          shouldBe("obj.intValue", "100");
+            rangeInput.increment();
+            await waitForAndExpectIntValue(100);
 
-          obj.increment();
-          shouldBe("obj.intValue", "100");
+            rangeInput.increment();
+            await waitForAndExpectIntValue(100);
 
-          obj.decrement();
-          shouldBe("obj.intValue", "75");
+            rangeInput.decrement();
+            await waitForAndExpectIntValue(75);
 
-          obj.decrement();
-          shouldBe("obj.intValue", "50");
+            rangeInput.decrement();
+            await waitForAndExpectIntValue(50);
 
-          obj.decrement();
-          shouldBe("obj.intValue", "25");
+            rangeInput.decrement();
+            await waitForAndExpectIntValue(25);
 
-          obj.decrement();
-          shouldBe("obj.intValue", "0");
+            rangeInput.decrement();
+            await waitForAndExpectIntValue(0);
 
-          obj.decrement();
-          shouldBe("obj.intValue", "0");
+            rangeInput.decrement();
+            await waitForAndExpectIntValue(0);
+
+            finishJSTest();
+        }, 0);
     }
-
 </script>
-
-<script src=""
 </body>
 </html>
+

Modified: trunk/LayoutTests/accessibility/spinbutton-value-expected.txt (285777 => 285778)


--- trunk/LayoutTests/accessibility/spinbutton-value-expected.txt	2021-11-13 18:49:16 UTC (rev 285777)
+++ trunk/LayoutTests/accessibility/spinbutton-value-expected.txt	2021-11-13 21:57:32 UTC (rev 285778)
@@ -1,16 +1,15 @@
-
-42
 This tests that a spin button supports range value attributes.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS endsWith(axSpin.intValue, '5') is true
-PASS endsWith(axSpin.minValue, '1') is true
-PASS endsWith(axSpin.maxValue, '9') is true
-PASS endsWith(axSpin.valueDescription, '5 of 9') is true
-PASS axSpin.title is axUntitled.title
+PASS endsWith(spinbutton.intValue, '5') is true
+PASS endsWith(spinbutton.minValue, '1') is true
+PASS endsWith(spinbutton.maxValue, '9') is true
+PASS endsWith(spinbutton.valueDescription, '5 of 9') is true
+PASS spinbutton.title is untitledButton.title
 PASS successfullyParsed is true
 
 TEST COMPLETE
 
+42

Modified: trunk/LayoutTests/accessibility/spinbutton-value.html (285777 => 285778)


--- trunk/LayoutTests/accessibility/spinbutton-value.html	2021-11-13 18:49:16 UTC (rev 285777)
+++ trunk/LayoutTests/accessibility/spinbutton-value.html	2021-11-13 21:57:32 UTC (rev 285778)
@@ -1,11 +1,14 @@
-<!DOCTYPE HTML>
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 <html>
+<head>
+<script src=""
+<script src=""
+</head>
 <body>
-<script src=""
 
-<button id="untitled"></button>
+<button id="untitledButton"></button>
 
-<div id="spin"
+<div id="spinbutton"
      tabindex="0"
      role="spinbutton"
      aria-valuetext="5 of 9"
@@ -13,35 +16,37 @@
      aria-valuemax="9"
      aria-valuenow="5">42</div>
 
-<div id="console"></div>
 <script>
-description("This tests that a spin button supports range value attributes.")
+    description("This tests that a spin button supports range value attributes.");
 
-if (window.testRunner && window.accessibilityController) {
     function endsWith(str, suffix) {
-        str = '' + str;
+        str = "" + str;
         return str.substr(str.length - suffix.length) == suffix;
     }
 
-    var untitled = document.getElementById('untitled');
-    untitled.focus();
-    window.axUntitled = accessibilityController.focusedElement;
+    var spinbutton, untitledButton;
+    if (window.accessibilityController) {
+        window.jsTestIsAsync = true;
 
-    var spin = document.getElementById('spin');
-    spin.focus();
-    window.axSpin = accessibilityController.focusedElement;
+        setTimeout(async function() {
+            untitledButton = await waitForElementById("untitledButton");
+            spinbutton = await waitForElementById("spinbutton");
+            await waitForExpression(spinbutton, "intValue", 5);
 
-    // Test range value attributes.
-    shouldBe("endsWith(axSpin.intValue, '5')", "true");
-    shouldBe("endsWith(axSpin.minValue, '1')", "true");
-    shouldBe("endsWith(axSpin.maxValue, '9')", "true");
-    shouldBe("endsWith(axSpin.valueDescription, '5 of 9')", "true");
+            // Test range value attributes.
+            shouldBe("endsWith(spinbutton.intValue, '5')", "true");
+            shouldBe("endsWith(spinbutton.minValue, '1')", "true");
+            shouldBe("endsWith(spinbutton.maxValue, '9')", "true");
+            shouldBe("endsWith(spinbutton.valueDescription, '5 of 9')", "true");
 
-    // Make sure the title doesn't come from the inner text. It should just be empty if
-    // not otherwise specified.
-    shouldBe("axSpin.title", "axUntitled.title");
-}
+            // Make sure the title doesn't come from the inner text. It should just be empty if
+            // not otherwise specified.
+            shouldBe("spinbutton.title", "untitledButton.title");
 
+            finishJSTest();
+        }, 0);
+    }
 </script>
 </body>
 </html>
+

Modified: trunk/LayoutTests/resources/accessibility-helper.js (285777 => 285778)


--- trunk/LayoutTests/resources/accessibility-helper.js	2021-11-13 18:49:16 UTC (rev 285777)
+++ trunk/LayoutTests/resources/accessibility-helper.js	2021-11-13 21:57:32 UTC (rev 285778)
@@ -110,3 +110,22 @@
         }, 0);
     });
 }
+
+async function waitForElementById(id) {
+    let element;
+    await waitFor(() => {
+        element = accessibilityController.accessibleElementById(id);
+        return element;
+    });
+    return element;
+}
+
+async function waitForExpression(element, _expression_, expectedValue) {
+    if (typeof _expression_ !== "string")
+        debug("WARN: The _expression_ arg in waitForExpression() should be a string.");
+
+    await waitFor(() => {
+        return eval(`element.${_expression_} === ${expectedValue}`);
+    });
+}
+
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to