Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
test: fulfilling with gzip should allow to read the body (#30065)
Dmitry Gozmanc8e8d8f8bb3a
diff --git a/tests/page/page-request-fulfill.spec.ts b/tests/page/page-request-fulfill.spec.tsindex c76fbd2ab7..9a568e8369 100644--- a/tests/page/page-request-fulfill.spec.ts+++ b/tests/page/page-request-fulfill.spec.ts@@ -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>`);+});