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 v30 #30334

Merged
merged 2 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
546 changes: 213 additions & 333 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"concurrently": "^6.2.1",
"cross-env": "^7.0.3",
"dotenv": "^16.0.0",
"electron": "19.0.11",
"electron": "^30.1.2",
"enquirer": "^2.3.6",
"esbuild": "^0.18.11",
"eslint": "^8.55.0",
Expand Down
1 change: 1 addition & 0 deletions tests/android/androidTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export const androidTest = baseTest.extend<PageTestFixtures, AndroidWorkerFixtur

isAndroid: [true, { scope: 'worker' }],
isElectron: [false, { scope: 'worker' }],
electronMajorVersion: [0, { scope: 'worker' }],
isWebView2: [false, { scope: 'worker' }],

androidContext: [async ({ androidDevice }, run) => {
Expand Down
1 change: 1 addition & 0 deletions tests/config/browserTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ const test = baseTest.extend<BrowserTestTestFixtures, BrowserTestWorkerFixtures>

isAndroid: [false, { scope: 'worker' }],
isElectron: [false, { scope: 'worker' }],
electronMajorVersion: [0, { scope: 'worker' }],
isWebView2: [false, { scope: 'worker' }],

contextFactory: async ({ _contextFactory }: any, run) => {
Expand Down
4 changes: 2 additions & 2 deletions tests/electron/electron-app.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,8 @@ test('should return app name / version from manifest', async ({ launchElectronAp
});
});

test('should report downloads', async ({ launchElectronApp, server }) => {
test.skip(parseInt(require('electron/package.json').version.split('.')[0], 10) < 30, 'Depends on https://github.com/electron/electron/pull/41718');
test('should report downloads', async ({ launchElectronApp, electronMajorVersion, server }) => {
test.skip(electronMajorVersion < 30, 'Depends on https://github.com/electron/electron/pull/41718');

server.setRoute('/download', (req, res) => {
res.setHeader('Content-Type', 'application/octet-stream');
Expand Down
1 change: 1 addition & 0 deletions tests/electron/electronTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type ElectronTestFixtures = PageTestFixtures & {
export const electronTest = baseTest.extend<TraceViewerFixtures>(traceViewerFixtures).extend<ElectronTestFixtures, PageWorkerFixtures>({
browserVersion: [({}, use) => use(process.env.ELECTRON_CHROMIUM_VERSION), { scope: 'worker' }],
browserMajorVersion: [({}, use) => use(Number(process.env.ELECTRON_CHROMIUM_VERSION.split('.')[0])), { scope: 'worker' }],
electronMajorVersion: [({}, use) => use(parseInt(require('electron/package.json').version.split('.')[0], 10)), { scope: 'worker' }],
isAndroid: [false, { scope: 'worker' }],
isElectron: [true, { scope: 'worker' }],
isWebView2: [false, { scope: 'worker' }],
Expand Down
4 changes: 2 additions & 2 deletions tests/library/browsercontext-storage-state.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,9 @@ 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, isElectron, electronMajorVersion }) => {
it.skip(isAndroid);
it.skip(isElectron);
it.skip(isElectron && electronMajorVersion < 30, 'error: Browser context management is not supported.');

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
Original file line number Diff line number Diff line change
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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we keep these ones with the electron/browser version check instead? I find such historical annotations very useful later on.

test.skip(isWebView2, 'Page.close() is not supported in WebView2');

await page.setContent(`<div>This page should crash</div>`);
Expand Down
2 changes: 1 addition & 1 deletion tests/page/expect-boolean.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ 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.skip(({ isElectron, electronMajorVersion }) => isElectron && electronMajorVersion < 30, '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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -685,8 +685,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
28 changes: 14 additions & 14 deletions tests/page/page-request-fulfill.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ 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, isElectron, electronMajorVersion }) => {
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');
it.skip(isElectron && electronMajorVersion < 30, 'Protocol error (Storage.getCookies): Browser context management is not supported');

await page.route('**/*', route => {
void route.fulfill({
Expand Down Expand Up @@ -253,8 +253,8 @@ 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, isElectron, electronMajorVersion, rewriteAndroidLoopbackURL }) => {
it.skip(isElectron && electronMajorVersion < 30, 'error: Browser context management is not supported.');
await page.route('**/*', async route => {
const request = await playwright.request.newContext();
const response = await request.get(rewriteAndroidLoopbackURL(server.PREFIX + '/simple.json'));
Expand All @@ -265,8 +265,8 @@ 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, isElectron, electronMajorVersion, rewriteAndroidLoopbackURL }) => {
it.skip(isElectron && electronMajorVersion < 30, 'error: Browser context management is not supported.');
await page.route('**/*', async route => {
const response = await page.request.get(rewriteAndroidLoopbackURL(server.PREFIX + '/simple.json'));
void route.fulfill({ response });
Expand All @@ -276,8 +276,8 @@ 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, isElectron, electronMajorVersion, rewriteAndroidLoopbackURL }) => {
it.skip(isElectron && electronMajorVersion < 30, 'error: Browser context management is not supported.');
await page.route('**/*', async route => {
const response = await page.request.get(rewriteAndroidLoopbackURL(server.PREFIX + '/simple.json'));
void route.fulfill({
Expand All @@ -295,8 +295,8 @@ 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, isElectron, electronMajorVersion, isAndroid }) => {
it.skip(isElectron && electronMajorVersion < 30, 'error: Browser context management is not supported.');
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 @@ -309,8 +309,8 @@ 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, isElectron, electronMajorVersion }) => {
it.skip(isElectron && electronMajorVersion < 14, 'Electron 14+ is required');
const cookies = ['a=b', 'c=d'];
await page.route('**/empty.html', async route => {
void route.fulfill({
Expand Down Expand Up @@ -442,9 +442,9 @@ 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, isElectron, electronMajorVersion }) => {
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.');
it.skip(isElectron && electronMajorVersion < 30, '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
Loading
Loading