Add properties to accessibility tree nodes
Change-Id: I1c57c87d058dfd40d7274c169421d1993969de5a
Bug: 1226486
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3289780
Commit-Queue: Johan Bay <[email protected]>
Reviewed-by: Changhao Han <[email protected]>
diff --git a/test/e2e/elements/accessibility-tree_test.ts b/test/e2e/elements/accessibility-tree_test.ts
index 006f26a..851e917 100644
--- a/test/e2e/elements/accessibility-tree_test.ts
+++ b/test/e2e/elements/accessibility-tree_test.ts
@@ -2,47 +2,66 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-import {click, enableExperiment, getBrowserAndPages, goToResource, waitForAria} from '../../shared/helper.js';
+import {assertNotNullOrUndefined, click, enableExperiment, getBrowserAndPages, goToResource, waitForAria, waitForNone} from '../../shared/helper.js';
import {describe, it} from '../../shared/mocha-extensions.js';
-import {toggleAccessibilityPane, toggleAccessibilityTree} from '../helpers/elements-helpers.js';
+import {toggleAccessibilityTree} from '../helpers/elements-helpers.js';
describe('Accessibility Tree in the Elements Tab', async function() {
- beforeEach(async () => {
- await enableExperiment('fullAccessibilityTree');
- });
-
it('displays the fuller accessibility tree', async () => {
+ await enableExperiment('fullAccessibilityTree');
await goToResource('elements/accessibility-simple-page.html');
- await toggleAccessibilityPane();
await toggleAccessibilityTree();
await waitForAria('heading\xa0"Title" [role="treeitem"]');
- await waitForAria('link\xa0"cats" [role="treeitem"]');
+ await waitForAria('link\xa0"cats"\xa0focusable:\xa0true[role="treeitem"]');
});
- // Test disabled to unblock chromium roll.
- it.skip('[crbug.com/1265818] allows navigating iframes', async () => {
+ it('allows navigating iframes', async () => {
+ await enableExperiment('fullAccessibilityTree');
await goToResource('elements/accessibility-iframe-page.html');
- await toggleAccessibilityPane();
await toggleAccessibilityTree();
- const iframeDoc = await waitForAria('RootWebArea\xa0"Simple page with aria labeled element" [role="treeitem"]');
+ waitForAria('RootWebArea\xa0"Page with nested iframe" [role="treeitem"]');
+ const iframeDoc = await waitForAria(
+ 'RootWebArea\xa0"Simple page with aria labeled element"\xa0focusable:\xa0true [role="treeitem"]');
+ assertNotNullOrUndefined(iframeDoc);
await click('.arrow-icon', {root: iframeDoc});
- await waitForAria('link\xa0"cats" [role="treeitem"]');
+ await waitForAria('link\xa0"cats"\xa0focusable:\xa0true[role="treeitem"]');
});
- // Test disabled to unblock chromium roll.
- it.skip('[crbug.com/1265818] listens for text changes to DOM and redraws the tree', async () => {
- const {target} = getBrowserAndPages();
+ it('listens for text changes to DOM and redraws the tree', async () => {
+ await enableExperiment('fullAccessibilityTree');
await goToResource('elements/accessibility-simple-page.html');
- await toggleAccessibilityPane();
await toggleAccessibilityTree();
- await waitForAria('heading\xa0"Title" [role="treeitem"]');
- await waitForAria('link\xa0"cats" [role="treeitem"]');
- const link = await target.$('aria/cats [role="link"]');
- link?.evaluate(node => {
+ const {target} = getBrowserAndPages();
+ await waitForAria('link\xa0"cats"\xa0focusable:\xa0true[role="treeitem"]');
+ const link = await target.waitForSelector('aria/cats [role="link"]');
+ assertNotNullOrUndefined(link);
+ await link.evaluate(node => {
(node as HTMLElement).innerText = 'dogs';
});
- await waitForAria('link\xa0"dogs" [role="treeitem"]');
- link?.evaluate(node => node.setAttribute('aria-label', 'birds'));
- await waitForAria('link\xa0"birds" [role="treeitem"]');
+ await waitForAria('link\xa0"dogs"\xa0focusable:\xa0true[role="treeitem"]');
+ });
+
+ it('listen for changes to properties and redraws tree', async () => {
+ await enableExperiment('fullAccessibilityTree');
+ await goToResource('elements/accessibility-simple-page.html');
+ await toggleAccessibilityTree();
+ const {target} = getBrowserAndPages();
+ const link = await target.waitForSelector('aria/cats [role="link"]');
+ assertNotNullOrUndefined(link);
+ await waitForAria('link\xa0"cats"\xa0focusable:\xa0true[role="treeitem"]');
+ await link.evaluate(node => node.setAttribute('aria-label', 'birds'));
+ await waitForAria('link\xa0"birds"\xa0focusable:\xa0true[role="treeitem"]');
+ });
+
+ it('listen for removed nodes and redraw tree', async () => {
+ await enableExperiment('fullAccessibilityTree');
+ await goToResource('elements/accessibility-simple-page.html');
+ await toggleAccessibilityTree();
+ const {target} = getBrowserAndPages();
+ const link = await target.waitForSelector('aria/cats [role="link"]');
+ assertNotNullOrUndefined(link);
+ await waitForAria('link\xa0"cats"\xa0focusable:\xa0true[role="treeitem"]');
+ await link.evaluate(node => node.remove());
+ await waitForNone('link\xa0"cats"\xa0focusable:\xa0true[role="treeitem"]', undefined, undefined, 'aria');
});
});