From 33f3a6002d0e3ffd34f469836da5480d2820aedc Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Fri, 19 May 2023 17:59:17 -0700 Subject: [PATCH] test: xhr request type for main resource url (#23174) --- tests/page/page-event-request.spec.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/page/page-event-request.spec.ts b/tests/page/page-event-request.spec.ts index a76f6b1d95..70a574a241 100644 --- a/tests/page/page-event-request.spec.ts +++ b/tests/page/page-event-request.spec.ts @@ -118,3 +118,19 @@ it('should fire requestfailed when intercepting race', async ({ page, server, br await promsie; }); + +it('main resource xhr should have type xhr', async ({ page, server, browserName }) => { + it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/22812' }); + it.fixme(browserName === 'webkit'); + await page.goto(server.EMPTY_PAGE); + const [request] = await Promise.all([ + page.waitForEvent('request'), + page.evaluate(() => { + const x = new XMLHttpRequest(); + x.open('GET', location.href, false); + x.send(); + }) + ]); + expect(request.isNavigationRequest()).toBe(false); + expect(request.resourceType()).toBe('xhr'); +});