Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions tests/page/page-aria-snapshot-json.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,21 @@ it('AR-103 should snapshot iframes in ai mode', async ({ page }) => {
expect(button?.ref).toMatch(/^f\d+e\d+$/);
});

it('AR-171 should snapshot iframes in ai mode when iframe has fallback text', {
annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/43628' },
}, async ({ page }) => {
await page.setContent(`
<iframe srcdoc="<button>In frame</button>"></iframe>
`);
const before = await page.ariaSnapshotJSON({ mode: 'ai' }) as NodeJSON[];
await page.locator('iframe').evaluate(iframe => iframe.textContent = 'Your browser does not support frames');
expect(await page.ariaSnapshotJSON({ mode: 'ai' })).toEqual(before);

const iframe = findNode(before, node => node.role === 'iframe');
expect(iframe?.text).toBeUndefined();
expect(findNode(iframe!.children!, node => node.role === 'button')?.name).toBe('In frame');
});

it('AR-104 should limit depth', async ({ page }) => {
await page.setContent(`<ul><li><button>One</button></li></ul>`);
expect(await page.ariaSnapshotJSON({ depth: 1 })).toEqual([
Expand Down