mirror of
https://github.com/stablyai/orca.git
synced 2026-09-23 08:02:31 +00:00
* test: add golden E2E tests for source control workflows - Tests core source control interactions: file edit/save, commit staging, and diff viewing - Integrated into CI/CD pipelines for Linux, macOS, and Windows - Includes helper utilities for test setup and worktree management * test(e2e): verify golden commit author and fix test flakiness - Configure git author name/email at worktree level during setup - Verify commits are made with correct author details in assertions - Add explicit timeouts to file visibility waits and git status polling - Fix test ordering to seed edits after source control is open - Simplify git status refresh logic to rely on automatic updates * Add rollback to createGoldenWorktree on setup failure Cleanup callbacks only register after setup succeeds. When a config command fails, the half-built worktree and branch leak into later test runs, causing flakiness. Now we roll back immediately and re-throw the setup error. * test(e2e): match explorer rows after the git status badge appears The golden file-save spec used an exact /^README.md$/ filter. After save, the explorer row text becomes "README.md M", so reopen clicked nothing. * test: strengthen golden worktree setup verification - Track working directory in git call inspection to verify correct execution context - Verify user.name/email config applies to worktree-specific settings, not repo - Add exhaustive setup call sequence assertions to catch setup/rollback leaks
53 lines
1.8 KiB
TypeScript
53 lines
1.8 KiB
TypeScript
import { realpathSync } from 'node:fs'
|
|
import path from 'node:path'
|
|
import { test, expect } from './helpers/orca-app'
|
|
import {
|
|
cleanupGoldenWorktree,
|
|
createGoldenWorktree,
|
|
GOLDEN_ADDED_LINE,
|
|
GOLDEN_CHANGED_PATH,
|
|
GOLDEN_REMOVED_LINE,
|
|
openGoldenSourceControl,
|
|
seedGoldenSourceEdit
|
|
} from './helpers/golden-source-control'
|
|
import { waitForSessionReady } from './helpers/store'
|
|
|
|
test('@golden opens an unstaged file diff from Source Control', async ({
|
|
orcaPage,
|
|
testRepoPath,
|
|
registerPostElectronShutdownCleanup
|
|
}) => {
|
|
const fixture = createGoldenWorktree(testRepoPath, 'open-diff')
|
|
registerPostElectronShutdownCleanup(async () => cleanupGoldenWorktree(testRepoPath, fixture))
|
|
|
|
await waitForSessionReady(orcaPage)
|
|
await openGoldenSourceControl(orcaPage, testRepoPath, fixture)
|
|
seedGoldenSourceEdit(fixture.worktreePath)
|
|
|
|
const changedFile = orcaPage
|
|
.locator('[data-testid="source-control-entry"]')
|
|
.filter({ hasText: path.basename(GOLDEN_CHANGED_PATH) })
|
|
await expect(changedFile).toBeVisible({ timeout: 15_000 })
|
|
await changedFile.click()
|
|
|
|
await expect(orcaPage.locator('.monaco-diff-editor')).toBeVisible({ timeout: 20_000 })
|
|
await expect(
|
|
orcaPage
|
|
.locator('.original-in-monaco-diff-editor .view-line')
|
|
.filter({ hasText: GOLDEN_REMOVED_LINE })
|
|
).toBeVisible()
|
|
await expect(
|
|
orcaPage
|
|
.locator('.modified-in-monaco-diff-editor .view-line')
|
|
.filter({ hasText: GOLDEN_ADDED_LINE })
|
|
).toBeVisible()
|
|
await expect(orcaPage.locator('.editor-header-path').first()).toHaveAttribute(
|
|
'title',
|
|
`${realpathSync(path.join(fixture.worktreePath, GOLDEN_CHANGED_PATH))} (diff)`
|
|
)
|
|
|
|
const probe = orcaPage.getByRole('button', { name: /Source Control/ })
|
|
await probe.focus()
|
|
await expect(probe).toBeFocused()
|
|
})
|