Diff
Modified: trunk/LayoutTests/ChangeLog (285873 => 285874)
--- trunk/LayoutTests/ChangeLog 2021-11-16 18:27:57 UTC (rev 285873)
+++ trunk/LayoutTests/ChangeLog 2021-11-16 19:26:36 UTC (rev 285874)
@@ -1,3 +1,34 @@
+2021-11-16 Tyler Wilcock <tyle...@apple.com>
+
+ AX: Simplify tests changed in https://bugs.webkit.org/show_bug.cgi?id=233085
+ https://bugs.webkit.org/show_bug.cgi?id=233167
+
+ Reviewed by Andres Gonzalez.
+
+ In https://bugs.webkit.org/show_bug.cgi?id=233085 and https://bugs.webkit.org/show_bug.cgi?id=233017,
+ we made some tests async so that they passed in --release --accessibility-isolated-tree mode. However,
+ we can make these tests simpler and still pass — i.e., only wait for elements and expressions asynchronously
+ when it's absolutely necessary.
+
+ * accessibility/color-well.html:
+ * accessibility/mac/header-expected.txt:
+ * accessibility/mac/header.html:
+ * accessibility/mac/scrollbars.html:
+ * accessibility/placeholder.html:
+ * 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:
+ Simplify these tests by only use async waiting when
+ necessary (i.e. dynamic mutation via JS)
+
+ * resources/accessibility-helper.js:
+ (async expectAsyncExpression):
+ (async waitForExpression): Renamed to expectAsyncExpression.
+
2021-11-16 Commit Queue <commit-qu...@webkit.org>
Unreviewed, reverting r280078, r280290 and r282008.
Modified: trunk/LayoutTests/accessibility/color-well.html (285873 => 285874)
--- trunk/LayoutTests/accessibility/color-well.html 2021-11-16 18:27:57 UTC (rev 285873)
+++ trunk/LayoutTests/accessibility/color-well.html 2021-11-16 19:26:36 UTC (rev 285874)
@@ -14,21 +14,15 @@
description("This test checks the role of ColorWellRolean input with type=color");
if (window.accessibilityController) {
- window.jsTestIsAsync = true;
+ let axColorwell = accessibilityController.accessibleElementById("empty_colorwell");
+ debug("Role of input type=color is: " + axColorwell.role);
+ debug("Value of empty color well: " + axColorwell.stringValue);
- 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);
+ axColorwell = accessibilityController.accessibleElementById("good_colorwell");
+ debug("Value of good color well: " + axColorwell.stringValue);
- axColorwell = await waitForElementById("good_colorwell");
- debug("Value of good color well: " + axColorwell.stringValue);
-
- axColorwell = await waitForElementById("bad_colorwell");
- debug("Value of bad color well: " + axColorwell.stringValue);
-
- finishJSTest();
- }, 0);
+ axColorwell = accessibilityController.accessibleElementById("bad_colorwell");
+ debug("Value of bad color well: " + axColorwell.stringValue);
}
</script>
</body>
Modified: trunk/LayoutTests/accessibility/mac/header-expected.txt (285873 => 285874)
--- trunk/LayoutTests/accessibility/mac/header-expected.txt 2021-11-16 18:27:57 UTC (rev 285873)
+++ trunk/LayoutTests/accessibility/mac/header-expected.txt 2021-11-16 19:26:36 UTC (rev 285874)
@@ -1,9 +1,9 @@
-PASS accessibilityController.focusedElement.role is "AXRole: AXGroup"
-PASS accessibilityController.focusedElement.roleDescription is "AXRoleDescription: banner"
-PASS accessibilityController.focusedElement.role is "AXRole: AXGroup"
-PASS accessibilityController.focusedElement.roleDescription is "AXRoleDescription: group"
-PASS accessibilityController.focusedElement.role is "AXRole: AXGroup"
-PASS accessibilityController.focusedElement.roleDescription is "AXRoleDescription: group"
+PASS accessibilityController.accessibleElementById("header01").role is "AXRole: AXGroup"
+PASS accessibilityController.accessibleElementById("header01").roleDescription is "AXRoleDescription: banner"
+PASS accessibilityController.accessibleElementById("header02").role is "AXRole: AXGroup"
+PASS accessibilityController.accessibleElementById("header02").roleDescription is "AXRoleDescription: group"
+PASS accessibilityController.accessibleElementById("header03").role is "AXRole: AXGroup"
+PASS accessibilityController.accessibleElementById("header03").roleDescription is "AXRoleDescription: group"
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/accessibility/mac/header.html (285873 => 285874)
--- trunk/LayoutTests/accessibility/mac/header.html 2021-11-16 18:27:57 UTC (rev 285873)
+++ trunk/LayoutTests/accessibility/mac/header.html 2021-11-16 19:26:36 UTC (rev 285874)
@@ -15,28 +15,15 @@
</section>
<script>
- async function expectRole(expectedRole, expectedDescription, id) {
- document.getElementById(id).focus();
-
- await waitFor(() => {
- const focusedElement = accessibilityController.focusedElement;
- return focusedElement && focusedElement.domIdentifier === id;
- });
-
- shouldBeEqualToString("accessibilityController.focusedElement.role", "AXRole: " + expectedRole);
- shouldBeEqualToString("accessibilityController.focusedElement.roleDescription", "AXRoleDescription: " + expectedDescription);
+ function expectRole(expectedRole, expectedDescription, id) {
+ shouldBeEqualToString(`accessibilityController.accessibleElementById("${id}").role`, `AXRole: ${expectedRole}`);
+ shouldBeEqualToString(`accessibilityController.accessibleElementById("${id}").roleDescription`, `AXRoleDescription: ${expectedDescription}`);
}
if (window.accessibilityController) {
- window.jsTestIsAsync = true;
-
- setTimeout(async function() {
- await expectRole("AXGroup", "banner", "header01");
- await expectRole("AXGroup", "group", "header02");
- await expectRole("AXGroup", "group", "header03");
-
- finishJSTest();
- }, 0);
+ expectRole("AXGroup", "banner", "header01");
+ expectRole("AXGroup", "group", "header02");
+ expectRole("AXGroup", "group", "header03");
}
</script>
Modified: trunk/LayoutTests/accessibility/mac/scrollbars.html (285873 => 285874)
--- trunk/LayoutTests/accessibility/mac/scrollbars.html 2021-11-16 18:27:57 UTC (rev 285873)
+++ trunk/LayoutTests/accessibility/mac/scrollbars.html 2021-11-16 19:26:36 UTC (rev 285874)
@@ -20,15 +20,18 @@
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") {
+ let maybeScrollArea = scrollArea = accessibilityController.accessibleElementById("body");
+ while (maybeScrollArea) {
+ if (maybeScrollArea.role === "AXRole: AXScrollArea") {
scrollArea = maybeScrollArea;
- return true;
+ break;
}
+ maybeScrollArea = maybeScrollArea.parentElement();
+ }
- maybeScrollArea = maybeScrollArea.parentElement();
- return false;
+ // Wait for scrollbar to be created.
+ await waitFor(() => {
+ return scrollArea.verticalScrollbar;
});
shouldBe("scrollArea.role", "'AXRole: AXScrollArea'");
Modified: trunk/LayoutTests/accessibility/placeholder.html (285873 => 285874)
--- trunk/LayoutTests/accessibility/placeholder.html 2021-11-16 18:27:57 UTC (rev 285873)
+++ trunk/LayoutTests/accessibility/placeholder.html 2021-11-16 19:26:36 UTC (rev 285874)
@@ -18,27 +18,19 @@
<script>
description("This test makes sure that the placeholder is returned as the correct attribute");
- var fieldElement, passwordElement, searchElement, textInput;
if (window.accessibilityController) {
- window.jsTestIsAsync = true;
+ var fieldElement = accessibilityController.accessibleElementById("searchterm");
+ shouldBe("fieldElement.stringAttributeValue('AXPlaceholderValue')", "'search'");
- setTimeout(async function() {
- fieldElement = await waitForElementById("searchterm");
- shouldBe("fieldElement.stringAttributeValue('AXPlaceholderValue')", "'search'");
+ var passwordElement = accessibilityController.accessibleElementById("password");
+ shouldBe("passwordElement.stringAttributeValue('AXPlaceholderValue')", "'Password'");
- passwordElement = await waitForElementById("password");
- shouldBe("passwordElement.stringAttributeValue('AXPlaceholderValue')", "'Password'");
-
- 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.
- textInput = await waitForElementById("input");
- shouldBe("textInput.stringAttributeValue('AXPlaceholderValue')", "'Fill in the blank'");
+ var searchElement = accessibilityController.accessibleElementById("search");
+ shouldBe("searchElement.stringAttributeValue('AXPlaceholderValue')", "'MM-DD-YYYY'");
- finishJSTest();
- }, 0);
+ // When the placeholder and aria-placeholder attributes are both present, use the placeholder attribute's value.
+ var textInput = accessibilityController.accessibleElementById("input");
+ shouldBe("textInput.stringAttributeValue('AXPlaceholderValue')", "'Fill in the blank'");
}
</script>
</body>
Modified: trunk/LayoutTests/accessibility/progressbar.html (285873 => 285874)
--- trunk/LayoutTests/accessibility/progressbar.html 2021-11-16 18:27:57 UTC (rev 285873)
+++ trunk/LayoutTests/accessibility/progressbar.html 2021-11-16 19:26:36 UTC (rev 285874)
@@ -17,33 +17,23 @@
var progressbar1, progressbar2, progressbar3, progressbar4;
if (window.accessibilityController) {
- window.jsTestIsAsync = true;
+ // ARIA determinate progressbar
+ progressbar1 = accessibilityController.accessibleElementById("progressbar1");
+ shouldBe("progressbar1.intValue", "7");
- setTimeout(async function() {
- // ARIA determinate progressbar
- progressbar1 = await waitForElementById("progressbar1");
- await waitForExpression(progressbar1, "intValue", 7);
- shouldBe("progressbar1.intValue", "7");
+ // ARIA indeterminate progressbar
+ progressbar2 = accessibilityController.accessibleElementById("progressbar2");
+ shouldBe("progressbar2.intValue", "5");
- // ARIA indeterminate progressbar
- progressbar2 = await waitForElementById("progressbar2");
- await waitForExpression(progressbar2, "intValue", 5);
- shouldBe("progressbar2.intValue", "5");
+ // Determinate progress element
+ progressbar3 = accessibilityController.accessibleElementById("progressbar3");
+ shouldBe("progressbar3.intValue", "7");
+ shouldBe("progressbar3.role", "'AXRole: AXProgressIndicator'");
- // Determinate progress element
- progressbar3 = await waitForElementById("progressbar3");
- await waitForExpression(progressbar3, "intValue", 7);
- shouldBe("progressbar3.intValue", "7");
- shouldBe("progressbar3.role", "'AXRole: AXProgressIndicator'");
-
- // Indeterminate progress element
- progressbar4 = await waitForElementById("progressbar4");
- await waitForExpression(progressbar4, "intValue", 0);
- shouldBe("progressbar4.intValue", "0");
- shouldBe("progressbar4.role", "'AXRole: AXProgressIndicator'");
-
- finishJSTest();
- }, 0);
+ // Indeterminate progress element
+ progressbar4 = accessibilityController.accessibleElementById("progressbar4");
+ shouldBe("progressbar4.intValue", "0");
+ shouldBe("progressbar4.role", "'AXRole: AXProgressIndicator'");
}
</script>
</body>
Modified: trunk/LayoutTests/accessibility/range-alter-by-percent-expected.txt (285873 => 285874)
--- trunk/LayoutTests/accessibility/range-alter-by-percent-expected.txt 2021-11-16 18:27:57 UTC (rev 285873)
+++ trunk/LayoutTests/accessibility/range-alter-by-percent-expected.txt 2021-11-16 19:26:36 UTC (rev 285874)
@@ -4,15 +4,15 @@
PASS largeRange.intValue is 50
-PASS largeRange.intValue is 55
-PASS largeRange.intValue is 60
-PASS largeRange.intValue is 55
-PASS largeRange.intValue is 50
+PASS largeRange.intValue === 55
+PASS largeRange.intValue === 60
+PASS largeRange.intValue === 55
+PASS largeRange.intValue === 50
PASS smallRange.intValue is 5
-PASS smallRange.intValue is 6
-PASS smallRange.intValue is 7
-PASS smallRange.intValue is 6
-PASS smallRange.intValue is 5
+PASS smallRange.intValue === 6
+PASS smallRange.intValue === 7
+PASS smallRange.intValue === 6
+PASS smallRange.intValue === 5
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/accessibility/range-alter-by-percent.html (285873 => 285874)
--- trunk/LayoutTests/accessibility/range-alter-by-percent.html 2021-11-16 18:27:57 UTC (rev 285873)
+++ trunk/LayoutTests/accessibility/range-alter-by-percent.html 2021-11-16 19:26:36 UTC (rev 285874)
@@ -23,37 +23,35 @@
window.jsTestIsAsync = true;
setTimeout(async function() {
- largeRange = await waitForElementById("largeRange");
- await waitForExpression(largeRange, "intValue", 50);
+ largeRange = accessibilityController.accessibleElementById("largeRange");
shouldBe("largeRange.intValue", "50");
+
largeRange.increment();
- await waitForExpression(largeRange, "intValue", 55);
- shouldBe("largeRange.intValue", "55");
+ await expectAsyncExpression("largeRange.intValue", 55);
+
largeRange.increment();
- await waitForExpression(largeRange, "intValue", 60);
- shouldBe("largeRange.intValue", "60");
+ await expectAsyncExpression("largeRange.intValue", 60);
+
largeRange.decrement();
- await waitForExpression(largeRange, "intValue", 55);
- shouldBe("largeRange.intValue", "55");
+ await expectAsyncExpression("largeRange.intValue", 55);
+
largeRange.decrement();
- await waitForExpression(largeRange, "intValue", 50);
- shouldBe("largeRange.intValue", "50");
+ await expectAsyncExpression("largeRange.intValue", 50);
- smallRange = await waitForElementById("smallRange");
- await waitForExpression(smallRange, "intValue", 5);
+ smallRange = accessibilityController.accessibleElementById("smallRange");
shouldBe("smallRange.intValue", "5");
+
smallRange.increment();
- await waitForExpression(smallRange, "intValue", 6);
- shouldBe("smallRange.intValue", "6");
+ await expectAsyncExpression("smallRange.intValue", 6);
+
smallRange.increment();
- await waitForExpression(smallRange, "intValue", 7);
- shouldBe("smallRange.intValue", "7");
+ await expectAsyncExpression("smallRange.intValue", 7);
+
smallRange.decrement();
- await waitForExpression(smallRange, "intValue", 6);
- shouldBe("smallRange.intValue", "6");
+ await expectAsyncExpression("smallRange.intValue", 6);
+
smallRange.decrement();
- await waitForExpression(smallRange, "intValue", 5);
- shouldBe("smallRange.intValue", "5");
+ await expectAsyncExpression("smallRange.intValue", 5);
finishJSTest();
}, 0);
Modified: trunk/LayoutTests/accessibility/range-alter-by-step-expected.txt (285873 => 285874)
--- trunk/LayoutTests/accessibility/range-alter-by-step-expected.txt 2021-11-16 18:27:57 UTC (rev 285873)
+++ trunk/LayoutTests/accessibility/range-alter-by-step-expected.txt 2021-11-16 19:26:36 UTC (rev 285874)
@@ -4,15 +4,15 @@
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 rangeInput.intValue === 50
+PASS rangeInput.intValue === 75
+PASS rangeInput.intValue === 100
+PASS rangeInput.intValue === 100
+PASS rangeInput.intValue === 75
+PASS rangeInput.intValue === 50
+PASS rangeInput.intValue === 25
+PASS rangeInput.intValue === 0
+PASS rangeInput.intValue === 0
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/accessibility/range-alter-by-step.html (285873 => 285874)
--- trunk/LayoutTests/accessibility/range-alter-by-step.html 2021-11-16 18:27:57 UTC (rev 285873)
+++ trunk/LayoutTests/accessibility/range-alter-by-step.html 2021-11-16 19:26:36 UTC (rev 285874)
@@ -12,11 +12,6 @@
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;
@@ -23,34 +18,34 @@
setTimeout(async function() {
// ARIA determinate progressbar
rangeInput = await waitForElementById("rangeInput");
- await waitForAndExpectIntValue(25);
+ shouldBe("rangeInput.intValue", "25");
rangeInput.increment();
- await waitForAndExpectIntValue(50);
+ await expectAsyncExpression("rangeInput.intValue", 50);
rangeInput.increment();
- await waitForAndExpectIntValue(75);
+ await expectAsyncExpression("rangeInput.intValue", 75);
rangeInput.increment();
- await waitForAndExpectIntValue(100);
+ await expectAsyncExpression("rangeInput.intValue", 100);
rangeInput.increment();
- await waitForAndExpectIntValue(100);
+ await expectAsyncExpression("rangeInput.intValue", 100);
rangeInput.decrement();
- await waitForAndExpectIntValue(75);
+ await expectAsyncExpression("rangeInput.intValue", 75);
rangeInput.decrement();
- await waitForAndExpectIntValue(50);
+ await expectAsyncExpression("rangeInput.intValue", 50);
rangeInput.decrement();
- await waitForAndExpectIntValue(25);
+ await expectAsyncExpression("rangeInput.intValue", 25);
rangeInput.decrement();
- await waitForAndExpectIntValue(0);
+ await expectAsyncExpression("rangeInput.intValue", 0);
rangeInput.decrement();
- await waitForAndExpectIntValue(0);
+ await expectAsyncExpression("rangeInput.intValue", 0);
finishJSTest();
}, 0);
Modified: trunk/LayoutTests/accessibility/spinbutton-value-expected.txt (285873 => 285874)
--- trunk/LayoutTests/accessibility/spinbutton-value-expected.txt 2021-11-16 18:27:57 UTC (rev 285873)
+++ trunk/LayoutTests/accessibility/spinbutton-value-expected.txt 2021-11-16 19:26:36 UTC (rev 285874)
@@ -3,6 +3,7 @@
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+PASS spinbutton.intValue is 5
PASS endsWith(spinbutton.intValue, '5') is true
PASS endsWith(spinbutton.minValue, '1') is true
PASS endsWith(spinbutton.maxValue, '9') is true
Modified: trunk/LayoutTests/accessibility/spinbutton-value.html (285873 => 285874)
--- trunk/LayoutTests/accessibility/spinbutton-value.html 2021-11-16 18:27:57 UTC (rev 285873)
+++ trunk/LayoutTests/accessibility/spinbutton-value.html 2021-11-16 19:26:36 UTC (rev 285874)
@@ -26,25 +26,19 @@
var spinbutton, untitledButton;
if (window.accessibilityController) {
- window.jsTestIsAsync = true;
+ untitledButton = accessibilityController.accessibleElementById("untitledButton");
+ spinbutton = accessibilityController.accessibleElementById("spinbutton");
+ shouldBe("spinbutton.intValue", "5");
- setTimeout(async function() {
- untitledButton = await waitForElementById("untitledButton");
- spinbutton = await waitForElementById("spinbutton");
- await waitForExpression(spinbutton, "intValue", 5);
+ // 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");
- // 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("spinbutton.title", "untitledButton.title");
-
- finishJSTest();
- }, 0);
+ // 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");
}
</script>
</body>
Modified: trunk/LayoutTests/resources/accessibility-helper.js (285873 => 285874)
--- trunk/LayoutTests/resources/accessibility-helper.js 2021-11-16 18:27:57 UTC (rev 285873)
+++ trunk/LayoutTests/resources/accessibility-helper.js 2021-11-16 19:26:36 UTC (rev 285874)
@@ -120,12 +120,14 @@
return element;
}
-async function waitForExpression(element, _expression_, expectedValue) {
+async function expectAsyncExpression(_expression_, expectedValue) {
if (typeof _expression_ !== "string")
debug("WARN: The _expression_ arg in waitForExpression() should be a string.");
+ const evalExpression = `${_expression_} === ${expectedValue}`;
await waitFor(() => {
- return eval(`element.${_expression_} === ${expectedValue}`);
+ return eval(evalExpression);
});
+ debug(`PASS ${evalExpression}`);
}