test: get response body for COOP responses (#9196)

This commit is contained in:
Yury Semikhatsky 2021-09-28 09:54:05 -07:00 committed by GitHub
parent 9a94ccaf0f
commit 962547e716
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -56,3 +56,16 @@ it('should report requests and responses handled by service worker', async ({ pa
expect(response.url()).toBe(server.PREFIX + '/serviceworkers/fetchdummy/foo');
expect(await response.text()).toBe('responseFromServiceWorker:foo');
});
it('should return response body when Cross-Origin-Opener-Policy is set', async ({ page, server, browserName }) => {
it.fail(browserName === 'webkit', 'https://github.com/microsoft/playwright/issues/8796');
server.setRoute('/empty.html', (req, res) => {
res.setHeader('Cross-Origin-Opener-Policy', 'same-origin');
res.end('Hello there!');
});
const response = await page.goto(server.EMPTY_PAGE);
expect(page.url()).toBe(server.EMPTY_PAGE);
await response.finished();
expect(response.request().failure()).toBeNull();
expect(await response.text()).toBe('Hello there!');
});