refactor(e2e): share Git fixture command

This commit is contained in:
Neil
2026-08-23 14:58:02 -07:00
parent f0c718ecd5
commit ace14e2d98
8 changed files with 13 additions and 36 deletions
@@ -1,8 +1,8 @@
import { execFileSync } from 'node:child_process'
import { mkdirSync, mkdtempSync, realpathSync, rmSync, writeFileSync } from 'node:fs'
import os from 'node:os'
import path from 'node:path'
import type { Page } from '@stablyai/playwright-test'
import { runGit } from './helpers/git-fixture-command'
import { test, expect } from './helpers/orca-app'
import { waitForSessionReady } from './helpers/store'
@@ -28,10 +28,6 @@ type ScrollProbeSample = {
const FILE_COUNT = 18
const ADDED_LINES_PER_FILE = 180
function runGit(repoPath: string, args: string[]): void {
execFileSync('git', args, { cwd: repoPath, stdio: 'pipe' })
}
function buildBaseFile(fileIndex: number): string {
return `${Array.from(
{ length: 20 },
+5
View File
@@ -0,0 +1,5 @@
import { execFileSync } from 'node:child_process'
export function runGit(repoPath: string, args: string[]): void {
execFileSync('git', args, { cwd: repoPath, stdio: 'pipe' })
}
+2 -6
View File
@@ -1,8 +1,8 @@
import { execFileSync } from 'node:child_process'
import { randomUUID } from 'node:crypto'
import { mkdirSync, mkdtempSync, realpathSync, writeFileSync } from 'node:fs'
import os from 'node:os'
import path from 'node:path'
import { randomUUID } from 'node:crypto'
import { runGit } from './helpers/git-fixture-command'
export type IsolatedLargeDiffRepo = {
repoPath: string
@@ -15,10 +15,6 @@ export type IsolatedStagedLocaleDiffRepo = {
relativePaths: string[]
}
function runGit(repoPath: string, args: string[]): void {
execFileSync('git', args, { cwd: repoPath, stdio: 'pipe' })
}
export function createIsolatedLargeDiffRepo(): IsolatedLargeDiffRepo {
const repoPath = realpathSync(mkdtempSync(path.join(os.tmpdir(), 'orca-large-diff-repro-')))
runGit(repoPath, ['init'])
+1 -5
View File
@@ -1,7 +1,7 @@
import { execFileSync } from 'node:child_process'
import { mkdirSync, mkdtempSync, realpathSync, rmSync, writeFileSync } from 'node:fs'
import os from 'node:os'
import path from 'node:path'
import { runGit } from './helpers/git-fixture-command'
export type LargeFileCountRepoOptions = {
/** Files committed on the initial commit. */
@@ -27,10 +27,6 @@ export type LargeFileCountRepo = {
modifiedFiles: number
}
function runGit(repoPath: string, args: string[]): void {
execFileSync('git', args, { cwd: repoPath, stdio: 'pipe' })
}
/**
* Removes a fixture repo, retrying ENOTEMPTY/EBUSY races: the app's git status
* poll can still be writing index.lock (or the watcher holding dirs) while the
@@ -1,7 +1,7 @@
import { execFileSync } from 'node:child_process'
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'
import os from 'node:os'
import path from 'node:path'
import { runGit } from './helpers/git-fixture-command'
import { test, expect } from './helpers/orca-app'
import { waitForActiveWorktree, waitForSessionReady } from './helpers/store'
@@ -9,10 +9,6 @@ const LONG_REPOSITORY_NAME = 'cross-project-dialog-long-repository-name'.repeat(
const LONG_REPOSITORY_SLUG = LONG_REPOSITORY_NAME
const CURRENT_REPOSITORY_NAME = 'current-project-name'.repeat(3)
function runGit(repositoryPath: string, args: string[]): void {
execFileSync('git', args, { cwd: repositoryPath, stdio: 'pipe' })
}
function createGitRepository(repositoryPath: string): void {
mkdirSync(repositoryPath, { recursive: true })
runGit(repositoryPath, ['init'])
@@ -12,11 +12,11 @@
* field pill re-render path.
*/
import { execFileSync } from 'node:child_process'
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'
import os from 'node:os'
import path from 'node:path'
import type { Page } from '@stablyai/playwright-test'
import { runGit } from './helpers/git-fixture-command'
import { test, expect } from './helpers/orca-app'
import { waitForActiveWorktree, waitForSessionReady } from './helpers/store'
import type { LinkedWorkItemSummary } from '../../src/renderer/src/lib/new-workspace'
@@ -24,10 +24,6 @@ import type { TaskSourceContext } from '../../src/shared/task-source-context'
const SECOND_PROJECT_NAME = 'linked-item-second-project'
function runGit(repoPath: string, args: string[]): void {
execFileSync('git', args, { cwd: repoPath, stdio: 'pipe' })
}
function createGitRepo(repoPath: string): void {
mkdirSync(repoPath, { recursive: true })
runGit(repoPath, ['init'])
+1 -5
View File
@@ -1,14 +1,10 @@
import { execFileSync } from 'node:child_process'
import { mkdirSync, rmSync, writeFileSync } from 'node:fs'
import path from 'node:path'
import type { Locator, Page } from '@stablyai/playwright-test'
import { runGit } from './helpers/git-fixture-command'
import { test, expect } from './helpers/orca-app'
import { waitForActiveWorktree, waitForSessionReady } from './helpers/store'
function runGit(repoPath: string, args: string[]): void {
execFileSync('git', args, { cwd: repoPath, stdio: 'pipe' })
}
function createGitRepo(repoPath: string): void {
rmSync(repoPath, { recursive: true, force: true })
mkdirSync(repoPath, { recursive: true })
@@ -1,7 +1,7 @@
import { execFileSync } from 'node:child_process'
import { mkdirSync, rmSync, writeFileSync } from 'node:fs'
import path from 'node:path'
import type { ElectronApplication, Page } from '@stablyai/playwright-test'
import { runGit } from './helpers/git-fixture-command'
import { test, expect } from './helpers/orca-app'
import { waitForActiveWorktree, waitForSessionReady } from './helpers/store'
import { worktreeRow, worktreeRowSurface } from './worktree-row-locators'
@@ -16,10 +16,6 @@ type WorktreeIds = {
featureWorktreeId: string
}
function runGit(cwd: string, args: string[]): void {
execFileSync('git', args, { cwd, stdio: 'pipe' })
}
/** Repo whose shared orca.yaml carries a real setup script, plus a second worktree. */
function createRepoWithSharedSetupScript(repoPath: string, featureWorktreePath: string): void {
rmSync(repoPath, { recursive: true, force: true })