diff --git a/test/accessibility.spec.js b/test/accessibility.spec.js index b9bb89356c..29805d6c5d 100644 --- a/test/accessibility.spec.js +++ b/test/accessibility.spec.js @@ -15,7 +15,7 @@ * limitations under the License. */ -module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT}) { +module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT, MAC}) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit, dit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; @@ -27,7 +27,6 @@ module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT}) Accessibility Test -
Hello World

Inputs

@@ -45,7 +44,6 @@ module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT}) role: 'document', name: 'Accessibility Test', children: [ - {role: 'text leaf', name: 'Hello World'}, {role: 'heading', name: 'Inputs', level: 1}, {role: 'textbox', name: 'Empty input', focused: true}, {role: 'textbox', name: 'readonly input', readonly: true}, @@ -59,7 +57,6 @@ module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT}) role: 'WebArea', name: 'Accessibility Test', children: [ - {role: 'text', name: 'Hello World'}, {role: 'heading', name: 'Inputs', level: 1}, {role: 'textbox', name: 'Empty input', focused: true}, {role: 'textbox', name: 'readonly input', readonly: true}, @@ -73,7 +70,6 @@ module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT}) role: 'WebArea', name: 'Accessibility Test', children: [ - {role: 'text', name: 'Hello World'}, {role: 'heading', name: 'Inputs', level: 1}, {role: 'textbox', name: 'Empty input', focused: true}, {role: 'textbox', name: 'readonly input', readonly: true}, @@ -86,6 +82,14 @@ module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT}) }; expect(await page.accessibility.snapshot()).toEqual(golden); }); + it.skip(WEBKIT && !MAC)('should work with regular text', async({page}) => { + await page.setContent(`
Hello World
`); + const snapshot = await page.accessibility.snapshot(); + expect(snapshot.children[0]).toEqual({ + role: FFOX ? 'text leaf' : 'text', + name: 'Hello World', + }); + }); it('roledescription', async({page}) => { await page.setContent('
Hi
'); const snapshot = await page.accessibility.snapshot(); @@ -328,27 +332,23 @@ module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT}) it('should show uninteresting nodes', async({page}) => { await page.setContent(`
-
hi
+
+ hello +
+ world +
+
`); const root = await page.$('#root'); const snapshot = await page.accessibility.snapshot({root, interestingOnly: false}); expect(snapshot.role).toBe('textbox'); - expect(snapshot.value).toBe('hi'); + expect(snapshot.value).toContain('hello'); + expect(snapshot.value).toContain('world'); expect(!!snapshot.children).toBe(true); }); }); }); - function findFocusedNode(node) { - if (node.focused) - return node; - for (const child of node.children || []) { - const focusedChild = findFocusedNode(child); - if (focusedChild) - return focusedChild; - } - return null; - } }); };