Skip to content

Commit

Permalink
chore: remove same-site expectations for old browsers (#32334)
Browse files Browse the repository at this point in the history
  • Loading branch information
yury-s authored Aug 27, 2024
1 parent 177576a commit 3f085d5
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 24 deletions.
12 changes: 4 additions & 8 deletions tests/config/browserTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,8 @@ const test = baseTest.extend<BrowserTestTestFixtures, BrowserTestWorkerFixtures>
}, { 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' }],
Expand All @@ -74,10 +72,8 @@ const test = baseTest.extend<BrowserTestTestFixtures, BrowserTestWorkerFixtures>
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' }],
Expand Down
7 changes: 1 addition & 6 deletions tests/library/permissions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) => {
Expand Down
4 changes: 2 additions & 2 deletions tests/page/jshandle-to-string.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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 }) => {
Expand Down
4 changes: 2 additions & 2 deletions tests/page/page-accessibility.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand All @@ -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',
Expand Down
4 changes: 2 additions & 2 deletions tests/page/page-network-response.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions tests/page/page-route.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand All @@ -522,7 +522,7 @@ it('should work with encoded server - 2', async ({ page, server, browserName, br
});
const response = await page.goto(`data:text/html,<link rel="stylesheet" href="${server.PREFIX}/fonts?helvetica|arial"/>`);
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);
Expand Down
4 changes: 2 additions & 2 deletions tests/page/wheel.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3f085d5

Please sign in to comment.