MCPcopy
hub / github.com/xtermjs/xterm.js / setupTests

Function setupTests

test/playwright/SharedRendererTests.ts:1358–1386  ·  view source on GitHub ↗
({ shadowDom }: { shadowDom: boolean })

Source from the content-addressed store, hash-verified

1356 */
1357export function injectSharedRendererTestsStandalone(ctx: ISharedRendererTestContext, setupCb: () => Promise<void> | void): void {
1358 const setupTests = ({ shadowDom }: { shadowDom: boolean }): void => {
1359 test.beforeEach(async () => {
1360 // Recreate terminal
1361 await openTerminal(ctx.value, {}, { useShadowDom: shadowDom });
1362 await ctx.value.page.evaluate(`
1363 window.term.options.minimumContrastRatio = 1;
1364 window.term.options.allowTransparency = false;
1365 window.term.options.theme = undefined;
1366 `);
1367 await setupCb();
1368 // Clear the cached screenshot before each test
1369 frameDetails = undefined;
1370 });
1371 test.describe('regression tests', () => {
1372 test('#4790: cursor should not be displayed before focusing', async () => {
1373 const theme: ITheme = {
1374 cursor: '#0000FF'
1375 };
1376 await ctx.value.page.evaluate(`window.term.options.theme = ${JSON.stringify(theme)};`);
1377 await pollFor(ctx.value.page, () => getCellColor(ctx.value, 1, 1), [0, 0, 0, 255]);
1378 await ctx.value.proxy.focus();
1379 frameDetails = undefined;
1380 await pollFor(ctx.value.page, () => getCellColor(ctx.value, 1, 1), [0, 0, 255, 255]);
1381 await ctx.value.proxy.blur();
1382 frameDetails = undefined;
1383 await pollFor(ctx.value.page, () => getCellColor(ctx.value, 1, 1), [0, 0, 0, 255]);
1384 });
1385 });
1386 };
1387
1388 test.describe('standalone tests', () => {
1389 setupTests({ shadowDom: false });

Callers 1

Calls 7

openTerminalFunction · 0.90
testFunction · 0.90
pollForFunction · 0.90
getCellColorFunction · 0.85
evaluateMethod · 0.65
focusMethod · 0.45
blurMethod · 0.45

Tested by

no test coverage detected