diff --git a/tests/library/capabilities.spec.ts b/tests/library/capabilities.spec.ts index 2969ac4749..d713260f5e 100644 --- a/tests/library/capabilities.spec.ts +++ b/tests/library/capabilities.spec.ts @@ -350,3 +350,52 @@ it('service worker should cover the iframe', async ({ page, server }) => { await expect(page.frameLocator('iframe').locator('div')).toHaveText('from the service worker'); }); + +it('service worker should register in an iframe', async ({ page, server }) => { + it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/29267' }); + + server.setRoute('/main.html', (req, res) => { + res.writeHead(200, { 'content-type': 'text/html' }).end(` + + `); + }); + + server.setRoute('/dir/iframe.html', (req, res) => { + res.writeHead(200, { 'content-type': 'text/html' }).end(` + + `); + }); + + server.setRoute('/dir/sw.js', (req, res) => { + res.writeHead(200, { 'content-type': 'application/javascript' }).end(` + const kIframeHtml = "