Files
orca/tests/e2e/golden-source-control-open-diff.spec.ts
T
6012570996 feat(files): reveal Source Control files and terminal file links in the file manager (#24502)
* feat(reveal): reveal changed files and terminal file links

Reveal only existed on file explorer rows. Every reveal menu now shares
one action, so a missing file or a remote workspace behaves the same
in all of them.

Fixes #24003

* fix(reveal): address review findings on missing links and SSH files

A hovered hyperlink to a missing file saved "missing" in the cache plain
path links trust, hiding the path once the file existed. A tab holding an
SSH file from outside its workspace still offered reveal.

* fix(reveal): drop reveal from check-details tabs

Their path is a synthetic id, so reveal could only fail.

* fix(reveal): use scoped file access for directory checks

* fix(reveal): retire superseded Spanish menu labels

* test: preserve explicit file access and untranslated-locale contracts

* refactor(terminal): reveal a file link from its click popover, not the right-click menu

The terminal "Reveal in Finder" action now lives in the file-link popover
(the one with "Open file" and "Open with default app"), as a row with no
click shortcut. It goes through the shared reveal, so a folder link (including
a macOS .app or .xcodeproj bundle) is selected in its parent and never opened.

The row is omitted, not disabled, when the file is not on this machine: an
SSH or runtime-owned file, a pane whose shell runs on another host, or while a
remote runtime is focused. Workspace-root links keep their own "Open in
Finder"/"Open folder" row and get no reveal row.

Removes the right-click path: the context-menu item, the hovered-link tracking
and its OSC 8 / path-existence probe refactors, the directory stat (and its
user-named file-access grant, which only served the open-a-folder behaviour),
and the right-click e2e case. Terminal files the PR touched are back to main
apart from the popover row.

Co-authored-by: Kelvin Amoaba <97001695+AmoabaKelvin@users.noreply.github.com>

* test(terminal): type the reveal settings fixture without assertion

* test(startup): account for encoded Windows prompt lines

* test(compatibility): retain the released journal parser dependency

* test(journal): retain one canonical provider-handle import

* fix(terminal): give the popover's Reveal in Finder row the reveal icon

Every other Reveal in Finder item shows the external-link icon; the link
popover draws it for rows that open outside Orca, so mark the row that way.

---------

Co-authored-by: Neil <4138956+nwparker@users.noreply.github.com>
Co-authored-by: Brennan Benson <79079362+brennanb2025@users.noreply.github.com>
2026-10-05 20:10:31 -07:00

78 lines
2.7 KiB
TypeScript

import { realpathSync } from 'node:fs'
import path from 'node:path'
import { test, expect } from './helpers/orca-app'
import {
cleanupGoldenWorktree,
createGoldenWorktree,
GOLDEN_ADDED_LINE,
GOLDEN_CHANGED_PATH,
GOLDEN_REMOVED_LINE,
openGoldenSourceControl,
seedGoldenSourceEdit
} from './helpers/golden-source-control'
import { waitForSessionReady } from './helpers/store'
test('@golden opens an unstaged file diff from Source Control', async ({
orcaPage,
testRepoPath,
registerPostElectronShutdownCleanup
}) => {
const fixture = createGoldenWorktree(testRepoPath, 'open-diff')
registerPostElectronShutdownCleanup(async () => cleanupGoldenWorktree(testRepoPath, fixture))
seedGoldenSourceEdit(fixture.worktreePath)
await waitForSessionReady(orcaPage)
await openGoldenSourceControl(orcaPage, testRepoPath, fixture)
const changedFile = orcaPage
.locator('[data-testid="source-control-entry"]')
.filter({ hasText: path.basename(GOLDEN_CHANGED_PATH) })
await expect(changedFile).toBeVisible({ timeout: 15_000 })
await changedFile.click()
await expect(orcaPage.locator('.monaco-diff-editor')).toBeVisible({ timeout: 20_000 })
await expect(
orcaPage
.locator('.original-in-monaco-diff-editor .view-line')
.filter({ hasText: GOLDEN_REMOVED_LINE })
).toBeVisible()
await expect(
orcaPage
.locator('.modified-in-monaco-diff-editor .view-line')
.filter({ hasText: GOLDEN_ADDED_LINE })
).toBeVisible()
await expect(orcaPage.locator('.editor-header-path').first()).toHaveAttribute(
'title',
`${realpathSync(path.join(fixture.worktreePath, GOLDEN_CHANGED_PATH)).replaceAll('\\', '/')} (diff)`
)
const probe = orcaPage.getByRole('button', { name: /Source Control/ })
await probe.focus()
await expect(probe).toBeFocused()
})
test('@golden offers to reveal a changed file in the OS file manager from its Source Control row', async ({
orcaPage,
testRepoPath,
registerPostElectronShutdownCleanup
}) => {
const fixture = createGoldenWorktree(testRepoPath, 'reveal-row')
registerPostElectronShutdownCleanup(async () => cleanupGoldenWorktree(testRepoPath, fixture))
seedGoldenSourceEdit(fixture.worktreePath)
await waitForSessionReady(orcaPage)
await openGoldenSourceControl(orcaPage, testRepoPath, fixture)
const changedFile = orcaPage
.locator('[data-testid="source-control-entry"]')
.filter({ hasText: path.basename(GOLDEN_CHANGED_PATH) })
await expect(changedFile).toBeVisible({ timeout: 15_000 })
await changedFile.click({ button: 'right' })
await expect(
orcaPage.getByRole('menuitem', {
name: /Reveal in Finder|Reveal in File Explorer|Open Containing Folder/
})
).toBeEnabled()
})