Skip to content

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

test: fix referer check on msedge, drop persistent OPFS test (#42570)

Yury Semikhatskyda022741298e
diff --git a/tests/library/browsercontext-storage-state.spec.ts b/tests/library/browsercontext-storage-state.spec.ts
index 3a42e2ed78..e382ba55e9 100644
--- a/tests/library/browsercontext-storage-state.spec.ts
+++ b/tests/library/browsercontext-storage-state.spec.ts
@@ -278,40 +278,6 @@ it('should round-trip OPFS', { annotation: { type: 'issue', description: 'https:
await context3.close();
});
-it('should round-trip OPFS in a persistent WebKit context', { annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/41400' } }, async ({ browserName, launchPersistent, server }) => {
- it.skip(browserName !== 'webkit');
-
- const { context, page } = await launchPersistent();
- await page.goto(server.EMPTY_PAGE);
- await page.evaluate(async () => {
- const root = await navigator.storage.getDirectory();
- await root.getDirectoryHandle('empty', { create: true });
- const file = await root.getFileHandle('hello.txt', { create: true });
- const writable = await file.createWritable();
- await writable.write('Hello, world!');
- await writable.close();
- });
-
- const storageState = await context.storageState({ opfs: true });
- expect(storageState.origins).toEqual([{
- origin: server.PREFIX,
- localStorage: [],
- opfs: [
- { path: 'empty', type: 'directory' },
- { path: 'hello.txt', type: 'file', base64: 'SGVsbG8sIHdvcmxkIQ==' },
- ],
- }]);
-
- await page.evaluate(async () => {
- const root = await navigator.storage.getDirectory();
- await root.removeEntry('empty', { recursive: true });
- await root.removeEntry('hello.txt');
- await root.getFileHandle('stale.txt', { create: true });
- });
- await context.setStorageState(storageState);
- expect(await context.storageState({ opfs: true })).toEqual(storageState);
-});
-
it('should capture cookies', async ({ server, context, page, contextFactory }) => {
server.setRoute('/setcookie.html', (req, res) => {
res.setHeader('Set-Cookie', ['a=b', 'empty=']);
diff --git a/tests/page/page-route.spec.ts b/tests/page/page-route.spec.ts
index 7da7d1e60b..f73056ded3 100644
--- a/tests/page/page-route.spec.ts
+++ b/tests/page/page-route.spec.ts
@@ -16,7 +16,6 @@
*/
import type { Route } from 'playwright-core';
-import { chromiumVersionLessThan } from '../config/utils';
import { test as it, expect } from './pageTest';
it('should intercept @smoke', async ({ page, server }) => {
@@ -274,11 +273,11 @@ it('should pause intercepted fetch request until continue', async ({ page, serve
expect(status).toBe(200);
});
-it('should work with custom referer headers', async ({ page, server, browserName, browserVersion }) => {
+it('should work with custom referer headers', async ({ page, server, browserName, browserMajorVersion }) => {
await page.setExtraHTTPHeaders({ 'referer': server.EMPTY_PAGE });
await page.route('**/*', route => {
// See https://github.com/microsoft/playwright/issues/8999
- if (browserName === 'chromium' && chromiumVersionLessThan(browserVersion, '154.0.8014.0'))
+ if (browserName === 'chromium' && browserMajorVersion < 154)
expect(route.request().headers()['referer']).toBe(server.EMPTY_PAGE + ', ' + server.EMPTY_PAGE);
else
expect(route.request().headers()['referer']).toBe(server.EMPTY_PAGE);
diff --git a/tests/page/page-set-extra-http-headers.spec.ts b/tests/page/page-set-extra-http-headers.spec.ts
index f9b9b4984d..192168dbec 100644
--- a/tests/page/page-set-extra-http-headers.spec.ts
+++ b/tests/page/page-set-extra-http-headers.spec.ts
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-import { chromiumVersionLessThan } from '../config/utils';
import { test as it, expect } from './pageTest';
it('should work @smoke', async ({ page, server }) => {
@@ -62,8 +61,8 @@ it('should throw for non-string header values', async ({ page }) => {
expect(error2.message).toContain('Expected value of header "foo" to be String, but "boolean" is found.');
});
-it('should not duplicate referer header', async ({ page, server, browserName, browserVersion }) => {
- it.fail(browserName === 'chromium' && chromiumVersionLessThan(browserVersion, '154.0.8014.0'), 'Request has referer and Referer');
+it('should not duplicate referer header', async ({ page, server, browserName, browserMajorVersion }) => {
+ it.fail(browserName === 'chromium' && browserMajorVersion < 154, 'Request has referer and Referer');
await page.setExtraHTTPHeaders({ 'referer': server.EMPTY_PAGE });
const response = await page.goto(server.EMPTY_PAGE);
expect(response.ok()).toBe(true);