Move playwright tests to use project references

This commit is contained in:
Daniel Imms
2024-07-07 09:06:26 -07:00
parent 215315b377
commit faed3e7c80
28 changed files with 97 additions and 62 deletions
+13
View File
@@ -29,54 +29,67 @@ jobs:
./lib/* \ ./lib/* \
./out/* \ ./out/* \
./out-esbuild/* \ ./out-esbuild/* \
./out-esbuild-test/* \
./out-test/* \ ./out-test/* \
./addons/addon-attach/lib/* \ ./addons/addon-attach/lib/* \
./addons/addon-attach/out/* \ ./addons/addon-attach/out/* \
./addons/addon-attach/out-esbuild/* \ ./addons/addon-attach/out-esbuild/* \
./addons/addon-attach/out-esbuild-test/* \
./addons/addon-attach/out-test/* \ ./addons/addon-attach/out-test/* \
./addons/addon-canvas/lib/* \ ./addons/addon-canvas/lib/* \
./addons/addon-canvas/out/* \ ./addons/addon-canvas/out/* \
./addons/addon-canvas/out-esbuild/* \ ./addons/addon-canvas/out-esbuild/* \
./addons/addon-canvas/out-esbuild-test/* \
./addons/addon-canvas/out-test/* \ ./addons/addon-canvas/out-test/* \
./addons/addon-clipboard/lib/* \ ./addons/addon-clipboard/lib/* \
./addons/addon-clipboard/out/* \ ./addons/addon-clipboard/out/* \
./addons/addon-clipboard/out-esbuild/* \ ./addons/addon-clipboard/out-esbuild/* \
./addons/addon-clipboard/out-esbuild-test/* \
./addons/addon-clipboard/out-test/* \ ./addons/addon-clipboard/out-test/* \
./addons/addon-fit/lib/* \ ./addons/addon-fit/lib/* \
./addons/addon-fit/out/* \ ./addons/addon-fit/out/* \
./addons/addon-fit/out-esbuild/* \ ./addons/addon-fit/out-esbuild/* \
./addons/addon-fit/out-esbuild-test/* \
./addons/addon-fit/out-test/* \ ./addons/addon-fit/out-test/* \
./addons/addon-image/lib/* \ ./addons/addon-image/lib/* \
./addons/addon-image/out/* \ ./addons/addon-image/out/* \
./addons/addon-image/out-esbuild/* \ ./addons/addon-image/out-esbuild/* \
./addons/addon-image/out-esbuild-test/* \
./addons/addon-image/out-test/* \ ./addons/addon-image/out-test/* \
./addons/addon-ligatures/lib/* \ ./addons/addon-ligatures/lib/* \
./addons/addon-ligatures/out/* \ ./addons/addon-ligatures/out/* \
./addons/addon-ligatures/out-esbuild/* \ ./addons/addon-ligatures/out-esbuild/* \
./addons/addon-ligatures/out-esbuild-test/* \
./addons/addon-ligatures/out-test/* \ ./addons/addon-ligatures/out-test/* \
./addons/addon-search/lib/* \ ./addons/addon-search/lib/* \
./addons/addon-search/out/* \ ./addons/addon-search/out/* \
./addons/addon-search/out-esbuild/* \ ./addons/addon-search/out-esbuild/* \
./addons/addon-search/out-esbuild-test/* \
./addons/addon-search/out-test/* \ ./addons/addon-search/out-test/* \
./addons/addon-serialize/lib/* \ ./addons/addon-serialize/lib/* \
./addons/addon-serialize/out/* \ ./addons/addon-serialize/out/* \
./addons/addon-serialize/out-esbuild/* \ ./addons/addon-serialize/out-esbuild/* \
./addons/addon-serialize/out-esbuild-test/* \
./addons/addon-serialize/out-test/* \ ./addons/addon-serialize/out-test/* \
./addons/addon-unicode11/lib/* \ ./addons/addon-unicode11/lib/* \
./addons/addon-unicode11/out/* \ ./addons/addon-unicode11/out/* \
./addons/addon-unicode11/out-esbuild/* \ ./addons/addon-unicode11/out-esbuild/* \
./addons/addon-unicode11/out-esbuild-test/* \
./addons/addon-unicode11/out-test/* \ ./addons/addon-unicode11/out-test/* \
./addons/addon-unicode-graphemes/lib/* \ ./addons/addon-unicode-graphemes/lib/* \
./addons/addon-unicode-graphemes/out/* \ ./addons/addon-unicode-graphemes/out/* \
./addons/addon-unicode-graphemes/out-esbuild/* \ ./addons/addon-unicode-graphemes/out-esbuild/* \
./addons/addon-unicode-graphemes/out-esbuild-test/* \
./addons/addon-unicode-graphemes/out-test/* \ ./addons/addon-unicode-graphemes/out-test/* \
./addons/addon-web-links/lib/* \ ./addons/addon-web-links/lib/* \
./addons/addon-web-links/out/* \ ./addons/addon-web-links/out/* \
./addons/addon-web-links/out-esbuild/* \ ./addons/addon-web-links/out-esbuild/* \
./addons/addon-web-links/out-esbuild-test/* \
./addons/addon-web-links/out-test/* \ ./addons/addon-web-links/out-test/* \
./addons/addon-webgl/lib/* \ ./addons/addon-webgl/lib/* \
./addons/addon-webgl/out/* \ ./addons/addon-webgl/out/* \
./addons/addon-webgl/out-esbuild/* \ ./addons/addon-webgl/out-esbuild/* \
./addons/addon-webgl/out-esbuild-test/* \
./addons/addon-webgl/out-test/* ./addons/addon-webgl/out-test/*
- name: Upload artifacts - name: Upload artifacts
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
+1 -1
View File
@@ -101,4 +101,4 @@ yarn test-integration --suite=core
yarn test-integration --suite=addon-search yarn test-integration --suite=addon-search
``` ```
These use `@playwright/test` to run all tests within the tsc test output (`out-test/`). These do not use the esbuild output because they require declaration files to get types to work. These use `@playwright/test` to run all tests within the esbuild test output (`out-esbuild-test/`).
+1 -1
View File
@@ -6,7 +6,7 @@
import WebSocket = require('ws'); import WebSocket = require('ws');
import test from '@playwright/test'; import test from '@playwright/test';
import { ITestContext, createTestContext, openTerminal, pollFor, timeout } from '../../../out-test/playwright/TestUtils'; import { ITestContext, createTestContext, openTerminal, pollFor, timeout } from '../../../test/playwright/TestUtils';
let ctx: ITestContext; let ctx: ITestContext;
test.beforeAll(async ({ browser }) => { test.beforeAll(async ({ browser }) => {
+4 -2
View File
@@ -20,8 +20,7 @@
}, },
"strict": true, "strict": true,
"types": [ "types": [
"../../../node_modules/@types/node", "../../../node_modules/@types/node"
"../../../out-test/playwright/TestUtils"
] ]
}, },
"include": [ "include": [
@@ -34,6 +33,9 @@
}, },
{ {
"path": "../../../src/browser" "path": "../../../src/browser"
},
{
"path": "../../../test/playwright"
} }
] ]
} }
@@ -4,8 +4,8 @@
*/ */
import test from '@playwright/test'; import test from '@playwright/test';
import { ISharedRendererTestContext, injectSharedRendererTests, injectSharedRendererTestsStandalone } from '../../../out-test/playwright/SharedRendererTests'; import { ISharedRendererTestContext, injectSharedRendererTests, injectSharedRendererTestsStandalone } from '../../../test/playwright/SharedRendererTests';
import { ITestContext, createTestContext, openTerminal } from '../../../out-test/playwright/TestUtils'; import { ITestContext, createTestContext, openTerminal } from '../../../test/playwright/TestUtils';
let ctx: ITestContext; let ctx: ITestContext;
const ctxWrapper: ISharedRendererTestContext = { const ctxWrapper: ISharedRendererTestContext = {
+4 -3
View File
@@ -21,9 +21,7 @@
"strict": true, "strict": true,
"types": [ "types": [
"../../../node_modules/@types/node", "../../../node_modules/@types/node",
"../../../node_modules/@lunapaint/png-codec", "../../../node_modules/@lunapaint/png-codec"
"../../../out-test/playwright/TestUtils",
"../../../out-test/playwright/SharedRendererTests"
] ]
}, },
"include": [ "include": [
@@ -36,6 +34,9 @@
}, },
{ {
"path": "../../../src/browser" "path": "../../../src/browser"
},
{
"path": "../../../test/playwright"
} }
] ]
} }
@@ -5,7 +5,7 @@
import test from '@playwright/test'; import test from '@playwright/test';
import { deepEqual, ok, strictEqual } from 'assert'; import { deepEqual, ok, strictEqual } from 'assert';
import { ITestContext, createTestContext, launchBrowser, openTerminal, timeout } from '../../../out-test/playwright/TestUtils'; import { ITestContext, createTestContext, launchBrowser, openTerminal, timeout } from '../../../test/playwright/TestUtils';
let ctx: ITestContext; let ctx: ITestContext;
test.beforeAll(async ({ browser }, testInfo) => { test.beforeAll(async ({ browser }, testInfo) => {
+4 -2
View File
@@ -20,8 +20,7 @@
}, },
"strict": true, "strict": true,
"types": [ "types": [
"../../../node_modules/@types/node", "../../../node_modules/@types/node"
"../../../out-test/playwright/TestUtils"
] ]
}, },
"include": [ "include": [
@@ -34,6 +33,9 @@
}, },
{ {
"path": "../../../src/browser" "path": "../../../src/browser"
},
{
"path": "../../../test/playwright"
} }
] ]
} }
+1 -1
View File
@@ -5,7 +5,7 @@
import test from '@playwright/test'; import test from '@playwright/test';
import { deepEqual, ok, strictEqual } from 'assert'; import { deepEqual, ok, strictEqual } from 'assert';
import { ITestContext, createTestContext, openTerminal, timeout } from '../../../out-test/playwright/TestUtils'; import { ITestContext, createTestContext, openTerminal, timeout } from '../../../test/playwright/TestUtils';
let ctx: ITestContext; let ctx: ITestContext;
test.beforeAll(async ({ browser }) => { test.beforeAll(async ({ browser }) => {
+4 -2
View File
@@ -20,8 +20,7 @@
}, },
"strict": true, "strict": true,
"types": [ "types": [
"../../../node_modules/@types/node", "../../../node_modules/@types/node"
"../../../out-test/playwright/TestUtils"
] ]
}, },
"include": [ "include": [
@@ -34,6 +33,9 @@
}, },
{ {
"path": "../../../src/browser" "path": "../../../src/browser"
},
{
"path": "../../../test/playwright"
} }
] ]
} }
+1 -1
View File
@@ -6,7 +6,7 @@
import test from '@playwright/test'; import test from '@playwright/test';
import { readFileSync } from 'fs'; import { readFileSync } from 'fs';
import { FINALIZER, introducer, sixelEncode } from 'sixel'; import { FINALIZER, introducer, sixelEncode } from 'sixel';
import { ITestContext, createTestContext, openTerminal, pollFor } from '../../../out-test/playwright/TestUtils'; import { ITestContext, createTestContext, openTerminal, pollFor } from '../../../test/playwright/TestUtils';
import { deepStrictEqual, ok, strictEqual } from 'assert'; import { deepStrictEqual, ok, strictEqual } from 'assert';
/** /**
+4 -2
View File
@@ -20,8 +20,7 @@
}, },
"strict": true, "strict": true,
"types": [ "types": [
"../../../node_modules/@types/node", "../../../node_modules/@types/node"
"../../../out-test/playwright/TestUtils"
] ]
}, },
"include": [ "include": [
@@ -34,6 +33,9 @@
}, },
{ {
"path": "../../../src/browser" "path": "../../../src/browser"
},
{
"path": "../../../test/playwright"
} }
] ]
} }
+1 -1
View File
@@ -7,7 +7,7 @@ import test from '@playwright/test';
import { deepStrictEqual, strictEqual } from 'assert'; import { deepStrictEqual, strictEqual } from 'assert';
import { readFile } from 'fs'; import { readFile } from 'fs';
import { resolve } from 'path'; import { resolve } from 'path';
import { ITestContext, createTestContext, openTerminal, timeout } from '../../../out-test/playwright/TestUtils'; import { ITestContext, createTestContext, openTerminal, timeout } from '../../../test/playwright/TestUtils';
let ctx: ITestContext; let ctx: ITestContext;
test.beforeAll(async ({ browser }) => { test.beforeAll(async ({ browser }) => {
+4 -2
View File
@@ -20,8 +20,7 @@
}, },
"strict": true, "strict": true,
"types": [ "types": [
"../../../node_modules/@types/node", "../../../node_modules/@types/node"
"../../../out-test/playwright/TestUtils"
] ]
}, },
"include": [ "include": [
@@ -34,6 +33,9 @@
}, },
{ {
"path": "../../../src/browser" "path": "../../../src/browser"
},
{
"path": "../../../test/playwright"
} }
] ]
} }
@@ -7,7 +7,7 @@ import test from '@playwright/test';
import { deepStrictEqual, notDeepStrictEqual, strictEqual } from 'assert'; import { deepStrictEqual, notDeepStrictEqual, strictEqual } from 'assert';
import { readFile } from 'fs'; import { readFile } from 'fs';
import { resolve } from 'path'; import { resolve } from 'path';
import { ITestContext, createTestContext, openTerminal, timeout, writeSync } from '../../../out-test/playwright/TestUtils'; import { ITestContext, createTestContext, openTerminal, timeout, writeSync } from '../../../test/playwright/TestUtils';
const writeRawSync = (page: any, str: string): Promise<void> => writeSync(ctx.page, `' +` + JSON.stringify(str) + `+ '`); const writeRawSync = (page: any, str: string): Promise<void> => writeSync(ctx.page, `' +` + JSON.stringify(str) + `+ '`);
+4 -2
View File
@@ -20,8 +20,7 @@
}, },
"strict": true, "strict": true,
"types": [ "types": [
"../../../node_modules/@types/node", "../../../node_modules/@types/node"
"../../../out-test/playwright/TestUtils"
] ]
}, },
"include": [ "include": [
@@ -34,6 +33,9 @@
}, },
{ {
"path": "../../../src/browser" "path": "../../../src/browser"
},
{
"path": "../../../test/playwright"
} }
] ]
} }
@@ -5,7 +5,7 @@
import test from '@playwright/test'; import test from '@playwright/test';
import { deepStrictEqual, strictEqual } from 'assert'; import { deepStrictEqual, strictEqual } from 'assert';
import { ITestContext, createTestContext, openTerminal } from '../../../out-test/playwright/TestUtils'; import { ITestContext, createTestContext, openTerminal } from '../../../test/playwright/TestUtils';
let ctx: ITestContext; let ctx: ITestContext;
test.beforeAll(async ({ browser }) => { test.beforeAll(async ({ browser }) => {
@@ -20,8 +20,7 @@
}, },
"strict": true, "strict": true,
"types": [ "types": [
"../../../node_modules/@types/node", "../../../node_modules/@types/node"
"../../../out-test/playwright/TestUtils"
] ]
}, },
"include": [ "include": [
@@ -34,6 +33,9 @@
}, },
{ {
"path": "../../../src/browser" "path": "../../../src/browser"
},
{
"path": "../../../test/playwright"
} }
] ]
} }
@@ -5,7 +5,7 @@
import test from '@playwright/test'; import test from '@playwright/test';
import { deepStrictEqual } from 'assert'; import { deepStrictEqual } from 'assert';
import { ITestContext, createTestContext, openTerminal } from '../../../out-test/playwright/TestUtils'; import { ITestContext, createTestContext, openTerminal } from '../../../test/playwright/TestUtils';
let ctx: ITestContext; let ctx: ITestContext;
test.beforeAll(async ({ browser }) => { test.beforeAll(async ({ browser }) => {
+4 -2
View File
@@ -20,8 +20,7 @@
}, },
"strict": true, "strict": true,
"types": [ "types": [
"../../../node_modules/@types/node", "../../../node_modules/@types/node"
"../../../out-test/playwright/TestUtils"
] ]
}, },
"include": [ "include": [
@@ -34,6 +33,9 @@
}, },
{ {
"path": "../../../src/browser" "path": "../../../src/browser"
},
{
"path": "../../../test/playwright"
} }
] ]
} }
@@ -6,7 +6,7 @@ import test from '@playwright/test';
import { deepStrictEqual, strictEqual } from 'assert'; import { deepStrictEqual, strictEqual } from 'assert';
import { readFile } from 'fs'; import { readFile } from 'fs';
import { resolve } from 'path'; import { resolve } from 'path';
import { ITestContext, createTestContext, openTerminal, pollFor, timeout } from '../../../out-test/playwright/TestUtils'; import { ITestContext, createTestContext, openTerminal, pollFor, timeout } from '../../../test/playwright/TestUtils';
interface ILinkStateData { interface ILinkStateData {
uri?: string; uri?: string;
+4 -2
View File
@@ -21,8 +21,7 @@
}, },
"strict": true, "strict": true,
"types": [ "types": [
"../../../node_modules/@types/node", "../../../node_modules/@types/node"
"../../../out-test/playwright/TestUtils"
] ]
}, },
"include": [ "include": [
@@ -35,6 +34,9 @@
}, },
{ {
"path": "../../../src/browser" "path": "../../../src/browser"
},
{
"path": "../../../test/playwright"
} }
] ]
} }
@@ -4,8 +4,8 @@
*/ */
import test from '@playwright/test'; import test from '@playwright/test';
import { ISharedRendererTestContext, injectSharedRendererTests, injectSharedRendererTestsStandalone } from '../../../out-test/playwright/SharedRendererTests'; import { ISharedRendererTestContext, injectSharedRendererTests, injectSharedRendererTestsStandalone } from '../../../test/playwright/SharedRendererTests';
import { ITestContext, createTestContext, openTerminal } from '../../../out-test/playwright/TestUtils'; import { ITestContext, createTestContext, openTerminal } from '../../../test/playwright/TestUtils';
import { platform } from 'os'; import { platform } from 'os';
let ctx: ITestContext; let ctx: ITestContext;
+4 -3
View File
@@ -21,9 +21,7 @@
"strict": true, "strict": true,
"types": [ "types": [
"../../../node_modules/@types/node", "../../../node_modules/@types/node",
"../../../node_modules/@lunapaint/png-codec", "../../../node_modules/@lunapaint/png-codec"
"../../../out-test/playwright/TestUtils",
"../../../out-test/playwright/SharedRendererTests"
] ]
}, },
"include": [ "include": [
@@ -36,6 +34,9 @@
}, },
{ {
"path": "../../../src/browser" "path": "../../../src/browser"
},
{
"path": "../../../test/playwright"
} }
] ]
} }
+21 -20
View File
@@ -92,10 +92,10 @@ let outConfig = {
let skipOut = false; let skipOut = false;
/** @type {esbuild.BuildOptions} */ /** @type {esbuild.BuildOptions} */
// let outTestConfig = { let outTestConfig = {
// format: 'cjs' format: 'cjs'
// } }
// let skipOutTest = false; let skipOutTest = false;
if (config.addon) { if (config.addon) {
bundleConfig = { bundleConfig = {
@@ -108,14 +108,15 @@ if (config.addon) {
entryPoints: [`addons/addon-${config.addon}/src/**/*.ts`], entryPoints: [`addons/addon-${config.addon}/src/**/*.ts`],
outdir: `addons/addon-${config.addon}/out-esbuild/` outdir: `addons/addon-${config.addon}/out-esbuild/`
}; };
// outTestConfig = { outTestConfig = {
// ...outConfig, ...outConfig,
// entryPoints: [`addons/addon-${config.addon}/test/**/*.ts`], entryPoints: [`addons/addon-${config.addon}/test/**/*.ts`],
// outdir: `addons/addon-${config.addon}/out-esbuild-test/` outdir: `addons/addon-${config.addon}/out-esbuild-test/`
// }; };
if (config.addon === 'ligatures') { if (config.addon === 'ligatures') {
bundleConfig.platform = 'node'; bundleConfig.platform = 'node';
skipOutTest = true;
} }
if (config.addon === 'serialize') { if (config.addon === 'serialize') {
@@ -173,11 +174,11 @@ if (config.addon) {
entryPoints: ['src/**/*.ts'], entryPoints: ['src/**/*.ts'],
outdir: 'out-esbuild/' outdir: 'out-esbuild/'
}; };
// outTestConfig = { outTestConfig = {
// ...outConfig, ...outConfig,
// entryPoints: ['test/**/*.ts'], entryPoints: ['test/**/*.ts'],
// outdir: 'out-esbuild-test/' outdir: 'out-esbuild-test/'
// }; };
} }
if (config.isWatch) { if (config.isWatch) {
@@ -185,15 +186,15 @@ if (config.isWatch) {
if (!skipOut) { if (!skipOut) {
context(outConfig).then(e => e.watch()); context(outConfig).then(e => e.watch());
} }
// if (!skipOutTest) { if (!skipOutTest) {
// context(outTestConfig).then(e => e.watch()); context(outTestConfig).then(e => e.watch());
// } }
} else { } else {
await build(bundleConfig); await build(bundleConfig);
if (!skipOut) { if (!skipOut) {
await build(outConfig); await build(outConfig);
} }
// if (!skipOutTest) { if (!skipOutTest) {
// await build(outTestConfig); await build(outTestConfig);
// } }
} }
+3 -3
View File
@@ -18,7 +18,7 @@ while (argv.some(e => e.startsWith('--suite='))) {
} }
let configs = [ let configs = [
{ name: 'core', path: 'out-test/playwright/playwright.config.js' } { name: 'core', path: 'out-esbuild-test/playwright/playwright.config.js' }
]; ];
const addons = [ const addons = [
'attach', 'attach',
@@ -34,7 +34,7 @@ const addons = [
'webgl', 'webgl',
]; ];
for (const addon of addons) { for (const addon of addons) {
configs.push({ name: `addon-${addon}`, path: `addons/addon-${addon}/out-test/playwright.config.js` }); configs.push({ name: `addon-${addon}`, path: `addons/addon-${addon}/out-esbuild-test/playwright.config.js` });
} }
if (suiteFilter) { if (suiteFilter) {
@@ -61,8 +61,8 @@ async function run() {
if (run.error) { if (run.error) {
console.error(run.error); console.error(run.error);
process.exit(run.status ?? -1);
} }
process.exit(run.status ?? -1);
} }
} }
run(); run();
+1 -1
View File
@@ -1313,7 +1313,7 @@ function getCellColor(ctx: ITestContext, col: number, row: number, position: Cel
let frameDetails: { cols: number, rows: number, decoded: IImage32 } | undefined = undefined; let frameDetails: { cols: number, rows: number, decoded: IImage32 } | undefined = undefined;
async function getFrameDetails(ctx: ITestContext): Promise<{ cols: number, rows: number, decoded: IImage32 }> { async function getFrameDetails(ctx: ITestContext): Promise<{ cols: number, rows: number, decoded: IImage32 }> {
const screenshotOptions: LocatorScreenshotOptions | undefined = process.env.DEBUG ? { path: 'out-test/playwright/screenshot.png' } : undefined; const screenshotOptions: LocatorScreenshotOptions | undefined = process.env.DEBUG ? { path: 'out-esbuild-test/playwright/screenshot.png' } : undefined;
const buffer = await ctx.page.locator('#terminal-container .xterm-screen').screenshot(screenshotOptions); const buffer = await ctx.page.locator('#terminal-container .xterm-screen').screenshot(screenshotOptions);
frameDetails = { frameDetails = {
cols: await ctx.proxy.cols, cols: await ctx.proxy.cols,
+1
View File
@@ -26,6 +26,7 @@
}, },
"target": "ESNext", "target": "ESNext",
"module": "commonjs", "module": "commonjs",
"composite": true
}, },
"include": [ "include": [
"./**/*", "./**/*",