Skip to content

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

test(capabilities): add tests for webgl (#4343)

Joel Einbinder4cb52144b565
diff --git a/test/capabilities.spec.ts b/test/capabilities.spec.ts
index ac2b4e62ca..14aefb9ee1 100644
--- a/test/capabilities.spec.ts
+++ b/test/capabilities.spec.ts
@@ -68,3 +68,24 @@ it('should play video', (test, { browserName, platform }) => {
await page.$eval('video', v => v.play());
await page.$eval('video', v => v.pause());
});
+
+it('should support webgl', (test, {browserName, headful}) => {
+ test.fixme(browserName === 'firefox' && !headful);
+}, async ({page}) => {
+ const hasWebGL2 = await page.evaluate(() => {
+ const canvas = document.createElement('canvas');
+ return !!canvas.getContext('webgl');
+ });
+ expect(hasWebGL2).toBe(true);
+});
+
+it('should support webgl 2', (test, {browserName, headful}) => {
+ test.skip(browserName === 'webkit', 'Webkit doesn\'t have webgl2 enabled yet upstream.');
+ test.fixme(browserName === 'firefox' && !headful);
+}, async ({page}) => {
+ const hasWebGL2 = await page.evaluate(() => {
+ const canvas = document.createElement('canvas');
+ return !!canvas.getContext('webgl2');
+ });
+ expect(hasWebGL2).toBe(true);
+});