From d437e268610b06a717e63a32e9873d1286161bc4 Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Tue, 5 Dec 2023 09:58:15 -0800 Subject: [PATCH] test: sync XHR interception (#28462) The test now ensures that the request is actually continued. Reference https://github.com/microsoft/playwright/issues/28461 --- tests/page/page-route.spec.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/page/page-route.spec.ts b/tests/page/page-route.spec.ts index 49546dc55a..d1757ce1be 100644 --- a/tests/page/page-route.spec.ts +++ b/tests/page/page-route.spec.ts @@ -261,10 +261,15 @@ it('should show custom HTTP headers', async ({ page, server }) => { }); // @see https://github.com/GoogleChrome/puppeteer/issues/4337 -it('should work with redirect inside sync XHR', async ({ page, server }) => { +it('should work with redirect inside sync XHR', async ({ page, server, browserName }) => { + it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/28461' }); + it.fixme(browserName === 'webkit', 'No Network.requestIntercepted for the request'); await page.goto(server.EMPTY_PAGE); server.setRedirect('/logo.png', '/pptr.png'); - await page.route('**/*', route => route.continue()); + let continuePromise; + await page.route('**/*', route => { + continuePromise = route.continue(); + }); const status = await page.evaluate(async () => { const request = new XMLHttpRequest(); request.open('GET', '/logo.png', false); // `false` makes the request synchronous @@ -272,6 +277,8 @@ it('should work with redirect inside sync XHR', async ({ page, server }) => { return request.status; }); expect(status).toBe(200); + expect(continuePromise).toBeTruthy(); + await continuePromise; }); it('should pause intercepted XHR until continue', async ({ page, server, browserName }) => {