arrow-left Back to topicQuizSnapshot testingCheck yourself1.A developer renames a CSS class on the order table from .orders-table to .data-table. Will the ARIA snapshot test break?Yes — the snapshot includes class namesNo — ARIA snapshots capture the accessibility tree, not CSS classesIt depends on whether the table has an aria-label attributeYes — the snapshot records every DOM attribute including class names2.You want to assert that a toolbar has EXACTLY 3 buttons and no more. What do you add to the template?Add count: 3 to each button entryAdd /children: equal to the toolbar node in the templateUse expect(toolbar).toHaveCount(3) instead of toMatchAriaSnapshotAdd strict: true as an option to toMatchAriaSnapshot()3.What does an ARIA snapshot actually capture about a page element?The full HTML markup including CSS classes and data attributesA pixel-by-pixel screenshot of the rendered elementRoles, accessible names, and semantic attributes like checked, expanded, disabledThe computed CSS styles and layout coordinates of each element4.You run a snapshot test for the first time with an empty template string. What happens?The test fails immediately because an empty template never matchesPlaywright auto-generates the snapshot template and the test passesThe test is skipped and a warning is printed to the consoleYou must run --update-snapshots first before any snapshot test can run5.How do you update all outdated ARIA snapshot templates after a legitimate UI restructure?Delete the snapshot files manually and re-run the testsRun npx playwright test --update-snapshotsEdit each YAML snapshot file by hand to match the new structureRun npx playwright test --reset to clear all snapshots6.You want to check that a navigation menu contains a 'Dashboard' link without listing every other link in the nav. How does ARIA snapshot matching work by default?By default matching is strict — you must list every element or the test failsBy default matching is partial — the template checks a subset, so you only include what you care aboutYou must add a wildcard '...' entry to allow unspecified elementsPartial matching requires passing { partial: true } as an option7.What is the key difference between ARIA snapshot testing and visual screenshot testing?ARIA snapshots are faster because they skip rendering; screenshot tests require a real browserARIA snapshots check semantic structure and accessibility; screenshot tests check visual pixel output. ARIA snapshots survive CSS/layout refactors; screenshots break on any visual changeScreenshot tests are more reliable because they capture exactly what the user seesARIA snapshots work across all browsers; screenshot tests are Chromium-only8.You can scope an ARIA snapshot assertion to a specific part of the page. Which call checks only the 'Actions' region instead of the whole page?await expect(page).toMatchAriaSnapshot('region Actions')await expect(page.getByRole('region', { name: 'Actions' })).toMatchAriaSnapshot(- button "Approve order")await expect(page).toMatchAriaSnapshot({ scope: 'Actions' })Scoping is not supported — toMatchAriaSnapshot always checks the entire pageSubmit answersarrow-left PreviousOther locatorsClockNext arrow-right