Migrate webgl to playwright/test, add unified runner script

This commit is contained in:
Daniel Imms
2023-09-08 10:04:25 -07:00
parent e54755b074
commit 070d194c6c
7 changed files with 1216 additions and 1173 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -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;
+1 -2
View File
@@ -20,9 +20,8 @@
},
"strict": true,
"types": [
"../../../node_modules/@types/mocha",
"../../../node_modules/@types/node",
"../../../out-test/api/TestUtils"
"../../../out-test/playwright/TestUtils"
]
},
"include": [
+34
View File
@@ -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);
}
}
+5 -5
View File
@@ -38,11 +38,11 @@
"test-api-chromium": "node ./bin/test_api.js --browser=chromium --timeout=20000",
"test-api-firefox": "node ./bin/test_api.js --browser=firefox --timeout=20000",
"test-api-webkit": "node ./bin/test_api.js --browser=webkit --timeout=20000",
"test-playwright": "playwright test -c ./out-test/playwright/playwright.config.js --workers 4",
"test-playwright-chromium": "playwright test -c ./out-test/playwright/playwright.config.js --workers 4 --project='Chrome Stable'",
"test-playwright-firefox": "playwright test -c ./out-test/playwright/playwright.config.js --workers 4 --project='Firefox Stable'",
"test-playwright-webkit": "playwright test -c ./out-test/playwright/playwright.config.js --workers 4 --project='WebKit'",
"test-playwright-debug": "playwright test -c ./out-test/playwright/playwright.config.js --headed --workers 1 --timeout 30000",
"test-playwright": "node ./bin/test_playwright.js --workers 4",
"test-playwright-chromium": "node ./bin/test_playwright.js --workers 4 \"--project=Chrome Stable\"",
"test-playwright-firefox": "node ./bin/test_playwright.js --workers 4 \"--project=Firefox Stable\"",
"test-playwright-webkit": "node ./bin/test_playwright.js --workers 4 \"--project=WebKit\"",
"test-playwright-debug": "node ./bin/test_playwright.js --headed --workers 1 --timeout 30000",
"test-unit": "node ./bin/test.js",
"test-unit-coverage": "node ./bin/test.js --coverage",
"test-unit-dev": "cross-env NODE_PATH='./out' mocha",
+8 -3
View File
@@ -12,8 +12,6 @@ import * as playwright from '@playwright/test';
import { PageFunction } from 'playwright-core/types/structs';
import { IBuffer, IBufferCell, IBufferLine, IBufferNamespace, IBufferRange, IDecoration, IDecorationOptions, IModes, ITerminalInitOnlyOptions, ITerminalOptions, Terminal } from 'xterm';
import { EventEmitter } from '../../out/common/EventEmitter';
// TODO: We could avoid needing this
import deepEqual = require('deep-equal');
export interface ITestContext {
browser: Browser;
@@ -387,7 +385,14 @@ export async function pollFor<T>(page: playwright.Page, evalOrFn: string | (() =
console.log('pollFor\n actual: ', JSON.stringify(result), ' expected: ', JSON.stringify(val));
}
if (!deepEqual(result, val)) {
let equalityCheck = true;
try {
deepStrictEqual(result, val);
} catch (e) {
equalityCheck = false;
}
if (!equalityCheck) {
if (maxDuration === undefined) {
maxDuration = 2000;
}