From 3f085d568935b9a4422f689185f720c1206bac84 Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Mon, 26 Aug 2024 18:41:58 -0700 Subject: [PATCH] chore: remove same-site expectations for old browsers (#32334) --- tests/config/browserTest.ts | 12 ++++-------- tests/library/permissions.spec.ts | 7 +------ tests/page/jshandle-to-string.spec.ts | 4 ++-- tests/page/page-accessibility.spec.ts | 4 ++-- tests/page/page-network-response.spec.ts | 4 ++-- tests/page/page-route.spec.ts | 4 ++-- tests/page/wheel.spec.ts | 4 ++-- 7 files changed, 15 insertions(+), 24 deletions(-) diff --git a/tests/config/browserTest.ts b/tests/config/browserTest.ts index 01b574f10522c..b5b09fbae76e2 100644 --- a/tests/config/browserTest.ts +++ b/tests/config/browserTest.ts @@ -59,10 +59,8 @@ const test = baseTest.extend }, { scope: 'worker' }], allowsThirdParty: [async ({ browserName, browserMajorVersion, channel }, run) => { - if (browserName === 'firefox' && !channel) - await run(browserMajorVersion >= 103); - else if (browserName === 'firefox' && channel === 'firefox-beta') - await run(browserMajorVersion < 103 || browserMajorVersion >= 110); + if (browserName === 'firefox') + await run(true); else await run(false); }, { scope: 'worker' }], @@ -74,10 +72,8 @@ const test = baseTest.extend await run('Lax'); else if (browserName === 'webkit' && !isLinux) await run('None'); - else if (browserName === 'firefox' && channel === 'firefox-beta') - await run(browserMajorVersion >= 103 && browserMajorVersion < 110 ? 'Lax' : 'None'); - else if (browserName === 'firefox' && channel !== 'firefox-beta') - await run(browserMajorVersion >= 103 ? 'None' : 'Lax'); + else if (browserName === 'firefox') + await run('None'); else throw new Error('unknown browser - ' + browserName); }, { scope: 'worker' }], diff --git a/tests/library/permissions.spec.ts b/tests/library/permissions.spec.ts index 592ee806915a5..1064eaf61f1f1 100644 --- a/tests/library/permissions.spec.ts +++ b/tests/library/permissions.spec.ts @@ -119,12 +119,7 @@ it.describe('permissions', () => { await context.grantPermissions(['geolocation'], { origin: server.EMPTY_PAGE }); expect(await page.evaluate(() => window['events'])).toEqual(['prompt', 'denied', 'granted']); await context.clearPermissions(); - - // Note: Chromium 110 stopped triggering "onchange" when clearing permissions. - expect(await page.evaluate(() => window['events'])).toEqual( - (browserName === 'chromium' && browserMajorVersion === 110) ? - ['prompt', 'denied', 'granted'] : - ['prompt', 'denied', 'granted', 'prompt']); + expect(await page.evaluate(() => window['events'])).toEqual(['prompt', 'denied', 'granted', 'prompt']); }); it('should isolate permissions between browser contexts', async ({ server, browser }) => { diff --git a/tests/page/jshandle-to-string.spec.ts b/tests/page/jshandle-to-string.spec.ts index 930899ae3d880..dc0a6695bb06b 100644 --- a/tests/page/jshandle-to-string.spec.ts +++ b/tests/page/jshandle-to-string.spec.ts @@ -56,7 +56,7 @@ it('should work for promises', async ({ page }) => { expect(bHandle.toString()).toBe('Promise'); }); -it('should work with different subtypes @smoke', async ({ page, browserName, browserMajorVersion }) => { +it('should work with different subtypes @smoke', async ({ page, browserName }) => { expect((await page.evaluateHandle('(function(){})')).toString()).toContain('function'); expect((await page.evaluateHandle('12')).toString()).toBe('12'); expect((await page.evaluateHandle('true')).toString()).toBe('true'); @@ -71,7 +71,7 @@ it('should work with different subtypes @smoke', async ({ page, browserName, bro expect((await page.evaluateHandle('new WeakMap()')).toString()).toBe('WeakMap'); expect((await page.evaluateHandle('new WeakSet()')).toString()).toBe('WeakSet'); expect((await page.evaluateHandle('new Error()')).toString()).toContain('Error'); - expect((await page.evaluateHandle('new Proxy({}, {})')).toString()).toBe((browserName === 'chromium' && browserMajorVersion >= 111) ? 'Proxy(Object)' : 'Proxy'); + expect((await page.evaluateHandle('new Proxy({}, {})')).toString()).toBe((browserName === 'chromium') ? 'Proxy(Object)' : 'Proxy'); }); it('should work with previewable subtypes', async ({ page, browserName }) => { diff --git a/tests/page/page-accessibility.spec.ts b/tests/page/page-accessibility.spec.ts index e6717c5e20bcb..a85d3112bde11 100644 --- a/tests/page/page-accessibility.spec.ts +++ b/tests/page/page-accessibility.spec.ts @@ -177,7 +177,7 @@ it('rich text editable fields should have children', async function({ page, brow expect(snapshot.children[0]).toEqual(golden); }); -it('rich text editable fields with role should have children', async function({ page, browserName, browserMajorVersion, browserVersion, isWebView2 }) { +it('rich text editable fields with role should have children', async function({ page, browserName, browserVersion, isWebView2 }) { it.skip(browserName === 'webkit', 'WebKit rich text accessibility is iffy'); it.skip(isWebView2, 'WebView2 is missing a Chromium fix'); @@ -196,7 +196,7 @@ it('rich text editable fields with role should have children', async function({ } : { role: 'textbox', name: '', - multiline: (browserName === 'chromium' && browserMajorVersion >= 92) ? true : undefined, + multiline: (browserName === 'chromium') ? true : undefined, value: 'Edit this image: ', children: (chromiumVersionLessThan(browserVersion, '104.0.1293.1') && browserName === 'chromium') ? [{ role: 'text', diff --git a/tests/page/page-network-response.spec.ts b/tests/page/page-network-response.spec.ts index ecae86987aeee..41d7178208e5a 100644 --- a/tests/page/page-network-response.spec.ts +++ b/tests/page/page-network-response.spec.ts @@ -270,14 +270,14 @@ it('should behave the same way for headers and allHeaders', async ({ page, serve expect(allHeaders['name-b']).toEqual('v4'); }); -it('should provide a Response with a file URL', async ({ page, asset, isAndroid, isElectron, isWindows, browserName, browserMajorVersion, mode }) => { +it('should provide a Response with a file URL', async ({ page, asset, isAndroid, isElectron, isWindows, browserName, mode }) => { it.skip(isAndroid, 'No files on Android'); it.skip(browserName === 'firefox', 'Firefox does return null for file:// URLs'); it.skip(mode.startsWith('service')); const fileurl = url.pathToFileURL(asset('frames/two-frames.html')).href; const response = await page.goto(fileurl); - if (isElectron || (browserName === 'chromium' && browserMajorVersion >= 99) || (browserName === 'webkit' && isWindows)) + if (isElectron || (browserName === 'chromium') || (browserName === 'webkit' && isWindows)) expect(response.status()).toBe(200); else expect(response.status()).toBe(0); diff --git a/tests/page/page-route.spec.ts b/tests/page/page-route.spec.ts index 911521018e147..9bdb41f8d6821 100644 --- a/tests/page/page-route.spec.ts +++ b/tests/page/page-route.spec.ts @@ -512,7 +512,7 @@ it('should work with badly encoded server', async ({ page, server }) => { expect(response.status()).toBe(200); }); -it('should work with encoded server - 2', async ({ page, server, browserName, browserMajorVersion }) => { +it('should work with encoded server - 2', async ({ page, server, browserName }) => { // The requestWillBeSent will report URL as-is, whereas interception will // report encoded URL for stylesheet. @see crbug.com/759388 const requests = []; @@ -522,7 +522,7 @@ it('should work with encoded server - 2', async ({ page, server, browserName, br }); const response = await page.goto(`data:text/html,`); expect(response).toBe(null); - if (browserName === 'firefox' && browserMajorVersion >= 97) + if (browserName === 'firefox') expect(requests.length).toBe(2); // Firefox DevTools report to navigations in this case as well. else expect(requests.length).toBe(1); diff --git a/tests/page/wheel.spec.ts b/tests/page/wheel.spec.ts index c8c634e16d385..7a1fccc2aac81 100644 --- a/tests/page/wheel.spec.ts +++ b/tests/page/wheel.spec.ts @@ -22,8 +22,8 @@ it.skip(({ isAndroid }) => { let ignoreDelta = false; -it.beforeAll(async ({ browserMajorVersion, browserName, isElectron, platform }) => { - if (((browserName === 'chromium' && browserMajorVersion >= 102) || isElectron) && platform === 'darwin') { +it.beforeAll(async ({ browserName, isElectron, platform }) => { + if (((browserName === 'chromium') || isElectron) && platform === 'darwin') { // Chromium reports deltaX/deltaY scaled by host device scale factor. // https://bugs.chromium.org/p/chromium/issues/detail?id=1324819 // https://github.com/microsoft/playwright/issues/7362