Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: update Electron to v27 #30334

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
541 changes: 206 additions & 335 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -82,7 +82,7 @@
"concurrently": "^6.2.1",
"cross-env": "^7.0.3",
"dotenv": "^16.0.0",
"electron": "19.0.11",
"electron": "27.3.10",
"enquirer": "^2.3.6",
"esbuild": "^0.18.11",
"eslint": "^8.55.0",
Expand Down
3 changes: 1 addition & 2 deletions tests/library/browsercontext-storage-state.spec.ts
Expand Up @@ -223,9 +223,8 @@ it('should serialize storageState with lone surrogates', async ({ page, context,
expect(storageState.origins[0].localStorage[0].value).toBe(String.fromCharCode(55934));
});

it('should work when service worker is intefering', async ({ page, context, server, isAndroid, isElectron }) => {
it('should work when service worker is intefering', async ({ page, context, server, isAndroid }) => {
it.skip(isAndroid);
it.skip(isElectron);

server.setRoute('/', (req, res) => {
res.writeHead(200, { 'content-type': 'text/html' });
Expand Down
3 changes: 1 addition & 2 deletions tests/library/page-event-crash.spec.ts
Expand Up @@ -70,9 +70,8 @@ test('should cancel navigation when page crashes', async ({ server, page, crash
expect(error.message).toContain('page.goto: Page crashed');
});

test('should be able to close context when page crashes', async ({ isAndroid, isElectron, isWebView2, page, crash }) => {
test('should be able to close context when page crashes', async ({ isAndroid, isWebView2, page, crash }) => {
test.skip(isAndroid);
test.skip(isElectron);
test.skip(isWebView2, 'Page.close() is not supported in WebView2');

await page.setContent(`<div>This page should crash</div>`);
Expand Down
1 change: 0 additions & 1 deletion tests/page/expect-boolean.spec.ts
Expand Up @@ -455,7 +455,6 @@ test('should print selector syntax error', async ({ page }) => {

test.describe(() => {
test.skip(({ isAndroid }) => isAndroid, 'server.EMPTY_PAGE is the emulator address 10.0.2.2');
test.skip(({ isElectron }) => isElectron, 'Protocol error (Storage.getCookies): Browser context management is not supported.');

test('toBeOK', async ({ page, server }) => {
const res = await page.request.get(server.EMPTY_PAGE);
Expand Down
3 changes: 1 addition & 2 deletions tests/page/interception.spec.ts
Expand Up @@ -33,9 +33,8 @@ it('should work with navigation @smoke', async ({ page, server }) => {
expect(requests.get('style.css').isNavigationRequest()).toBe(false);
});

it('should intercept after a service worker', async ({ page, server, browserName, isAndroid, isElectron }) => {
it('should intercept after a service worker', async ({ page, server, browserName, isAndroid }) => {
it.skip(isAndroid);
it.skip(isElectron);

await page.goto(server.PREFIX + '/serviceworkers/fetchdummy/sw.html');
await page.evaluate(() => window['activationPromise']);
Expand Down
6 changes: 2 additions & 4 deletions tests/page/page-event-request.spec.ts
Expand Up @@ -107,9 +107,8 @@ it('should report requests and responses handled by service worker with routing'
expect(interceptedUrls).toEqual(expectedUrls);
});

it('should report navigation requests and responses handled by service worker', async ({ page, server, isAndroid, isElectron, browserName }) => {
it('should report navigation requests and responses handled by service worker', async ({ page, server, isAndroid, browserName }) => {
it.fixme(isAndroid);
it.fixme(isElectron);

await page.goto(server.PREFIX + '/serviceworkers/stub/sw.html');
await page.evaluate(() => window['activationPromise']);
Expand All @@ -136,9 +135,8 @@ it('should report navigation requests and responses handled by service worker',
}
});

it('should report navigation requests and responses handled by service worker with routing', async ({ page, server, isAndroid, isElectron, browserName }) => {
it('should report navigation requests and responses handled by service worker with routing', async ({ page, server, isAndroid, browserName }) => {
it.fixme(isAndroid);
it.fixme(isElectron);

await page.route('**/*', route => route.continue());
await page.goto(server.PREFIX + '/serviceworkers/stub/sw.html');
Expand Down
3 changes: 1 addition & 2 deletions tests/page/page-goto.spec.ts
Expand Up @@ -684,8 +684,7 @@ it('should fail when canceled by another navigation', async ({ page, server }) =
expect(error.message).toBeTruthy();
});

it('should work with lazy loading iframes', async ({ page, server, isElectron, isAndroid }) => {
it.fixme(isElectron);
it('should work with lazy loading iframes', async ({ page, server, isAndroid }) => {
it.fixme(isAndroid);

await page.goto(server.PREFIX + '/frames/lazy-frame.html');
Expand Down
15 changes: 5 additions & 10 deletions tests/page/page-network-request.spec.ts
Expand Up @@ -82,8 +82,7 @@ it('should return headers', async ({ page, server, browserName }) => {
expect(response.request().headers()['user-agent']).toContain('WebKit');
});

it('should get the same headers as the server', async ({ page, server, browserName, platform, isElectron, browserMajorVersion }) => {
it.skip(isElectron && browserMajorVersion < 99, 'This needs Chromium >= 99');
it('should get the same headers as the server', async ({ page, server, browserName, platform }) => {
it.fail(browserName === 'webkit' && platform === 'win32', 'Curl does not show accept-encoding and accept-language');
let serverRequest;
server.setRoute('/empty.html', (request, response) => {
Expand All @@ -95,8 +94,7 @@ it('should get the same headers as the server', async ({ page, server, browserNa
expect(headers).toEqual(serverRequest.headers);
});

it('should not return allHeaders() until they are available', async ({ page, server, browserName, platform, isElectron, browserMajorVersion }) => {
it.skip(isElectron && browserMajorVersion < 99, 'This needs Chromium >= 99');
it('should not return allHeaders() until they are available', async ({ page, server, browserName, platform }) => {
it.fail(browserName === 'webkit' && platform === 'win32', 'Curl does not show accept-encoding and accept-language');

let requestHeadersPromise;
Expand All @@ -120,8 +118,7 @@ it('should not return allHeaders() until they are available', async ({ page, ser
expect(responseHeaders['foo']).toBe('bar');
});

it('should get the same headers as the server CORS', async ({ page, server, browserName, platform, isElectron, browserMajorVersion }) => {
it.skip(isElectron && browserMajorVersion < 99, 'This needs Chromium >= 99');
it('should get the same headers as the server CORS', async ({ page, server, browserName, platform }) => {
it.fail(browserName === 'webkit' && platform === 'win32', 'Curl does not show accept-encoding and accept-language');

await page.goto(server.PREFIX + '/empty.html');
Expand Down Expand Up @@ -353,8 +350,7 @@ it('should return navigation bit when navigating to image', async ({ page, serve
expect(requests[0].isNavigationRequest()).toBe(true);
});

it('should report raw headers', async ({ page, server, browserName, platform, isElectron, browserMajorVersion }) => {
it.skip(isElectron && browserMajorVersion < 99, 'This needs Chromium >= 99');
it('should report raw headers', async ({ page, server, browserName, platform }) => {

let expectedHeaders: { name: string, value: string }[];
server.setRoute('/headers', (req, res) => {
Expand Down Expand Up @@ -421,8 +417,7 @@ it('should report raw response headers in redirects', async ({ page, server, bro
expect(headersChain).toEqual(expectedHeaders);
});

it('should report all cookies in one header', async ({ page, server, isElectron, browserMajorVersion }) => {
it.skip(isElectron && browserMajorVersion < 99, 'This needs Chromium >= 99');
it('should report all cookies in one header', async ({ page, server }) => {

const expectedHeaders = {};
server.setRoute('/headers', (req, res) => {
Expand Down
14 changes: 6 additions & 8 deletions tests/page/page-network-response.spec.ts
Expand Up @@ -178,8 +178,7 @@ it('should return status text', async ({ page, server }) => {
expect(response.statusText()).toBe('cool!');
});

it('should report all headers', async ({ page, server, browserName, platform, isElectron, browserMajorVersion }) => {
it.skip(isElectron && browserMajorVersion < 99, 'This needs Chromium >= 99');
it('should report all headers', async ({ page, server, browserName, platform }) => {
it.skip(browserName === 'webkit' && platform === 'win32', 'libcurl does not support non-set-cookie multivalue headers');

const expectedHeaders = {
Expand Down Expand Up @@ -214,8 +213,7 @@ it('should report all headers', async ({ page, server, browserName, platform, is
expect(actualHeaders).toEqual(expectedHeaders);
});

it('should report multiple set-cookie headers', async ({ page, server, isElectron, browserMajorVersion }) => {
it.skip(isElectron && browserMajorVersion < 99, 'This needs Chromium >= 99');
it('should report multiple set-cookie headers', async ({ page, server }) => {

server.setRoute('/headers', (req, res) => {
res.writeHead(200, {
Expand Down Expand Up @@ -270,14 +268,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, isWindows, browserName, browserMajorVersion, 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 ((browserName === 'chromium' && browserMajorVersion >= 99) || (browserName === 'webkit' && isWindows))
expect(response.status()).toBe(200);
else
expect(response.status()).toBe(0);
Expand Down Expand Up @@ -322,8 +320,8 @@ it('should return headers after route.fulfill', async ({ page, server }) => {
});
});

it('should report if request was fromServiceWorker', async ({ page, server, isAndroid, isElectron }) => {
it.skip(isAndroid || isElectron);
it('should report if request was fromServiceWorker', async ({ page, server, isAndroid }) => {
it.skip(isAndroid);
{
const res = await page.goto(server.PREFIX + '/serviceworkers/fetch/sw.html');
expect(res.fromServiceWorker()).toBe(false);
Expand Down
2 changes: 0 additions & 2 deletions tests/page/page-network-sizes.spec.ts
Expand Up @@ -20,8 +20,6 @@ import zlib from 'zlib';

import { test as it, expect } from './pageTest';

it.skip(({ isElectron, browserMajorVersion }) => isElectron && browserMajorVersion < 99, 'This needs Chromium >= 99');

it('should set bodySize and headersSize', async ({ page, server }) => {
await page.goto(server.EMPTY_PAGE);
const [request] = await Promise.all([
Expand Down
21 changes: 7 additions & 14 deletions tests/page/page-request-fulfill.spec.ts
Expand Up @@ -139,10 +139,9 @@ it('should allow mocking binary responses', async ({ page, server, browserName,
expect(await img.screenshot()).toMatchSnapshot('mock-binary-response.png');
});

it('should allow mocking svg with charset', async ({ page, server, browserName, headless, isAndroid, isElectron, mode }) => {
it('should allow mocking svg with charset', async ({ page, server, browserName, headless, isAndroid }) => {
it.skip(browserName === 'firefox' && !headless, 'Firefox headed produces a different image.');
it.skip(isAndroid);
it.skip(isElectron, 'Protocol error (Storage.getCookies): Browser context management is not supported');

await page.route('**/*', route => {
void route.fulfill({
Expand Down Expand Up @@ -252,8 +251,7 @@ it('should include the origin header', async ({ page, server, isAndroid }) => {
expect(interceptedRequest.headers()['origin']).toEqual(server.PREFIX);
});

it('should fulfill with global fetch result', async ({ playwright, page, server, isElectron, rewriteAndroidLoopbackURL }) => {
it.fixme(isElectron, 'error: Browser context management is not supported.');
it('should fulfill with global fetch result', async ({ playwright, page, server, rewriteAndroidLoopbackURL }) => {
await page.route('**/*', async route => {
const request = await playwright.request.newContext();
const response = await request.get(rewriteAndroidLoopbackURL(server.PREFIX + '/simple.json'));
Expand All @@ -264,8 +262,7 @@ it('should fulfill with global fetch result', async ({ playwright, page, server,
expect(await response.json()).toEqual({ 'foo': 'bar' });
});

it('should fulfill with fetch result', async ({ page, server, isElectron, rewriteAndroidLoopbackURL }) => {
it.fixme(isElectron, 'error: Browser context management is not supported.');
it('should fulfill with fetch result', async ({ page, server, rewriteAndroidLoopbackURL }) => {
await page.route('**/*', async route => {
const response = await page.request.get(rewriteAndroidLoopbackURL(server.PREFIX + '/simple.json'));
void route.fulfill({ response });
Expand All @@ -275,8 +272,7 @@ it('should fulfill with fetch result', async ({ page, server, isElectron, rewrit
expect(await response.json()).toEqual({ 'foo': 'bar' });
});

it('should fulfill with fetch result and overrides', async ({ page, server, isElectron, rewriteAndroidLoopbackURL }) => {
it.fixme(isElectron, 'error: Browser context management is not supported.');
it('should fulfill with fetch result and overrides', async ({ page, server, rewriteAndroidLoopbackURL }) => {
await page.route('**/*', async route => {
const response = await page.request.get(rewriteAndroidLoopbackURL(server.PREFIX + '/simple.json'));
void route.fulfill({
Expand All @@ -294,8 +290,7 @@ it('should fulfill with fetch result and overrides', async ({ page, server, isEl
expect(await response.json()).toEqual({ 'foo': 'bar' });
});

it('should fetch original request and fulfill', async ({ page, server, isElectron, isAndroid }) => {
it.fixme(isElectron, 'error: Browser context management is not supported.');
it('should fetch original request and fulfill', async ({ page, server, isAndroid }) => {
it.skip(isAndroid, 'The internal Android localhost (10.0.0.2) != the localhost on the host');
await page.route('**/*', async route => {
const response = await page.request.fetch(route.request());
Expand All @@ -308,8 +303,7 @@ it('should fetch original request and fulfill', async ({ page, server, isElectro
expect(await page.title()).toEqual('Woof-Woof');
});

it('should fulfill with multiple set-cookie', async ({ page, server, isElectron }) => {
it.fixme(isElectron, 'Electron 14+ is required');
it('should fulfill with multiple set-cookie', async ({ page, server }) => {
const cookies = ['a=b', 'c=d'];
await page.route('**/empty.html', async route => {
void route.fulfill({
Expand Down Expand Up @@ -441,9 +435,8 @@ it('should fulfill json', async ({ page, server }) => {

it('should fulfill with gzip and readback', {
annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/29261' },
}, async ({ page, server, isAndroid, isElectron }) => {
}, async ({ page, server, isAndroid }) => {
it.skip(isAndroid, 'The internal Android localhost (10.0.0.2) != the localhost on the host');
it.fixme(isElectron, 'error: Browser context management is not supported.');
server.enableGzip('/one-style.html');
await page.route('**/one-style.html', async route => {
const response = await route.fetch();
Expand Down