diff --git a/tests/e2e/helpers/orca-app.ts b/tests/e2e/helpers/orca-app.ts index 5904a8416ff..af0915a6621 100644 --- a/tests/e2e/helpers/orca-app.ts +++ b/tests/e2e/helpers/orca-app.ts @@ -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({ // 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({ // 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({ 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 diff --git a/tests/e2e/helpers/source-control-generation-app.ts b/tests/e2e/helpers/source-control-generation-app.ts index 2a1d00ca390..220647397d0 100644 --- a/tests/e2e/helpers/source-control-generation-app.ts +++ b/tests/e2e/helpers/source-control-generation-app.ts @@ -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) + } }) diff --git a/tests/e2e/source-control-create-pr-intent-switch.spec.ts b/tests/e2e/source-control-create-pr-intent-switch.spec.ts index 816cf396d3c..2b6ad8bb9c4 100644 --- a/tests/e2e/source-control-create-pr-intent-switch.spec.ts +++ b/tests/e2e/source-control-create-pr-intent-switch.spec.ts @@ -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,