Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
fix(accessibility): don't filter everything when the page has a title (#2909)
Joel Einbinder9140063c90c0
diff --git a/src/chromium/crAccessibility.ts b/src/chromium/crAccessibility.tsindex fe3be4d201..b5eba7ab65 100644--- a/src/chromium/crAccessibility.ts+++ b/src/chromium/crAccessibility.ts@@ -145,7 +145,7 @@ class CRAXNode implements accessibility.AXNode {// Here and below: Android heuristicsif (this._hasFocusableChild())return false;- if (this._focusable && this._name)+ if (this._focusable && this._role !== 'WebArea' && this._name)return true;if (this._role === 'heading' && this._name)return true;diff --git a/src/firefox/ffAccessibility.ts b/src/firefox/ffAccessibility.tsindex dd9bf3570a..e757b05c28 100644--- a/src/firefox/ffAccessibility.ts+++ b/src/firefox/ffAccessibility.ts@@ -148,7 +148,7 @@ class FFAXNode implements accessibility.AXNode {// Here and below: Android heuristicsif (this._hasFocusableChild())return false;- if (this._focusable && this._name)+ if (this._focusable && this._role !== 'document' && this._name)return true;if (this._role === 'heading' && this._name)return true;diff --git a/test/accessibility.jest.js b/test/accessibility.jest.jsindex 508a4250ff..aedbb73ef8 100644--- a/test/accessibility.jest.js+++ b/test/accessibility.jest.js@@ -347,4 +347,13 @@ describe('Accessibility', function() {});});});+ it('should work when there is a title ', async ({page}) => {+ await page.setContent(`+ <title>This is the title</title>+ <div>This is the content</div>+ `);+ const snapshot = await page.accessibility.snapshot();+ expect(snapshot.name).toBe('This is the title');+ expect(snapshot.children[0].name).toBe('This is the content');+ });});