mirror of
https://github.com/stablyai/orca.git
synced 2026-11-17 11:24:37 +00:00
test: remove low-value onboarding, editor and plugin cases (#42344)
Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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.`
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -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 <selector>',
|
||||
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'
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
+3
-41
@@ -49,6 +49,9 @@ describe('ImageViewer app zoom ownership', () => {
|
||||
</EditorCommandOwnerContext>
|
||||
)
|
||||
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(
|
||||
<EditorCommandOwnerContext value={true}>
|
||||
<ImageViewer
|
||||
src="orca-media://file/t?revision=1"
|
||||
filePath="/repo/shot.png"
|
||||
mimeType="image/png"
|
||||
/>
|
||||
</EditorCommandOwnerContext>
|
||||
)
|
||||
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) => (
|
||||
<EditorCommandOwnerContext value={true}>
|
||||
<ImageViewer
|
||||
src={`orca-media://file/t?revision=${revision}`}
|
||||
filePath="/repo/shot.png"
|
||||
mimeType="image/png"
|
||||
/>
|
||||
</EditorCommandOwnerContext>
|
||||
)
|
||||
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()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -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(<OnboardingLanguageLoading />)
|
||||
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()
|
||||
}
|
||||
})
|
||||
@@ -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(<OnboardingLanguageSwitcher open={false} onOpenChange={vi.fn()} />)
|
||||
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(<OnboardingLanguageSwitcher open={false} onOpenChange={vi.fn()} />)
|
||||
expect(screen.queryByRole('button', { name: 'Switch language' })).toBeNull()
|
||||
|
||||
useLanguageReadiness.setState({ error: true })
|
||||
rerender(<OnboardingLanguageSwitcher open={false} onOpenChange={vi.fn()} />)
|
||||
expect(screen.getByRole('button', { name: 'Switch language' })).toBeTruthy()
|
||||
})
|
||||
})
|
||||
@@ -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<GlobalSettings>) => {
|
||||
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(<YoloPermissionsControl yoloPermissions={false} />)
|
||||
|
||||
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' })
|
||||
})
|
||||
@@ -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: {} } })
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -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<string, unknown> = {}): 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> = {}): 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'
|
||||
)
|
||||
})
|
||||
})
|
||||
@@ -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<string, unknown> = {}) {
|
||||
}
|
||||
|
||||
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<string, unknown>) =>
|
||||
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'])))
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -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 () => {
|
||||
|
||||
Reference in New Issue
Block a user