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

This commit is contained in:
Joel Einbinder 2020-11-04 13:24:30 -08:00 committed by GitHub
parent 283bc2c7d0
commit 4cb52144b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -68,3 +68,24 @@ it('should play video', (test, { browserName, platform }) => {
await page.$eval('video', v => v.play()); await page.$eval('video', v => v.play());
await page.$eval('video', v => v.pause()); 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);
});