Skip to content

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

test: add libsoup3 related tests (#26572)

Max Schmitt2edecd4244ab
diff --git a/packages/playwright-core/src/utils/index.ts b/packages/playwright-core/src/utils/index.ts
index 1956d38ddd..a33e73ba01 100644
--- a/packages/playwright-core/src/utils/index.ts
+++ b/packages/playwright-core/src/utils/index.ts
@@ -23,6 +23,7 @@ export * from './eventsHelper';
export * from './fileUtils';
export * from './glob';
export * from './headers';
+export * from './hostPlatform';
export * from './httpServer';
export * from './manualPromise';
export * from './mimeType';
diff --git a/tests/library/capabilities.spec.ts b/tests/library/capabilities.spec.ts
index c4d86a7618..db49209f12 100644
--- a/tests/library/capabilities.spec.ts
+++ b/tests/library/capabilities.spec.ts
@@ -17,6 +17,7 @@
import os from 'os';
import url from 'url';
import { contextTest as it, expect } from '../config/browserTest';
+const { hostPlatform } = require('playwright-core/lib/utils');
it('SharedArrayBuffer should work @smoke', async function({ contextFactory, httpsServer, browserName }) {
it.fail(browserName === 'webkit', 'no shared array buffer on webkit');
@@ -270,3 +271,18 @@ it('requestFullscreen', async ({ page, server, browserName, headless, isLinux })
});
expect(await page.evaluate(() => !!document.fullscreenElement)).toBeFalsy();
});
+
+it('should send no Content-Length header for GET requests with a Content-Type', async ({ page, server, browserName }) => {
+ it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/22569' });
+ it.skip(browserName === 'webkit' && hostPlatform === 'ubuntu20.04', 'libsoup2.4 bug');
+ it.fixme(browserName === 'webkit' && hostPlatform === 'ubuntu22.04', 'waiting for libsoup3 upgrade');
+ await page.goto(server.EMPTY_PAGE);
+ const [request] = await Promise.all([
+ server.waitForRequest('/empty.html'),
+ page.evaluate(() => fetch('/empty.html', {
+ 'headers': { 'Content-Type': 'application/json' },
+ 'method': 'GET'
+ }))
+ ]);
+ expect(request.headers['content-length']).toBe(undefined);
+});
diff --git a/tests/page/page-event-network.spec.ts b/tests/page/page-event-network.spec.ts
index 02f7211735..e7004f576a 100644
--- a/tests/page/page-event-network.spec.ts
+++ b/tests/page/page-event-network.spec.ts
@@ -58,7 +58,7 @@ it('Page.Events.RequestFailed @smoke', async ({ page, server, browserName, platf
expect(failedRequests[0].failure().errorText).toBe('net::ERR_EMPTY_RESPONSE');
} else if (browserName === 'webkit') {
if (platform === 'linux')
- expect(failedRequests[0].failure().errorText).toBe('Message Corrupt');
+ expect(failedRequests[0].failure().errorText).toMatch(/(Message Corrupt)|(Connection terminated unexpectedly)/i);
else if (platform === 'darwin')
expect(failedRequests[0].failure().errorText).toBe('The network connection was lost.');
else if (platform === 'win32')