mirror of
https://github.com/stablyai/orca.git
synced 2026-11-16 19:07:41 +00:00
test: remove six low-value suites and trim MCP inspection coverage (#43017)
Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
This commit is contained in:
@@ -46,7 +46,6 @@ jobs:
|
||||
pnpm exec vitest run --config config/vitest.config.ts --maxWorkers=2
|
||||
src/main/ipc/preflight-runnable-local-cli.test.ts
|
||||
src/main/ipc/preflight-wsl-agent-detection.test.ts
|
||||
src/main/startup/shell-environment/login-shell-environment.test.ts
|
||||
src/packages/process-host/src/process-tree-termination.test.ts
|
||||
src/packages/process-host/src/run-process.test.ts
|
||||
src/packages/process-host/src/run-process-termination-failure.test.ts
|
||||
|
||||
@@ -206,7 +206,6 @@
|
||||
2 test-no-real-time-wait:tests/e2e/default-tabs-mark-crash-relaunch.spec.ts
|
||||
1 test-no-real-time-wait:tests/e2e/diff-note-draft.spec.ts
|
||||
2 test-no-real-time-wait:tests/e2e/droid-notification.spec.ts
|
||||
2 test-no-real-time-wait:tests/e2e/editor-tab-selection-restore.spec.ts
|
||||
1 test-no-real-time-wait:tests/e2e/file-explorer-linked-watch-refresh.spec.ts
|
||||
1 test-no-real-time-wait:tests/e2e/file-explorer-watch-refresh.spec.ts
|
||||
1 test-no-real-time-wait:tests/e2e/fixtures/daemon-generation-legacy-close-client.ts
|
||||
@@ -440,7 +439,6 @@
|
||||
2 test-no-wall-clock:src/main/skills/transaction-state/skill-transaction-startup-recovery.test.ts
|
||||
4 test-no-wall-clock:src/main/ssh/remote-exec/ssh-remote-commands.test.ts
|
||||
2 test-no-wall-clock:config/scripts/development/launch/run-electron-vite-dev.test.ts
|
||||
1 test-no-wall-clock:src/main/startup/shell-environment/login-shell-environment.test.ts
|
||||
2 test-no-wall-clock:src/main/startup/windows-install-permissions/windows-install-dir-acl-recovery.test.ts
|
||||
4 test-no-wall-clock:src/main/updater/lifecycle/serve-supervisor-install-park.test.ts
|
||||
1 test-no-wall-clock:src/main/window/desktop-integration/macos-press-and-hold-default.defaults-domain.test.ts
|
||||
@@ -682,7 +680,6 @@
|
||||
1 test-timeout-needs-reason:tests/e2e/runtime-file-browser-windows-drives.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/runtime-host-status-recovery.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/settled-worker-tab-survives-restart.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/sidebar-creation-registry.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/sidebar-desktop-reads-main.spec.ts
|
||||
2 test-timeout-needs-reason:tests/e2e/sidebar-host-unread.spec.ts
|
||||
4 test-timeout-needs-reason:tests/e2e/sidebar-phone-feed-list.spec.ts
|
||||
@@ -734,7 +731,6 @@
|
||||
1 test-timeout-needs-reason:tests/e2e/terminal-tab-close-running-confirm.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/terminal-tab-level-binding-upgrade.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/terminal-warm-reattach-split-live-output.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/terminal-window-wake-stale-grid-repro.spec.ts
|
||||
2 test-timeout-needs-reason:tests/e2e/terminal-windows-codex-multiline-paste.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/unopened-workspace-agent-single-resume.spec.ts
|
||||
1 test-timeout-needs-reason:tests/e2e/windows-wsl-terminal-restore.spec.ts
|
||||
|
||||
@@ -4874,7 +4874,6 @@
|
||||
"tests/e2e/diff-note-layout.spec.ts": 24900,
|
||||
"tests/e2e/droid-notification.spec.ts": 65000,
|
||||
"tests/e2e/editable-context-paste-ownership.spec.ts": 15700,
|
||||
"tests/e2e/editor-tab-selection-restore.spec.ts": 28900,
|
||||
"tests/e2e/electron-home-isolation.spec.ts": 12800,
|
||||
"tests/e2e/ephemeral-vm-cleanup-retry.spec.ts": 26800,
|
||||
"tests/e2e/feature-wall.spec.ts": 101800,
|
||||
@@ -5048,7 +5047,6 @@
|
||||
"tests/e2e/terminal-output-scheduler.spec.ts": 54700,
|
||||
"tests/e2e/terminal-pane-close-layout-consistency.spec.ts": 128900,
|
||||
"tests/e2e/terminal-pane-content-retention.spec.ts": 45100,
|
||||
"tests/e2e/terminal-pane-layout-resize.spec.ts": 47500,
|
||||
"tests/e2e/terminal-pane-split-identity.spec.ts": 81000,
|
||||
"tests/e2e/terminal-pane-title-editing.spec.ts": 189100,
|
||||
"tests/e2e/terminal-pane-title-strip-placement.spec.ts": 62400,
|
||||
@@ -5079,7 +5077,6 @@
|
||||
"tests/e2e/terminal-tui-wheel-reports.spec.ts": 34400,
|
||||
"tests/e2e/terminal-typing-latency.spec.ts": 15200,
|
||||
"tests/e2e/terminal-wedged-write-pipeline-recovery.spec.ts": 71900,
|
||||
"tests/e2e/terminal-window-wake-stale-grid-repro.spec.ts": 15900,
|
||||
"tests/e2e/update-install-renderer-checkpoint-recovery.spec.ts": 14900,
|
||||
"tests/e2e/windows-terminal-env-icons.spec.ts": 15400,
|
||||
"tests/e2e/workspace-back-forward-navigation.spec.ts": 108500,
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
import { existsSync } from 'node:fs'
|
||||
import { mkdtemp, rm, writeFile } from 'node:fs/promises'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { afterEach, describe, expect, it } from 'vitest'
|
||||
import {
|
||||
resetLoginShellEnvironmentCacheForTests,
|
||||
resolveLoginShellEnvironment
|
||||
} from './login-shell-environment'
|
||||
|
||||
const originalHome = process.env.HOME
|
||||
const originalZdotdir = process.env.ZDOTDIR
|
||||
const SHELL_ONLY_VARIABLE = 'ORCA_TEST_LOGIN_SHELL_ONLY'
|
||||
const originalShellOnlyValue = process.env[SHELL_ONLY_VARIABLE]
|
||||
let testHome: string | null = null
|
||||
|
||||
// Choose an installed real shell with its login profile: Linux CI may lack zsh, and login bash reads .bash_profile rather than .bashrc.
|
||||
const REAL_SHELL_CANDIDATES = [
|
||||
{ path: '/bin/zsh', profileFile: '.zshenv' },
|
||||
{ path: '/bin/bash', profileFile: '.bash_profile' }
|
||||
] as const
|
||||
|
||||
const realShell = REAL_SHELL_CANDIDATES.find((candidate) => existsSync(candidate.path)) ?? null
|
||||
|
||||
afterEach(async () => {
|
||||
resetLoginShellEnvironmentCacheForTests()
|
||||
if (originalHome === undefined) {
|
||||
delete process.env.HOME
|
||||
} else {
|
||||
process.env.HOME = originalHome
|
||||
}
|
||||
if (originalZdotdir === undefined) {
|
||||
delete process.env.ZDOTDIR
|
||||
} else {
|
||||
process.env.ZDOTDIR = originalZdotdir
|
||||
}
|
||||
if (originalShellOnlyValue === undefined) {
|
||||
delete process.env[SHELL_ONLY_VARIABLE]
|
||||
} else {
|
||||
process.env[SHELL_ONLY_VARIABLE] = originalShellOnlyValue
|
||||
}
|
||||
if (testHome) {
|
||||
await rm(testHome, { recursive: true, force: true })
|
||||
testHome = null
|
||||
}
|
||||
})
|
||||
|
||||
describe('resolveLoginShellEnvironment', () => {
|
||||
it.runIf(realShell !== null)(
|
||||
'captures a profile export missing from the parent process',
|
||||
async () => {
|
||||
const shell = realShell!
|
||||
testHome = await mkdtemp(join(tmpdir(), 'orca-login-shell-env-'))
|
||||
await writeFile(
|
||||
join(testHome, shell.profileFile),
|
||||
`export ${SHELL_ONLY_VARIABLE}=shell-only\n`
|
||||
)
|
||||
process.env.HOME = testHome
|
||||
// zsh reads .zshenv from ZDOTDIR when set; harmless for the bash variant.
|
||||
process.env.ZDOTDIR = testHome
|
||||
delete process.env[SHELL_ONLY_VARIABLE]
|
||||
|
||||
const environment = await resolveLoginShellEnvironment({
|
||||
shellOverride: shell.path,
|
||||
startedAfter: Date.now()
|
||||
})
|
||||
expect(environment[SHELL_ONLY_VARIABLE]).toBe('shell-only')
|
||||
}
|
||||
)
|
||||
})
|
||||
@@ -28,97 +28,6 @@ describe('mcp-config', () => {
|
||||
expect(result.servers).toEqual([])
|
||||
})
|
||||
|
||||
it('summarizes stdio, http, disabled, and invalid servers', () => {
|
||||
const result = inspectMcpConfigContent(
|
||||
workspaceCandidate,
|
||||
JSON.stringify({
|
||||
mcpServers: {
|
||||
filesystem: {
|
||||
command: 'npx',
|
||||
args: ['-y', '@modelcontextprotocol/server-filesystem'],
|
||||
env: { NODE_ENV: 'production', API_TOKEN: 'secret-token' }
|
||||
},
|
||||
docs: { type: 'http', url: 'https://example.com/mcp' },
|
||||
old: { command: 'node', enabled: false },
|
||||
broken: { args: ['missing-command'] }
|
||||
}
|
||||
})
|
||||
)
|
||||
|
||||
expect(result.status).toBe('valid')
|
||||
expect(result.servers).toEqual([
|
||||
{
|
||||
name: 'filesystem',
|
||||
transport: 'stdio',
|
||||
status: 'enabled',
|
||||
command: 'npx',
|
||||
env: { NODE_ENV: 'production', API_TOKEN: '••••••••' }
|
||||
},
|
||||
{
|
||||
name: 'docs',
|
||||
transport: 'http',
|
||||
status: 'enabled',
|
||||
url: 'https://example.com/mcp'
|
||||
},
|
||||
{
|
||||
name: 'old',
|
||||
transport: 'stdio',
|
||||
status: 'disabled',
|
||||
command: 'node'
|
||||
},
|
||||
{
|
||||
name: 'broken',
|
||||
transport: 'unknown',
|
||||
status: 'invalid',
|
||||
issue: 'Missing command or URL.'
|
||||
}
|
||||
])
|
||||
})
|
||||
|
||||
it('supports agent-specific command and URL shapes from common adapters', () => {
|
||||
const result = inspectMcpConfigContent(
|
||||
workspaceCandidate,
|
||||
JSON.stringify({
|
||||
mcpServers: {
|
||||
opencodeLocal: { type: 'local', command: ['uvx', 'server'] },
|
||||
geminiRemote: { httpUrl: 'https://example.com/sse' }
|
||||
}
|
||||
})
|
||||
)
|
||||
|
||||
expect(result.servers).toMatchObject([
|
||||
{ name: 'opencodeLocal', transport: 'stdio', command: 'uvx' },
|
||||
{ name: 'geminiRemote', transport: 'http', url: 'https://example.com/sse' }
|
||||
])
|
||||
})
|
||||
|
||||
it('marks declared transports without their target as invalid', () => {
|
||||
const result = inspectMcpConfigContent(
|
||||
workspaceCandidate,
|
||||
JSON.stringify({
|
||||
mcpServers: {
|
||||
remoteMissingUrl: { type: 'http' },
|
||||
localMissingCommand: { type: 'local' }
|
||||
}
|
||||
})
|
||||
)
|
||||
|
||||
expect(result.servers).toEqual([
|
||||
{
|
||||
name: 'remoteMissingUrl',
|
||||
transport: 'http',
|
||||
status: 'invalid',
|
||||
issue: 'Missing URL.'
|
||||
},
|
||||
{
|
||||
name: 'localMissingCommand',
|
||||
transport: 'stdio',
|
||||
status: 'invalid',
|
||||
issue: 'Missing command.'
|
||||
}
|
||||
])
|
||||
})
|
||||
|
||||
it('masks env values that look sensitive by key or value', () => {
|
||||
expect(
|
||||
maskMcpEnv({
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
import { test, expect } from './helpers/orca-app'
|
||||
import {
|
||||
activateGoldenWorktree,
|
||||
cleanupGoldenWorktree,
|
||||
createGoldenWorktree
|
||||
} from './helpers/golden-source-control'
|
||||
import { waitForSessionReady } from './helpers/store'
|
||||
|
||||
test('preserves highlighted editor text across worktree tab switches', async ({
|
||||
orcaPage,
|
||||
testRepoPath,
|
||||
registerPostElectronShutdownCleanup
|
||||
}) => {
|
||||
const fixture = createGoldenWorktree(testRepoPath, 'editor-selection')
|
||||
registerPostElectronShutdownCleanup(async () => cleanupGoldenWorktree(testRepoPath, fixture))
|
||||
|
||||
await waitForSessionReady(orcaPage)
|
||||
await activateGoldenWorktree(orcaPage, testRepoPath, fixture.worktreePath)
|
||||
await orcaPage.evaluate(() => {
|
||||
const state = window.__store?.getState()
|
||||
state?.setRightSidebarTab('explorer')
|
||||
state?.setRightSidebarOpen(true)
|
||||
})
|
||||
|
||||
const explorer = orcaPage.locator('[data-orca-explorer-shell]')
|
||||
const rowNamed = (name: string) =>
|
||||
explorer.locator('[data-file-explorer-row]').filter({
|
||||
has: orcaPage.getByText(name, { exact: true })
|
||||
})
|
||||
|
||||
await rowNamed('package.json').dblclick()
|
||||
const monaco = orcaPage.locator('.monaco-editor').first()
|
||||
await expect(monaco).toBeVisible({ timeout: 25_000 })
|
||||
await monaco.click()
|
||||
await orcaPage.keyboard.press('ControlOrMeta+f')
|
||||
const findInput = monaco.locator('.find-widget .input[aria-label="Find"]')
|
||||
await expect(findInput).toBeVisible()
|
||||
await findInput.fill('orca-e2e-test')
|
||||
await orcaPage.keyboard.press('Enter')
|
||||
await orcaPage.keyboard.press('Escape')
|
||||
|
||||
await expect
|
||||
.poll(() => orcaPage.evaluate(() => window.__monacoEditorE2E?.snapshot().selection ?? null), {
|
||||
message: 'Monaco did not select the searched text'
|
||||
})
|
||||
.not.toBeNull()
|
||||
const selectedRange = await orcaPage.evaluate(
|
||||
() => window.__monacoEditorE2E?.snapshot().selection ?? null
|
||||
)
|
||||
if (!selectedRange) {
|
||||
throw new Error('Monaco selection disappeared before the tab switch')
|
||||
}
|
||||
expect([selectedRange.selectionStartLineNumber, selectedRange.selectionStartColumn]).not.toEqual([
|
||||
selectedRange.positionLineNumber,
|
||||
selectedRange.positionColumn
|
||||
])
|
||||
if (process.env.ORCA_E2E_RECORD_VIDEO === '1') {
|
||||
await orcaPage.waitForTimeout(700)
|
||||
}
|
||||
|
||||
await rowNamed('src').click()
|
||||
await rowNamed('index.ts').click()
|
||||
await expect(orcaPage.locator('.editor-header-path').first()).toContainText('index.ts', {
|
||||
timeout: 20_000
|
||||
})
|
||||
|
||||
await orcaPage.locator('[data-tab-id]').filter({ hasText: 'package.json' }).last().click()
|
||||
await expect(orcaPage.locator('.editor-header-path').first()).toContainText('package.json', {
|
||||
timeout: 20_000
|
||||
})
|
||||
await expect
|
||||
.poll(() => orcaPage.evaluate(() => window.__monacoEditorE2E?.snapshot().selection ?? null))
|
||||
.toEqual(selectedRange)
|
||||
await expect(monaco.locator('.selected-text').first()).toBeVisible()
|
||||
if (process.env.ORCA_E2E_RECORD_VIDEO === '1') {
|
||||
await orcaPage.waitForTimeout(700)
|
||||
}
|
||||
})
|
||||
@@ -1,73 +0,0 @@
|
||||
import { randomUUID } from 'node:crypto'
|
||||
import { mkdtempSync, rmSync, writeFileSync } from 'node:fs'
|
||||
import os from 'node:os'
|
||||
import path from 'node:path'
|
||||
import { test, expect } from './helpers/orca-app'
|
||||
import { ensureTerminalVisible, waitForActiveWorktree, waitForSessionReady } from './helpers/store'
|
||||
import {
|
||||
waitForActivePaneHookDescriptor,
|
||||
waitForActivePanePtyId,
|
||||
waitForActiveTerminalManager
|
||||
} from './helpers/terminal'
|
||||
import { waitForPtyShellEcho } from './terminal-pty-readiness'
|
||||
import {
|
||||
claudeTranscriptLines,
|
||||
enableNativeChatSetting,
|
||||
seedClaudeProviderSession,
|
||||
toggleTerminalTabToChatView
|
||||
} from './helpers/native-chat-transcript-fixture'
|
||||
|
||||
const REPLY = [
|
||||
'Both issues are fixed.',
|
||||
'- **Local tabs:** pass.\n- **Streamed pages:** pass.',
|
||||
'1. **First fix.** Done.\n2. **Second fix.** Done.'
|
||||
].join('\n\n')
|
||||
|
||||
test('a reply sets paragraphs and list items on one line height, with bold in the body color', async ({
|
||||
orcaPage
|
||||
}) => {
|
||||
await waitForSessionReady(orcaPage)
|
||||
await waitForActiveWorktree(orcaPage)
|
||||
await ensureTerminalVisible(orcaPage)
|
||||
await waitForActiveTerminalManager(orcaPage, 30_000)
|
||||
await waitForPtyShellEcho(orcaPage, await waitForActivePanePtyId(orcaPage), 15_000)
|
||||
const descriptor = await waitForActivePaneHookDescriptor(orcaPage)
|
||||
const [tabId] = descriptor.paneKey.split(':')
|
||||
const sessionId = `e2e-typography-${randomUUID()}`
|
||||
const scratchDir = mkdtempSync(path.join(os.tmpdir(), 'orca-e2e-native-chat-typography-'))
|
||||
const transcriptPath = path.join(scratchDir, `${sessionId}.jsonl`)
|
||||
writeFileSync(
|
||||
transcriptPath,
|
||||
claudeTranscriptLines({ sessionId, userText: 'How did it go?', assistantText: REPLY })
|
||||
)
|
||||
try {
|
||||
await enableNativeChatSetting(orcaPage)
|
||||
await seedClaudeProviderSession(orcaPage, { ...descriptor, sessionId, transcriptPath })
|
||||
await toggleTerminalTabToChatView(orcaPage, { tabId, worktreeId: descriptor.worktreeId })
|
||||
const reply = orcaPage.locator('[data-native-chat-window] .native-chat-markdown').filter({
|
||||
hasText: 'Both issues are fixed.'
|
||||
})
|
||||
await expect(reply.locator('li')).toHaveCount(4, { timeout: 30_000 })
|
||||
|
||||
const measured = await reply.evaluate((markdown) => {
|
||||
const style = (selector: string) => getComputedStyle(markdown.querySelector(selector)!)
|
||||
const [first, second] = [...markdown.querySelectorAll('ul > li')]
|
||||
return {
|
||||
paragraph: { size: style('p').fontSize, line: style('p').lineHeight },
|
||||
item: { size: style('li').fontSize, line: style('li').lineHeight },
|
||||
blockGap: style('ul').marginTop,
|
||||
itemGap: second!.getBoundingClientRect().top - first!.getBoundingClientRect().bottom,
|
||||
body: style('p').color,
|
||||
bold: style('li strong').color
|
||||
}
|
||||
})
|
||||
// Text size 13px on 20px lines, the same for paragraphs and list items.
|
||||
expect(measured.paragraph).toEqual({ size: '13px', line: '20px' })
|
||||
expect(measured.item).toEqual(measured.paragraph)
|
||||
expect(measured.blockGap).toBe('10px')
|
||||
expect(measured.itemGap).toBeCloseTo(3, 1)
|
||||
expect(measured.bold).toBe(measured.body)
|
||||
} finally {
|
||||
rmSync(scratchDir, { recursive: true, force: true })
|
||||
}
|
||||
})
|
||||
@@ -1,64 +0,0 @@
|
||||
import { chmodSync, rmSync, writeFileSync } from 'node:fs'
|
||||
import path from 'node:path'
|
||||
import type { Page } from '@stablyai/playwright-test'
|
||||
import { removeWorktreeViaStore } from './helpers/dead-terminal'
|
||||
import { expect, test } from './helpers/orca-app'
|
||||
import { SIDEBAR_INPUTS_BUILD } from './helpers/sidebar-inputs-build'
|
||||
import { openSidebarWorkspaceComposer } from './helpers/sidebar-project-dialog'
|
||||
import { getActiveWorktreeId, waitForActiveWorktree, waitForSessionReady } from './helpers/store'
|
||||
|
||||
test.skip(!SIDEBAR_INPUTS_BUILD, 'main lists creations only in an ORCA_SIDEBAR_INPUTS=main build')
|
||||
|
||||
function readCreations(page: Page): Promise<{ pending: string[]; host: string[] }> {
|
||||
return page.evaluate(async () => {
|
||||
const response = await window.api.runtime.call({ method: 'sidebarInputs.workspaceCreations' })
|
||||
const result: unknown = response.ok ? response.result : null
|
||||
const creations: unknown =
|
||||
result && typeof result === 'object' && 'creations' in result ? result.creations : null
|
||||
return {
|
||||
pending: Object.keys(window.__store!.getState().pendingWorktreeCreations),
|
||||
host: creations && typeof creations === 'object' ? Object.keys(creations) : []
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
test('main lists a window create while it runs and drops it when the workspace lands', async ({
|
||||
orcaPage,
|
||||
testRepoPath
|
||||
}) => {
|
||||
test.setTimeout(120_000)
|
||||
await waitForSessionReady(orcaPage)
|
||||
const originalWorktreeId = await waitForActiveWorktree(orcaPage)
|
||||
// Holds `git worktree add` in main long enough for two shadow comparisons.
|
||||
const hookPath = path.join(testRepoPath, '.git', 'hooks', 'post-checkout')
|
||||
writeFileSync(hookPath, '#!/bin/sh\nsleep 8\n')
|
||||
chmodSync(hookPath, 0o755)
|
||||
const name = `registry-${Date.now()}`
|
||||
let createdId: string | null = null
|
||||
|
||||
try {
|
||||
await openSidebarWorkspaceComposer(orcaPage)
|
||||
const dialog = orcaPage.getByRole('dialog', { name: /Create (Workspace|Worktree)/i })
|
||||
await dialog.getByPlaceholder(/Type a name/i).fill(name)
|
||||
await dialog.getByRole('button', { name: /Create (Workspace|Worktree)/i }).click()
|
||||
|
||||
await expect
|
||||
.poll(async () => {
|
||||
const { pending, host } = await readCreations(orcaPage)
|
||||
return pending.length === 1 && host.includes(pending[0])
|
||||
})
|
||||
.toBe(true)
|
||||
|
||||
await expect
|
||||
.poll(async () => (await readCreations(orcaPage)).pending.length, { timeout: 30_000 })
|
||||
.toBe(0)
|
||||
expect((await readCreations(orcaPage)).host).toEqual([])
|
||||
createdId = await getActiveWorktreeId(orcaPage)
|
||||
expect(createdId).not.toBe(originalWorktreeId)
|
||||
} finally {
|
||||
rmSync(hookPath, { force: true })
|
||||
if (createdId && createdId !== originalWorktreeId) {
|
||||
await removeWorktreeViaStore(orcaPage, createdId)
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -1,62 +0,0 @@
|
||||
// Require pane geometry to change after a divider drag.
|
||||
|
||||
import { test, expect } from './helpers/orca-app'
|
||||
import {
|
||||
countVisibleTerminalPanes,
|
||||
splitActiveTerminalPane,
|
||||
waitForPaneCount
|
||||
} from './helpers/terminal'
|
||||
import { registerTerminalPaneMountReadiness } from './helpers/terminal-pane-mount-readiness'
|
||||
|
||||
// Serialize headful scenarios; visible-window runs require an isolated display.
|
||||
test.describe.configure({ mode: 'serial' })
|
||||
test.describe('Terminal Panes', () => {
|
||||
registerTerminalPaneMountReadiness()
|
||||
|
||||
// Real pointer capture needs a valid pointing-device id, unreliable in hidden Electron.
|
||||
// Run ORCA_BACKGROUND_LAUNCH=1 ORCA_E2E_HEADFUL=1 pnpm run test:e2e only on an isolated display or CI.
|
||||
test('@headful can resize terminal panes by real mouse drag', async ({ orcaPage }) => {
|
||||
const panesBefore = await countVisibleTerminalPanes(orcaPage)
|
||||
await splitActiveTerminalPane(orcaPage, 'vertical')
|
||||
await waitForPaneCount(orcaPage, panesBefore + 1)
|
||||
|
||||
const paneWidthsBefore = await orcaPage.evaluate(() => {
|
||||
const xterms = document.querySelectorAll('.xterm')
|
||||
return Array.from(xterms)
|
||||
.filter((x) => (x as HTMLElement).offsetParent !== null)
|
||||
.map((x) => (x as HTMLElement).getBoundingClientRect().width)
|
||||
})
|
||||
expect(paneWidthsBefore.length).toBeGreaterThanOrEqual(2)
|
||||
|
||||
const divider = orcaPage.locator('.pane-divider.is-vertical').first()
|
||||
await expect(divider).toBeVisible({ timeout: 3_000 })
|
||||
const box = await divider.boundingBox()
|
||||
expect(box).not.toBeNull()
|
||||
|
||||
const startX = box!.x + box!.width / 2
|
||||
const startY = box!.y + box!.height / 2
|
||||
await orcaPage.mouse.move(startX, startY)
|
||||
await orcaPage.mouse.down()
|
||||
await orcaPage.mouse.move(startX + 150, startY, { steps: 20 })
|
||||
await orcaPage.mouse.up()
|
||||
|
||||
await expect
|
||||
.poll(
|
||||
async () => {
|
||||
const widthsAfter = await orcaPage.evaluate(() => {
|
||||
const xterms = document.querySelectorAll('.xterm')
|
||||
return Array.from(xterms)
|
||||
.filter((x) => (x as HTMLElement).offsetParent !== null)
|
||||
.map((x) => (x as HTMLElement).getBoundingClientRect().width)
|
||||
})
|
||||
if (widthsAfter.length < 2) {
|
||||
return false
|
||||
}
|
||||
|
||||
return paneWidthsBefore.some((w, i) => Math.abs(w - widthsAfter[i]) > 20)
|
||||
},
|
||||
{ timeout: 5_000, message: 'Pane widths did not change after dragging divider' }
|
||||
)
|
||||
.toBe(true)
|
||||
})
|
||||
})
|
||||
@@ -1,71 +0,0 @@
|
||||
import type { Page } from '@stablyai/playwright-test'
|
||||
import { test, expect } from './helpers/orca-app'
|
||||
import { ensureTerminalVisible, waitForActiveWorktree, waitForSessionReady } from './helpers/store'
|
||||
import { waitForActivePanePtyId, waitForActiveTerminalManager } from './helpers/terminal'
|
||||
import { waitForPtyShellEcho } from './terminal-pty-readiness'
|
||||
|
||||
type Grid = { cols: number; rows: number }
|
||||
type GridSnapshot = { applied: Grid | null; xterm: Grid | null }
|
||||
|
||||
async function readGridSnapshot(page: Page, ptyId: string): Promise<GridSnapshot> {
|
||||
return page.evaluate(async (id) => {
|
||||
let xterm: Grid | null = null
|
||||
for (const manager of window.__paneManagers?.values() ?? []) {
|
||||
for (const pane of manager.getPanes?.() ?? []) {
|
||||
if (pane.container?.dataset?.ptyId === id) {
|
||||
xterm = { cols: pane.terminal.cols, rows: pane.terminal.rows }
|
||||
}
|
||||
}
|
||||
}
|
||||
return { applied: (await window.api.pty.getSize(id)) ?? null, xterm }
|
||||
}, ptyId)
|
||||
}
|
||||
|
||||
function chooseStaleGrid(current: Grid): Grid {
|
||||
return {
|
||||
cols: Math.max(40, current.cols - 19),
|
||||
rows: Math.max(12, current.rows - 7)
|
||||
}
|
||||
}
|
||||
|
||||
test.describe('terminal window-wake stale grid repro', () => {
|
||||
test('window focus heals a local PTY whose applied grid drifted from xterm', async ({
|
||||
orcaPage
|
||||
}) => {
|
||||
test.setTimeout(120_000)
|
||||
await waitForSessionReady(orcaPage)
|
||||
await waitForActiveWorktree(orcaPage)
|
||||
await ensureTerminalVisible(orcaPage)
|
||||
await waitForActiveTerminalManager(orcaPage, 30_000)
|
||||
const ptyId = await waitForActivePanePtyId(orcaPage)
|
||||
await waitForPtyShellEcho(orcaPage, ptyId, 15_000)
|
||||
|
||||
const baseline = await readGridSnapshot(orcaPage, ptyId)
|
||||
expect(baseline.xterm).not.toBeNull()
|
||||
expect(baseline.applied).toEqual(baseline.xterm)
|
||||
const staleGrid = chooseStaleGrid(baseline.xterm!)
|
||||
|
||||
// Why: model the field state directly—xterm is fitted, but the idle PTY
|
||||
// still has an older grid and produces no output that could self-heal it.
|
||||
await orcaPage.evaluate(({ id, grid }) => window.api.pty.resize(id, grid.cols, grid.rows), {
|
||||
id: ptyId,
|
||||
grid: staleGrid
|
||||
})
|
||||
await expect
|
||||
.poll(async () => (await readGridSnapshot(orcaPage, ptyId)).applied, { timeout: 10_000 })
|
||||
.toEqual(staleGrid)
|
||||
expect((await readGridSnapshot(orcaPage, ptyId)).xterm).toEqual(baseline.xterm)
|
||||
|
||||
await orcaPage.evaluate(() => window.dispatchEvent(new Event('focus')))
|
||||
|
||||
await expect
|
||||
.poll(
|
||||
async () => {
|
||||
const snapshot = await readGridSnapshot(orcaPage, ptyId)
|
||||
return snapshot.applied && snapshot.xterm ? snapshot : null
|
||||
},
|
||||
{ timeout: 10_000, message: 'Window focus should converge the local PTY to xterm' }
|
||||
)
|
||||
.toEqual({ applied: baseline.xterm, xterm: baseline.xterm })
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user