Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

test: adjust unsafe headers test for electron, channels (#35237)

Yury Semikhatskyf49f52248d95
diff --git a/tests/page/page-request-continue.spec.ts b/tests/page/page-request-continue.spec.ts
index bd1d90f333..0642086ef0 100644
--- a/tests/page/page-request-continue.spec.ts
+++ b/tests/page/page-request-continue.spec.ts
@@ -40,7 +40,8 @@ it('should amend HTTP headers', async ({ page, server }) => {
expect(request.headers['foo']).toBe('bar');
});
-it('should not allow to override unsafe HTTP headers', async ({ page, server, browserName }) => {
+it('should not allow to override unsafe HTTP headers', async ({ page, server, browserName, isAndroid, isElectron }) => {
+ it.skip(isAndroid);
let resolve;
const routePromise = new Promise<Route>(f => resolve = f);
await page.route('**/*', route => resolve(route));
@@ -53,8 +54,12 @@ it('should not allow to override unsafe HTTP headers', async ({ page, server, br
host: 'bar'
}
}).catch(e => e);
- if (browserName === 'chromium') {
- expect(error.message).toContain('Unsafe header: host');
+ if (isElectron) {
+ // Electron doesn't send the request if the host header is overridden,
+ // but doesn't throw an error either.
+ expect(error).toBeFalsy();
+ } else if (browserName === 'chromium') {
+ expect(error.message).toContain('Unsafe header');
} else {
expect(error).toBeFalsy();
// These lines just document current behavior in FF and WK,