mirror of
https://ghproxy.cflmy.top/https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-11-30 00:59:36 +08:00
Merge pull request #9238 from deepseek-harness/fix/flaky-remote-connection
test(web): open Settings only after the first Session list lands
This commit is contained in:
commit
e09e660045
3 files changed
+66
-4
No files matched your search
@@ -17,7 +17,7 @@ import {
|
||||
WELCOME_NOTICE_ACK_FIELD, WELCOME_NOTICE_COPY, WELCOME_NOTICE_SETTINGS_NAMESPACE,
|
||||
WELCOME_NOTICE_VERSION,
|
||||
} from './scaffold.ts'
|
||||
import { openSettings, ZH_BROWSER_LOCALE, connectFreshWorkspaceZh, saveFailureShot } from './support.ts'
|
||||
import { credentialOnboardingStarted, openSettings, ZH_BROWSER_LOCALE, connectFreshWorkspaceZh, saveFailureShot } from './support.ts'
|
||||
|
||||
const SNAPSHOT_DIR = fileURLToPath(new URL('./expected/onboarding-deepseek-config', import.meta.url))
|
||||
const WELCOME_EXPECTED = join(SNAPSHOT_DIR, 'welcome.expected.md')
|
||||
@@ -186,10 +186,16 @@ describe.skipIf(MODE === 'record')('web e2e: first-run DeepSeek credential setup
|
||||
})
|
||||
const warningsBefore = tripwire.warnings.length
|
||||
await page.reload({ waitUntil: 'commit' })
|
||||
// Armed after the commit, so a read from the previous document, whose Models
|
||||
// page loaded in the first scenario, cannot satisfy it. The credential step
|
||||
// mounts once the welcome step has decided; the next scenario opens Settings
|
||||
// on this page without reloading it.
|
||||
const credentialStep = credentialOnboardingStarted(page)
|
||||
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 credentialStep
|
||||
await page.waitForTimeout(400)
|
||||
await page.unroute('**/api/settings/describe')
|
||||
acknowledgeReloadConnectionLoss(tripwire, warningsBefore)
|
||||
|
||||
@@ -6,7 +6,7 @@ import { chromium, type Browser, type Locator, type Page } from 'playwright'
|
||||
import { afterAll, beforeAll, describe, expect, it, onTestFinished } from 'vitest'
|
||||
import { captureStableAria, compareOrRefreshGolden, launchWebScaffold, watchConsole, webSnapshotMode } from './scaffold.ts'
|
||||
import { launchRemoteConnectionFixture, type RemoteConnectionFixture } from './remote-connection-fixture.ts'
|
||||
import { openSettings, ZH_BROWSER_LOCALE } from './support.ts'
|
||||
import { credentialOnboardingStarted, openSettings, ZH_BROWSER_LOCALE } from './support.ts'
|
||||
|
||||
const EXPECTED = fileURLToPath(new URL('./expected/remote-connection', import.meta.url))
|
||||
const MODE = webSnapshotMode()
|
||||
@@ -16,7 +16,35 @@ const EXTENSION_FIXTURE = fileURLToPath(new URL('./fixtures/plugins/fixture-remo
|
||||
const REPLACEMENT_OVERLAY = fileURLToPath(new URL('./remote-connection-replacement.overlay.yml', import.meta.url))
|
||||
const UNTRUSTED_OVERLAY = fileURLToPath(new URL('./remote-connection-untrusted.overlay.yml', import.meta.url))
|
||||
|
||||
/**
|
||||
* Wait until startup navigation opens the default Workspace's blank Session,
|
||||
* whose live composer replaces the Workspace trigger. Navigation selects that
|
||||
* Session only after the first Session-list pull lands; on the same pull the
|
||||
* Settings onboarding coordinator mounts its first-run steps and closes a
|
||||
* Settings panel that is already open (#9234).
|
||||
* @param page - application page of a Remote fixture, whose CLI starts with a default Workspace.
|
||||
*/
|
||||
async function startupSession(page: Page): Promise<void> {
|
||||
await page.locator('[data-composer-input][data-placeholder="描述你想要构建的内容, / 调用指令, @ 文件或对话"]')
|
||||
.waitFor({ state: 'attached' })
|
||||
}
|
||||
|
||||
/**
|
||||
* Open Remote connection settings on a Remote fixture page once startup navigation has settled.
|
||||
* @param page - application page of a Remote fixture.
|
||||
* @returns the Remote connection section.
|
||||
*/
|
||||
async function remoteSettings(page: Page): Promise<Locator> {
|
||||
await startupSession(page)
|
||||
return openRemoteSettings(page)
|
||||
}
|
||||
|
||||
/**
|
||||
* Open Settings on the Remote connection page and wait for its address card.
|
||||
* @param page - application page whose first Session-list pull has landed.
|
||||
* @returns the Remote connection section.
|
||||
*/
|
||||
async function openRemoteSettings(page: Page): Promise<Locator> {
|
||||
await openSettings(page, 'zh')
|
||||
await page.getByRole('dialog', { name: '设置', exact: true })
|
||||
.getByRole('button', { name: '远程连接', exact: true }).click()
|
||||
@@ -453,7 +481,10 @@ describe('web e2e: one-use QR browser login', () => {
|
||||
try {
|
||||
const page = await context.newPage()
|
||||
const console = watchConsole(page)
|
||||
// The scaffold starts without a Workspace, so startup navigation opens no Session to wait for.
|
||||
const onboarding = credentialOnboardingStarted(page)
|
||||
await page.goto(scaffold.authenticatedUrl)
|
||||
await onboarding
|
||||
await openSettings(page, 'zh')
|
||||
await page.getByRole('dialog', { name: '设置', exact: true })
|
||||
.getByRole('button', { name: '远程连接', exact: true }).click()
|
||||
@@ -514,7 +545,9 @@ describe('web e2e: one-use QR browser login', () => {
|
||||
}
|
||||
|
||||
await page.route('**/api/remoteConnection/status', route => route.abort('failed'))
|
||||
const reloadedOnboarding = credentialOnboardingStarted(page)
|
||||
await page.reload()
|
||||
await reloadedOnboarding
|
||||
await openSettings(page, 'zh')
|
||||
await page.getByRole('dialog', { name: '设置', exact: true })
|
||||
.getByRole('button', { name: '远程连接', exact: true }).click()
|
||||
@@ -549,6 +582,7 @@ describe('web e2e: one-use QR browser login', () => {
|
||||
const page = await context.newPage()
|
||||
const console = watchConsole(page)
|
||||
await page.goto(secure.authenticatedUrl)
|
||||
await startupSession(page)
|
||||
await openSettings(page, 'zh')
|
||||
const dialog = page.getByRole('dialog', { name: '设置', exact: true })
|
||||
for (const [viewport, colorScheme, suffix] of [
|
||||
@@ -1275,8 +1309,11 @@ describe('web e2e: one-use QR browser login', () => {
|
||||
try {
|
||||
const page = await desktop.newPage()
|
||||
const console = watchConsole(page)
|
||||
// The scaffold starts without a Workspace, so startup navigation opens no Session to wait for.
|
||||
const onboarding = credentialOnboardingStarted(page)
|
||||
await page.goto(scaffold.authenticatedUrl)
|
||||
const section = await remoteSettings(page)
|
||||
await onboarding
|
||||
const section = await openRemoteSettings(page)
|
||||
const extension = page.getByRole('region', { name: '连接选项', exact: true })
|
||||
const additional = await scaffold.ctx.loader.create({ name: '@fixture/remote-connection-extension' })
|
||||
await extension.waitFor()
|
||||
|
||||
@@ -4,7 +4,7 @@ import { createServer } from 'node:net'
|
||||
import { createRequire } from 'node:module'
|
||||
import { join } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import type { Browser, Locator, Page } from 'playwright'
|
||||
import type { Browser, Locator, Page, Request } from 'playwright'
|
||||
import { expect, vi, type MockInstance } from 'vitest'
|
||||
import type { RegionRect } from '@deepseek-ai/dsh-client-web/src/window-drag/regions.ts'
|
||||
|
||||
@@ -482,7 +482,26 @@ export function conversationContextKey(kind: string, id: string): string {
|
||||
return `${kind.length}:${kind}${id}`
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve on the first-run credential onboarding step's provider-directory
|
||||
* read. The Settings onboarding coordinator mounts that step only after the
|
||||
* first Session-list pull lands and the welcome step finishes, and from then
|
||||
* on it leaves an open Settings panel in place (#9234). Arm it before the
|
||||
* navigation it observes; a page whose Models settings already loaded sends
|
||||
* no such read.
|
||||
* @param page - page about to load an application with automatic credential onboarding.
|
||||
* @returns the read request.
|
||||
*/
|
||||
export function credentialOnboardingStarted(page: Page): Promise<Request> {
|
||||
return page.waitForRequest(request => new URL(request.url()).pathname === '/api/llm/listConfigurableProviders')
|
||||
}
|
||||
|
||||
/** Open Settings through the sidebar account menu.
|
||||
* A panel opened before the first Session-list pull lands closes again when
|
||||
* the onboarding coordinator mounts its first-run steps on that pull (#9234),
|
||||
* so a caller that opens Settings right after loading first waits for a state
|
||||
* that follows the pull, such as {@link credentialOnboardingStarted} or the
|
||||
* Session that startup navigation opens.
|
||||
* @param page - browser page with the mounted sidebar.
|
||||
* @param locale - current UI language.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user