Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

test: fix webview2 tests (#36172)

Max Schmitt3e4284c7d6d0
diff --git a/tests/webview2/globalSetup.ts b/tests/webview2/globalSetup.ts
index 030a10401e..b1a8f9e41f 100644
--- a/tests/webview2/globalSetup.ts
+++ b/tests/webview2/globalSetup.ts
@@ -26,13 +26,19 @@ export default async () => {
WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS: `--remote-debugging-port=${cdpPort}`,
}
});
- await new Promise<void>(resolve => spawnedProcess.stdout.on('data', (data: Buffer): void => {
- if (data.toString().includes('WebView2 initialized'))
- resolve();
- }));
+ 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;
diff --git a/tests/webview2/webview2-app/webview2.csproj b/tests/webview2/webview2-app/webview2.csproj
index 4636d47030..2c914444c6 100644
--- a/tests/webview2/webview2-app/webview2.csproj
+++ b/tests/webview2/webview2-app/webview2.csproj
@@ -9,7 +9,7 @@
</PropertyGroup>
<ItemGroup>
- <PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2792.45" />
+ <PackageReference Include="Microsoft.Web.WebView2" Version="1.0.3240.44" />
</ItemGroup>
</Project>
\ No newline at end of file