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: add a couple more route+headers tests (#9322)
Pavel Feldman9b7e02b88bcd
diff --git a/tests/page/page-route.spec.ts b/tests/page/page-route.spec.tsindex ca08fe9f85..24e954e074 100644--- a/tests/page/page-route.spec.ts+++ b/tests/page/page-route.spec.ts@@ -673,7 +673,7 @@ it('should support the times parameter with route matching', async ({ page, servexpect(intercepted).toHaveLength(1);});-it('should contain raw header', async ({ page, server }) => {+it('should contain raw request header', async ({ page, server }) => {let headers: any;await page.route('**/*', async route => {headers = await route.request().allHeaders();@@ -682,3 +682,31 @@ it('should contain raw header', async ({ page, server }) => {await page.goto(server.PREFIX + '/empty.html');expect(headers.accept).toBeTruthy();});++it('should contain raw response header', async ({ page, server }) => {+ let request: any;+ await page.route('**/*', async route => {+ request = route.request();+ route.continue();+ });+ await page.goto(server.PREFIX + '/empty.html');+ const response = await request.response();+ const headers = await response.allHeaders();+ expect(headers['content-type']).toBeTruthy();+});++it('should contain raw response header after fulfill', async ({ page, server }) => {+ let request: any;+ await page.route('**/*', async route => {+ request = route.request();+ await route.fulfill({+ status: 200,+ body: 'Hello',+ contentType: 'text/html',+ });+ });+ await page.goto(server.PREFIX + '/empty.html');+ const response = await request.response();+ const headers = await response.allHeaders();+ expect(headers['content-type']).toBeTruthy();+});