Files
orca/tests/e2e/runtime-file-browser-windows-drives.spec.ts
afbd98d8a4 Support Windows drives in the remote host filesystem picker (#7439)
* Support Windows drives in the remote host filesystem picker

The remote picker was locked to the system drive on Windows hosts: the
breadcrumb root resolved to C:\ and typed drive paths (M:\dev) were
treated as filter text, so projects could only ever be created on C:.

- Server: answer host-root browses ('/') on win32 with the mounted
  drives instead of resolving to C:\.
- Client: recognize drive-anchored input (M:\, M:/, m:) as path mode,
  resolve segments from the normalized drive root, and make
  joinPath/parentPath/breadcrumbs drive-aware. Up from a drive root
  returns to the host root (the drive list).

Fixes #7438

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Document why joinDrivePath uses a literal backslash

Review feedback suggested path.win32.join, but the renderer bundle
imports no Node builtins anywhere and runs sandboxed, so path.win32 is
not available here. The backslash targets the remote Windows host
regardless of client OS; say so at the call site.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Complete Windows drive browsing over SSH

* fix remote Windows drive browsing

* fix(ui): key remote breadcrumbs by path

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
2026-07-28 20:51:14 -07:00

54 lines
1.8 KiB
TypeScript

import os from 'node:os'
import path from 'node:path'
import { test, expect } from './helpers/orca-app'
import {
createRuntimeDesktopPairingOffer,
launchPairedElectronClient
} from './helpers/paired-electron-client'
import { waitForSessionReady } from './helpers/store'
test.describe('paired runtime Windows file browser', () => {
test.skip(process.platform !== 'win32', 'Windows drive roots require a Windows runtime host')
test('reports the runtime path flavor with Windows drive roots', async ({
orcaPage
}, testInfo) => {
test.setTimeout(120_000)
await waitForSessionReady(orcaPage)
const offer = await createRuntimeDesktopPairingOffer(orcaPage)
const client = await launchPairedElectronClient(offer, testInfo, 'Windows drive browser')
try {
const driveRoot = path.parse(os.tmpdir()).root.toUpperCase()
const listing = await client.page.evaluate(async () => {
const [environment] = await window.api.runtimeEnvironments.list()
if (!environment) {
throw new Error('Paired client runtime environment is unavailable')
}
const response = await window.api.runtimeEnvironments.call({
selector: environment.id,
method: 'files.browseServerDir',
params: { path: '/' },
timeoutMs: 15_000
})
if (!response.ok) {
throw new Error(response.error.message)
}
return response.result as {
pathFlavor: string
entries: { name: string; isDirectory: boolean }[]
}
})
expect(listing.pathFlavor).toBe('win32')
expect(listing.entries).toContainEqual({
name: driveRoot,
isDirectory: true,
isSymlink: false
})
} finally {
await client.dispose()
}
})
})