mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-16 13:03:31 +08:00
Reset session messageCount when /clear is confirmed so active headers and sidebars do not keep stale message totals after the transcript is cleared. Also wait for the restored project chip in the live desktop smoke lane before filling the prompt, preventing the test from racing against EmptySession and creating a default-home session. Tested: cd desktop && bun run test -- --run src/stores/chatStore.test.ts src/stores/sessionStore.test.ts Tested: bun test scripts/quality-gate/desktop-smoke/execute.test.ts Tested: bun run check:desktop Tested: SKIP_INSTALL=1 MAC_TARGETS=zip desktop/scripts/build-macos-arm64.sh Tested: bun run quality:smoke --provider-model codingplan:main:codingplan-main Not-tested: bun run verify Confidence: high Scope-risk: narrow
78 lines
2.4 KiB
TypeScript
78 lines
2.4 KiB
TypeScript
import { describe, expect, test } from 'bun:test'
|
|
import {
|
|
buildDesktopSmokeBrowserEnv,
|
|
desktopSmokeTextShowsProject,
|
|
resolveDesktopSmokeRuntimeSelection,
|
|
} from './execute'
|
|
|
|
describe('desktop smoke runtime selection', () => {
|
|
test('lets current-runtime use the desktop default active provider', () => {
|
|
expect(resolveDesktopSmokeRuntimeSelection({
|
|
providerId: null,
|
|
modelId: 'current',
|
|
label: 'current-runtime',
|
|
})).toBeNull()
|
|
})
|
|
|
|
test('keeps explicit official and saved provider selections scoped to the session', () => {
|
|
expect(resolveDesktopSmokeRuntimeSelection({
|
|
providerId: null,
|
|
modelId: 'claude-sonnet-4-6',
|
|
label: 'official-sonnet',
|
|
})).toEqual({
|
|
providerId: null,
|
|
modelId: 'claude-sonnet-4-6',
|
|
})
|
|
|
|
expect(resolveDesktopSmokeRuntimeSelection({
|
|
providerId: 'provider-a',
|
|
modelId: 'model-a',
|
|
label: 'provider-a-main',
|
|
})).toEqual({
|
|
providerId: 'provider-a',
|
|
modelId: 'model-a',
|
|
})
|
|
})
|
|
})
|
|
|
|
describe('desktop smoke browser environment', () => {
|
|
test('scopes agent-browser to a temporary session and bypasses loopback proxy traffic', () => {
|
|
expect(buildDesktopSmokeBrowserEnv('session-a', '/tmp/profile-a', {
|
|
NO_PROXY: 'internal.example.com',
|
|
})).toEqual({
|
|
AGENT_BROWSER_SESSION: 'session-a',
|
|
AGENT_BROWSER_PROFILE: '/tmp/profile-a',
|
|
NO_PROXY: 'internal.example.com,127.0.0.1,localhost,::1,[::1]',
|
|
no_proxy: 'internal.example.com,127.0.0.1,localhost,::1,[::1]',
|
|
})
|
|
})
|
|
|
|
test('deduplicates existing lowercase no_proxy loopback entries', () => {
|
|
expect(buildDesktopSmokeBrowserEnv('session-b', '/tmp/profile-b', {
|
|
no_proxy: 'localhost,127.0.0.1',
|
|
})).toEqual({
|
|
AGENT_BROWSER_SESSION: 'session-b',
|
|
AGENT_BROWSER_PROFILE: '/tmp/profile-b',
|
|
NO_PROXY: 'localhost,127.0.0.1,::1,[::1]',
|
|
no_proxy: 'localhost,127.0.0.1,::1,[::1]',
|
|
})
|
|
})
|
|
})
|
|
|
|
describe('desktop smoke restored session detection', () => {
|
|
test('waits for the target project chip instead of the first empty-session textarea', () => {
|
|
expect(desktopSmokeTextShowsProject([
|
|
'新建会话',
|
|
'随便问点什么...',
|
|
'folder_open 选择项目...',
|
|
].join('\n'), 'project')).toBe(false)
|
|
|
|
expect(desktopSmokeTextShowsProject([
|
|
'Untitled Session',
|
|
'让 Claude 编辑、调试或解释代码...',
|
|
'folder',
|
|
'project',
|
|
].join('\n'), 'project')).toBe(true)
|
|
})
|
|
})
|