Skip to content

Commit

Permalink
test: update Electron to v30
Browse files Browse the repository at this point in the history
  • Loading branch information
mxschmitt committed Jun 20, 2024
1 parent 95fc2b8 commit 335d8b3
Show file tree
Hide file tree
Showing 15 changed files with 253 additions and 413 deletions.
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
3 changes: 1 addition & 2 deletions tests/library/browsercontext-storage-state.spec.ts
Original file line number Diff line number Diff line change
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
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);
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
Original file line number Diff line number Diff line change
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
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
16 changes: 5 additions & 11 deletions tests/page/page-network-request.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,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 @@ -101,8 +100,7 @@ it('should get the same headers as the server', async ({ page, server, browserNa
expect(headers).toEqual(adjustServerHeaders(serverRequest.headers, browserName));
});

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 @@ -126,8 +124,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 @@ -384,9 +381,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, channel }) => {
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) => {
expectedHeaders = [];
Expand Down Expand Up @@ -455,8 +450,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
Original file line number Diff line number Diff line change
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:https:// 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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,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 @@ -253,8 +252,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 @@ -265,8 +263,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 @@ -276,8 +273,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 @@ -295,8 +291,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 @@ -309,8 +304,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 @@ -442,9 +436,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
Loading

0 comments on commit 335d8b3

Please sign in to comment.