From 4cb52144b5654c6dfce35f04df901986491e087c Mon Sep 17 00:00:00 2001 From: Joel Einbinder Date: Wed, 4 Nov 2020 13:24:30 -0800 Subject: [PATCH] test(capabilities): add tests for webgl (#4343) --- test/capabilities.spec.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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); +});