Fix E2E completed onboarding profile for restarts (#2299)

Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
Brennan Benson
2026-05-18 20:42:59 -07:00
committed by GitHub
co-authored by Orca
parent edf5cf9a85
commit cdd40f117e
3 changed files with 34 additions and 46 deletions
@@ -0,0 +1,25 @@
import { ONBOARDING_FINAL_STEP } from '../../../src/shared/constants'
const SEEN_FIRST_RUN_FEATURE_TIP_IDS = ['voice-dictation'] as const
export function getE2ECompletedOnboardingProfile() {
return {
settings: {
telemetry: {
optedIn: true,
installId: '00000000-0000-4000-8000-000000000000',
existedBeforeTelemetryRelease: false
}
},
onboarding: {
closedAt: 1,
outcome: 'completed',
lastCompletedStep: ONBOARDING_FINAL_STEP
},
ui: {
// Why: completed-onboarding E2E profiles should not be interrupted by
// first-run education modals that cover the UI under test.
featureTipsSeenIds: [...SEEN_FIRST_RUN_FEATURE_TIP_IDS]
}
}
}
+5 -26
View File
@@ -27,6 +27,7 @@ import os from 'os'
import path from 'path'
import { TEST_REPO_PATH_FILE } from '../global-setup'
import { cleanupE2EDaemons, closeElectronAppForE2E } from './electron-process-shutdown'
import { getE2ECompletedOnboardingProfile } from './e2e-completed-onboarding-profile'
type OrcaTestFixtures = {
electronApp: ElectronApplication
@@ -173,34 +174,12 @@ export const test = base.extend<OrcaTestFixtures, OrcaWorkerFixtures>({
if (dismissOnboarding) {
// Why: onboarding renders a fullscreen `fixed inset-0 z-[100]` overlay
// when persisted `closedAt` is null, which intercepts pointer events for
// every other test. Seed explicit fresh-user state: an empty file would
// make persistence treat the profile as an existing-user upgrade cohort
// and mount the telemetry notice overlay instead.
// every other test. Seed a completed-onboarding fresh-install profile:
// an empty file would make persistence treat the profile as an
// existing-user upgrade cohort and mount the telemetry notice overlay.
writeFileSync(
path.join(userDataDir, 'orca-data.json'),
`${JSON.stringify(
{
settings: {
telemetry: {
optedIn: true,
installId: '00000000-0000-4000-8000-000000000000',
existedBeforeTelemetryRelease: false
}
},
onboarding: {
closedAt: 1,
outcome: 'completed',
lastCompletedStep: 4
},
ui: {
// Why: unrelated E2Es start from a completed-onboarding profile;
// seed first-run feature education too so modals do not cover UI.
featureTipsSeenIds: ['voice-dictation']
}
},
null,
2
)}\n`
`${JSON.stringify(getE2ECompletedOnboardingProfile(), null, 2)}\n`
)
}
const headful = shouldLaunchHeadful(testInfo)
+4 -20
View File
@@ -19,6 +19,7 @@ import { execSync } from 'child_process'
import { existsSync, mkdtempSync, rmSync, writeFileSync } from 'fs'
import os from 'os'
import path from 'path'
import { getE2ECompletedOnboardingProfile } from './e2e-completed-onboarding-profile'
import { cleanupE2EDaemons, closeElectronAppForE2E } from './electron-process-shutdown'
type LaunchedOrca = {
@@ -63,28 +64,11 @@ export function createRestartSession(testInfo: TestInfo): RestartSession {
const headful = shouldLaunchHeadful(testInfo)
// Why: this helper bypasses the shared `electronApp` fixture, so it must
// seed the same dismissed onboarding state or the full-screen overlay covers
// both launches and obscures restart failures.
// seed the same completed onboarding profile or first-run overlays cover
// both launches and obscure restart failures.
writeFileSync(
path.join(userDataDir, 'orca-data.json'),
`${JSON.stringify(
{
settings: {
telemetry: {
optedIn: true,
installId: '00000000-0000-4000-8000-000000000000',
existedBeforeTelemetryRelease: false
}
},
onboarding: {
closedAt: 1,
outcome: 'completed',
lastCompletedStep: 4
}
},
null,
2
)}\n`
`${JSON.stringify(getE2ECompletedOnboardingProfile(), null, 2)}\n`
)
const launch = async (): Promise<LaunchedOrca> => {