The integration test file used test.describe('Search Tests'), copied from
addon-search. That mislabels attach-addon results in Playwright reports and
makes the suite harder to filter or debug.
Rename the block to 'AttachAddon' so the describe name matches the addon
under test. No test logic changed.
Validated with: npm run build && npm run esbuild, npm run test-unit,
npm run esbuild-demo-client && npm run esbuild-demo-server &&
npm run test-integration, npm run package, npm run package-headless.
Co-authored-by: Cursor <cursoragent@cursor.com>
43 lines
1.4 KiB
TypeScript
43 lines
1.4 KiB
TypeScript
/**
|
|
* Copyright (c) 2019 The xterm.js authors. All rights reserved.
|
|
* @license MIT
|
|
*/
|
|
|
|
import WebSocket = require('ws');
|
|
|
|
import test from '@playwright/test';
|
|
import { ITestContext, createTestContext, openTerminal, pollFor, timeout } from '../../../test/playwright/TestUtils';
|
|
|
|
let ctx: ITestContext;
|
|
test.beforeAll(async ({ browser }) => {
|
|
ctx = await createTestContext(browser);
|
|
await openTerminal(ctx);
|
|
});
|
|
test.afterAll(async () => await ctx.page.close());
|
|
|
|
test.describe('AttachAddon', () => {
|
|
|
|
test.beforeEach(async () => {
|
|
await ctx.proxy.reset();
|
|
});
|
|
|
|
test('string', async function(): Promise<any> {
|
|
const port = 8080;
|
|
const server = new WebSocket.Server({ port });
|
|
server.on('connection', socket => socket.send('foo'));
|
|
await ctx.page.evaluate(`window.term.loadAddon(new window.AttachAddon(new WebSocket('ws://localhost:${port}')))`);
|
|
await pollFor(ctx.page, `window.term.buffer.active.getLine(0).translateToString(true)`, 'foo');
|
|
server.close();
|
|
});
|
|
|
|
test('utf8', async function(): Promise<any> {
|
|
const port = 8080;
|
|
const server = new WebSocket.Server({ port });
|
|
const data = new Uint8Array([102, 111, 111]);
|
|
server.on('connection', socket => socket.send(data));
|
|
await ctx.page.evaluate(`window.term.loadAddon(new window.AttachAddon(new WebSocket('ws://localhost:${port}')))`);
|
|
await pollFor(ctx.page, `window.term.buffer.active.getLine(0).translateToString(true)`, 'foo');
|
|
server.close();
|
|
});
|
|
});
|