Test for lack of WebAssembly support (#12792)

* Test for lack of WebAssembly support

* Good news: the 'only' detection works
pull/28217/head
David Baker 2024-07-18 14:25:02 +01:00 committed by GitHub
parent 564ea53b83
commit 2920e76b64
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 0 deletions

View File

@ -20,8 +20,23 @@ test(`shows error page if browser lacks Intl support`, async ({ page }) => {
await page.addInitScript({ content: `delete window.Intl;` });
await page.goto("/");
// Lack of Intl support causes the app bundle to fail to load, so we get the iframed
// static error page and need to explicitly look in the iframe becuse Playwright doesn't
// recurse into iframes when looking for elements
const header = await page.frameLocator("iframe").getByText("Unsupported browser");
await expect(header).toBeVisible();
await expect(page).toMatchScreenshot("unsupported-browser.png");
});
test(`shows error page if browser lacks WebAssembly support`, async ({ page }) => {
await page.addInitScript({ content: `delete window.WebAssembly;` });
await page.goto("/");
// Lack of WebAssembly support doesn't cause the bundle to fail loading, so we get
// CompatibilityView, ie. no iframes.
const header = await page.getByText("Unsupported browser");
await expect(header).toBeVisible();
await expect(page).toMatchScreenshot("unsupported-browser-CompatibilityView.png");
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB