Files
toor 1e9ea89d86
Build / build (push) Canceled after 0s
NPM Lockfile Check / npm ci --ignore-scripts (push) Canceled after 0s
Playwright / e2e (push) Canceled after 0s
chore: bootstrap hermes-ui skeleton from 0.6.29 snapshot
Import the client, server, skills, tests, and build scripts as the starting
point for the rebuild, then trim the surfaces this project does not ship:
Electron desktop packaging, the marketing website, and the ESP32 firmware
tree. CI keeps the web build, e2e, lockfile, release, and Docker workflows.

Rename the package and CLI entry points to hermes-ui, drop the prepare hook so
npm ci no longer triggers a build, and drop the removed tsconfig and nodemon
references. Rewrite AGENTS.md, ARCHITECTURE.md, DEVELOPMENT.md, and the READMEs
so the documented package map and hard rules match this repository.

reference_code/ is ignored: it is a read-only snapshot, not an input to the build.
2026-10-16 10:34:35 +08:00

61 lines
2.3 KiB
TypeScript

import { expect, test } from '@playwright/test'
import { authenticate, mockHermesApi, mockTerminalWebSocket, TEST_ACCESS_KEY } from './fixtures'
test('opens terminal websocket session and forwards user input', async ({ page }) => {
await authenticate(page, TEST_ACCESS_KEY, 'research')
const api = await mockHermesApi(page)
await mockTerminalWebSocket(page)
await page.goto('/#/hermes/terminal')
await expect(page.getByText('Sessions')).toBeVisible()
await expect(page.locator('.session-item-title', { hasText: 'zsh #1' })).toBeVisible()
const terminalState = await page.waitForFunction(() => {
const state = (window as any).__PW_TERMINAL_WS__
return state?.sockets?.length
? {
url: state.latest.url,
sent: state.sent,
}
: null
})
const initialState = await terminalState.jsonValue() as any
const terminalUrl = new URL(initialState.url)
expect(terminalUrl.pathname).toBe('/api/hermes/terminal')
expect(terminalUrl.searchParams.get('token')).toBe(TEST_ACCESS_KEY)
await page.locator('.terminal-header .header-actions button').last().click()
await expect(page.locator('.session-item-title', { hasText: 'bash #2' })).toBeVisible()
await page.locator('.terminal-xterm').click()
await page.keyboard.type('pwd')
await page.keyboard.press('Enter')
await expect.poll(async () => page.evaluate(() => {
const state = (window as any).__PW_TERMINAL_WS__
return state.sent
.map((item: any) => item.data)
.filter((data: string) => !data.startsWith('{'))
.join('')
})).toContain('pwd')
await expect.poll(async () => page.evaluate(() => {
const state = (window as any).__PW_TERMINAL_WS__
return state.sent
.map((item: any) => item.data)
.filter((data: string) => data.startsWith('{'))
.map((data: string) => JSON.parse(data))
.some((message: any) => message.type === 'resize' && message.cols > 0 && message.rows > 0)
})).toBe(true)
const finalState = await page.evaluate(() => (window as any).__PW_TERMINAL_WS__)
const controlMessages = finalState.sent
.map((item: any) => item.data)
.filter((data: string) => data.startsWith('{'))
.map((data: string) => JSON.parse(data))
expect(controlMessages.some((message: any) => message.type === 'create')).toBe(true)
expect(api.unexpectedRequests).toEqual([])
})