test: align mount fixtures and isolate upstream reference checks

This commit is contained in:
hairyf committed 2026-10-13 22:42:37 +08:00
1 parent 228b753ad2
commit 1685e10d01
6 files changed
+31 -24

No files matched your search

+1
View File
@@ -21,6 +21,7 @@ export default tseslint.config(
'test-results/',
'node_modules/',
'.worktrees/',
'soruce/vscode/', // Pinned upstream reference checkout, not plugin source.
],
},
+2 -2
View File
@@ -7,7 +7,7 @@
* Every lane consumes the same contract:
* - `PAGE_URL` / `pageUrl({...})` for page.goto (the token URL performs the
* browser's token→cookie exchange),
* - `sidebarApi(path)` for the plugin's own public routes,
* - `sidebarApi(path)` for the plugin's own authenticated routes,
* - `createHostApi()` for an APIRequestContext carrying the auth cookie,
* - `hostRpc(api, 'workspace.create', {...})` for the host's unary RPC.
*/
@@ -36,7 +36,7 @@ export function pageUrl(extra: Record<string, string>): string {
return pageUrlWith(RAW_URL, extra)
}
/** Absolute URL for the plugin's own (public, unauthenticated) API route. */
/** Absolute URL for the plugin API; native Connection admission requires authentication. */
export function sidebarApi(path: string): string {
return `${ORIGIN}/sidebar/api/${path}`
}
+3 -3
View File
@@ -888,10 +888,10 @@ test('a shell-stamped render URL mounts normally; plugin chrome carries the stab
expect(regions.layerChild, 'panels stay no-drag so their controls keep receiving clicks').toBe('no-drag')
})
test('the custom-CSS escape hatch injects the user stylesheet live', async ({ request, page }) => {
test('the custom-CSS escape hatch injects the user stylesheet live', async ({ page }) => {
// The one setting the removed scheme row really owned: user-space CSS. It
// has no scheme gate any more — a non-empty customCss is always applied.
const update = await request.post(sidebarApi('settings.update'), {
const update = await api.post(sidebarApi('settings.update'), {
data: { patch: { customCss: 'html { --dsh-e2e-marker: 1; }' } },
})
expect(update.ok(), `settings.update: ${update.status()}`).toBe(true)
@@ -903,6 +903,6 @@ test('the custom-CSS escape hatch injects the user stylesheet live', async ({ re
const marker = await page.evaluate(() => getComputedStyle(document.documentElement).getPropertyValue('--dsh-e2e-marker').trim())
expect(marker).toBe('1')
} finally {
await request.post(sidebarApi('settings.update'), { data: { patch: { customCss: '' } } })
await api.post(sidebarApi('settings.update'), { data: { patch: { customCss: '' } } })
}
})
+18 -18
View File
@@ -17,7 +17,7 @@
import { appendFileSync, existsSync, mkdirSync, realpathSync, writeFileSync } from 'node:fs'
import { execFileSync } from 'node:child_process'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { basename, join } from 'node:path'
import { test, expect, type APIRequestContext, type Page } from '@playwright/test'
import { PAGE_URL, createHostApi, hostRpc, sendFirstMessage } from './host'
@@ -344,27 +344,27 @@ test('the explorer keeps its state across a tab switch and a conversation round
await expect(page.locator(GUIDE)).toBeVisible({ timeout: 30_000 })
await page.locator('[data-sidebar-right-panel]:visible [data-sidebar-right-guide-entry="git"]').click()
const commitBox = page.locator('[data-sidebar-right-panel]:visible')
.getByRole('textbox', { name: /Commit message/i }).first()
.locator('[data-message-box] textarea').first()
await expect(commitBox, 'the changes tab must render its commit box').toBeVisible({ timeout: 30_000 })
await commitBox.fill(COMMIT_MSG)
await expect(commitBox).toHaveValue(COMMIT_MSG)
// ── A CHOSEN WORKTREE (the third painted-state loss #712 covered) ─────────
// The lane's linked checkout is the non-auto choice: picking it must survive
// the round trip, not be re-derived from the inventory. Paths are compared
// through `realpathSync` because macOS /var is a symlink to /private/var and
// git reports the resolved form.
// the round trip, not be re-derived from the inventory. Match the menu's
// branch/path-leaf label; `realpathSync` follows Git's canonical path.
const linkedPath = realpathSync(join(WORKSPACE_PATH, 'linked-checkout'))
const worktreeSelect = page.locator('[data-sidebar-right-panel]:visible select')
.filter({ has: page.locator('option') }).first()
await expect(worktreeSelect, 'the changes tab must offer its worktree selector').toBeVisible({ timeout: 30_000 })
const linkedOption = await worktreeSelect.locator('option').evaluateAll(
(options, path) => options.some(option => (option as HTMLOptionElement).value === path),
linkedPath,
)
expect(linkedOption, 'the linked worktree must appear in the selector').toBe(true)
await worktreeSelect.selectOption(linkedPath)
await expect(worktreeSelect).toHaveValue(linkedPath)
await page.locator('[data-sidebar-right-panel]:visible').getByRole('button', { name: 'More Actions', exact: true }).click()
await page.getByRole('menuitem', { name: 'Worktree', exact: true }).click()
const linkedOption = page.getByRole('menuitem', { name: `lane-linked · ${basename(linkedPath)}` })
await expect(linkedOption, 'the linked worktree must appear in the menu').toBeVisible({ timeout: 30_000 })
await linkedOption.click()
await expect(page.locator('[data-sidebar-right-panel]:visible [data-git-footer]'), 'the linked checkout must be selected')
.toContainText('lane-linked', { timeout: 30_000 })
// Drafts are checkout-scoped: the primary draft must not leak into linked.
await expect(commitBox).toHaveValue('')
await commitBox.fill(COMMIT_MSG)
await expect(commitBox).toHaveValue(COMMIT_MSG)
// Back to the Files window and RE-BUILD the scroll offset: opening the file
// swapped this tab's content, so the tree remounted at the top (by design,
@@ -414,16 +414,16 @@ test('the explorer keeps its state across a tab switch and a conversation round
await expect(changesTab, 'the changes tab survives the round trip').toHaveCount(1, { timeout: 30_000 })
await changesTab.first().click()
const backCommitBox = page.locator('[data-sidebar-right-panel]:visible')
.getByRole('textbox', { name: /Commit message/i }).first()
.locator('[data-message-box] textarea').first()
await expect(backCommitBox, 'the changes tab still renders its commit box').toBeVisible({ timeout: 30_000 })
await expect(
backCommitBox,
'an unsaved commit message survives the conversation round trip',
).toHaveValue(COMMIT_MSG)
await expect(
page.locator('[data-sidebar-right-panel]:visible select').first(),
page.locator('[data-sidebar-right-panel]:visible [data-git-footer]'),
'the chosen worktree survives the conversation round trip',
).toHaveValue(linkedPath)
).toContainText('lane-linked', { timeout: 30_000 })
// And the tree's own tab is still there too.
await expect(
page.locator('[data-sidebar-right-panel]:visible [role="tab"]').filter({ hasText: /Files|文件/ }),
+6 -1
View File
@@ -3,7 +3,8 @@
* catalog walking, workflow run attachment + member re-parenting, team
* enrichment, and the per-parent settled-leaf fold.
*/
import { describe, expect, it } from 'vitest'
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
import { attachLocale } from '../src/client/locales.ts'
import {
buildTasksModel,
tasksEdges,
@@ -510,6 +511,10 @@ describe('buildTasksModel: duplicate workflow members', () => {
})
describe('shared task status rule (taskBlocked / taskStatusLabel / taskTone)', () => {
// These assertions use English, regardless of the runner's browser/OS locale.
beforeEach(() => { attachLocale({ getSnapshot: () => ({ active: 'en' }) }) })
afterEach(() => { attachLocale(undefined) })
const facts = (status: 'pending' | 'in_progress' | 'completed', ready: boolean) => ({ status, ready })
it('calls a queued task with an open blocker blocked', () => {
+1
View File
@@ -46,6 +46,7 @@ export default defineConfig({
// node_modules/dist/etc. excludes must be restated here.
exclude: [
'tests/e2e/**',
'soruce/vscode/**', // Pinned upstream reference, not this plugin's tests.
// Local dev worktrees (pnpm/DSH-style task branches) may carry stale
// code against this checkout's node_modules — never collect them.
'**/.worktrees/**',