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
chore: include child nodes when parsing snapshot (#34318)
Pavel Feldmanad365c3bc3ca
diff --git a/packages/playwright-core/src/utils/isomorphic/ariaSnapshot.ts b/packages/playwright-core/src/utils/isomorphic/ariaSnapshot.tsindex 165cf1c92a..7ffe9b4de9 100644--- a/packages/playwright-core/src/utils/isomorphic/ariaSnapshot.ts+++ b/packages/playwright-core/src/utils/isomorphic/ariaSnapshot.ts@@ -180,8 +180,9 @@ export function parseAriaSnapshot(yaml: YamlLibrary, text: string, options: yaml// - role "name":// - child- const valueIsSequence = value instanceof yaml.YAMLSeq ;+ const valueIsSequence = value instanceof yaml.YAMLSeq;if (valueIsSequence) {+ container.children.push(childNode);convertSeq(childNode, value as yamlTypes.YAMLSeq);continue;}diff --git a/packages/trace-viewer/src/ui/inspectorTab.tsx b/packages/trace-viewer/src/ui/inspectorTab.tsxindex 8656e4a9f8..b6882a6a04 100644--- a/packages/trace-viewer/src/ui/inspectorTab.tsx+++ b/packages/trace-viewer/src/ui/inspectorTab.tsx@@ -60,6 +60,7 @@ export const InspectorTab: React.FunctionComponent<{<div style={{ margin: '0 10px 10px', flex: 'auto' }}><CodeMirrorWrappertext={highlightedElement.ariaSnapshot || ''}+ language='yaml'wrapLines={false}highlight={ariaSnapshotErrors}onChange={onAriaEditorChange} />diff --git a/tests/page/to-match-aria-snapshot.spec.ts b/tests/page/to-match-aria-snapshot.spec.tsindex ac94909741..2f7ff203a5 100644--- a/tests/page/to-match-aria-snapshot.spec.ts+++ b/tests/page/to-match-aria-snapshot.spec.ts@@ -670,3 +670,15 @@ test('should not unshift actual template text', async ({ page }) => {- heading "title" [level=1]- heading "title 2" [level=1]`);});++test('should not match what is not matched', async ({ page }) => {+ await page.setContent(`<p>Text</p>`);+ const error = await expect(page.locator('body')).toMatchAriaSnapshot(`+ - paragraph:+ - button "bogus"+ `).catch(e => e);+ expect(stripAnsi(error.message)).toContain(`+- - paragraph:+- - button "bogus"++ - paragraph: Text`);+});