mirror of
https://github.com/stablyai/orca.git
synced 2026-11-16 19:07:41 +00:00
test: remove nine low-value renderer and preview suites (#43025)
Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
This commit is contained in:
@@ -4871,7 +4871,6 @@
|
||||
"tests/e2e/dictation-indicator.spec.ts": 14900,
|
||||
"tests/e2e/diff-note-delete.spec.ts": 18700,
|
||||
"tests/e2e/diff-note-edit.spec.ts": 20900,
|
||||
"tests/e2e/diff-note-layout.spec.ts": 24900,
|
||||
"tests/e2e/droid-notification.spec.ts": 65000,
|
||||
"tests/e2e/editable-context-paste-ownership.spec.ts": 15700,
|
||||
"tests/e2e/electron-home-isolation.spec.ts": 12800,
|
||||
|
||||
@@ -33,7 +33,6 @@ export const PR_EDITOR_PREVIEW_E2E_SOURCE_ROUTES = [
|
||||
// Image, PDF and media viewers read orca-media grants; the PDF reloads exercise remint and range reads.
|
||||
id: 'editor.byte-range-preview',
|
||||
specs: [
|
||||
'tests/e2e/editor-media-playback-position.spec.ts',
|
||||
'tests/e2e/media-preview-partition-isolation.spec.ts',
|
||||
'tests/e2e/paired-remote-large-file-open.spec.ts',
|
||||
'tests/e2e/pdf-find-counter.spec.ts',
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
|
||||
vi.mock('@/i18n/ui-intl-formatters', () => ({
|
||||
languageDisplayName: (locale: string, display: string) => `${locale}@${display}`
|
||||
}))
|
||||
|
||||
import { deviceLanguageOffer } from './device-language-offer'
|
||||
import type { CatalogLanguagePack } from './language-pack-options'
|
||||
import type { PluginLanguagePackRegistration } from '../../../../shared/plugins/artifacts/plugin-language-pack-artifact'
|
||||
|
||||
const installedPack = (locale: string): PluginLanguagePackRegistration => ({
|
||||
id: `plugin:ebbop.orca-${locale}/${locale}`,
|
||||
resourceLanguage: locale,
|
||||
pluginKey: `ebbop.orca-${locale}`,
|
||||
locale,
|
||||
catalog: {},
|
||||
coverage: 94
|
||||
})
|
||||
|
||||
const catalogPack = (locale: string): CatalogLanguagePack =>
|
||||
// oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: the offer reads only id, locale and listing.pluginKey.
|
||||
({
|
||||
id: `plugin:other.orca-${locale}/${locale}`,
|
||||
locale,
|
||||
listing: { pluginKey: `other.orca-${locale}` }
|
||||
}) as CatalogLanguagePack
|
||||
|
||||
describe('deviceLanguageOffer', () => {
|
||||
it('offers to install a catalog pack that matches the device', () => {
|
||||
const offer = deviceLanguageOffer([], [catalogPack('it')], 'it-IT')
|
||||
expect(offer).toMatchObject({
|
||||
locale: 'it',
|
||||
installed: null,
|
||||
name: 'it@it',
|
||||
englishName: 'it@en'
|
||||
})
|
||||
expect(offer?.catalog?.id).toBe('plugin:other.orca-it/it')
|
||||
})
|
||||
|
||||
it('offers to switch to an installed match instead of installing another copy', () => {
|
||||
const offer = deviceLanguageOffer([installedPack('it')], [catalogPack('it')], 'it-IT')
|
||||
expect(offer?.installed?.id).toBe('plugin:ebbop.orca-it/it')
|
||||
expect(offer?.catalog).toBeNull()
|
||||
})
|
||||
|
||||
it('returns null when nothing matches the device', () => {
|
||||
expect(deviceLanguageOffer([installedPack('vi')], [catalogPack('uk')], 'it-IT')).toBeNull()
|
||||
expect(deviceLanguageOffer([installedPack('it')], [], null)).toBeNull()
|
||||
})
|
||||
})
|
||||
@@ -1,24 +0,0 @@
|
||||
import { expect, it } from 'vitest'
|
||||
import { recommendedLanguagePack } from './language-pack-options'
|
||||
|
||||
it('prefers a regional translation over an earlier generic pack', () => {
|
||||
const packs = [
|
||||
{ locale: 'pt', id: 'generic' },
|
||||
{ locale: 'pt-PT', id: 'portugal' }
|
||||
]
|
||||
expect(recommendedLanguagePack(packs, 'pt_PT.UTF-8')?.id).toBe('portugal')
|
||||
})
|
||||
|
||||
it('does not recommend the wrong writing system when a device specifies a script', () => {
|
||||
const packs = [
|
||||
{ locale: 'sr-Cyrl', id: 'cyrillic' },
|
||||
{ locale: 'sr-Latn', id: 'latin' }
|
||||
]
|
||||
expect(recommendedLanguagePack(packs, 'sr_RS@latin')?.id).toBe('latin')
|
||||
expect(recommendedLanguagePack([{ locale: 'zh-Hans' }], 'zh-TW')).toBeUndefined()
|
||||
})
|
||||
|
||||
it('does not turn an unknown system locale into a language recommendation', () => {
|
||||
expect(recommendedLanguagePack([{ locale: 'en' }], 'C')).toBeUndefined()
|
||||
expect(recommendedLanguagePack([{ locale: 'vi-VN' }], null)).toBeUndefined()
|
||||
})
|
||||
@@ -1,71 +0,0 @@
|
||||
// @vitest-environment happy-dom
|
||||
import { afterEach, expect, it, vi } from 'vitest'
|
||||
import { getDefaultSettings } from '../../../../shared/constants'
|
||||
import { useAppStore } from '@/store'
|
||||
import { loadRendererUiLanguage } from '@/i18n/i18n'
|
||||
import { selectUiLanguage } from './language-selection'
|
||||
|
||||
vi.mock('@/i18n/i18n', () => ({ loadRendererUiLanguage: vi.fn(), translate: vi.fn() }))
|
||||
|
||||
afterEach(() => {
|
||||
useAppStore.setState(useAppStore.getInitialState(), true)
|
||||
vi.clearAllMocks()
|
||||
})
|
||||
|
||||
function deferred() {
|
||||
let resolve = (): void => {}
|
||||
const promise = new Promise<void>((done) => {
|
||||
resolve = done
|
||||
})
|
||||
return { promise, resolve }
|
||||
}
|
||||
|
||||
it('preserves the latest choice when an earlier save completes during its catalog download', async () => {
|
||||
const savingJapanese = deferred()
|
||||
const finishJapanese = deferred()
|
||||
const frenchCatalog = deferred()
|
||||
vi.mocked(loadRendererUiLanguage).mockImplementation(async (language) => {
|
||||
if (language === 'fr') {
|
||||
await frenchCatalog.promise
|
||||
}
|
||||
return language === 'fr' ? 'fr' : 'ja'
|
||||
})
|
||||
useAppStore.setState({
|
||||
settings: { ...getDefaultSettings('/tmp'), uiLanguage: 'en' },
|
||||
updateSettingsOrThrow: async (updates) => {
|
||||
if (updates.uiLanguage === 'ja') {
|
||||
savingJapanese.resolve()
|
||||
await finishJapanese.promise
|
||||
}
|
||||
useAppStore.setState((state) => ({ settings: { ...state.settings!, ...updates } }))
|
||||
}
|
||||
})
|
||||
const japanese = selectUiLanguage('ja')
|
||||
await savingJapanese.promise
|
||||
const french = selectUiLanguage('fr')
|
||||
finishJapanese.resolve()
|
||||
await japanese
|
||||
frenchCatalog.resolve()
|
||||
await french
|
||||
expect(useAppStore.getState().settings?.uiLanguage).toBe('fr')
|
||||
})
|
||||
|
||||
it('keeps the saved language when the picker closes before its catalog arrives', async () => {
|
||||
const catalog = deferred()
|
||||
let pickerOpen = true
|
||||
vi.mocked(loadRendererUiLanguage).mockImplementation(async () => {
|
||||
await catalog.promise
|
||||
return 'fr'
|
||||
})
|
||||
useAppStore.setState({
|
||||
settings: { ...getDefaultSettings('/tmp'), uiLanguage: 'en' },
|
||||
updateSettingsOrThrow: async (updates) => {
|
||||
useAppStore.setState((state) => ({ settings: { ...state.settings!, ...updates } }))
|
||||
}
|
||||
})
|
||||
const changing = selectUiLanguage('fr', () => pickerOpen)
|
||||
pickerOpen = false
|
||||
catalog.resolve()
|
||||
await changing
|
||||
expect(useAppStore.getState().settings?.uiLanguage).toBe('en')
|
||||
})
|
||||
@@ -1,37 +0,0 @@
|
||||
import { beforeEach, describe, expect, it } from 'vitest'
|
||||
import type { PluginUpdateReviewNotice } from '../../../../../shared/plugins/catalog/plugin-update-policy'
|
||||
import {
|
||||
announcePluginUpdateReviews,
|
||||
resolvePluginUpdateReviews,
|
||||
usePluginUpdateReviewNoticesStore
|
||||
} from './plugin-update-review-toast'
|
||||
|
||||
const notice = (id: string, version: string): PluginUpdateReviewNotice => ({
|
||||
pluginKey: `acme.${id}`,
|
||||
name: id,
|
||||
publisher: 'acme',
|
||||
version,
|
||||
reason: 'access'
|
||||
})
|
||||
const shown = (): string[] =>
|
||||
usePluginUpdateReviewNoticesStore
|
||||
.getState()
|
||||
.notices.map((item) => `${item.pluginKey}@${item.version}`)
|
||||
|
||||
describe('held update notices', () => {
|
||||
beforeEach(() => usePluginUpdateReviewNoticesStore.setState({ notices: [] }))
|
||||
|
||||
it('joins a later batch to the open one, a newer version replacing the older', () => {
|
||||
announcePluginUpdateReviews([notice('dusk', '2.0.0'), notice('dawn', '1.1.0')])
|
||||
announcePluginUpdateReviews([notice('dusk', '3.0.0')])
|
||||
expect(shown()).toEqual(['acme.dawn@1.1.0', 'acme.dusk@3.0.0'])
|
||||
})
|
||||
|
||||
it('drops only what was handled, keeping a notice that arrived meanwhile', () => {
|
||||
const handled = [notice('dusk', '2.0.0'), notice('dawn', '1.1.0')]
|
||||
announcePluginUpdateReviews(handled)
|
||||
announcePluginUpdateReviews([notice('dusk', '3.0.0'), notice('noon', '0.2.0')])
|
||||
resolvePluginUpdateReviews(handled)
|
||||
expect(shown()).toEqual(['acme.dusk@3.0.0', 'acme.noon@0.2.0'])
|
||||
})
|
||||
})
|
||||
@@ -1,136 +0,0 @@
|
||||
import type { Page, TestInfo } from '@stablyai/playwright-test'
|
||||
import { expect, test } from './helpers/orca-app'
|
||||
import { waitForActiveWorktree, waitForSessionReady } from './helpers/store'
|
||||
|
||||
const NOTE_LINE = 6
|
||||
const INITIAL_ZONE_HEIGHT = 88
|
||||
const FOLLOWING_LINE = 'export const line07 = "following-line-marker"'
|
||||
const NOTE_BODY =
|
||||
'This saved note is intentionally one long paragraph so it wraps across several visual lines in narrow and wide diff layouts without adding newline characters to the initial zone estimate.'
|
||||
|
||||
async function assertCardClearsFollowingLine(page: Page): Promise<void> {
|
||||
const card = page.locator('.orca-diff-comment-card').first()
|
||||
const followingLine = page
|
||||
.locator('.modified-in-monaco-diff-editor .view-lines .view-line')
|
||||
.filter({ hasText: FOLLOWING_LINE })
|
||||
.first()
|
||||
|
||||
await expect(card).toBeVisible({ timeout: 15_000 })
|
||||
await expect(followingLine).toBeVisible({ timeout: 15_000 })
|
||||
await expect
|
||||
.poll(async () => (await card.boundingBox())?.height ?? 0)
|
||||
.toBeGreaterThan(INITIAL_ZONE_HEIGHT)
|
||||
await expect
|
||||
.poll(
|
||||
async () => {
|
||||
const [cardBox, lineBox] = await Promise.all([
|
||||
card.boundingBox(),
|
||||
followingLine.boundingBox()
|
||||
])
|
||||
return cardBox && lineBox ? lineBox.y - (cardBox.y + cardBox.height) : -1
|
||||
},
|
||||
{ message: 'saved note overlaps the following diff line' }
|
||||
)
|
||||
.toBeGreaterThanOrEqual(0)
|
||||
}
|
||||
|
||||
async function attachDiffScreenshot(page: Page, testInfo: TestInfo, name: string): Promise<void> {
|
||||
const diff = page.locator('.monaco-diff-editor').first()
|
||||
const screenshotPath = testInfo.outputPath(`${name}.png`)
|
||||
await diff.screenshot({ path: screenshotPath })
|
||||
await testInfo.attach(name, { path: screenshotPath, contentType: 'image/png' })
|
||||
}
|
||||
|
||||
test.describe('Diff note layout', () => {
|
||||
test.beforeEach(async ({ orcaPage }) => {
|
||||
await waitForSessionReady(orcaPage)
|
||||
await waitForActiveWorktree(orcaPage)
|
||||
})
|
||||
|
||||
test('saved notes reserve their rendered height in both diff layouts', async ({
|
||||
orcaPage
|
||||
}, testInfo) => {
|
||||
await orcaPage.setViewportSize({ width: 1200, height: 800 })
|
||||
const worktreeId = await waitForActiveWorktree(orcaPage)
|
||||
const relativePath = await orcaPage.evaluate(async (wId) => {
|
||||
const store = window.__store
|
||||
if (!store) {
|
||||
throw new Error('window.__store is not available')
|
||||
}
|
||||
const state = store.getState()
|
||||
const worktree = Object.values(state.worktreesByRepo)
|
||||
.flat()
|
||||
.find((entry) => entry.id === wId)
|
||||
if (!worktree) {
|
||||
throw new Error('active worktree not found')
|
||||
}
|
||||
const separator = worktree.path.includes('\\') ? '\\' : '/'
|
||||
const relative = `src${separator}diff-note-layout.ts`
|
||||
const lines = Array.from({ length: 14 }, (_, index) => {
|
||||
const number = String(index + 1).padStart(2, '0')
|
||||
const value = index + 1 === 7 ? 'following-line-marker' : `value-${number}`
|
||||
return `export const line${number} = "${value}"`
|
||||
})
|
||||
await window.api.fs.writeFile({
|
||||
filePath: `${worktree.path}${separator}${relative}`,
|
||||
content: `${lines.join('\n')}\n`
|
||||
})
|
||||
await state.updateSettings({ diffDefaultView: 'side-by-side' })
|
||||
return relative
|
||||
}, worktreeId)
|
||||
|
||||
const added = await orcaPage.evaluate(
|
||||
({ wId, filePath, lineNumber, body }) =>
|
||||
// The seeded worktree is this app's own (local) copy.
|
||||
window.__store?.getState().addDiffComment(
|
||||
{
|
||||
kind: 'worktree',
|
||||
worktreeId: wId,
|
||||
authority: { endpoint: { kind: 'self' }, at: 'local' }
|
||||
},
|
||||
{
|
||||
worktreeId: wId,
|
||||
filePath,
|
||||
source: 'diff',
|
||||
lineNumber,
|
||||
body,
|
||||
side: 'modified'
|
||||
}
|
||||
),
|
||||
{ wId: worktreeId, filePath: relativePath, lineNumber: NOTE_LINE, body: NOTE_BODY }
|
||||
)
|
||||
expect(added, 'addDiffComment returned null').not.toBeNull()
|
||||
|
||||
await orcaPage.evaluate(
|
||||
({ wId, filePath }) => {
|
||||
const state = window.__store?.getState()
|
||||
const worktree = Object.values(state?.worktreesByRepo ?? {})
|
||||
.flat()
|
||||
.find((entry) => entry.id === wId)
|
||||
if (!state || !worktree) {
|
||||
throw new Error('active worktree not found')
|
||||
}
|
||||
const separator = worktree.path.includes('\\') ? '\\' : '/'
|
||||
state.openDiff(
|
||||
wId,
|
||||
`${worktree.path}${separator}${filePath}`,
|
||||
filePath,
|
||||
'typescript',
|
||||
false
|
||||
)
|
||||
},
|
||||
{ wId: worktreeId, filePath: relativePath }
|
||||
)
|
||||
|
||||
await expect(orcaPage.locator('button:has(svg.lucide-rows-2)')).toBeVisible()
|
||||
await assertCardClearsFollowingLine(orcaPage)
|
||||
await attachDiffScreenshot(orcaPage, testInfo, 'side-by-side-diff-note-layout')
|
||||
|
||||
await orcaPage.evaluate(() =>
|
||||
window.__store?.getState().updateSettings({ diffDefaultView: 'inline' })
|
||||
)
|
||||
await expect(orcaPage.locator('button:has(svg.lucide-columns-2)')).toBeVisible()
|
||||
await assertCardClearsFollowingLine(orcaPage)
|
||||
await attachDiffScreenshot(orcaPage, testInfo, 'inline-diff-note-layout')
|
||||
})
|
||||
})
|
||||
@@ -1,89 +0,0 @@
|
||||
import { copyFileSync, mkdtempSync, realpathSync, rmSync, writeFileSync } from 'node:fs'
|
||||
import { tmpdir } from 'node:os'
|
||||
import path from 'node:path'
|
||||
import { test, expect } from './helpers/orca-app'
|
||||
import { openFileExplorer } from './helpers/file-explorer'
|
||||
import { waitForSessionReady } from './helpers/store'
|
||||
|
||||
test.use({ seedTestRepo: false })
|
||||
|
||||
test('restores media playback after switching editor tabs without retaining the player', async ({
|
||||
orcaPage,
|
||||
registerPostElectronShutdownCleanup
|
||||
}) => {
|
||||
const folder = realpathSync(mkdtempSync(path.join(tmpdir(), 'orca-media-position-')))
|
||||
registerPostElectronShutdownCleanup(async () => rmSync(folder, { recursive: true, force: true }))
|
||||
copyFileSync(
|
||||
path.resolve('docs/site/public/docs/videos/tab-split.mp4'),
|
||||
path.join(folder, 'playback.mp4')
|
||||
)
|
||||
writeFileSync(path.join(folder, 'other.txt'), 'Switch back to the media tab.\n')
|
||||
|
||||
await waitForSessionReady(orcaPage)
|
||||
await orcaPage.evaluate(async (folder) => {
|
||||
await window.__store?.getState().addRepoPath(folder, 'folder')
|
||||
}, folder)
|
||||
await orcaPage
|
||||
.getByRole('option')
|
||||
.filter({ hasText: path.basename(folder) })
|
||||
.click()
|
||||
await openFileExplorer(orcaPage)
|
||||
const row = (name: string) =>
|
||||
orcaPage.locator('[data-file-explorer-row]').filter({
|
||||
has: orcaPage.getByText(name, { exact: true })
|
||||
})
|
||||
await row('playback.mp4').dblclick()
|
||||
const video = orcaPage.locator('video')
|
||||
await expect
|
||||
.poll(() => video.evaluate((media: HTMLVideoElement) => media.readyState))
|
||||
.toBeGreaterThanOrEqual(2)
|
||||
await video.evaluate(async (media: HTMLVideoElement) => {
|
||||
media.muted = true
|
||||
media.currentTime = 1
|
||||
await media.play()
|
||||
})
|
||||
await expect
|
||||
.poll(() => video.evaluate((media: HTMLVideoElement) => media.currentTime))
|
||||
.toBeGreaterThan(1.1)
|
||||
const savedTime = await video.evaluate((media: HTMLVideoElement) => {
|
||||
media.pause()
|
||||
return media.currentTime
|
||||
})
|
||||
const previousPlayer = await video.elementHandle()
|
||||
if (!previousPlayer) {
|
||||
throw new Error('Media player disappeared before switching tabs')
|
||||
}
|
||||
|
||||
await row('other.txt').dblclick()
|
||||
await expect(video).toHaveCount(0)
|
||||
expect(
|
||||
await previousPlayer.evaluate((media: HTMLVideoElement) => ({
|
||||
connected: media.isConnected,
|
||||
paused: media.paused,
|
||||
source: media.getAttribute('src')
|
||||
}))
|
||||
).toEqual({ connected: false, paused: true, source: null })
|
||||
|
||||
await orcaPage.locator('[data-tab-id]').filter({ hasText: 'playback.mp4' }).click()
|
||||
await expect
|
||||
.poll(() => video.evaluate((media: HTMLVideoElement) => media.readyState))
|
||||
.toBeGreaterThanOrEqual(2)
|
||||
expect(await video.evaluate((media: HTMLVideoElement) => media.currentTime)).toBeCloseTo(
|
||||
savedTime,
|
||||
1
|
||||
)
|
||||
expect(
|
||||
await video.evaluate((media: HTMLVideoElement) => ({
|
||||
paused: media.paused,
|
||||
controls: media.controls
|
||||
}))
|
||||
).toEqual({
|
||||
paused: true,
|
||||
controls: true
|
||||
})
|
||||
await video.evaluate((media: HTMLVideoElement) => media.play())
|
||||
await expect
|
||||
.poll(() => video.evaluate((media: HTMLVideoElement) => media.currentTime))
|
||||
.toBeGreaterThan(savedTime + 0.1)
|
||||
await video.evaluate((media: HTMLVideoElement) => media.pause())
|
||||
})
|
||||
@@ -1,127 +0,0 @@
|
||||
import type { Page } from '@stablyai/playwright-test'
|
||||
import type { JiraIssue } from '../../src/shared/jira/jira-types'
|
||||
import { expect, test } from './helpers/orca-app'
|
||||
import { waitForSessionReady } from './helpers/store'
|
||||
|
||||
const ISSUE_TITLE = 'Keep planning notes visible while switching between project tasks'
|
||||
const ISSUE: JiraIssue = {
|
||||
id: 'layout-fixture',
|
||||
key: 'DEMO-101',
|
||||
siteId: 'layout-site',
|
||||
title: ISSUE_TITLE,
|
||||
url: 'https://example.atlassian.net/browse/DEMO-101',
|
||||
project: { id: 'layout-project', key: 'DEMO', name: 'Demo' },
|
||||
issueType: { id: 'task', name: 'Task' },
|
||||
status: { id: 'open', name: 'To Do', categoryKey: 'new', categoryName: 'To Do' },
|
||||
labels: [],
|
||||
parent: { key: 'DEMO-10', title: 'Epic planning' },
|
||||
sprint: 'Sprint 12',
|
||||
storyPoints: 5,
|
||||
originalEstimateSeconds: 7200,
|
||||
remainingEstimateSeconds: 1800,
|
||||
priority: { id: 'high', name: 'High' },
|
||||
assignee: { accountId: 'layout-user', displayName: 'Demo User' },
|
||||
createdAt: '2026-10-01T00:00:00Z',
|
||||
updatedAt: '2026-10-13T00:00:00Z'
|
||||
}
|
||||
|
||||
async function openFixtureJiraList(page: Page): Promise<void> {
|
||||
await waitForSessionReady(page)
|
||||
await page.setViewportSize({ width: 1500, height: 900 })
|
||||
await page.evaluate((issue) => {
|
||||
const store = window.__store
|
||||
if (!store) {
|
||||
throw new Error('Store unavailable')
|
||||
}
|
||||
const state = store.getState()
|
||||
if (!state.settings) {
|
||||
throw new Error('Settings unavailable')
|
||||
}
|
||||
const status = {
|
||||
connected: true,
|
||||
viewer: null,
|
||||
selectedSiteId: 'layout-site',
|
||||
sites: [
|
||||
{
|
||||
id: 'layout-site',
|
||||
siteUrl: 'https://example.atlassian.net',
|
||||
email: '',
|
||||
displayName: 'Demo Jira',
|
||||
accountId: 'layout-user'
|
||||
}
|
||||
]
|
||||
}
|
||||
store.setState({
|
||||
settings: { ...state.settings, defaultTaskSource: 'jira', visibleTaskProviders: ['jira'] },
|
||||
jiraStatus: status,
|
||||
jiraStatusChecked: true,
|
||||
jiraStatusContextKey: 'local#0',
|
||||
checkJiraConnection: async () => {},
|
||||
readJiraStatus: async () => status,
|
||||
listJiraIssues: async () => [issue],
|
||||
searchJiraIssues: async () => [issue]
|
||||
})
|
||||
store.getState().openTaskPage({ taskSource: 'jira' })
|
||||
}, ISSUE)
|
||||
}
|
||||
|
||||
test('Jira planning columns persist and hiding a sorted field selects a visible fallback', async ({
|
||||
orcaPage
|
||||
}) => {
|
||||
await openFixtureJiraList(orcaPage)
|
||||
const title = orcaPage.getByRole('heading', { name: ISSUE_TITLE })
|
||||
await expect(title).toBeVisible()
|
||||
await title.evaluate((element) => {
|
||||
const host =
|
||||
element.closest('[role="button"]')?.parentElement?.parentElement?.parentElement?.parentElement
|
||||
?.parentElement
|
||||
if (!(host instanceof HTMLElement)) {
|
||||
throw new Error('Jira list host unavailable')
|
||||
}
|
||||
host.style.width = '780px'
|
||||
})
|
||||
await orcaPage.getByRole('button', { name: 'Columns', exact: true }).click()
|
||||
for (const name of ['Parent', 'Sprint', 'Points', 'Estimate', 'Remaining']) {
|
||||
await orcaPage.getByRole('menuitemcheckbox', { name, exact: true }).click()
|
||||
}
|
||||
await orcaPage.keyboard.press('Escape')
|
||||
await expect(orcaPage.getByText('Epic planning', { exact: true })).toBeVisible()
|
||||
await expect(orcaPage.getByText('Sprint 12', { exact: true })).toBeVisible()
|
||||
await expect(orcaPage.getByText('2h', { exact: true })).toBeVisible()
|
||||
await expect(orcaPage.getByText('30m', { exact: true })).toBeVisible()
|
||||
const layout = await title.evaluate((element) => {
|
||||
const row = element.closest('[role="button"]')
|
||||
const scroll = row?.parentElement?.parentElement?.parentElement?.parentElement
|
||||
if (!(scroll instanceof HTMLElement)) {
|
||||
throw new Error('Scroll container unavailable')
|
||||
}
|
||||
return {
|
||||
title: element.getBoundingClientRect().width,
|
||||
content: scroll.scrollWidth,
|
||||
viewport: scroll.clientWidth
|
||||
}
|
||||
})
|
||||
expect(layout.title).toBeGreaterThanOrEqual(180)
|
||||
expect(layout.content).toBeGreaterThan(layout.viewport)
|
||||
await orcaPage.getByRole('button', { name: 'Points', exact: true }).click()
|
||||
await expect(orcaPage.getByRole('button', { name: 'Points, ascending' })).toHaveAttribute(
|
||||
'aria-pressed',
|
||||
'true'
|
||||
)
|
||||
await orcaPage.getByRole('button', { name: 'Columns', exact: true }).click()
|
||||
await orcaPage.getByRole('menuitemcheckbox', { name: 'Points', exact: true }).click()
|
||||
await orcaPage.keyboard.press('Escape')
|
||||
await expect(orcaPage.getByRole('button', { name: 'Updated, descending' })).toHaveAttribute(
|
||||
'aria-pressed',
|
||||
'true'
|
||||
)
|
||||
await orcaPage.reload()
|
||||
await openFixtureJiraList(orcaPage)
|
||||
await orcaPage.getByRole('button', { name: 'Columns', exact: true }).click()
|
||||
await expect(
|
||||
orcaPage.getByRole('menuitemcheckbox', { name: 'Sprint', exact: true })
|
||||
).toHaveAttribute('aria-checked', 'true')
|
||||
await expect(
|
||||
orcaPage.getByRole('menuitemcheckbox', { name: 'Points', exact: true })
|
||||
).toHaveAttribute('aria-checked', 'false')
|
||||
})
|
||||
@@ -1,81 +0,0 @@
|
||||
import { mkdtempSync, rmSync } from 'node:fs'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { expect, test } from './helpers/orca-app'
|
||||
import { makeResourceManagerFixtureVisible } from './helpers/resource-manager-visible-fixture'
|
||||
import { waitForSessionReady } from './helpers/store'
|
||||
import { createRestartSession } from './helpers/orca-restart'
|
||||
|
||||
test.use({ seedTestRepo: false })
|
||||
|
||||
test('names a folder terminal recovered from the daemon after restart without an open tab', async (// oxlint-disable-next-line no-empty-pattern -- Playwright requires destructuring to request no fixtures.
|
||||
{}, testInfo) => {
|
||||
const root = mkdtempSync(join(tmpdir(), 'orca-recovered-folder-'))
|
||||
const session = createRestartSession(testInfo)
|
||||
let launched: Awaited<ReturnType<typeof session.launch>> | undefined
|
||||
try {
|
||||
launched = await session.launch()
|
||||
await waitForSessionReady(launched.page)
|
||||
await launched.page.evaluate(async (folderPath) => {
|
||||
const state = window.__store!.getState()
|
||||
await state.updateSettingsOrThrow({ theme: 'dark' })
|
||||
const group = await window.api.projectGroups.create({
|
||||
name: 'Documentation',
|
||||
parentPath: folderPath,
|
||||
createdFrom: 'folder-scan'
|
||||
})
|
||||
await state.fetchProjectGroups({ runtimeEnvironmentId: null, throwOnError: true })
|
||||
if (!group) {
|
||||
throw new Error('Could not create project group')
|
||||
}
|
||||
const folder = await state.createFolderWorkspace(
|
||||
{
|
||||
projectGroupId: group.id,
|
||||
name: 'Recovered notes',
|
||||
folderPath
|
||||
},
|
||||
{ runtimeEnvironmentId: null }
|
||||
)
|
||||
if (!folder) {
|
||||
throw new Error('Could not create folder workspace')
|
||||
}
|
||||
await window.api.pty.spawn({
|
||||
cols: 80,
|
||||
rows: 24,
|
||||
cwd: folderPath,
|
||||
worktreeId: `folder:${folder.folderWorkspace.id}`,
|
||||
initiallyHidden: true
|
||||
})
|
||||
}, root)
|
||||
await session.close(launched.app)
|
||||
launched = await session.launch()
|
||||
const page = launched.page
|
||||
await waitForSessionReady(page)
|
||||
await page.setViewportSize({ width: 1200, height: 900 })
|
||||
await makeResourceManagerFixtureVisible(launched.app, page)
|
||||
await page.getByRole('button', { name: /^Resource Manager,/ }).click()
|
||||
const popover = page.getByRole('dialog')
|
||||
await expect(popover.getByText('Resource Manager', { exact: true })).toBeVisible()
|
||||
try {
|
||||
await expect(
|
||||
popover.getByRole('button', { name: 'Resume workspace Recovered notes', exact: true })
|
||||
).toBeVisible()
|
||||
await expect(popover.getByText(/^pid \d+$/)).toBeVisible()
|
||||
await expect(popover).not.toContainText('Unattributed')
|
||||
await expect(popover).not.toContainText('folder:')
|
||||
} finally {
|
||||
const screenshot = testInfo.outputPath('resource-manager-recovered-folder.png')
|
||||
await page.screenshot({ path: screenshot, animations: 'disabled' })
|
||||
await testInfo.attach('resource-manager-recovered-folder', {
|
||||
path: screenshot,
|
||||
contentType: 'image/png'
|
||||
})
|
||||
}
|
||||
} finally {
|
||||
if (launched) {
|
||||
await session.close(launched.app)
|
||||
}
|
||||
await session.dispose()
|
||||
rmSync(root, { recursive: true, force: true })
|
||||
}
|
||||
})
|
||||
@@ -1,84 +0,0 @@
|
||||
import { deflateSync } from 'node:zlib'
|
||||
import { z } from 'zod'
|
||||
import { test, expect } from './helpers/orca-app'
|
||||
import { SIDEBAR_INPUTS_BUILD } from './helpers/sidebar-inputs-build'
|
||||
import { waitForActiveWorktree, waitForSessionReady } from './helpers/store'
|
||||
import { repoIconId } from '../../src/main/runtime/sidebar-inputs/repo-icons/repo-icon-data-urls'
|
||||
import { readRasterImageDimensions } from '../../src/shared/file-preview/raster-image-dimensions'
|
||||
|
||||
test.skip(
|
||||
!SIDEBAR_INPUTS_BUILD,
|
||||
'main publishes sidebar inputs only in an ORCA_SIDEBAR_INPUTS=main build'
|
||||
)
|
||||
|
||||
const ReplySchema = z.object({
|
||||
icons: z.array(z.object({ id: z.string(), dataUrl: z.string().nullable() }))
|
||||
})
|
||||
|
||||
function crc32(bytes: Buffer): number {
|
||||
let crc = ~0
|
||||
for (const byte of bytes) {
|
||||
crc ^= byte
|
||||
for (let bit = 0; bit < 8; bit += 1) {
|
||||
crc = crc & 1 ? 0xedb88320 ^ (crc >>> 1) : crc >>> 1
|
||||
}
|
||||
}
|
||||
return ~crc >>> 0
|
||||
}
|
||||
|
||||
function pngChunk(type: string, data: Buffer): Buffer {
|
||||
const body = Buffer.concat([Buffer.from(type, 'ascii'), data])
|
||||
const length = Buffer.alloc(4)
|
||||
length.writeUInt32BE(data.length)
|
||||
const crc = Buffer.alloc(4)
|
||||
crc.writeUInt32BE(crc32(body))
|
||||
return Buffer.concat([length, body, crc])
|
||||
}
|
||||
|
||||
/** A real, decodable solid-colour RGB PNG. */
|
||||
function solidPng(edge: number): string {
|
||||
const header = Buffer.alloc(13)
|
||||
header.writeUInt32BE(edge, 0)
|
||||
header.writeUInt32BE(edge, 4)
|
||||
header[8] = 8
|
||||
header[9] = 2
|
||||
const row = Buffer.concat([Buffer.from([0]), Buffer.alloc(edge * 3, 0x80)])
|
||||
const png = Buffer.concat([
|
||||
Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]),
|
||||
pngChunk('IHDR', header),
|
||||
pngChunk('IDAT', deflateSync(Buffer.concat(Array.from({ length: edge }, () => row)))),
|
||||
pngChunk('IEND', Buffer.alloc(0))
|
||||
])
|
||||
return `data:image/png;base64,${png.toString('base64')}`
|
||||
}
|
||||
|
||||
test('main re-encodes a 128 px repo upload as a 64 px PNG data URL', async ({ orcaPage }) => {
|
||||
await waitForSessionReady(orcaPage)
|
||||
await waitForActiveWorktree(orcaPage)
|
||||
const icon = { type: 'image' as const, src: solidPng(128), source: 'upload' as const }
|
||||
|
||||
await orcaPage.evaluate(async (repoIcon) => {
|
||||
const [repo] = await window.api.repos.list()
|
||||
await window.api.repos.update({ repoId: repo.id, updates: { repoIcon } })
|
||||
}, icon)
|
||||
|
||||
const id = repoIconId(icon)
|
||||
expect(id).not.toBeNull()
|
||||
const response = await orcaPage.evaluate(
|
||||
(ids) => window.api.runtime.call({ method: 'sidebarInputs.repoIcons', params: { ids } }),
|
||||
[id, 'unknown']
|
||||
)
|
||||
if (!response.ok) {
|
||||
throw new Error('sidebarInputs.repoIcons failed')
|
||||
}
|
||||
const { icons } = ReplySchema.parse(response.result)
|
||||
|
||||
expect(icons.map((entry) => entry.id)).toEqual([id, 'unknown'])
|
||||
expect(icons[1].dataUrl).toBeNull()
|
||||
const encoded = icons[0].dataUrl?.match(/^data:image\/png;base64,(.+)$/)?.[1]
|
||||
expect(encoded).toBeDefined()
|
||||
expect(readRasterImageDimensions(Buffer.from(encoded ?? '', 'base64'))).toEqual({
|
||||
width: 64,
|
||||
height: 64
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user