mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
test: fulfilling with gzip should allow to read the body (#30065)
Fixes #29261.
This commit is contained in:
parent
2443d6560f
commit
c8e8d8f8bb
@ -438,3 +438,19 @@ it('should fulfill json', async ({ page, server }) => {
|
||||
expect(response.headers()['content-type']).toBe('application/json');
|
||||
expect(body).toBe(JSON.stringify({ bar: 'baz' }));
|
||||
});
|
||||
|
||||
it('should fulfill with gzip and readback', {
|
||||
annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/29261' },
|
||||
}, async ({ page, server }) => {
|
||||
server.enableGzip('/one-style.html');
|
||||
await page.route('**/one-style.html', async route => {
|
||||
const response = await route.fetch();
|
||||
expect(response.headers()['content-encoding']).toBe('gzip');
|
||||
await route.fulfill({ response });
|
||||
});
|
||||
|
||||
const response = await page.goto(server.PREFIX + '/one-style.html');
|
||||
await expect(page.locator('div')).toHaveText('hello, world!');
|
||||
await expect(page.locator('body')).toHaveCSS('background-color', 'rgb(255, 192, 203)');
|
||||
expect(await response.text()).toContain(`<div>hello, world!</div>`);
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user