Support Kitty graphics protocol

This commit is contained in:
Anthony Kim
2026-01-22 10:44:38 -08:00
parent 8e67c0093c
commit 304943658d
21 changed files with 781 additions and 22 deletions
@@ -0,0 +1,41 @@
/**
* Copyright (c) 2025 The xterm.js authors. All rights reserved.
* @license MIT
*
* Playwright integration tests for Kitty Graphics Addon.
* These test the addon in a real browser with visual verification.
*
* Unit tests for parsing are in src/KittyGraphicsAddon.test.ts
*/
import test from '@playwright/test';
import { deepStrictEqual, strictEqual } from 'assert';
import { ITestContext, createTestContext, openTerminal } from '../../../test/playwright/TestUtils';
let ctx: ITestContext;
test.beforeAll(async ({ browser }) => {
ctx = await createTestContext(browser);
});
test.afterAll(async () => {
await ctx.page.close();
});
test.describe('KittyGraphicsAddon', () => {
test.beforeEach(async () => {
await openTerminal(ctx, { cols: 80, rows: 24 });
await ctx.page.evaluate(`
window.term.reset();
`);
});
test('addon should be loaded and activated', async () => {
// Verify the addon is available on the window
const hasAddon = await ctx.page.evaluate(`typeof window.KittyGraphicsAddon !== 'undefined'`);
strictEqual(hasAddon, true, 'KittyGraphicsAddon should be available');
});
// TODO: WAYYYYYY More tests that would initially fail, but work when addon work is complete. Like implementation of the handler.
});
@@ -0,0 +1,35 @@
import { PlaywrightTestConfig } from '@playwright/test';
const config: PlaywrightTestConfig = {
testDir: '.',
timeout: 10000,
projects: [
{
name: 'ChromeStable',
use: {
browserName: 'chromium',
channel: 'chrome'
}
},
{
name: 'FirefoxStable',
use: {
browserName: 'firefox'
}
},
{
name: 'WebKit',
use: {
browserName: 'webkit'
}
}
],
reporter: 'list',
webServer: {
command: 'npm run start',
port: 3000,
timeout: 120000,
reuseExistingServer: !process.env.CI
}
};
export default config;
@@ -0,0 +1,30 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "ESNext",
"lib": ["es2021"],
"rootDir": ".",
"outDir": "../out-test",
"sourceMap": true,
"removeComments": true,
"baseUrl": ".",
"paths": {
"common/*": ["../../../src/common/*"],
"browser/*": ["../../../src/browser/*"]
},
"strict": true,
"types": ["../../../node_modules/@types/node"]
},
"include": ["./**/*", "../../../typings/xterm.d.ts"],
"references": [
{
"path": "../../../src/common"
},
{
"path": "../../../src/browser"
},
{
"path": "../../../test/playwright"
}
]
}