-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4768 from Tyriar/renderer_pw
DOM renderer playwright tests
- Loading branch information
Showing
12 changed files
with
1,293 additions
and
1,177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1,163 changes: 0 additions & 1,163 deletions
1,163
addons/xterm-addon-webgl/test/WebglRenderer.api.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* Copyright (c) 2019 The xterm.js authors. All rights reserved. | ||
* @license MIT | ||
*/ | ||
|
||
import test from '@playwright/test'; | ||
import { strictEqual } from 'assert'; | ||
import { injectSharedRendererTests } from '../../../out-test/playwright/SharedRendererTests'; | ||
import { ITestContext, createTestContext, openTerminal } from '../../../out-test/playwright/TestUtils'; | ||
import { platform } from 'os'; | ||
|
||
let ctx: ITestContext; | ||
const ctxWrapper: { value: ITestContext } = { value: undefined } as any; | ||
test.beforeAll(async ({ browser }) => { | ||
ctx = await createTestContext(browser); | ||
await openTerminal(ctx); | ||
ctxWrapper.value = ctx; | ||
await ctx.page.evaluate(` | ||
window.addon = new WebglAddon(true); | ||
window.term.loadAddon(window.addon); | ||
`); | ||
}); | ||
test.afterAll(async () => await ctx.page.close()); | ||
|
||
test.describe('WebGL Renderer Integration Tests', async () => { | ||
// HACK: webgl2 is often not supported in headless firefox on Linux | ||
// https://github.com/microsoft/playwright/issues/11566 | ||
if (platform() === 'linux') { | ||
test.skip(({ browserName }) => browserName === 'firefox'); | ||
} | ||
|
||
test('dispose removes renderer canvases', async function(): Promise<void> { | ||
strictEqual(await ctx.page.evaluate(`document.querySelectorAll('.xterm canvas').length`), 2); | ||
await ctx.page.evaluate(`addon.dispose()`); | ||
strictEqual(await ctx.page.evaluate(`document.querySelectorAll('.xterm canvas').length`), 0); | ||
// Re-create webgl addon to avoid side effects impacting other tests | ||
await ctx.page.evaluate(` | ||
window.addon = new WebglAddon(true); | ||
window.term.loadAddon(window.addon); | ||
`); | ||
}); | ||
|
||
injectSharedRendererTests(ctxWrapper); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { PlaywrightTestConfig } from '@playwright/test'; | ||
|
||
const config: PlaywrightTestConfig = { | ||
testDir: '.', | ||
timeout: 10000, | ||
projects: [ | ||
{ | ||
name: 'Chrome Stable', | ||
use: { | ||
browserName: 'chromium', | ||
channel: 'chrome' | ||
} | ||
}, | ||
{ | ||
name: 'Firefox Stable', | ||
use: { | ||
browserName: 'firefox' | ||
} | ||
}, | ||
{ | ||
name: 'WebKit', | ||
use: { | ||
browserName: 'webkit' | ||
} | ||
} | ||
], | ||
reporter: 'list', | ||
webServer: { | ||
command: 'npm start', | ||
port: 3000, | ||
timeout: 120000, | ||
reuseExistingServer: !process.env.CI | ||
} | ||
}; | ||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/** | ||
* Copyright (c) 2019 The xterm.js authors. All rights reserved. | ||
* @license MIT | ||
*/ | ||
|
||
// @ts-check | ||
|
||
const cp = require('child_process'); | ||
const path = require('path'); | ||
|
||
const configs = [ | ||
{ name: 'core', path: 'out-test/playwright/playwright.config.js' }, | ||
{ name: 'xterm-addon-webgl', path: 'addons/xterm-addon-webgl/out-test/playwright.config.js' } | ||
]; | ||
|
||
function npmBinScript(script) { | ||
return path.resolve(__dirname, `../node_modules/.bin/` + (process.platform === 'win32' ? | ||
`${script}.cmd` : script)); | ||
} | ||
|
||
for (const config of configs) { | ||
const command = npmBinScript('playwright'); | ||
const args = ['test', '-c', config.path, ...process.argv.slice(2)]; | ||
console.log(`Running suite \x1b[1;34m${config.name}...\x1b[0m`); | ||
console.log(`\n\x1b[32m${command}\x1b[0m`, args); | ||
const run = cp.spawnSync(command, args, { | ||
cwd: path.resolve(__dirname, '..'), | ||
stdio: 'inherit' | ||
} | ||
); | ||
if (run.status) { | ||
process.exit(run.status); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* Copyright (c) 2019 The xterm.js authors. All rights reserved. | ||
* @license MIT | ||
*/ | ||
|
||
import { test } from '@playwright/test'; | ||
import { ITestContext, createTestContext, openTerminal } from './TestUtils'; | ||
import { injectSharedRendererTests } from './SharedRendererTests'; | ||
|
||
let ctx: ITestContext; | ||
const ctxWrapper: { value: ITestContext } = { value: undefined } as any; | ||
test.beforeAll(async ({ browser }) => { | ||
ctx = await createTestContext(browser); | ||
ctxWrapper.value = ctx; | ||
await openTerminal(ctx); | ||
}); | ||
test.afterAll(async () => await ctx.page.close()); | ||
|
||
test.describe('DOM Renderer Integration Tests', () => { | ||
injectSharedRendererTests(ctxWrapper); | ||
}); | ||
|
Oops, something went wrong.