Skip to content

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

test: add test for avif image format (#32815)

Max Schmittded567d8f82b
diff --git a/tests/assets/rgb.avif b/tests/assets/rgb.avif
new file mode 100644
index 0000000000..d79bff8a21
Binary files /dev/null and b/tests/assets/rgb.avif differ
diff --git a/tests/library/capabilities.spec.ts b/tests/library/capabilities.spec.ts
index 816f647ef4..bde5a8bd0b 100644
--- a/tests/library/capabilities.spec.ts
+++ b/tests/library/capabilities.spec.ts
@@ -401,3 +401,14 @@ it('service worker should register in an iframe', async ({ page, server }) => {
});
expect(response).toBe('responseFromServiceWorker');
});
+
+it('should be able to render avif images', async ({ page, server, browserName, platform }) => {
+ it.fixme(browserName === 'webkit' && platform === 'win32');
+ await page.goto(server.EMPTY_PAGE);
+ await page.setContent(`<img src="${server.PREFIX}/rgb.avif" onerror="window.error = true">`);
+ await expect.poll(() => page.locator('img').boundingBox()).toEqual(expect.objectContaining({
+ width: 128,
+ height: 128,
+ }));
+ expect(await page.evaluate(() => (window as any).error)).toBe(undefined);
+});