diff --git a/.github/workflows/tests_others.yml b/.github/workflows/tests_others.yml index 10fa1dc71d..7683684bb4 100644 --- a/.github/workflows/tests_others.yml +++ b/.github/workflows/tests_others.yml @@ -55,36 +55,6 @@ jobs: - run: npm run stest heap -- --project=chromium if: ${{ !cancelled() }} - test_webview2: - name: WebView2 - environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }} - runs-on: windows-2022 - permissions: - id-token: write # This is required for OIDC login (azure/login) to succeed - contents: read # This is required for actions/checkout to succeed - steps: - - uses: actions/checkout@v6 - - uses: actions/setup-dotnet@v5 - with: - dotnet-version: '8.0.x' - - run: dotnet build - working-directory: tests/webview2/webview2-app/ - - name: Update to Evergreen WebView2 Runtime - shell: pwsh - run: | - # See here: https://developer.microsoft.com/en-us/microsoft-edge/webview2/ - Invoke-WebRequest -Uri 'https://go.microsoft.com/fwlink/p/?LinkId=2124703' -OutFile 'setup.exe' - Start-Process -FilePath setup.exe -Verb RunAs -Wait - - uses: ./.github/actions/run-test - with: - node-version: 20 - browsers-to-install: chromium - command: npm run webview2test - bot-name: "webview2-chromium-windows" - flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }} - flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }} - flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }} - test_clock_frozen_time_linux: name: time library - ${{ matrix.clock }} environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }} diff --git a/package.json b/package.json index 805ba4b6f3..21938cd139 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,6 @@ "wtest": "playwright test --config=tests/library/playwright.config.ts --project=webkit-*", "atest": "playwright test --config=tests/android/playwright.config.ts", "etest": "playwright test --config=tests/electron/playwright.config.ts", - "webview2test": "playwright test --config=tests/webview2/playwright.config.ts", "itest": "playwright test --config=tests/installation/playwright.config.ts", "stest": "playwright test --config=tests/stress/playwright.config.ts", "biditest": "playwright test --config=tests/bidi/playwright.config.ts", diff --git a/tests/android/androidTest.ts b/tests/android/androidTest.ts index b11ca339d6..e2015db451 100644 --- a/tests/android/androidTest.ts +++ b/tests/android/androidTest.ts @@ -60,7 +60,6 @@ export const androidTest = baseTest.extend { diff --git a/tests/config/browserTest.ts b/tests/config/browserTest.ts index 2279e01197..2925b037d6 100644 --- a/tests/config/browserTest.ts +++ b/tests/config/browserTest.ts @@ -98,7 +98,6 @@ const test = baseTest.extend isAndroid: [false, { scope: 'worker' }], isElectron: [false, { scope: 'worker' }], electronMajorVersion: [0, { scope: 'worker' }], - isWebView2: [false, { scope: 'worker' }], isHeadlessShell: [async ({ browserName, channel, headless }, use) => { await use(browserName === 'chromium' && (channel === 'chromium-headless-shell' || channel === 'chromium-tip-of-tree-headless-shell' || (!channel && headless))); diff --git a/tests/electron/electronTest.ts b/tests/electron/electronTest.ts index b2105017a0..516f5c1e5c 100644 --- a/tests/electron/electronTest.ts +++ b/tests/electron/electronTest.ts @@ -38,7 +38,6 @@ export const electronTest = baseTest.extend(traceViewerFixt 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' }], isHeadlessShell: [false, { scope: 'worker' }], createUserDataDir: async ({ mode }, run) => { diff --git a/tests/library/page-event-crash.spec.ts b/tests/library/page-event-crash.spec.ts index 02c9f616c1..f4037f8805 100644 --- a/tests/library/page-event-crash.spec.ts +++ b/tests/library/page-event-crash.spec.ts @@ -75,9 +75,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, isWebView2, page, crash }) => { +test('should be able to close context when page crashes', async ({ isAndroid, page, crash }) => { test.skip(isAndroid); - test.skip(isWebView2, 'Page.close() is not supported in WebView2'); await page.setContent(`
This page should crash
`); crash(); diff --git a/tests/page/page-filechooser.spec.ts b/tests/page/page-filechooser.spec.ts index ba45345474..6c4262e41d 100644 --- a/tests/page/page-filechooser.spec.ts +++ b/tests/page/page-filechooser.spec.ts @@ -21,9 +21,8 @@ import { attachFrame } from '../config/utils'; import fs from 'fs'; import formidable from 'formidable'; -test('should upload multiple large files', async ({ page, server, isAndroid, isWebView2, mode }, testInfo) => { +test('should upload multiple large files', async ({ page, server, isAndroid, mode }, testInfo) => { test.skip(isAndroid); - test.skip(isWebView2); test.skip(mode.startsWith('service')); test.slow(); diff --git a/tests/page/page-set-input-files.spec.ts b/tests/page/page-set-input-files.spec.ts index 9129a6ee4f..673553cfe5 100644 --- a/tests/page/page-set-input-files.spec.ts +++ b/tests/page/page-set-input-files.spec.ts @@ -143,9 +143,8 @@ test('should upload a file after popup', async ({ page, server, asset }) => { expect(await page.evaluate(e => e.files[0].name, input)).toBe('file-to-upload.txt'); }); -test('should upload large file', async ({ page, server, isAndroid, isWebView2, mode }, testInfo) => { +test('should upload large file', async ({ page, server, isAndroid, mode }, testInfo) => { test.skip(isAndroid); - test.skip(isWebView2); test.skip(mode.startsWith('service')); test.slow(); @@ -201,9 +200,8 @@ test('should throw an error if the file does not exist', async ({ page, server, expect(error.message).toContain('i actually do not exist.txt'); }); -test('should upload large file with relative path', async ({ page, server, isAndroid, isWebView2, mode }, testInfo) => { +test('should upload large file with relative path', async ({ page, server, isAndroid, mode }, testInfo) => { test.skip(isAndroid); - test.skip(isWebView2); test.skip(mode.startsWith('service')); test.slow(); diff --git a/tests/page/pageTest.ts b/tests/page/pageTest.ts index 52d9b95c67..92de301080 100644 --- a/tests/page/pageTest.ts +++ b/tests/page/pageTest.ts @@ -20,7 +20,6 @@ import type { TestModeTestFixtures, TestModeWorkerFixtures, TestModeWorkerOption import { androidTest } from '../android/androidTest'; import { browserTest } from '../config/browserTest'; import { electronTest } from '../electron/electronTest'; -import { webView2Test } from '../webview2/webView2Test'; import type { PageTestFixtures, PageWorkerFixtures } from './pageTestApi'; import type { ServerFixtures, ServerWorkerOptions } from '../config/serverFixtures'; import { expect as baseExpect } from '@playwright/test'; @@ -32,8 +31,6 @@ if (process.env.PWPAGE_IMPL === 'android') impl = androidTest; if (process.env.PWPAGE_IMPL === 'electron') impl = electronTest; -if (process.env.PWPAGE_IMPL === 'webview2') - impl = webView2Test; export const test = impl; diff --git a/tests/page/pageTestApi.ts b/tests/page/pageTestApi.ts index 1b7c8e0b4b..de9ee1b23b 100644 --- a/tests/page/pageTestApi.ts +++ b/tests/page/pageTestApi.ts @@ -35,6 +35,5 @@ export type PageWorkerFixtures = { electronMajorVersion: number; isAndroid: boolean; isElectron: boolean; - isWebView2: boolean; isHeadlessShell: boolean; }; diff --git a/tests/webview2/globalSetup.ts b/tests/webview2/globalSetup.ts deleted file mode 100644 index b1a8f9e41f..0000000000 --- a/tests/webview2/globalSetup.ts +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import path from 'path'; -import childProcess from 'child_process'; -import playwright from 'playwright'; - -export default async () => { - const cdpPort = 9876; - const spawnedProcess = childProcess.spawn(path.join(__dirname, 'webview2-app/bin/Debug/net8.0-windows/webview2.exe'), { - shell: true, - env: { - ...process.env, - WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS: `--remote-debugging-port=${cdpPort}`, - } - }); - await new Promise((resolve, reject) => { - spawnedProcess.on('error', error => { - reject(error); - }); - spawnedProcess.stdout.on('data', (data: Buffer): void => { - if (data.toString().includes('WebView2 initialized')) - resolve(); - }); - }); - const browser = await playwright.chromium.connectOverCDP(`http://127.0.0.1:${cdpPort}`); - console.log(`Using version ${browser.version()} WebView2 runtime`); - const page = browser.contexts()[0].pages()[0]; - await page.waitForURL('about:blank'); - await page.goto('data:text/html,'); - const chromeVersion = await page.evaluate(() => navigator.userAgent.match(/Chrome\/(.*?) /)[1]); - process.env.PWTEST_WEBVIEW2_CHROMIUM_VERSION = chromeVersion; - await browser.close(); - childProcess.spawnSync(`taskkill /pid ${spawnedProcess.pid} /T /F`, { shell: true }); -}; diff --git a/tests/webview2/playwright.config.ts b/tests/webview2/playwright.config.ts deleted file mode 100644 index 57e9b3fc4b..0000000000 --- a/tests/webview2/playwright.config.ts +++ /dev/null @@ -1,70 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { config as loadEnv } from 'dotenv'; -loadEnv({ path: path.join(__dirname, '..', '..', '.env') }); -process.env.PWTEST_UNDER_TEST = '1'; - -import type { Config, PlaywrightTestOptions, PlaywrightWorkerOptions } from '@playwright/test'; -import * as path from 'path'; - -process.env.PWPAGE_IMPL = 'webview2'; - -const outputDir = path.join(__dirname, '..', '..', 'test-results'); -const testDir = path.join(__dirname, '..'); -const config: Config = { - testDir, - outputDir, - expect: { - timeout: 10000, - }, - timeout: 30000, - globalTimeout: 5400000, - workers: process.env.CI ? 1 : undefined, - forbidOnly: !!process.env.CI, - retries: process.env.CI ? 3 : 0, - reporter: process.env.CI ? [ - ['dot'], - ['json', { outputFile: path.join(outputDir, 'report.json') }], - ['blob'], - ] : 'line', - tag: process.env.PW_TAG, - projects: [], - globalSetup: './globalSetup.ts', -}; - -const metadata = { - platform: process.platform, - headless: 'headed', - browserName: 'webview2', - channel: undefined, - mode: 'default', - video: false, -}; - -config.projects.push({ - name: 'webview2', - // Share screenshots with chromium. - snapshotPathTemplate: '{testDir}/{testFileDir}/{testFileName}-snapshots/{arg}-chromium{ext}', - use: { - browserName: 'chromium', - headless: false, - }, - testDir: path.join(testDir, 'page'), - metadata, -}); - -export default config; diff --git a/tests/webview2/webView2Test.ts b/tests/webview2/webView2Test.ts deleted file mode 100644 index 49837c6f1e..0000000000 --- a/tests/webview2/webView2Test.ts +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { baseTest } from '../config/baseTest'; -import fs from 'fs'; -import os from 'os'; -import path from 'path'; -import type { PageTestFixtures, PageWorkerFixtures } from '../page/pageTestApi'; -import type { TraceViewerFixtures } from '../config/traceViewerFixtures'; -import { traceViewerFixtures } from '../config/traceViewerFixtures'; -export { expect } from '@playwright/test'; -import { TestChildProcess } from '../config/commonFixtures'; -import { chromiumSwitches } from '../../packages/playwright-core/lib/server/chromium/chromiumSwitches'; - -export const webView2Test = baseTest.extend(traceViewerFixtures).extend({ - browserVersion: [process.env.PWTEST_WEBVIEW2_CHROMIUM_VERSION, { scope: 'worker' }], - browserMajorVersion: [({ browserVersion }, use) => use(Number(browserVersion.split('.')[0])), { scope: 'worker' }], - isAndroid: [false, { scope: 'worker' }], - isElectron: [false, { scope: 'worker' }], - electronMajorVersion: [0, { scope: 'worker' }], - isWebView2: [true, { scope: 'worker' }], - isHeadlessShell: [false, { scope: 'worker' }], - - browser: [async ({ playwright }, use, testInfo) => { - const cdpPort = 10000 + testInfo.workerIndex; - const spawnedProcess = new TestChildProcess({ - command: [path.join(__dirname, 'webview2-app/bin/Debug/net8.0-windows/webview2.exe')], - shell: true, - env: { - ...process.env, - WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS: `--remote-debugging-port=${cdpPort} ${chromiumSwitches().join(' ')}`, - WEBVIEW2_USER_DATA_FOLDER: path.join(fs.realpathSync.native(os.tmpdir()), `playwright-webview2-tests/user-data-dir-${testInfo.workerIndex}`), - } - }); - await new Promise(resolve => spawnedProcess.process.stdout.on('data', data => { - if (data.toString().includes('WebView2 initialized')) - resolve(); - })); - const browser = await playwright.chromium.connectOverCDP(`http://127.0.0.1:${cdpPort}`); - await use(browser); - await browser.close(); - await spawnedProcess.kill('SIGINT'); - }, { scope: 'worker' }], -}); diff --git a/tests/webview2/webview2-app/.gitignore b/tests/webview2/webview2-app/.gitignore deleted file mode 100644 index 674593b9f8..0000000000 --- a/tests/webview2/webview2-app/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -obj/ -bin/ -.vs/ diff --git a/tests/webview2/webview2-app/Form1.Designer.cs b/tests/webview2/webview2-app/Form1.Designer.cs deleted file mode 100644 index a1157f3e05..0000000000 --- a/tests/webview2/webview2-app/Form1.Designer.cs +++ /dev/null @@ -1,64 +0,0 @@ -namespace webview2; - -partial class Form1 -{ - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.webView = new Microsoft.Web.WebView2.WinForms.WebView2(); - ((System.ComponentModel.ISupportInitialize)(this.webView)).BeginInit(); - this.SuspendLayout(); - // - // webView - // - this.webView.AllowExternalDrop = true; - this.webView.CreationProperties = null; - this.webView.DefaultBackgroundColor = System.Drawing.Color.White; - this.webView.Dock = System.Windows.Forms.DockStyle.Fill; - this.webView.Location = new System.Drawing.Point(0, 0); - this.webView.Name = "webView"; - this.webView.Size = new System.Drawing.Size(1280, 720); - this.webView.Source = new System.Uri("about:blank", System.UriKind.Absolute); - this.webView.TabIndex = 0; - this.webView.ZoomFactor = 1D; - // - // Form1 - // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1280, 720); - this.Controls.Add(this.webView); - this.Name = "Form1"; - this.Text = "Playwright WebView2"; - ((System.ComponentModel.ISupportInitialize)(this.webView)).EndInit(); - this.ResumeLayout(false); - - } - - #endregion - - private Microsoft.Web.WebView2.WinForms.WebView2 webView; -} diff --git a/tests/webview2/webview2-app/Form1.cs b/tests/webview2/webview2-app/Form1.cs deleted file mode 100644 index a69643319f..0000000000 --- a/tests/webview2/webview2-app/Form1.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace webview2; - -public partial class Form1 : Form -{ - public Form1() - { - InitializeComponent(); - this.webView.CoreWebView2InitializationCompleted += (_, e) => - { - if (e.IsSuccess) - Console.WriteLine("WebView2 initialized"); - }; - } -} diff --git a/tests/webview2/webview2-app/Form1.resx b/tests/webview2/webview2-app/Form1.resx deleted file mode 100644 index f298a7be80..0000000000 --- a/tests/webview2/webview2-app/Form1.resx +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/tests/webview2/webview2-app/Program.cs b/tests/webview2/webview2-app/Program.cs deleted file mode 100644 index 1c90d15c77..0000000000 --- a/tests/webview2/webview2-app/Program.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace webview2; - -static class Program -{ - /// - /// The main entry point for the application. - /// - [STAThread] - static void Main() - { - // To customize application configuration such as set high DPI settings or default font, - // see https://aka.ms/applicationconfiguration. - ApplicationConfiguration.Initialize(); - Application.Run(new Form1()); - } -} \ No newline at end of file diff --git a/tests/webview2/webview2-app/webview2.csproj b/tests/webview2/webview2-app/webview2.csproj deleted file mode 100644 index 2c914444c6..0000000000 --- a/tests/webview2/webview2-app/webview2.csproj +++ /dev/null @@ -1,15 +0,0 @@ - - - - WinExe - net8.0-windows - enable - true - enable - - - - - - - \ No newline at end of file diff --git a/tests/webview2/webview2-app/webview2.csproj.user b/tests/webview2/webview2-app/webview2.csproj.user deleted file mode 100644 index 7814ea24ef..0000000000 --- a/tests/webview2/webview2-app/webview2.csproj.user +++ /dev/null @@ -1,8 +0,0 @@ - - - - - Form - - -