mirror of
https://github.com/stablyai/orca.git
synced 2026-10-06 08:02:28 +00:00
test: run captured OpenCode redraw replay from a committed fixture
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -1,4 +1,4 @@
|
||||
import { existsSync, readFileSync } from 'node:fs'
|
||||
import { readFileSync } from 'node:fs'
|
||||
import path from 'node:path'
|
||||
import type { Page, TestInfo } from '@stablyai/playwright-test'
|
||||
import { test, expect } from './helpers/orca-app'
|
||||
@@ -8,8 +8,6 @@ import { waitForTerminalPtyDataInjector } from './helpers/terminal-pty-injection
|
||||
|
||||
// Repro commands:
|
||||
// SKIP_BUILD=1 pnpm exec playwright test tests/e2e/terminal-foreground-redraw-freeze.spec.ts --config tests/playwright.config.ts --project electron-headless -g "active OpenTUI-style"
|
||||
// git clone https://github.com/anomalyco/opencode.git .tmp/opencode
|
||||
// node tests/e2e/capture-opencode-tui-repro.mjs
|
||||
// SKIP_BUILD=1 pnpm exec playwright test tests/e2e/terminal-foreground-redraw-freeze.spec.ts --config tests/playwright.config.ts --project electron-headless -g "captured OpenCode/OpenTUI" --reporter=json
|
||||
// The captured replay uses an artificial OpenCode source-tree harness that
|
||||
// imports OpenCode's spinner frames and emits real OpenTUI <=2KB redraw chunks.
|
||||
@@ -61,7 +59,13 @@ const TIMER_SAMPLE_MS = 16
|
||||
const MAX_RENDERER_TIMER_DRIFT_MS = 500
|
||||
const FOREGROUND_IMMEDIATE_BUDGET_CHARS = 128 * 1024
|
||||
const OPENCODE_CAPTURE_REPLAY_CHARS = FOREGROUND_IMMEDIATE_BUDGET_CHARS * 64
|
||||
const OPENCODE_CAPTURE_PATH = path.join(process.cwd(), '.tmp', 'opencode-tui-capture.txt')
|
||||
const OPENCODE_CAPTURE_PATH = path.join(
|
||||
process.cwd(),
|
||||
'tests',
|
||||
'e2e',
|
||||
'fixtures',
|
||||
'opencode-small-redraw-capture.json'
|
||||
)
|
||||
|
||||
async function resetSchedulerDebug(page: Page): Promise<void> {
|
||||
await page.evaluate(() => {
|
||||
@@ -297,10 +301,7 @@ async function disposeActivePaneRefreshProbe(page: Page): Promise<void> {
|
||||
}
|
||||
|
||||
function loadCapturedOpenCodeSmallRedrawFrames(): string[] {
|
||||
if (!existsSync(OPENCODE_CAPTURE_PATH)) {
|
||||
return []
|
||||
}
|
||||
const capture = readFileSync(OPENCODE_CAPTURE_PATH, 'utf8')
|
||||
const { capture } = JSON.parse(readFileSync(OPENCODE_CAPTURE_PATH, 'utf8')) as { capture: string }
|
||||
const smallFrames = capture
|
||||
.split('\x1b[?2026h')
|
||||
.slice(1)
|
||||
@@ -424,10 +425,10 @@ test.describe('Terminal foreground redraw freeze repro', () => {
|
||||
orcaPage
|
||||
}, testInfo) => {
|
||||
const frames = loadCapturedOpenCodeSmallRedrawFrames()
|
||||
test.skip(
|
||||
frames.length === 0,
|
||||
`OpenCode PTY capture missing; run "git clone https://github.com/anomalyco/opencode.git .tmp/opencode" then "node tests/e2e/capture-opencode-tui-repro.mjs" to generate ${OPENCODE_CAPTURE_PATH}`
|
||||
)
|
||||
expect(
|
||||
frames.length,
|
||||
'committed OpenCode capture must contain small redraw frames'
|
||||
).toBeGreaterThan(0)
|
||||
|
||||
await waitForSessionReady(orcaPage)
|
||||
await waitForActiveWorktree(orcaPage)
|
||||
|
||||
Reference in New Issue
Block a user