mirror of
https://github.com/deepseek-ai/deepseek-harness
synced 2026-08-15 21:04:50 +00:00
apps/web/tests/README.md records why these e2e type-check in the Host aggregate and why importing a Client package there pulls its project tree into the Host build graph, with mirroring as the standing answer. The Agent Note drops the directory-picker face split (assessed and declined) and the grep-level gate in favour of that README. docs: regenerate the catalogs and retarget the moved declarations The forwarded-event change moved three owner packages' cordis `Events` declarations and their branded types into client-safe `./types` modules, and the settings-scope split moves the shell spec into ui-settings-general. Point the type-equivalence manifest and the affected Agent Note at those homes, register the new `remote/*` event scope and the `ctx.settingsScope` service in the catalog partition, and re-run the generators. `$on` joins the documented `TypeRTClientRemote` surface, and the two Agent Note fences that quote a bare member signature are marked `ignore-check`: they are declaration fragments, not compilable units. refactor(client): make ui-settings the settings domain's base layer The settings-namespace transport lived in client/runtime, where every feature could value-import it because runtime is a platform module. It belongs to the settings domain, but moving it into ui-settings as a shared function fails twice: the client bundle purity gate forbids cross-plugin value imports, and ui-settings reached ui-sidebar for its shell, so any feature depending on it closed a cycle through ui-layout and ui-theme. Both halves move. `ctx.settingsScope` is now a cordis service — the collaboration shape the purity gate prescribes, and the service proxy binds `this.ctx` to the caller, so a bound scope's disposer belongs to the calling fiber. The shell ui-settings used to own (the `sidebar.settings` occupant, its navigation, and the nav-row projection) moves to ui-settings-general, which already owns the chrome and the General section. What stays in ui-settings is what carries no `ui-*` dependency: the scope service and the canonical settings slot types, `settings.general.item` included. That type was parked in the locale package precisely because the declarer was unreachable without a cycle; every registrant now depends on this base layer, so it comes home. The scope CONTRACT stays in client/runtime: a feature service accepts a scope through its own signature without depending on the surface that binds it. The forwarded settings invalidation replaces the deleted client-side `settings/changed` event, so the transport reads `ctx.remote.$on`. It reaches `$on` through the gateway's Client half plus the allowlist's type-only subpath rather than api-remotes' Client face: that face imports a Host-tsdown-generated artifact, and this package is reachable from the Host build graph through its callers. refactor(client): reach the settings transport through ctx.settingsScope Every feature that owns a preference row switches from value-importing a shared binder to the settings domain's service, and declares the two injections that binding needs: `settingsScope` for the transport and `remote` for the forwarded invalidation it subscribes to on the caller's own context. The rows stay with the features that own the preferences — Language with locale, Appearance with ui-theme, Composer Enter with ui-conversation. Only their route to the transport changes, so no settings surface moves and no feature gains a dependency on the shell. The `settings.general.item` slot type now arrives from ui-settings, the base layer every registrant already depends on, which retires the re-export outlet ui-theme kept and the parked declaration in the locale package. client/runtime drops its settings-form and schemastery dependencies with the transport that used them. test(client): bind the settings transport in the specs that boot a preference row Every bench that activates a plugin owning a preference row now supplies the two services that plugin injects: the forwarded-event port and the scope service. Specs that exercise no settings path get the minimal doubles; the ones that do drive their refresh chains through `remote/host-event`, the same signal client/runtime republishes from a forwarded frame, replacing the deleted client-side `settings/changed` event. Also fixes a publication defect the built-invariant gate catches once it runs: api-remotes' invariant companion shared the allowlist module with the package index, so rolldown hoisted it into a third chunk beside the two bundled entries — a file the mechanically derived publication list does not carry, leaving an installed companion unable to import it. The companion now reads the allowlist through this package's own published `./types` subpath, which the bundle keeps external, so each entry stays self-contained. The dynamic-subscription cast in apiproxy is gone: after the vendored cordis rescope, `on` accepts the rest-parameter handler directly, and the allowlist's shape assertion still carries the safety argument. fix(client): carry the settings-scope move across the release manifests Rebasing onto the publishable release set replaced every manifest's dependency block, so the packages this change touches restate their additions in the workspace-protocol form: the base layer's own transport dependencies, and the `ui-settings` plus `remote` edges each preference-row owner now needs. ui-settings-general takes clsx with the shell it received, and client/runtime drops the settings-form and schemastery dependencies that left with the transport. fix(api-gateway): give each $on subscription its own registration and containment Two defects in the forwarded-event subscription table, both raised in review: A set keyed on listener identity stored one entry when two callers subscribed the same function object to the same event, so the first frame reached it once instead of twice and either disposer silenced the surviving registration. Subscriptions are now records addressed by registration, which is what "the disposer belongs to the calling fiber" requires. A listener declared void may still be `async`, and the synchronous `try/catch` could not see its rejection: the promise was dropped and surfaced as an unhandled rejection outside the documented containment. Delivery now attaches a rejection handler when a listener returns a promise, so both failure modes are logged and isolated alike. Delivery also iterates a snapshot, so a listener that subscribes or disposes during a frame no longer changes who receives that frame, and production matches the TestRemote double instead of relying on live Set iteration order. Both fixes are pinned by tests that fail against the previous implementation. The double gains its own spec for the `$mount` refusal and the unsubscribed-name drop — per-file coverage reaches it — plus a note that it propagates a throwing listener where production contains one, so no spec mistakes it for the containment guarantee. Three prose corrections: `assertJsonArgs` states where its throw actually surfaces (the emitter's listener containment, not load or emit time), the browser e2e README names every standing Client import rather than claiming one exception, and two comments and a test title state the forwarded event instead of the deleted client-side one. refactor(remote): deliver forwarded frames through ctx.remote.$dispatch The carrier used to relay each decoded frame over an internal `remote/host-event` cordis event so the delivery port could stay off the Remote contract. The relay was the wrong shape twice over: it put a client-face event into a scan whose subject is the Host vocabulary, forcing a walk exemption for something that is not a Host event at all, and it made a direct handoff between two Client plugins look like a broadcast any plugin participates in. `TypeRTClientRemote` now carries both roles of one surface — consumers subscribe with `$on`, and whoever owns the Host frame sink hands frames over with `$dispatch` — so client/runtime calls the Remote service directly and the event declaration is gone. A cordis service method is the collaboration shape the client bundle purity gate prescribes, and it needs no relay to satisfy it. The trade is that the handoff is now developer-visible: any plugin holding `ctx.remote` can synthesize a forwarded event. That is the exposure the relay already had — `ctx.emit` was equally reachable — stated in the contract instead of hidden behind a private subscriber. runtime reaches `ctx.remote` through the gateway's Client face rather than api-remotes': that face imports a Host-tsdown-generated artifact, and this project sits in the Host build graph. refactor(api-remotes): keep the allowlist value out of types.ts `src/types.ts` carries only types by package convention, but it held the forwarded-event array, so the type-only subpath published runtime code. The array moves to `src/remote-events.ts` and `types.ts` derives its projection from it; both compiler faces list both files, so the Host forwarding loop and the consumer key face still read one declaration and the package's exports are unchanged. The invariant companion returns to an empty installer. Its dispatch-shape check was the only reason the companion imported the allowlist, which made the two bundled entries share a module: rolldown hoisted it into a third chunk that the mechanically derived publication list does not carry, so an installed companion could not import it. Dropping the check retires that coupling along with the subpath-import and bundle-external workarounds it needed, and the shape the check enforced at runtime is the part the Host face's `TypeRTForwardableEvent` assertion already refuses at compile time. test(ui-task): bind the locale plugin's new injections in its bench The bench boots the real locale plugin, which now injects the settings-scope service and the forwarded-event port, so it stayed pending and left `ctx.locale` undefined. Supplies both doubles like the other benches that boot a plugin owning a preference row. docs: close the documentation gates for the forwarded-event surface Regenerates the two graph catalogs and re-records every bilingual pair this branch edited. Several pairs needed real work beyond the record: - The generators write only the English side, so the Chinese sides of `event-producer-consumer` and `module-graph` had drifted: the former still listed the three deleted client-face events and pointed at declaration sites this branch moved into `types.ts` modules, and the latter carried a stale dependency graph. - `TypeRTClientRemote`'s documented declaration gains `$dispatch` on both sides. - The pairing contract requires both sides to link the same target, so the apiproxy README and the design note now link the English note from both languages, and the note's code blocks are byte-identical across the pair (a translated comment inside a fence counts as divergence). - `apps/web/tests/README.md` gains its Chinese counterpart; the browser e2e lane documents a discipline reviewers apply, so it belongs in the bilingual corpus rather than in the pairing exemption list. - Four fences in the design note are marked `ignore-check`: each quotes a member signature, a union arm, or a snippet that names symbols it does not import, so none is a compilable unit. docs(agent-note): transition the forwarded-event note to implemented The design shipped in this PR, so the pair moves into `implemented/` and takes that folder's skeleton: `## Proposal` becomes a present-tense `## Decision`, and `## Acceptance criteria` plus `## Risks` fold into `## Verification` (what pins the behavior) and `## Consequences` (what the shipped shape costs). Facts that moved after the proposal are corrected rather than preserved: the allowlist value now lives in `remote-events.ts` beside a type-only `types.ts`, the delivery port is `$dispatch` rather than an internal cordis event, and the invariant companion is an explained empty installer. `Verification` states the two `$on` defects the review found — independent registration identity and async-rejection containment — since those are now the properties tests pin. Supersession is partial, so five active notes stay active and gain a cross-link each: `web-config-plane`, `web-client-session-scope`, `config-plane-boundaries`, `versioned-gui-welcome-onboarding`, and `permission-default-for-new-sessions` each described a frame this change replaced. Only the mechanism sentence is annotated; every conclusion those notes own is untouched, and `host/models-changed` remains apiproxy's own derived frame in all of them. Also pins the disposer's idempotence: calling one `$on` disposer twice must not splice a surviving twin registration out from under its owner. fix: docs fix: test
271 lines
14 KiB
TypeScript
271 lines
14 KiB
TypeScript
// Keyless browser e2e: the shipped DeepSeek adapter stays mounted while its
|
|
// credential is absent, onboarding routes to the real Models editor, and its
|
|
// write lands in an isolated harness home without a reload or model call.
|
|
import { randomBytes } from 'node:crypto'
|
|
import { readFile } from 'node:fs/promises'
|
|
import { fileURLToPath } from 'node:url'
|
|
import { join } from 'node:path'
|
|
import type { Browser, Page } from 'playwright'
|
|
import { chromium } from 'playwright'
|
|
import { afterAll, beforeAll, describe, expect, it, onTestFailed } from 'vitest'
|
|
import {
|
|
acknowledgeReloadConnectionLoss, assertFixtureInventory, captureStableAria, compareOrRefreshGolden,
|
|
WELCOME_NOTICE_SETTINGS_NAMESPACE, WELCOME_NOTICE_ACK_FIELD,
|
|
WELCOME_NOTICE_VERSION, WELCOME_NOTICE_COPY,
|
|
launchWebScaffold, watchConsole, webSnapshotMode, type WebScaffold,
|
|
} from './scaffold.ts'
|
|
import { ZH_BROWSER_LOCALE, connectFreshWorkspaceZh, saveFailureShot } from './support.ts'
|
|
import { settingsNamespace } from '@deepseek-ai/dsh-settings'
|
|
|
|
const SNAPSHOT_DIR = fileURLToPath(new URL('./snapshots/onboarding-deepseek-config', import.meta.url))
|
|
const WELCOME_EXPECTED = join(SNAPSHOT_DIR, 'welcome.expected.md')
|
|
const MISSING_EXPECTED = join(SNAPSHOT_DIR, 'missing.expected.md')
|
|
const MODELS_EXPECTED = join(SNAPSHOT_DIR, 'models.expected.md')
|
|
const MODE = webSnapshotMode()
|
|
|
|
describe.skipIf(MODE === 'record')('web e2e: first-run DeepSeek credential setup', () => {
|
|
let scaffold: WebScaffold
|
|
let browser: Browser
|
|
let page: Page
|
|
let tripwire: ReturnType<typeof watchConsole>
|
|
const browserConsole: string[] = []
|
|
|
|
beforeAll(async () => {
|
|
scaffold = await launchWebScaffold({ deepSeekMissingCredential: true, welcomeNoticePending: true })
|
|
browser = await chromium.launch()
|
|
// The scenario asserts the shipped Chinese copy, so the browser asks for it.
|
|
page = await browser.newPage({ viewport: { width: 1440, height: 960 }, locale: ZH_BROWSER_LOCALE })
|
|
tripwire = watchConsole(page)
|
|
page.on('console', message => browserConsole.push(message.text()))
|
|
await page.goto(scaffold.baseUrl, { waitUntil: 'load' })
|
|
await page.waitForSelector('[class*="frame"]', { timeout: 30_000 })
|
|
}, 120_000)
|
|
|
|
afterAll(async () => {
|
|
await browser?.close()
|
|
await scaffold?.close()
|
|
})
|
|
|
|
it('stores a key write-only and observes configured state without restarting', async () => {
|
|
onTestFailed(() => saveFailureShot(page, 'web-e2e-onboarding-deepseek-config'))
|
|
const welcome = page.getByRole('region', { name: WELCOME_NOTICE_COPY.zh.title })
|
|
await welcome.waitFor({ timeout: 15_000 })
|
|
expect(await page.locator('#root').evaluate(root => (root as HTMLElement).inert)).toBe(true)
|
|
const welcomeAria = await captureStableAria(page, '[role="region"]', scaffold.workspaceCwd)
|
|
await compareOrRefreshGolden(WELCOME_EXPECTED, welcomeAria, MODE)
|
|
expect(await welcome.getByRole('button').allTextContents()).toEqual([WELCOME_NOTICE_COPY.zh.continueLabel])
|
|
expect(await welcome.locator('button').count()).toBe(1)
|
|
|
|
const mask = page.locator('[class*="onboardingMask"]')
|
|
expect(await mask.count()).toBe(1)
|
|
const maskStyles = await mask.evaluate((mask) => {
|
|
const style = getComputedStyle(mask)
|
|
const rect = mask.getBoundingClientRect()
|
|
return {
|
|
position: style.position,
|
|
left: style.left,
|
|
right: style.right,
|
|
top: style.top,
|
|
bottom: style.bottom,
|
|
background: style.backgroundColor,
|
|
backdropFilter: style.backdropFilter,
|
|
rect: { left: rect.left, top: rect.top, right: rect.right, bottom: rect.bottom },
|
|
}
|
|
})
|
|
expect(maskStyles).toEqual({
|
|
position: 'absolute',
|
|
left: '0px',
|
|
right: '0px',
|
|
top: '80px',
|
|
bottom: '0px',
|
|
background: 'rgba(0, 0, 0, 0.24)',
|
|
backdropFilter: 'blur(2px)',
|
|
rect: { left: 0, top: 80, right: 1440, bottom: 960 },
|
|
})
|
|
|
|
// Closing the process/page before acknowledgement writes nothing, so the
|
|
// same durable profile presents the notice again after reload.
|
|
const firstReloadWarnings = tripwire.warnings.length
|
|
await page.reload({ waitUntil: 'load' })
|
|
acknowledgeReloadConnectionLoss(tripwire, firstReloadWarnings)
|
|
await welcome.waitFor({ timeout: 15_000 })
|
|
|
|
await welcome.getByRole('button', { name: WELCOME_NOTICE_COPY.zh.continueLabel }).click()
|
|
await welcome.waitFor({ state: 'detached', timeout: 15_000 })
|
|
const credentialStep = page.getByRole('region', { name: '添加一个 API Key 开始使用' })
|
|
await credentialStep.waitFor({ timeout: 15_000 })
|
|
expect(await credentialStep.getByRole('textbox').count()).toBe(0)
|
|
const initial = await captureStableAria(page, '[role="region"]', scaffold.workspaceCwd)
|
|
await compareOrRefreshGolden(MISSING_EXPECTED, initial, MODE)
|
|
|
|
await credentialStep.getByRole('button', { name: '前往配置' }).click()
|
|
await credentialStep.waitFor({ state: 'detached', timeout: 15_000 })
|
|
const settings = page.getByRole('dialog', { name: '设置' })
|
|
await settings.waitFor({ timeout: 10_000 })
|
|
expect(await page.locator('#root').evaluate(root => (root as HTMLElement).inert)).toBe(false)
|
|
const keyInput = settings.getByLabel('API 密钥', { exact: true })
|
|
await keyInput.waitFor({ timeout: 10_000 })
|
|
|
|
const secret = `dsh_onboarding_${randomBytes(12).toString('hex')}`
|
|
await keyInput.fill(secret)
|
|
await settings.getByRole('button', { name: '保存', exact: true }).click()
|
|
await keyInput.waitFor({ state: 'detached', timeout: 15_000 })
|
|
|
|
const stored = await readFile(join(scaffold.harnessHome, '.credentials.yaml'), 'utf8')
|
|
expect(stored.includes(`DEEPSEEK_API_KEY: ${secret}`)).toBe(true)
|
|
expect((await page.content()).includes(secret)).toBe(false)
|
|
expect((await page.locator('body').ariaSnapshot()).includes(secret)).toBe(false)
|
|
expect(browserConsole.some(line => line.includes(secret))).toBe(false)
|
|
|
|
// The same open Models surface reuses the refreshed join and exposes the
|
|
// configured write-only placeholder without a reload.
|
|
const deepSeekRow = settings.getByText('DeepSeek', { exact: true }).first()
|
|
await deepSeekRow.waitFor({ timeout: 10_000 })
|
|
await deepSeekRow.locator('xpath=ancestor::li').getByRole('button', { name: '编辑' }).click()
|
|
const configuredInput = settings.getByLabel('API 密钥', { exact: true })
|
|
await configuredInput.waitFor({ timeout: 10_000 })
|
|
await expect.poll(
|
|
() => configuredInput.getAttribute('placeholder'),
|
|
{ timeout: 10_000 },
|
|
).toBe('已配置——输入新值可替换')
|
|
|
|
const acknowledgedSettings = await readFile(join(scaffold.harnessHome, 'settings.yaml'), 'utf8')
|
|
expect(acknowledgedSettings).toContain(`${WELCOME_NOTICE_ACK_FIELD}: ${WELCOME_NOTICE_VERSION}`)
|
|
|
|
const secondReloadWarnings = tripwire.warnings.length
|
|
await page.reload({ waitUntil: 'load' })
|
|
acknowledgeReloadConnectionLoss(tripwire, secondReloadWarnings)
|
|
await page.waitForSelector('[class*="frame"]', { timeout: 15_000 })
|
|
expect(await page.getByRole('region', { name: WELCOME_NOTICE_COPY.zh.title }).count()).toBe(0)
|
|
expect(await page.getByRole('region', { name: '添加一个 API Key 开始使用' }).count()).toBe(0)
|
|
|
|
// A different stored copy version represents an intentional version bump:
|
|
// the welcome step returns even though the credential is already ready.
|
|
await scaffold.ctx.settings.mutate(settingsNamespace(WELCOME_NOTICE_SETTINGS_NAMESPACE), [{
|
|
op: 'set', path: [WELCOME_NOTICE_ACK_FIELD], value: 'previous-copy-version',
|
|
}])
|
|
const thirdReloadWarnings = tripwire.warnings.length
|
|
await page.reload({ waitUntil: 'load' })
|
|
acknowledgeReloadConnectionLoss(tripwire, thirdReloadWarnings)
|
|
await welcome.waitFor({ timeout: 15_000 })
|
|
await welcome.getByRole('button', { name: WELCOME_NOTICE_COPY.zh.continueLabel }).click()
|
|
await welcome.waitFor({ state: 'detached', timeout: 15_000 })
|
|
expect(await page.getByRole('region', { name: '添加一个 API Key 开始使用' }).count()).toBe(0)
|
|
|
|
expect((await page.content()).includes(secret)).toBe(false)
|
|
expect((await page.locator('body').ariaSnapshot()).includes(secret)).toBe(false)
|
|
expect(browserConsole.some(line => line.includes(secret))).toBe(false)
|
|
expect(tripwire.warnings).toEqual([])
|
|
expect(tripwire.pageErrors).toEqual([])
|
|
}, 60_000)
|
|
|
|
it('never paints the takeover chrome on a configured reload, even with the settings join held open', async () => {
|
|
onTestFailed(() => saveFailureShot(page, 'web-e2e-onboarding-configured-reload'))
|
|
// Regression pin for the reload white flash: both steps are satisfied
|
|
// (welcome acknowledged, credential configured), yet each must LOAD its
|
|
// private join before it can decide not to show. The chrome lives inside
|
|
// the step (OnboardingSurface), so the deciding window paints and blocks
|
|
// nothing. Holding settings.describe widens that window from loopback
|
|
// RTT scale to a deterministic hundreds of milliseconds, removing all
|
|
// timing dependence from the sampler assertions below.
|
|
//
|
|
// The sampler init script persists across this shared page's later
|
|
// navigations (init scripts re-run per navigation); that stays harmless
|
|
// because no later scenario in this file legitimately shows the
|
|
// takeover, and only this test reads __takeoverSightings.
|
|
await page.addInitScript(() => {
|
|
const sightings: string[] = []
|
|
;(window as unknown as { __takeoverSightings: string[] }).__takeoverSightings = sightings
|
|
setInterval(() => {
|
|
if (document.querySelector('[class*="onboardingStage"], [class*="onboardingMask"]') !== null) {
|
|
sightings.push('chrome')
|
|
}
|
|
if (document.getElementById('root')?.inert === true) sightings.push('inert')
|
|
}, 8)
|
|
})
|
|
// EVERY settings.describe issued before the release is held — not just
|
|
// the first — so the pin cannot silently collapse back to loopback
|
|
// timing if a second boot-time consumer of the join ever appears.
|
|
let released = false
|
|
const heldRoutes: Array<() => void> = []
|
|
const releaseDescribe = (): void => {
|
|
released = true
|
|
for (const resolve of heldRoutes.splice(0)) resolve()
|
|
}
|
|
await page.route('**/api/settings.describe', async (route) => {
|
|
if (!released) await new Promise<void>((resolve) => { heldRoutes.push(resolve) })
|
|
await route.continue()
|
|
})
|
|
const warningsBefore = tripwire.warnings.length
|
|
await page.reload({ waitUntil: 'commit' })
|
|
await page.waitForSelector('[class*="frame"]', { timeout: 15_000 })
|
|
// The app is painted and interactive while the steps are still deciding.
|
|
await page.waitForTimeout(600)
|
|
releaseDescribe()
|
|
await page.waitForTimeout(400)
|
|
await page.unroute('**/api/settings.describe')
|
|
acknowledgeReloadConnectionLoss(tripwire, warningsBefore)
|
|
expect(await page.evaluate(() =>
|
|
(window as unknown as { __takeoverSightings: string[] }).__takeoverSightings)).toEqual([])
|
|
expect(await page.locator('[class*="onboardingStage"]').count()).toBe(0)
|
|
expect(tripwire.pageErrors).toEqual([])
|
|
}, 60_000)
|
|
|
|
it('configures arbitrary DeepSeek models and prompts after the selected model is removed', async () => {
|
|
onTestFailed(() => saveFailureShot(page, 'web-e2e-onboarding-deepseek-models'))
|
|
// Opened here rather than inherited: the credential test reloads the page
|
|
// to exercise the welcome step, so nothing carries an open dialog across.
|
|
await page.getByRole('button', { name: '设置', exact: true }).click()
|
|
const settings = page.getByRole('dialog', { name: '设置' })
|
|
await settings.waitFor({ timeout: 10_000 })
|
|
await settings.getByRole('button', { name: '模型' }).click()
|
|
const deepSeek = settings.getByText('DeepSeek', { exact: true }).first()
|
|
await deepSeek.waitFor({ timeout: 10_000 })
|
|
await deepSeek.locator('xpath=ancestor::li').getByRole('button', { name: '编辑' }).click()
|
|
await settings.getByText('自定义设置').click()
|
|
await settings.getByRole('button', { name: /删除模型/ }).first().click()
|
|
await settings.getByRole('button', { name: '添加模型' }).click()
|
|
const customModelId = settings.getByLabel('模型 ID 2')
|
|
await customModelId.fill('private-preview')
|
|
await settings.getByLabel('显示名称 2').fill('Private Preview')
|
|
// Capacities live behind the row's own disclosure, as in the pi-ai form.
|
|
await settings.getByRole('button', { name: '容量 2' }).click()
|
|
await settings.getByLabel('上下文窗口 2').fill('131072')
|
|
await settings.getByLabel('最大输出 token 数 2').fill('64K')
|
|
|
|
const modelEditor = await captureStableAria(page, '[role="dialog"]', scaffold.workspaceCwd)
|
|
await compareOrRefreshGolden(MODELS_EXPECTED, modelEditor, MODE)
|
|
await settings.getByRole('button', { name: '保存', exact: true }).click()
|
|
await customModelId.waitFor({ state: 'detached', timeout: 15_000 })
|
|
|
|
const document = await readFile(join(scaffold.harnessHome, 'settings.yaml'), 'utf8')
|
|
expect(document).toContain('id: deepseek-v4-pro')
|
|
expect(document).toContain('id: private-preview')
|
|
expect(document).toContain('name: Private Preview')
|
|
expect(document).toContain('contextWindow: 131072')
|
|
expect(document).toContain('maxTokens: 64000')
|
|
expect(document).not.toContain('id: deepseek-v4-flash')
|
|
|
|
await page.keyboard.press('Escape')
|
|
// A connected Workspace is what puts a live composer — and its model
|
|
// trigger — on the page; the scaffold boots without one.
|
|
await connectFreshWorkspaceZh(page, scaffold.workspaceCwd, 'model-fallback-e2e')
|
|
|
|
const modelTrigger = page.getByRole('button', { name: '选择模型', exact: true })
|
|
await modelTrigger.waitFor({ timeout: 10_000 })
|
|
await modelTrigger.click()
|
|
await page.getByRole('menuitem', { name: /模型/ }).click()
|
|
expect(await page.getByText('deepseek-v4-flash', { exact: true }).count()).toBe(0)
|
|
await page.getByRole('menuitemradio', { name: 'Private Preview' }).waitFor({ timeout: 10_000 })
|
|
expect(tripwire.warnings).toEqual([])
|
|
expect(tripwire.pageErrors).toEqual([])
|
|
}, 60_000)
|
|
|
|
it('keeps the fixture inventory closed', async () => {
|
|
await assertFixtureInventory(
|
|
SNAPSHOT_DIR,
|
|
['missing.expected.md', 'models.expected.md', 'welcome.expected.md'],
|
|
)
|
|
})
|
|
})
|