From 9de229b2d199a030c0c5441295273b93127a49a0 Mon Sep 17 00:00:00 2001 From: "microsoft-playwright-automation[bot]" <203992400+microsoft-playwright-automation[bot]@users.noreply.github.com> Date: Wed, 18 Nov 2026 16:54:09 +0000 Subject: [PATCH] test(frames): cover child navigation during parent redirects Issue: https://github.com/microsoft/playwright/issues/44207 --- tests/page/frame-hierarchy.spec.ts | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/tests/page/frame-hierarchy.spec.ts b/tests/page/frame-hierarchy.spec.ts index 5fa4d22857c38..30cb3b19e4f8c 100644 --- a/tests/page/frame-hierarchy.spec.ts +++ b/tests/page/frame-hierarchy.spec.ts @@ -101,7 +101,7 @@ it('FR-028 should not send attach/detach events for main frame', async ({ page, expect(hasEvents).toBe(false); }); -it('FR-029 should detach child frames on navigation', async ({ page, server }) => { +it('FR-029 should detach child frames on navigation', { annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/44207' } }, async ({ page, server }) => { let attachedFrames = []; let detachedFrames = []; let navigatedFrames = []; @@ -120,6 +120,32 @@ it('FR-029 should detach child frames on navigation', async ({ page, server }) = expect(attachedFrames.length).toBe(0); expect(detachedFrames.length).toBe(4); expect(navigatedFrames.length).toBe(1); + + for (const [path, next] of [['/redirect1.html', '/redirect2.html'], ['/redirect2.html', '/empty.html']]) { + server.setRoute(path, (req, res) => { + res.writeHead(200, { 'Content-Type': 'text/html' }); + res.end(` + + + `); + }); + } + server.setRoute('/navigating-child.html', (req, res) => { + res.writeHead(200, { 'Content-Type': 'text/html' }); + res.end(` + + + `); + }); + await page.goto(server.PREFIX + '/redirect1.html', { waitUntil: 'commit' }); + await page.waitForURL(server.EMPTY_PAGE); + expect(page.frames()).toEqual([page.mainFrame()]); + await expect(page.locator('iframe')).toHaveCount(0); }); it('FR-030 should support framesets', async ({ page, server }) => {