Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
test: drop webview2 bot (#38490)
Simon Knott2529632db6da
diff --git a/.github/workflows/tests_others.yml b/.github/workflows/tests_others.ymlindex 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=chromiumif: ${{ !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.jsonindex 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.tsindex b11ca339d6..e2015db451 100644--- a/tests/android/androidTest.ts+++ b/tests/android/androidTest.ts@@ -60,7 +60,6 @@ export const androidTest = baseTest.extend<PageTestFixtures & AndroidTestFixtureisAndroid: [true, { scope: 'worker' }],isElectron: [false, { scope: 'worker' }],electronMajorVersion: [0, { scope: 'worker' }],- isWebView2: [false, { scope: 'worker' }],isHeadlessShell: [false, { scope: 'worker' }],androidDevice: async ({ androidDeviceWorker }, use) => {diff --git a/tests/config/browserTest.ts b/tests/config/browserTest.tsindex 2279e01197..2925b037d6 100644--- a/tests/config/browserTest.ts+++ b/tests/config/browserTest.ts@@ -98,7 +98,6 @@ const test = baseTest.extend<BrowserTestTestFixtures, BrowserTestWorkerFixtures>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.tsindex b2105017a0..516f5c1e5c 100644--- a/tests/electron/electronTest.ts+++ b/tests/electron/electronTest.ts@@ -38,7 +38,6 @@ export const electronTest = baseTest.extend<TraceViewerFixtures>(traceViewerFixtelectronMajorVersion: [({}, 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.tsindex 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, crashexpect(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(`<div>This page should crash</div>`);crash();diff --git a/tests/page/page-filechooser.spec.ts b/tests/page/page-filechooser.spec.tsindex 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.tsindex 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.tsindex 52d9b95c67..92de301080 100644--- a/tests/page/pageTest.ts+++ b/tests/page/pageTest.ts@@ -20,7 +20,6 @@ import type { TestModeTestFixtures, TestModeWorkerFixtures, TestModeWorkerOptionimport { 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.tsindex 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.tsdeleted file mode 100644index 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<void>((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.tsdeleted file mode 100644index 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<PlaywrightWorkerOptions & PlaywrightTestOptions> = {- 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.tsdeleted file mode 100644index 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>(traceViewerFixtures).extend<PageTestFixtures, PageWorkerFixtures>({- 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<void>(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/.gitignoredeleted file mode 100644index 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.csdeleted file mode 100644index a1157f3e05..0000000000--- a/tests/webview2/webview2-app/Form1.Designer.cs+++ /dev/null@@ -1,64 +0,0 @@-namespace webview2;--partial class Form1-{- /// <summary>- /// Required designer variable.- /// </summary>- private System.ComponentModel.IContainer components = null;-- /// <summary>- /// Clean up any resources being used.- /// </summary>- /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>- protected override void Dispose(bool disposing)- {- if (disposing && (components != null))- {- components.Dispose();- }- base.Dispose(disposing);- }-- #region Windows Form Designer generated code-- /// <summary>- /// Required method for Designer support - do not modify- /// the contents of this method with the code editor.- /// </summary>- 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.csdeleted file mode 100644index 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.resxdeleted file mode 100644index f298a7be80..0000000000--- a/tests/webview2/webview2-app/Form1.resx+++ /dev/null@@ -1,60 +0,0 @@-<root>- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">- <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />- <xsd:element name="root" msdata:IsDataSet="true">- <xsd:complexType>- <xsd:choice maxOccurs="unbounded">- <xsd:element name="metadata">- <xsd:complexType>- <xsd:sequence>- <xsd:element name="value" type="xsd:string" minOccurs="0" />- </xsd:sequence>- <xsd:attribute name="name" use="required" type="xsd:string" />- <xsd:attribute name="type" type="xsd:string" />- <xsd:attribute name="mimetype" type="xsd:string" />- <xsd:attribute ref="xml:space" />- </xsd:complexType>- </xsd:element>- <xsd:element name="assembly">- <xsd:complexType>- <xsd:attribute name="alias" type="xsd:string" />- <xsd:attribute name="name" type="xsd:string" />- </xsd:complexType>- </xsd:element>- <xsd:element name="data">- <xsd:complexType>- <xsd:sequence>- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />- </xsd:sequence>- <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />- <xsd:attribute ref="xml:space" />- </xsd:complexType>- </xsd:element>- <xsd:element name="resheader">- <xsd:complexType>- <xsd:sequence>- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />- </xsd:sequence>- <xsd:attribute name="name" type="xsd:string" use="required" />- </xsd:complexType>- </xsd:element>- </xsd:choice>- </xsd:complexType>- </xsd:element>- </xsd:schema>- <resheader name="resmimetype">- <value>text/microsoft-resx</value>- </resheader>- <resheader name="version">- <value>2.0</value>- </resheader>- <resheader name="reader">- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>- </resheader>- <resheader name="writer">- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>- </resheader>-</root>\ No newline at end of filediff --git a/tests/webview2/webview2-app/Program.cs b/tests/webview2/webview2-app/Program.csdeleted file mode 100644index 1c90d15c77..0000000000--- a/tests/webview2/webview2-app/Program.cs+++ /dev/null@@ -1,16 +0,0 @@-namespace webview2;--static class Program-{- /// <summary>- /// The main entry point for the application.- /// </summary>- [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 filediff --git a/tests/webview2/webview2-app/webview2.csproj b/tests/webview2/webview2-app/webview2.csprojdeleted file mode 100644index 2c914444c6..0000000000--- a/tests/webview2/webview2-app/webview2.csproj+++ /dev/null@@ -1,15 +0,0 @@-<Project Sdk="Microsoft.NET.Sdk">-- <PropertyGroup>- <OutputType>WinExe</OutputType>- <TargetFramework>net8.0-windows</TargetFramework>- <Nullable>enable</Nullable>- <UseWindowsForms>true</UseWindowsForms>- <ImplicitUsings>enable</ImplicitUsings>- </PropertyGroup>-- <ItemGroup>- <PackageReference Include="Microsoft.Web.WebView2" Version="1.0.3240.44" />- </ItemGroup>--</Project>\ No newline at end of filediff --git a/tests/webview2/webview2-app/webview2.csproj.user b/tests/webview2/webview2-app/webview2.csproj.userdeleted file mode 100644index 7814ea24ef..0000000000--- a/tests/webview2/webview2-app/webview2.csproj.user+++ /dev/null@@ -1,8 +0,0 @@-<?xml version="1.0" encoding="utf-8"?>-<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">- <ItemGroup>- <Compile Update="Form1.cs">- <SubType>Form</SubType>- </Compile>- </ItemGroup>-</Project>