mirror of
https://github.com/stablyai/orca.git
synced 2026-09-21 16:02:20 +00:00
test: isolate native crash restoration and refresh stale fixtures (#18883)
* test: isolate native crash restoration and seed current integration facts * test: await scoped GitLab preflight before URL transition checks
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import type { ElectronApplication } from '@stablyai/playwright-test'
|
||||
import { realpathSync } from 'node:fs'
|
||||
import path from 'node:path'
|
||||
import { expect, test } from './helpers/orca-app'
|
||||
|
||||
@@ -23,7 +24,7 @@ async function readElectronHomeState(electronApp: ElectronApplication) {
|
||||
// HOME boundary and that real-home routing lands inside the disposable profile.
|
||||
test('isolates Electron and Codex from the developer home by default', async ({ electronApp }) => {
|
||||
const state = await readElectronHomeState(electronApp)
|
||||
const expectedHome = path.join(state.userDataDir!, 'home')
|
||||
const expectedHome = realpathSync.native(path.join(state.userDataDir!, 'home'))
|
||||
|
||||
expect(state.appHome).toBe(expectedHome)
|
||||
expect(state.nodeHome).toBe(expectedHome)
|
||||
|
||||
@@ -179,9 +179,40 @@ test.describe('Feature tour modal', () => {
|
||||
})
|
||||
|
||||
test('does not pre-check configured workflows until the user visits them', async ({
|
||||
orcaPage
|
||||
orcaPage,
|
||||
electronApp
|
||||
}) => {
|
||||
await orcaPage.evaluate(() => {
|
||||
await electronApp.evaluate(
|
||||
({ ipcMain }, preflightStatus) => {
|
||||
ipcMain.removeHandler('preflight:check')
|
||||
ipcMain.handle('preflight:check', () => preflightStatus)
|
||||
ipcMain.removeHandler('linear:status')
|
||||
ipcMain.handle('linear:status', () => ({ connected: false, viewer: null }))
|
||||
ipcMain.removeHandler('jira:status')
|
||||
ipcMain.handle('jira:status', () => ({ connected: false, viewer: null }))
|
||||
},
|
||||
{
|
||||
git: { installed: true },
|
||||
gh: { installed: true, authenticated: true },
|
||||
glab: { installed: false, authenticated: false },
|
||||
bitbucket: { configured: false, authenticated: false, account: null },
|
||||
azureDevOps: {
|
||||
configured: false,
|
||||
authenticated: false,
|
||||
account: null,
|
||||
baseUrl: null,
|
||||
tokenConfigured: false
|
||||
},
|
||||
gitea: {
|
||||
configured: false,
|
||||
authenticated: false,
|
||||
account: null,
|
||||
baseUrl: null,
|
||||
tokenConfigured: false
|
||||
}
|
||||
}
|
||||
)
|
||||
await orcaPage.evaluate(async () => {
|
||||
for (const key of [
|
||||
'orca.featureWall.visitedWorkflows.v1',
|
||||
'orca.featureWall.visitedAgentSteps.v1',
|
||||
@@ -198,32 +229,12 @@ test.describe('Feature tour modal', () => {
|
||||
if (!store) {
|
||||
throw new Error('window.__store is not available')
|
||||
}
|
||||
store.setState({
|
||||
preflightStatus: {
|
||||
git: { installed: true },
|
||||
gh: { installed: true, authenticated: true },
|
||||
glab: { installed: false, authenticated: false },
|
||||
bitbucket: { configured: false, authenticated: false, account: null },
|
||||
azureDevOps: {
|
||||
configured: false,
|
||||
authenticated: false,
|
||||
account: null,
|
||||
baseUrl: null,
|
||||
tokenConfigured: false
|
||||
},
|
||||
gitea: {
|
||||
configured: false,
|
||||
authenticated: false,
|
||||
account: null,
|
||||
baseUrl: null,
|
||||
tokenConfigured: false
|
||||
}
|
||||
},
|
||||
preflightStatusChecked: true,
|
||||
preflightStatusLoading: false,
|
||||
linearStatus: { connected: false, viewer: null },
|
||||
linearStatusChecked: true
|
||||
})
|
||||
// Seed through the status actions so each result gets the current execution context.
|
||||
await Promise.all([
|
||||
store.getState().refreshPreflightStatus({ force: true }),
|
||||
store.getState().checkLinearConnection(true),
|
||||
store.getState().checkJiraConnection()
|
||||
])
|
||||
store.getState().openModal('feature-wall', { source: 'help_menu' })
|
||||
})
|
||||
|
||||
|
||||
@@ -203,6 +203,12 @@ async function installHeldGitLabLookup(
|
||||
__releaseGitLabUrlLookup?: () => void
|
||||
}
|
||||
fixture.__gitlabUrlLookupStarted = false
|
||||
ipcMain.removeHandler('preflight:check')
|
||||
ipcMain.handle('preflight:check', () => ({
|
||||
git: { installed: true },
|
||||
gh: { installed: true, authenticated: true },
|
||||
glab: { installed: true, authenticated: true }
|
||||
}))
|
||||
ipcMain.removeHandler('gitlab:listMRs')
|
||||
ipcMain.handle('gitlab:listMRs', () => ({
|
||||
items: [wrongItem],
|
||||
@@ -221,23 +227,12 @@ async function installHeldGitLabLookup(
|
||||
},
|
||||
{ wrongItem: GITLAB_WRONG_ITEM, targetItem: GITLAB_TARGET_ITEM }
|
||||
)
|
||||
await page.evaluate(() => {
|
||||
await page.evaluate(async () => {
|
||||
const store = window.__store
|
||||
if (!store) {
|
||||
throw new Error('window.__store is not available')
|
||||
}
|
||||
const state = store.getState()
|
||||
if (!state.preflightStatusContextKey) {
|
||||
throw new Error('preflight context is not ready')
|
||||
}
|
||||
store.setState({
|
||||
preflightStatus: {
|
||||
git: state.preflightStatus?.git ?? { installed: true },
|
||||
gh: state.preflightStatus?.gh ?? { installed: true, authenticated: true },
|
||||
glab: { installed: true, authenticated: true }
|
||||
},
|
||||
preflightStatusChecked: true
|
||||
})
|
||||
await store.getState().refreshPreflightStatus({ force: true })
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,10 @@ export function getOrcaElectronLaunchArgs(mainPath: string, headful: boolean): s
|
||||
// these Chromium switches startup can block before the first renderer target.
|
||||
const keychainArgs =
|
||||
process.platform === 'darwin' ? ['--password-store=basic', '--use-mock-keychain'] : []
|
||||
if (process.platform === 'darwin') {
|
||||
// Crash tests must not block later launches on AppKit's saved-window recovery dialog.
|
||||
return [...keychainArgs, appPath, '-ApplePersistenceIgnoreState', 'YES']
|
||||
}
|
||||
if (headful || process.platform !== 'linux') {
|
||||
return [...keychainArgs, appPath]
|
||||
}
|
||||
|
||||
@@ -8,10 +8,17 @@ describe('getOrcaElectronLaunchArgs', () => {
|
||||
const mainPath = join(root, 'out', 'main', 'index.js')
|
||||
|
||||
const args = getOrcaElectronLaunchArgs(mainPath, true)
|
||||
expect(args.at(-1)).toBe(root)
|
||||
if (process.platform === 'darwin') {
|
||||
expect(args.slice(0, -1)).toEqual(['--password-store=basic', '--use-mock-keychain'])
|
||||
expect(args).toEqual([
|
||||
'--password-store=basic',
|
||||
'--use-mock-keychain',
|
||||
root,
|
||||
'-ApplePersistenceIgnoreState',
|
||||
'YES'
|
||||
])
|
||||
} else {
|
||||
expect(args.at(-1)).toBe(root)
|
||||
}
|
||||
expect(getOrcaElectronLaunchArgs(mainPath, false).at(-1)).toBe(root)
|
||||
expect(getOrcaElectronLaunchArgs(mainPath, false)).toContain(root)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user