Skip to content

Commit 5d2ef24

Browse files
committed
fix(breadcrumb): scope ariaSnapshot to DBBreadcrumb section for improved accuracy
1 parent c00d94b commit 5d2ef24

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

showcases/e2e/default.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,20 @@ export const runAriaSnapshotTest = ({
271271

272272
await page.waitForTimeout(1000); // We wait a little bit until everything loaded
273273

274-
let snapshot = await page.locator('main').ariaSnapshot();
274+
// Scope snapshot to the DBBreadcrumb section to avoid unrelated page-level landmarks
275+
const breadcrumbSection = page
276+
.getByRole('heading', { name: 'DBBreadcrumb', level: 1 })
277+
.locator('xpath=ancestor::section[1]');
278+
279+
let snapshot: string;
280+
try {
281+
// If the section exists, snapshot only that region
282+
await expect(breadcrumbSection).toBeVisible({ timeout: 5000 });
283+
snapshot = await breadcrumbSection.ariaSnapshot();
284+
} catch {
285+
// Fallback to the full main snapshot if section resolution fails
286+
snapshot = await page.locator('main').ariaSnapshot();
287+
}
275288

276289
// Remove `/url` in snapshot because they differ in every showcase
277290
const lines = snapshot.split('\n');

0 commit comments

Comments
 (0)