mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Only enable webgl tests on chromium and non-headless firefox
See microsoft/playwright#1032
This commit is contained in:
@@ -7,7 +7,7 @@ import { ITerminalOptions } from '../../../src/Types';
|
||||
import { ITheme } from 'xterm';
|
||||
import { assert } from 'chai';
|
||||
import { openTerminal, pollFor, writeSync, getBrowserType } from '../../../out-test/api/TestUtils';
|
||||
import { Browser, Page } from 'playwright';
|
||||
import { Browser, Page, BrowserType } from 'playwright';
|
||||
|
||||
const APP = 'http://127.0.0.1:3000/test';
|
||||
|
||||
@@ -17,7 +17,18 @@ const width = 800;
|
||||
const height = 600;
|
||||
|
||||
describe('WebGL Renderer Integration Tests', function(): void {
|
||||
it('dispose removes renderer canvases', async () => {
|
||||
this.timeout(20000);
|
||||
|
||||
const browserType = getBrowserType();
|
||||
const isHeadless = process.argv.indexOf('--headless') !== -1;
|
||||
const areTestsEnabled = browserType.name() === 'chromium' || (browserType.name() === 'firefox' && !isHeadless);
|
||||
if (!areTestsEnabled) {
|
||||
// Firefox work only in non-headless mode https://github.com/microsoft/playwright/issues/1032
|
||||
console.log(`WebGL Renderer tests are disabled browser "${browserType.name()}" and headless mode "${isHeadless}"`);
|
||||
return;
|
||||
}
|
||||
|
||||
it('dispose removes renderer canvases', async function(): Promise<void> {
|
||||
await setupBrowser();
|
||||
assert.equal(await page.evaluate(`document.querySelectorAll('.xterm canvas').length`), 3);
|
||||
await page.evaluate(`addon.dispose()`);
|
||||
|
||||
@@ -81,7 +81,7 @@ export class WebglRenderer extends Disposable implements IRenderer {
|
||||
};
|
||||
this._gl = this._canvas.getContext('webgl2', contextAttributes) as IWebGL2RenderingContext;
|
||||
if (!this._gl) {
|
||||
throw new Error('WebGL2 not supported');
|
||||
throw new Error('WebGL2 not supported ' + this._gl);
|
||||
}
|
||||
this._core.screenElement.appendChild(this._canvas);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user