|
|
@@ -23,7 +23,7 @@ import {
|
|
|
launchWebScaffold, recordFixture, watchConsole, webSnapshotMode, type WebScaffold,
|
|
|
} from './scaffold.ts'
|
|
|
import {
|
|
|
- connectFreshWorkspace, newEnglishPage, saveFailureShot, writeComposerDraft,
|
|
|
+ connectFreshWorkspace, newEnglishPage, saveFailureShot, writeComposerDraft, ZH_BROWSER_LOCALE,
|
|
|
} from './support.ts'
|
|
|
|
|
|
const SNAPSHOT_DIR = fileURLToPath(new URL('../../../snapshots/web/lifecycle-chrome', import.meta.url))
|
|
|
@@ -31,6 +31,7 @@ const FIXTURE = join(SNAPSHOT_DIR, 'session.v2.jsonl')
|
|
|
const REPLAY_OVERRIDE = join(SNAPSHOT_DIR, 'replay.override.json')
|
|
|
const HERO_EXPECTED = join(SNAPSHOT_DIR, 'hero.expected.md')
|
|
|
const COMMAND_MENU_EXPECTED = join(SNAPSHOT_DIR, 'command-menu.expected.md')
|
|
|
+const COMMAND_MENU_ZH_EXPECTED = join(SNAPSHOT_DIR, 'command-menu-zh.expected.md')
|
|
|
const FUZZY_COMMAND_MENU_EXPECTED = join(SNAPSHOT_DIR, 'command-menu-fuzzy.expected.md')
|
|
|
const PLAN_ACTIVE_EXPECTED = join(SNAPSHOT_DIR, 'plan-active.expected.md')
|
|
|
const CONNECTION_ERROR_EXPECTED = join(SNAPSHOT_DIR, 'connection-error.expected.md')
|
|
|
@@ -103,6 +104,26 @@ describe('web e2e: lifecycle & chrome (workspace flow / reload / dark mode)', ()
|
|
|
await expect.poll(() => menu.count()).toBe(0)
|
|
|
})
|
|
|
|
|
|
+ it.skipIf(MODE === 'record')('localizes slash-command descriptions from the browser language', async () => {
|
|
|
+ const zhPage = await browser.newPage({ viewport: { width: 1680, height: 1000 }, locale: ZH_BROWSER_LOCALE })
|
|
|
+ const zhTripwire = watchConsole(zhPage)
|
|
|
+ onTestFailed(() => saveFailureShot(zhPage, 'web-e2e-command-menu-zh'))
|
|
|
+ try {
|
|
|
+ await zhPage.goto(scaffold.authenticatedUrl, { waitUntil: 'load' })
|
|
|
+ await zhPage.waitForSelector('[class*="frame"]', { timeout: 30_000 })
|
|
|
+ const launcher = zhPage.getByRole('button', { name: '指令' })
|
|
|
+ await launcher.click()
|
|
|
+ const menu = zhPage.getByRole('listbox', { name: '触发候选建议' })
|
|
|
+ await menu.waitFor({ timeout: 10_000 })
|
|
|
+ const snapshot = await captureStableAria(zhPage, '[role="listbox"]', scaffold.workspaceCwd)
|
|
|
+ await compareOrRefreshGolden(COMMAND_MENU_ZH_EXPECTED, snapshot, MODE)
|
|
|
+ expect(zhTripwire.pageErrors).toEqual([])
|
|
|
+ expect(zhTripwire.warnings).toEqual([])
|
|
|
+ } finally {
|
|
|
+ await zhPage.close()
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
it.skipIf(MODE === 'record')('shows active Plan as the warn-state status action', async () => {
|
|
|
const activeScaffold = await launchWebScaffold()
|
|
|
const activePage = await newEnglishPage(browser)
|
|
|
@@ -415,7 +436,8 @@ describe('web e2e: lifecycle & chrome (workspace flow / reload / dark mode)', ()
|
|
|
expect(tripwire.warnings).toEqual([])
|
|
|
await assertFixtureInventory(SNAPSHOT_DIR, [
|
|
|
'session.v2.jsonl', 'replay.override.json', 'command-menu.expected.md',
|
|
|
- 'command-menu-fuzzy.expected.md', 'connection-error.expected.md', 'hero.expected.md', 'plan-active.expected.md',
|
|
|
+ 'command-menu-fuzzy.expected.md', 'command-menu-zh.expected.md', 'connection-error.expected.md',
|
|
|
+ 'hero.expected.md', 'plan-active.expected.md',
|
|
|
'reloaded.expected.md', 'reloaded-expanded.expected.md',
|
|
|
])
|
|
|
})
|