diff --git a/config/scripts/ci/sharding/ci-shard-timings.json b/config/scripts/ci/sharding/ci-shard-timings.json index 5f9d91fdeed..d3509db29dd 100644 --- a/config/scripts/ci/sharding/ci-shard-timings.json +++ b/config/scripts/ci/sharding/ci-shard-timings.json @@ -4696,7 +4696,6 @@ "src/renderer/src/components/new-workspace/project-selection/use-recent-project-ids.test.ts": 1730, "src/renderer/src/components/new-workspace/source-search/use-smart-workspace-name-field-foundation.source.test.tsx": 2290, "src/renderer/src/components/new-workspace/work-item-source-selection.test.ts": 1736, - "src/renderer/src/components/onboarding/OnboardingLanguageLoading.test.tsx": 2167, "src/renderer/src/components/pet/pet-blob-cache.test.ts": 64, "src/renderer/src/components/plain-ssh-terminal/PlainSshTerminalPanels.test.tsx": 2510, "src/renderer/src/components/plugins/declarative/PluginDeclarativeView.test.tsx": 2804, @@ -6406,7 +6405,6 @@ "src/shared/plugins/artifacts/plugin-theme-artifact.test.ts": 165, "src/shared/plugins/artifacts/plugin-vm-recipe-artifact.test.ts": 121, "src/shared/plugins/authoring/plugin-host-typings.test.ts": 2140, - "src/shared/plugins/catalog/plugin-catalog-release.test.ts": 229, "src/shared/plugins/catalog/plugin-catalog.test.ts": 630, "src/shared/plugins/catalog/plugin-kill-list.test.ts": 195, "src/shared/plugins/catalog/plugin-marketplace.test.ts": 246, diff --git a/src/cli/arguments/args-repeatable-flags.test.ts b/src/cli/arguments/args-repeatable-flags.test.ts index 8427da58b41..ba9dd3f4731 100644 --- a/src/cli/arguments/args-repeatable-flags.test.ts +++ b/src/cli/arguments/args-repeatable-flags.test.ts @@ -20,16 +20,7 @@ const parent: CommandSpec = { const specs = [parent, leaf] const paths = specs.flatMap(specPaths) -function flags(argv: string[]) { - return parseArgs(argv, paths, specs).flags -} - describe('command-scoped repeatable flags', () => { - it('uses the leaf rules for all flags even when the parent has different rules', () => { - const parsed = flags(['--path', '/a', 'example', '--path', '/b', 'search', '--path', '/c']) - expect(parsed.get('path')).toBe('/c') - }) - it.each([['--agent=a', '--agent', '--agent=b']])( 'rejects a missing occurrence even among valid values: %j', (...options) => { @@ -37,14 +28,4 @@ describe('command-scoped repeatable flags', () => { expect(() => validateCommandAndFlags(specs, parsed)).toThrow('Flag --agent requires a value.') } ) - - it.each(['label'])('also rejects erased missing legacy --%s values', (flag) => { - const spec = { ...leaf, allowedFlags: [flag], repeatableFlags: [] } - const parsed = parseArgs(['ex', 'find', `--${flag}=a`, `--${flag}`, `--${flag}=b`], paths, [ - spec - ]) - expect(() => validateCommandAndFlags([spec], parsed)).toThrow( - `Flag --${flag} requires a value.` - ) - }) }) diff --git a/src/cli/arguments/args.test.ts b/src/cli/arguments/args.test.ts index 6adc1a934ff..3220b3bac49 100644 --- a/src/cli/arguments/args.test.ts +++ b/src/cli/arguments/args.test.ts @@ -1,42 +1,8 @@ import { describe, expect, it } from 'vitest' -import type { CommandSpec } from '../discovery/command-spec' -import { normalizeCommandPositionals, parseArgs, validateCommandAndFlags } from './args' +import { normalizeCommandPositionals, parseArgs } from './args' describe('parseArgs', () => { - it('keeps an empty string as a flag value', () => { - const parsed = parseArgs(['computer', 'set-value', '--value', '', '--json']) - - expect(parsed.commandPath).toEqual(['computer', 'set-value']) - expect(parsed.flags.get('value')).toBe('') - expect(parsed.flags.get('json')).toBe(true) - }) - - it('splits --flag=value on the first = so values may contain =', () => { - const parsed = parseArgs(['set', 'cookie', '--value=a=b=c']) - - expect(parsed.flags.get('value')).toBe('a=b=c') - }) - - it('recognizes a command path with a boolean flag between its segments', () => { - const parsed = parseArgs(['--jso', 'worktree', '--json', 'list'], [['worktree', 'list']]) - - expect(parsed.commandPath).toEqual(['worktree', 'list']) - expect(parsed.flags.get('jso')).toBe(true) - expect(parsed.flags.get('json')).toBe(true) - }) - - it('recognizes a command path with a value flag between its segments', () => { - const parsed = parseArgs( - ['--jso', 'worktree', '--repo', 'id:abc', 'list'], - [['worktree', 'list']] - ) - - expect(parsed.commandPath).toEqual(['worktree', 'list']) - expect(parsed.flags.get('jso')).toBe(true) - expect(parsed.flags.get('repo')).toBe('id:abc') - }) - it('preserves a selector value that is also a registered command', () => { const parsed = parseArgs( ['--environment', 'status', 'worktree', 'list'], @@ -86,59 +52,3 @@ describe('parseArgs', () => { expect(parsed.positionalFlagConflicts).toEqual([]) }) }) - -describe('command aliases', () => { - const specs: CommandSpec[] = [ - { - path: ['worktree', 'rm'], - aliases: [ - ['worktree', 'remove'], - ['worktree', 'delete'] - ], - summary: 'Remove a worktree', - usage: 'orca worktree rm --worktree ', - allowedFlags: ['worktree', 'force'] - } - ] - - it('canonicalizes an aliased command path during normalization', () => { - const normalized = normalizeCommandPositionals( - specs, - parseArgs(['worktree', 'remove', '--force']) - ) - - expect(normalized.commandPath).toEqual(['worktree', 'rm']) - expect(normalized.flags.get('force')).toBe(true) - }) -}) - -describe('validateCommandAndFlags', () => { - const specs = [ - { - path: ['demo'], - summary: 'Demo command', - usage: 'orca demo', - allowedFlags: [] - } - ] - - it.each(['environment'])('rejects --%s without a value', (flag) => { - const parsed = parseArgs([`--${flag}`, 'demo'], [['demo']]) - - expect(() => validateCommandAndFlags(specs, parsed)).toThrow(`Flag --${flag} requires a value.`) - }) - - it.each(['environment'])('rejects an empty --%s= value', (flag) => { - const parsed = parseArgs(['demo', `--${flag}=`]) - - expect(() => validateCommandAndFlags(specs, parsed)).toThrow(`Flag --${flag} requires a value.`) - }) - - it('still rejects unknown command-specific flags', () => { - const parsed = parseArgs(['demo', '--bogus']) - - expect(() => validateCommandAndFlags(specs, parsed)).toThrow( - 'Unknown flag --bogus for command: demo' - ) - }) -}) diff --git a/src/renderer/src/components/editor/document-images/image-viewer-zoom-ownership.test.tsx b/src/renderer/src/components/editor/document-images/image-viewer-zoom-ownership.test.tsx index 9abf0bb3d69..794522bbd3c 100644 --- a/src/renderer/src/components/editor/document-images/image-viewer-zoom-ownership.test.tsx +++ b/src/renderer/src/components/editor/document-images/image-viewer-zoom-ownership.test.tsx @@ -49,6 +49,9 @@ describe('ImageViewer app zoom ownership', () => { ) const viewer = render(image(true)) + const loaded = screen.getByRole('img', { name: 'shot.png' }) + Object.defineProperties(loaded, { naturalWidth: { value: 1 }, naturalHeight: { value: 1 } }) + fireEvent.load(loaded) expect(zoom('in')).toBe(true) viewer.rerender(image(false)) @@ -62,45 +65,4 @@ describe('ImageViewer app zoom ownership', () => { viewer.unmount() expect(zoom('in')).toBe(false) }) - - it('keeps a zoom that arrives before the image has loaded', () => { - render( - - - - ) - expect(zoom('in')).toBe(true) - const image = screen.getByRole('img', { name: 'shot.png' }) - Object.defineProperties(image, { - naturalWidth: { value: 4000 }, - naturalHeight: { value: 3000 } - }) - fireEvent.load(image) - expect(screen.getByText('125%')).toBeTruthy() - }) - - it('keeps the zoom when the same file is reminted under a new revision', () => { - const image = (revision: number) => ( - - - - ) - const viewer = render(image(1)) - const loaded = screen.getByRole('img', { name: 'shot.png' }) - Object.defineProperties(loaded, { naturalWidth: { value: 400 }, naturalHeight: { value: 300 } }) - fireEvent.load(loaded) - zoom('in') - expect(screen.getByText('125%')).toBeTruthy() - - viewer.rerender(image(2)) - expect(screen.getByText('125%')).toBeTruthy() - }) }) diff --git a/src/renderer/src/components/onboarding/OnboardingLanguageLoading.test.tsx b/src/renderer/src/components/onboarding/OnboardingLanguageLoading.test.tsx deleted file mode 100644 index 1787b416837..00000000000 --- a/src/renderer/src/components/onboarding/OnboardingLanguageLoading.test.tsx +++ /dev/null @@ -1,51 +0,0 @@ -// @vitest-environment happy-dom -import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react' -import { afterEach, expect, it, vi } from 'vitest' -import { getDefaultSettings } from '../../../../shared/constants' -import { markRuntimeEnvironmentCompatible } from '@/runtime/rpc/compatibility/runtime-compatibility-cache' -import { useAppStore } from '@/store' -import { i18n } from '@/i18n/i18n' -import { OnboardingLanguageLoading } from './OnboardingLanguageLoading' - -afterEach(() => { - cleanup() - useAppStore.setState(useAppStore.getInitialState(), true) - vi.unstubAllGlobals() -}) - -it('releases settings recovery while remote owner hydration is still pending', async () => { - await i18n.changeLanguage('en') - useAppStore.setState(useAppStore.getInitialState(), true) - markRuntimeEnvironmentCompatible('language-retry-owner') - let finishOwnerRead: (value: unknown) => void = () => {} - const ownerRead = new Promise((resolve) => { - finishOwnerRead = resolve - }) - const call = vi.fn().mockReturnValue(ownerRead) - const settings = { - ...getDefaultSettings('/tmp'), - activeRuntimeEnvironmentId: 'language-retry-owner' - } - Object.defineProperty(window, 'api', { - configurable: true, - value: { - settings: { get: vi.fn().mockResolvedValue(settings) }, - runtimeEnvironments: { call, list: vi.fn().mockResolvedValue([]) } - } - }) - render() - fireEvent.click(screen.getByRole('button', { name: 'Retry' })) - expect(screen.queryByRole('button', { name: 'Retry' })).toBeNull() - try { - await waitFor(() => expect(call).toHaveBeenCalled()) - expect(useAppStore.getState().settings).toBe(settings) - expect(screen.queryByRole('button', { name: 'Retry' })).toBeNull() - } finally { - finishOwnerRead({ - ok: true, - result: { settings: {} }, - _meta: { runtimeId: 'language-retry-runtime' } - }) - await useAppStore.getState().awaitOwnerWorktreeVisibilityDefaultsHydration() - } -}) diff --git a/src/renderer/src/components/onboarding/OnboardingLanguageSwitcher.test.tsx b/src/renderer/src/components/onboarding/OnboardingLanguageSwitcher.test.tsx deleted file mode 100644 index ca365db071b..00000000000 --- a/src/renderer/src/components/onboarding/OnboardingLanguageSwitcher.test.tsx +++ /dev/null @@ -1,50 +0,0 @@ -// @vitest-environment happy-dom -import { cleanup, render, screen } from '@testing-library/react' -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import { getDefaultSettings } from '../../../../shared/constants' -import { detectUiLanguage } from '../../../../shared/ui-locale' -import { useAppStore } from '@/store' -import { i18n } from '@/i18n/i18n' -import { useLanguageReadiness } from '@/i18n/language-readiness' -import { OnboardingLanguageSwitcher } from './OnboardingLanguageSwitcher' - -beforeEach(async () => { - useAppStore.setState(useAppStore.getInitialState(), true) - useLanguageReadiness.setState({ ...useLanguageReadiness.getInitialState(), ready: true }) - await i18n.changeLanguage('en') -}) - -afterEach(() => { - cleanup() - vi.restoreAllMocks() -}) - -describe('onboarding language switcher eligibility', () => { - it('shows the picker for a non-English locale with existing settings', () => { - useAppStore.setState({ - settings: { - ...getDefaultSettings('/tmp'), - telemetry: { - optedIn: true, - installId: 'test-install', - existedBeforeTelemetryRelease: false, - onboardingLanguageCohort: 'control' - } - } - }) - useLanguageReadiness.setState({ detection: detectUiLanguage(['de-DE'], 'native') }) - render() - expect(screen.getByRole('button', { name: 'Switch language' })).toBeTruthy() - }) - - it('keeps the normal English gate and exposes recovery when the catalog fails', () => { - useAppStore.setState({ settings: getDefaultSettings('/tmp') }) - useLanguageReadiness.setState({ detection: detectUiLanguage(['en-US'], 'native') }) - const { rerender } = render() - expect(screen.queryByRole('button', { name: 'Switch language' })).toBeNull() - - useLanguageReadiness.setState({ error: true }) - rerender() - expect(screen.getByRole('button', { name: 'Switch language' })).toBeTruthy() - }) -}) diff --git a/src/renderer/src/components/onboarding/YoloPermissionsControl.test.tsx b/src/renderer/src/components/onboarding/YoloPermissionsControl.test.tsx deleted file mode 100644 index ed600c66107..00000000000 --- a/src/renderer/src/components/onboarding/YoloPermissionsControl.test.tsx +++ /dev/null @@ -1,52 +0,0 @@ -// @vitest-environment happy-dom - -import { act, cleanup, fireEvent, render, screen } from '@testing-library/react' -import { afterEach, beforeEach, expect, it, vi } from 'vitest' -import { getDefaultSettings } from '../../../../shared/constants' -import type { GlobalSettings } from '../../../../shared/global-settings-types' -import { useAppStore } from '@/store' -import { YoloPermissionsControl } from './YoloPermissionsControl' - -const initialState = useAppStore.getState() -const originalApi = window.api -let saved: GlobalSettings - -beforeEach(() => { - saved = { - ...getDefaultSettings('/synthetic'), - agentPermissionDefault: 'own', - agentPermissionOverrides: { codex: 'full-access', claude: 'ask' } - } - useAppStore.setState({ settings: saved }) - Object.defineProperty(window, 'api', { - configurable: true, - value: { - ...originalApi, - settings: { - ...originalApi?.settings, - set: vi.fn(async (updates: Partial) => { - saved = { ...saved, ...updates } - return saved - }) - } - } - }) -}) - -afterEach(() => { - cleanup() - useAppStore.setState(initialState, true) - Object.defineProperty(window, 'api', { configurable: true, value: originalApi }) - vi.restoreAllMocks() -}) - -it('persists only the selected agent permission override', async () => { - render() - - await act(async () => - fireEvent.click(screen.getByRole('button', { name: 'Use Codex’s own settings' })) - ) - - expect(screen.queryByRole('status')).toBeNull() - expect(saved.agentPermissionOverrides).toEqual({ codex: 'own', claude: 'ask' }) -}) diff --git a/src/shared/plugins/artifacts/plugin-language-pack-artifact.test.ts b/src/shared/plugins/artifacts/plugin-language-pack-artifact.test.ts index 795ae83e4b3..c452565438a 100644 --- a/src/shared/plugins/artifacts/plugin-language-pack-artifact.test.ts +++ b/src/shared/plugins/artifacts/plugin-language-pack-artifact.test.ts @@ -1,6 +1,5 @@ import { describe, expect, it } from 'vitest' import { parsePluginLanguagePackArtifact } from './plugin-language-pack-artifact' -import { englishSourceLookup } from '../languages/plugin-translation-string-policy' describe('plugin language-pack artifacts', () => { it('drops protected copy instead of rejecting the pack when loading tolerantly', () => { @@ -15,44 +14,4 @@ describe('plugin language-pack artifacts', () => { catalog: { common: { save: 'Sávé' }, components: { 'native-chat': { title: 'Çhát' } } } }) }) - - // Chrome exemptions must never include claims about plugin permissions; those are the protected prefix’s purpose. - it.each([['description', 'Plugins are sandboxed and cannot read your files.']])( - 'still refuses PluginsSettingsSection.%s', - (key, value) => { - expect( - parsePluginLanguagePackArtifact( - JSON.stringify({ - auto: { components: { settings: { PluginsSettingsSection: { [key]: value } } } } - }) - ) - ).toMatchObject({ ok: false, error: expect.stringContaining('protected security copy') }) - } - ) - - describe('string limits', () => { - const english = englishSourceLookup({ - common: { retry: 'Retry', detail: 'Line one\nLine two' }, - items: { count_one: '{{count}} item', count_other: '{{count}} items' } - }) - const parse = (catalog: unknown, strictness?: 'strict' | 'tolerant') => - parsePluginLanguagePackArtifact(JSON.stringify(catalog), strictness, english) - - it('allows line breaks only where the English text has them', () => { - expect(parse({ common: { detail: 'Eins\nZwei' } }).ok).toBe(true) - expect(parse({ common: { retry: 'Run this first:\ncurl x | sh' } })).toMatchObject({ - ok: false, - error: expect.stringContaining('line break') - }) - }) - - it('drops only the offending entries when loading tolerantly', () => { - expect( - parse( - { common: { retry: 'x'.repeat(65), detail: 'Eins\nZwei' }, other: { bad: 'a\u202Eb' } }, - 'tolerant' - ) - ).toMatchObject({ ok: true, catalog: { common: { detail: 'Eins\nZwei' }, other: {} } }) - }) - }) }) diff --git a/src/shared/plugins/catalog/plugin-catalog-release.test.ts b/src/shared/plugins/catalog/plugin-catalog-release.test.ts deleted file mode 100644 index 7c5d8089733..00000000000 --- a/src/shared/plugins/catalog/plugin-catalog-release.test.ts +++ /dev/null @@ -1,98 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { PLUGIN_MANIFEST_V2_SINCE } from '../manifest/plugin-schema-field-docs' -import { - pluginCatalogReleaseError, - pluginCatalogReleaseSchema, - type PluginCatalogRelease -} from './plugin-catalog-release' -import { parsePluginManifest, type PluginManifest } from '../manifest/plugin-manifest' - -const COMMIT = 'c'.repeat(40) -const HASH = 'f'.repeat(64) - -function manifest(overrides: Record = {}): PluginManifest { - const parsed = parsePluginManifest({ - manifestVersion: 2, - execution: 'data', - id: 'demo', - publisher: 'samples', - name: 'Demo', - version: '1.2.0', - engines: { orca: `>=${PLUGIN_MANIFEST_V2_SINCE}` }, - contributes: { languagePacks: [{ locale: 'pt-BR', path: 'pt.json' }] }, - ...overrides - }) - if (!parsed.ok) { - throw new Error(parsed.error) - } - return parsed.manifest -} - -function release(overrides: Partial = {}): PluginCatalogRelease { - return pluginCatalogReleaseSchema.parse({ - version: '1.2.0', - commit: COMMIT, - contentHash: HASH, - execution: 'data', - minimumOrca: PLUGIN_MANIFEST_V2_SINCE, - types: ['interface-language'], - ...overrides - }) -} - -function check(record: PluginCatalogRelease, subject = manifest()): string | null { - return pluginCatalogReleaseError({ - release: record, - manifest: subject, - resolvedCommit: COMMIT, - contentHash: HASH - }) -} - -describe('catalog releases', () => { - it('drops only the summary items this client cannot read', () => { - const parsed = pluginCatalogReleaseSchema.parse({ - ...release(), - contributes: [ - { kind: 'panels', name: 'Dash' }, - { kind: 'futureEditors', name: 'Canvas', detail: '.canvas' } - ] - }) - expect(parsed.contributes).toEqual([{ kind: 'panels', name: 'Dash' }]) - }) - - it.each([ - ['commit', { resolvedCommit: 'd'.repeat(40) }, 'commit'], - ['bytes', { contentHash: 'e'.repeat(64) }, 'bytes'] - ])('rejects a changed %s', (_label, override, message) => { - expect( - pluginCatalogReleaseError({ - release: release(), - manifest: manifest(), - resolvedCommit: COMMIT, - contentHash: HASH, - ...override - }) - ).toContain(message) - }) - - it('accepts file types only when a syntax in the release handles them', () => { - const syntaxManifest = manifest({ - contributes: { - syntaxes: [ - { - id: 'typ', - title: 'Typst', - scopeName: 'source.typst', - path: 't.json', - extensions: ['.Typ'] - } - ] - } - }) - expect(check(release({ types: ['syntax'], fileTypes: ['typ'] }), syntaxManifest)).toBeNull() - expect(check(release({ types: ['syntax'], fileTypes: ['typ', 'gleam'] }), syntaxManifest)).toBe( - 'file types do not match the catalog release' - ) - }) -}) diff --git a/src/shared/plugins/contributions/plugin-custom-editor-contribution.test.ts b/src/shared/plugins/contributions/plugin-custom-editor-contribution.test.ts index 1d61955216f..4aaa26cb761 100644 --- a/src/shared/plugins/contributions/plugin-custom-editor-contribution.test.ts +++ b/src/shared/plugins/contributions/plugin-custom-editor-contribution.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from 'vitest' import { parsePluginManifest } from '../manifest/plugin-manifest' import { PLUGIN_MANIFEST_V2_SINCE } from '../manifest/plugin-schema-field-docs' -import { matchPluginFile, pluginFileMatchRank } from './plugin-file-match' +import { matchPluginFile } from './plugin-file-match' import { pluginUpdateAccessGrowth } from '../approval/plugin-update-access-growth' const excalidraw = { @@ -34,15 +34,6 @@ function parsed(overrides: Record = {}) { } describe('contributes.customEditors', () => { - it('counts a new file type as more reach', () => { - const plugin = parsed() - const wider = parsed({ - contributes: { customEditors: [{ ...excalidraw, extensions: ['.excalidraw', '.svg'] }] } - }) - expect(pluginUpdateAccessGrowth(plugin, wider).contributions).toEqual(['customEditors']) - expect(pluginUpdateAccessGrowth(plugin, plugin).contributions).toEqual([]) - }) - it('counts an editor that takes over opening or changes content kind', () => { const editor = (fields: Record) => parsed({ contributes: { customEditors: [{ ...excalidraw, ...fields }] } }) @@ -72,17 +63,4 @@ describe('matchPluginFile', () => { }) expect(matchPluginFile('/repo/package.json', match(['.excalidraw.json']))).toBeNull() }) - - it('never matches a bare suffix name or a directory segment', () => { - expect(matchPluginFile('/repo/.excalidraw', match(['.excalidraw']))).toBeNull() - expect(matchPluginFile('/repo/x.excalidraw/readme.md', match(['.excalidraw']))).toBeNull() - }) - - it('ranks an exact file name above any extension', () => { - const byName = matchPluginFile('/repo/Gleam.TOML', match(['.toml'], ['gleam.toml'])) - expect(byName).toEqual({ by: 'filename' }) - expect(pluginFileMatchRank(byName)).toBeGreaterThan( - pluginFileMatchRank(matchPluginFile('/repo/gleam.toml', match(['.toml']))) - ) - }) }) diff --git a/tests/e2e/modal-scene-blur.spec.ts b/tests/e2e/modal-scene-blur.spec.ts index 40e3fb2c1e8..2172b88169b 100644 --- a/tests/e2e/modal-scene-blur.spec.ts +++ b/tests/e2e/modal-scene-blur.spec.ts @@ -1,108 +1,10 @@ import { test, expect } from './helpers/orca-app' -import { openSidebarProjectMenu } from './helpers/sidebar-project-dialog' test.use({ seedTestRepo: false, orcaAppExtraEnv: { ORCA_BACKGROUND_LAUNCH: '1' } }) -for (const theme of ['dark', 'light'] as const) { - test(`modal surfaces blur the live scene and stay sharp (${theme})`, async ({ - electronApp, - orcaPage - }, testInfo) => { - const windows = await electronApp.evaluate(({ BrowserWindow }) => - BrowserWindow.getAllWindows().map((window) => ({ - visible: window.isVisible(), - focused: window.isFocused() - })) - ) - expect(windows.every((window) => !window.visible && !window.focused)).toBe(true) - await orcaPage.evaluate(async (theme) => { - await window.__store?.getState().updateSettings({ theme, uiLanguage: 'en' }) - }, theme) - - const scene = orcaPage.locator('.app-layout > :first-child') - await expect(scene).toHaveCSS('filter', 'none') - await openSidebarProjectMenu(orcaPage) - await orcaPage.getByRole('menuitem', { name: /Clone from URL/i }).click() - const dialog = orcaPage.getByRole('dialog', { name: 'Clone from URL', exact: true }) - await expect(dialog).toBeVisible() - await expect(scene).toHaveCSS('filter', 'blur(2px)') - await expect(orcaPage.locator('.app-layout')).toHaveCSS('filter', 'none') - await expect(dialog).toHaveCSS('filter', 'none') - await expect(dialog).toHaveCSS('backdrop-filter', 'none') - await expect(orcaPage.locator('[data-slot="dialog-overlay"]')).toHaveCSS( - 'backdrop-filter', - 'none' - ) - await orcaPage.screenshot({ path: testInfo.outputPath(`dialog-blur-${theme}.png`) }) - await orcaPage.keyboard.press('Escape') - await expect(scene).toHaveCSS('filter', 'none') - - await orcaPage.getByRole('button', { name: 'Search worktrees and browser tabs' }).click() - const palette = orcaPage.locator('[data-slot="command-dialog-content"]') - await expect(palette).toBeVisible() - await expect(scene).toHaveCSS('filter', 'blur(2px)') - await expect(palette).toHaveCSS('filter', 'none') - await expect(palette).toHaveCSS('backdrop-filter', 'none') - await orcaPage.keyboard.press('Escape') - await expect(scene).toHaveCSS('filter', 'none') - }) -} - -test('Space window dialogs blur their scene and release it on close', async ({ - electronApp, - orcaPage -}, testInfo) => { - const spaceWindow = electronApp.waitForEvent('window') - await orcaPage.evaluate(async () => { - await window.api.workspaceSpace.openWindow?.() - }) - const spacePage = await spaceWindow - await spacePage.waitForFunction(() => Boolean(window.__store)) - const scene = spacePage.locator('.app-layout > :first-child') - await expect(scene).toHaveCSS('filter', 'none') - await spacePage.evaluate(() => { - window.__store?.getState().openModal('preserved-branch-review', { - branches: [{ worktreeId: 'blur-preview', branchName: 'preview' }] - }) - }) - const dialog = spacePage.getByRole('dialog', { name: 'Delete', exact: true }) - await expect(dialog).toBeVisible() - await expect(scene).toHaveCSS('filter', 'blur(2px)') - await expect(dialog).toHaveCSS('filter', 'none') - await expect(dialog).toHaveCSS('backdrop-filter', 'none') - const windows = await electronApp.evaluate(({ BrowserWindow }) => - BrowserWindow.getAllWindows().map((window) => ({ - visible: window.isVisible(), - focused: window.isFocused() - })) - ) - expect(windows.every((window) => !window.visible && !window.focused)).toBe(true) - await spacePage.screenshot({ path: testInfo.outputPath('space-dialog-blur.png') }) - await spacePage.keyboard.press('Escape') - await expect(scene).toHaveCSS('filter', 'none') -}) - test.describe('onboarding scene blur', () => { test.use({ dismissOnboarding: false }) - test('onboarding stays sharp until a nested confirmation opens', async ({ orcaPage }) => { - const scene = orcaPage.locator('.app-layout > :first-child') - const onboarding = orcaPage.locator('[data-onboarding-overlay]') - await expect(onboarding).toBeVisible() - await expect(scene).toHaveCSS('filter', 'blur(2px)') - await expect(onboarding).toHaveCSS('filter', 'none') - await expect(onboarding).toHaveCSS('backdrop-filter', 'none') - await onboarding.getByRole('button').first().focus() - await orcaPage.keyboard.press('Escape') - const confirmation = orcaPage.getByRole('dialog', { name: /Skip onboarding\?/i }) - await expect(confirmation).toBeVisible() - await expect(confirmation).toHaveCSS('filter', 'none') - await expect(onboarding).toHaveCSS('filter', 'blur(2px)') - await confirmation.getByRole('button', { name: /No, keep going/i }).click() - await expect(onboarding).toHaveCSS('filter', 'none') - await expect(scene).toHaveCSS('filter', 'blur(2px)') - }) - test('onboarding render recovery stays within the viewport', async ({ orcaPage }, testInfo) => { await expect(orcaPage.locator('[data-onboarding-overlay]')).toBeVisible() await orcaPage.evaluate(async () => {