Skip to content

Commit d29bb82

Browse files
Skn0ttclaude
andcommitted
refactor(test): use getByRole('main') for narrower scope
Replace page.locator('body') with page.getByRole('main') to more precisely target the test content area. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 0feb87d commit d29bb82

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tests/playwright-test/reporter-html.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3276,7 +3276,7 @@ test('should support sorting by duration', async ({ runInlineTest, showReport, p
32763276

32773277
const searchInput = page.locator('.subnav-search-input');
32783278

3279-
await expect(page.locator('body')).toMatchAriaSnapshot(`
3279+
await expect(page.getByRole('main')).toMatchAriaSnapshot(`
32803280
- button "a.test.js" [expanded]
32813281
- region:
32823282
- link "fast test"
@@ -3289,7 +3289,7 @@ test('should support sorting by duration', async ({ runInlineTest, showReport, p
32893289
`);
32903290

32913291
await searchInput.fill('o:duration');
3292-
await expect(page.locator('body')).toMatchAriaSnapshot(`
3292+
await expect(page.getByRole('main')).toMatchAriaSnapshot(`
32933293
- button [expanded]
32943294
- region:
32953295
- link "very fast test"
@@ -3300,7 +3300,7 @@ test('should support sorting by duration', async ({ runInlineTest, showReport, p
33003300
`);
33013301

33023302
await searchInput.fill('!o:duration');
3303-
await expect(page.locator('body')).toMatchAriaSnapshot(`
3303+
await expect(page.getByRole('main')).toMatchAriaSnapshot(`
33043304
- button [expanded]
33053305
- region:
33063306
- link "very slow test"
@@ -3311,7 +3311,7 @@ test('should support sorting by duration', async ({ runInlineTest, showReport, p
33113311
`);
33123312

33133313
await searchInput.clear();
3314-
await expect(page.locator('body')).toMatchAriaSnapshot(`
3314+
await expect(page.getByRole('main')).toMatchAriaSnapshot(`
33153315
- button "a.test.js" [expanded]
33163316
- region:
33173317
- link "fast test"

0 commit comments

Comments
 (0)