test: xhr request type for main resource url (#23174)

This commit is contained in:
Yury Semikhatsky 2023-05-19 17:59:17 -07:00 committed by GitHub
parent 0e1aeaaecf
commit 33f3a6002d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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');
});