test: isolate source-control generation repositories per scenario (#19105)

* test: isolate source control generation repositories per scenario

* test: explain scenario repository fixture scope
This commit is contained in:
Neil
2026-09-06 11:25:52 -07:00
committed by GitHub
parent 4cccadcb95
commit 6aa0aaee6b
3 changed files with 14 additions and 16 deletions
+7 -2
View File
@@ -48,6 +48,7 @@ type OrcaTestFixtures = {
// Why: most E2E specs need a ready project before assertions start. Golden
// first-run specs opt out so they can prove the zero-project onboarding path.
seedTestRepo: boolean
seededRepoPath: string
// Synthetic-list specs need only the primary checkout; switching specs keep the two-row default.
minimumSeededWorktreeCount: number
// Why: spec-scoped launch env. Mutating process.env at spec module scope
@@ -278,6 +279,10 @@ export const test = base.extend<OrcaTestFixtures, OrcaWorkerFixtures>({
// Default: dismiss the onboarding overlay so it doesn't intercept clicks.
dismissOnboarding: [true, { option: true }],
seedTestRepo: [true, { option: true }],
// Test-scoped so generation scenarios can isolate Git indexes and remotes.
seededRepoPath: async ({ testRepoPath }, provideFixture) => {
await provideFixture(testRepoPath)
},
minimumSeededWorktreeCount: [2, { option: true }],
launchEnv: [{}, { option: true }],
orcaAppExtraEnv: [{}, { option: true }],
@@ -286,7 +291,7 @@ export const test = base.extend<OrcaTestFixtures, OrcaWorkerFixtures>({
// Test-scoped: grab the first BrowserWindow, add the test repo, and wait
// until the session is fully ready with a worktree active.
sharedPage: async (
{ electronApp, minimumSeededWorktreeCount, seedTestRepo, testRepoPath },
{ electronApp, minimumSeededWorktreeCount, seedTestRepo, seededRepoPath },
provideFixture
) => {
// Why: the Electron app may take a while to create the first window,
@@ -308,7 +313,7 @@ export const test = base.extend<OrcaTestFixtures, OrcaWorkerFixtures>({
return
}
const repoPath = isValidGitRepo(testRepoPath) ? testRepoPath : createSeededTestRepo()
const repoPath = isValidGitRepo(seededRepoPath) ? seededRepoPath : createSeededTestRepo()
// Add the test repo via the IPC bridge
// Why: calling window.api.repos.add() goes through the same code path as
@@ -5,17 +5,10 @@ import { cleanupTestRepository } from '../global-teardown'
export { expect }
export const test = base.extend({
testRepoPath: [
// oxlint-disable-next-line no-empty-pattern -- Playwright requires destructured fixture arguments.
async ({}, provideFixture) => {
// Generation must not fetch external remotes installed by unrelated specs.
const repoPath = createSeededTestRepo({ publishPath: false })
try {
await provideFixture(repoPath)
} finally {
cleanupTestRepository(repoPath)
}
},
{ scope: 'worker' }
]
seededRepoPath: async ({ registerPostElectronShutdownCleanup }, provideFixture) => {
// Git indexes and remotes must not survive between generation scenarios.
const repoPath = createSeededTestRepo({ publishPath: false })
registerPostElectronShutdownCleanup(async () => cleanupTestRepository(repoPath))
await provideFixture(repoPath)
}
})
@@ -3,7 +3,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 { test, expect } from './helpers/orca-app'
import { test, expect } from './helpers/source-control-generation-app'
import { waitForActiveWorktree, waitForSessionReady } from './helpers/store'
import {
createStagedCommitMessageChange,