release: bump version to 0.82.0
This commit is contained in:
1 parent
b3d2d9e9f1
commit
04cebdc504
131 files changed
+17975
-2323
No files matched your search
@@ -676,13 +676,13 @@ def check_connection_test_input_pattern() -> None:
|
||||
if "function ConnectionTestInput" not in text:
|
||||
fail("AI/WebSearch connection tests must use the shared ConnectionTestInput pattern")
|
||||
|
||||
for label in ("测试 AI Provider 连通性", "测试 Web Search 连通性"):
|
||||
for label in ("测试 AI 供应商连通性", "测试 Web Search 连通性"):
|
||||
if re.search(rf"<Button\b(?=[^>]*\btitle=['\"]{re.escape(label)}['\"])", text):
|
||||
fail(f"{label}: connection test must be attached to the Base URL input suffix, not a standalone Button")
|
||||
|
||||
provider_pattern = re.compile(
|
||||
r"key:\s*'base_url'[\s\S]{0,260}inputAction:[\s\S]{0,260}"
|
||||
r"title:\s*'测试 AI Provider 连通性'",
|
||||
r"title:\s*'测试 AI 供应商连通性'",
|
||||
)
|
||||
if not provider_pattern.search(text):
|
||||
fail("AI Provider Base URL field must expose its connection test through inputAction")
|
||||
|
||||
@@ -23,7 +23,7 @@ function formatSmokeError(error) {
|
||||
}
|
||||
|
||||
const publicRoutes = [
|
||||
{ path: '/login', text: '登录 Planet 控制台' },
|
||||
{ path: '/login', text: '登录智能星球控制台' },
|
||||
{ path: '/register', text: '注册账户' },
|
||||
{ path: '/verify-email', text: '验证邮箱' },
|
||||
{ path: '/forgot-password', text: '找回密码' },
|
||||
@@ -93,7 +93,6 @@ const adminEnglishI18nRoutes = [
|
||||
'/advisor/playground',
|
||||
'/advisor/workflows',
|
||||
'/advisor/runs',
|
||||
'/ops/monitoring',
|
||||
'/ai',
|
||||
'/earth-content',
|
||||
'/collection-management',
|
||||
@@ -268,7 +267,7 @@ function loadAdminSurface() {
|
||||
['Dashboard', { text: '仪表盘' }],
|
||||
['Users', { text: '用户管理' }],
|
||||
['DataList', { text: '采集数据' }],
|
||||
['AI', { text: 'AI 基础设施' }],
|
||||
['AI', { text: '模型供应商' }],
|
||||
['AdvisorPlayground', { text: 'AI 参谋 Playground' }],
|
||||
['AdvisorWorkflows', { text: 'AI 工作流与节点编排' }],
|
||||
['AdvisorRuns', { text: 'AI 运行记录与轨迹' }],
|
||||
@@ -283,9 +282,7 @@ function loadAdminSurface() {
|
||||
protectedRoutes.push(path)
|
||||
|
||||
if (redirectTarget) {
|
||||
if (redirectTarget.startsWith('/ops/monitoring')) {
|
||||
authenticatedChecks.push({ path, text: '告警与观测' })
|
||||
} else if (redirectTarget.startsWith('/advisor/workflows')) {
|
||||
if (redirectTarget.startsWith('/advisor/workflows')) {
|
||||
authenticatedChecks.push({ path, text: 'AI 工作流与节点编排' })
|
||||
} else if (redirectTarget.startsWith('/advisor/playground')) {
|
||||
authenticatedChecks.push({ path, text: 'AI 参谋 Playground' })
|
||||
@@ -449,7 +446,7 @@ async function ensureAdminPreferencesOpen(page, label) {
|
||||
}
|
||||
|
||||
async function getEarthFrame(page, label) {
|
||||
const iframe = page.locator('iframe[title="3D Earth"]')
|
||||
const iframe = page.locator('iframe[data-earth-iframe="true"]')
|
||||
await iframe.waitFor({ state: 'visible', timeout: 10000 })
|
||||
const handle = await iframe.elementHandle()
|
||||
const frame = await handle?.contentFrame()
|
||||
@@ -1072,8 +1069,8 @@ function apiPayloadFor(requestUrl, method) {
|
||||
if (path === '/ai/workflows') {
|
||||
const sampleGraph = {
|
||||
nodes: [
|
||||
{ id: 'intake', node_type: 'input', title: '问题入口', title_en: 'Intake', position: { x: 40, y: 120 }, enabled: true, system_prompt: '', prompt: '', tools: [], thinking_enabled: true, max_steps: 1, timeout_seconds: 60, native_web_search: false, guardrails: {}, params: {} },
|
||||
{ id: 'default_advisor', node_type: 'llm_agent', title: '通用参谋', title_en: 'General Advisor', position: { x: 320, y: 120 }, enabled: true, prompt_key: 'situational.copilot.reply', system_prompt: 'System', prompt: 'Prompt', tools: ['query_global_situational'], thinking_enabled: true, max_steps: 2, timeout_seconds: 60, native_web_search: false, guardrails: {}, params: {} },
|
||||
{ id: 'intake', node_type: 'trigger', title: '问题入口', title_en: 'Intake', position: { x: 40, y: 140 }, enabled: true, system_prompt: '', prompt: '', tools: [], thinking_enabled: true, max_steps: 1, timeout_seconds: 60, native_web_search: false, guardrails: {}, params: {} },
|
||||
{ id: 'default_advisor', node_type: 'llm_agent', title: '通用参谋', title_en: 'General Advisor', position: { x: 420, y: 140 }, enabled: true, prompt_key: 'situational.copilot.reply', system_prompt: 'System', prompt: 'Prompt', tools: ['query_global_situational'], thinking_enabled: true, max_steps: 2, timeout_seconds: 60, native_web_search: false, guardrails: {}, params: {} },
|
||||
],
|
||||
edges: [{ id: 'e1', source: 'intake', target: 'default_advisor', label: 'Always', label_en: 'Always' }],
|
||||
}
|
||||
@@ -1087,15 +1084,45 @@ function apiPayloadFor(requestUrl, method) {
|
||||
}
|
||||
if (path.startsWith('/ai/workflows/')) {
|
||||
const wfId = path.replace('/ai/workflows/', '').split('/')[0] || 'default.general'
|
||||
const sampleGraph = {
|
||||
nodes: [
|
||||
{ id: 'intake', node_type: 'input', title: '问题入口', title_en: 'Intake', position: { x: 40, y: 120 }, enabled: true, system_prompt: '', prompt: '', tools: [], thinking_enabled: true, max_steps: 1, timeout_seconds: 60, native_web_search: false, guardrails: {}, params: {} },
|
||||
{ id: 'default_advisor', node_type: 'llm_agent', title: '通用参谋', title_en: 'General Advisor', position: { x: 320, y: 120 }, enabled: true, prompt_key: 'situational.copilot.reply', system_prompt: 'System', prompt: 'Prompt', tools: ['query_global_situational'], thinking_enabled: true, max_steps: 2, timeout_seconds: 60, native_web_search: false, guardrails: {}, params: {} },
|
||||
],
|
||||
edges: [{ id: 'e1', source: 'intake', target: 'default_advisor', label: 'Always', label_en: 'Always' }],
|
||||
}
|
||||
const isLocation = wfId === 'location.resolve_unknown'
|
||||
const sampleGraph = isLocation
|
||||
? {
|
||||
nodes: [
|
||||
{ id: 'l0_normalize', node_type: 'trigger', title: 'L0:实体归一化', title_en: 'L0: Normalize', position: { x: 40, y: 160 }, enabled: true, system_prompt: '', prompt: '', tools: [], thinking_enabled: true, max_steps: 1, timeout_seconds: 60, native_web_search: false, guardrails: {}, params: {} },
|
||||
{ id: 'l1_knowledge', node_type: 'deterministic', title: 'L1:设施知识库', title_en: 'L1: Knowledge', position: { x: 420, y: 160 }, enabled: true, system_prompt: '', prompt: '', tools: ['wikidata_lookup'], thinking_enabled: false, max_steps: 1, timeout_seconds: 60, native_web_search: false, guardrails: {}, params: {} },
|
||||
{ id: 'l2_agent_research', node_type: 'llm_agent', title: 'L2:取证 Agent', title_en: 'L2: Agent', position: { x: 800, y: 300 }, enabled: true, prompt_key: 'location.factcheck.resolve', system_prompt: 'Verify address', prompt: 'Resolve city', tools: ['fetch_source_url', 'geocode_verify'], thinking_enabled: true, max_steps: 4, timeout_seconds: 90, native_web_search: false, guardrails: {}, params: {} },
|
||||
{ id: 'l3_geo_guardrail', node_type: 'guardrail', title: 'L3:边界硬校验', title_en: 'L3: Guardrail', position: { x: 1180, y: 160 }, enabled: true, system_prompt: '', prompt: '', tools: [], thinking_enabled: false, max_steps: 1, timeout_seconds: 60, native_web_search: false, guardrails: { enforce_country_match: true }, params: {} },
|
||||
{ id: 'l4_persist_outcome', node_type: 'output', title: 'L4:候选输出', title_en: 'L4: Output', position: { x: 1560, y: 160 }, enabled: true, system_prompt: '', prompt: '', tools: [], thinking_enabled: false, max_steps: 1, timeout_seconds: 60, native_web_search: false, guardrails: {}, params: {} },
|
||||
],
|
||||
edges: [
|
||||
{ id: 'loc-e1', source: 'l0_normalize', target: 'l1_knowledge', label: '未标记终态', label_en: 'Not terminal' },
|
||||
{ id: 'loc-e2', source: 'l1_knowledge', target: 'l3_geo_guardrail', label: '高置信度命中', label_en: 'Verified hit' },
|
||||
{ id: 'loc-e3', source: 'l1_knowledge', target: 'l2_agent_research', label: '未命中/需核查', label_en: 'Miss / verify' },
|
||||
{ id: 'loc-e4', source: 'l2_agent_research', target: 'l3_geo_guardrail', label: '提交候选', label_en: 'Submitted' },
|
||||
{ id: 'loc-e5', source: 'l3_geo_guardrail', target: 'l4_persist_outcome', label: '校验完成', label_en: 'Validated' },
|
||||
],
|
||||
}
|
||||
: {
|
||||
nodes: [
|
||||
{ id: 'intake', node_type: 'trigger', title: '问题入口', title_en: 'Intake', position: { x: 40, y: 140 }, enabled: true, system_prompt: '', prompt: '', tools: [], thinking_enabled: true, max_steps: 1, timeout_seconds: 60, native_web_search: false, guardrails: {}, params: {} },
|
||||
{ id: 'default_advisor', node_type: 'llm_agent', title: '通用参谋', title_en: 'General Advisor', position: { x: 420, y: 140 }, enabled: true, prompt_key: 'situational.copilot.reply', system_prompt: 'System', prompt: 'Prompt', tools: ['query_global_situational'], thinking_enabled: true, max_steps: 2, timeout_seconds: 60, native_web_search: false, guardrails: {}, params: {} },
|
||||
],
|
||||
edges: [{ id: 'e1', source: 'intake', target: 'default_advisor', label: '初始化上下文', label_en: 'Load context' }],
|
||||
}
|
||||
return jsonResponse({
|
||||
workflow: { workflow_id: wfId, name: '通用AI参谋(默认)', name_en: 'General AI Advisor (Default)', category: 'default', description: '', description_en: '', is_default: wfId === 'default.general', active_revision: 1, has_draft: false, published_graph: sampleGraph, draft_graph: null },
|
||||
workflow: {
|
||||
workflow_id: wfId,
|
||||
name: isLocation ? '未知算力位置事实核查 Agent' : '通用AI参谋(默认)',
|
||||
name_en: isLocation ? 'Unknown Location Fact-Check Agent' : 'General AI Advisor (Default)',
|
||||
category: isLocation ? 'location' : 'default',
|
||||
description: '',
|
||||
description_en: '',
|
||||
is_default: wfId === 'default.general',
|
||||
active_revision: 1,
|
||||
has_draft: false,
|
||||
published_graph: sampleGraph,
|
||||
draft_graph: null,
|
||||
},
|
||||
revisions: [{ id: 1, revision: 1, status: 'published', change_summary: 'Initial built-in workflow', created_at: now }],
|
||||
fixtures: [],
|
||||
tool_catalog: [{ id: 'query_global_situational', name: '全球态势全览快照', name_en: 'Global Situational Snapshot', category: 'internal_read', description: '' }],
|
||||
@@ -1105,10 +1132,49 @@ function apiPayloadFor(requestUrl, method) {
|
||||
return jsonResponse({
|
||||
items: [
|
||||
{ id: 'run_smoke_1', workflow_id: 'default.general', status: 'completed', actor_key: 'admin', question: 'Smoke run question', tool_trace: ['intake', 'default_advisor'], started_at: now },
|
||||
{ id: 'run_smoke_2', workflow_id: 'location.resolve_unknown', status: 'completed', actor_key: 'admin', question: 'Locate Colossus Memphis', tool_trace: ['l0_normalize', 'l1_knowledge', 'l2_agent_research'], started_at: now },
|
||||
],
|
||||
total: 1,
|
||||
total: 2,
|
||||
})
|
||||
}
|
||||
if (path === '/ai/evolution/policy') {
|
||||
return jsonResponse({
|
||||
business_mode: 'draft',
|
||||
meta_mode: 'off',
|
||||
daily_auto_budget: 3,
|
||||
business_cooldown_hours: 24,
|
||||
meta_cooldown_days: 7,
|
||||
locked_workflows: [],
|
||||
auto_adapt_on_model_change: true,
|
||||
})
|
||||
}
|
||||
if (path === '/ai/evolution/ledger') {
|
||||
return jsonResponse({ items: [], total: 0 })
|
||||
}
|
||||
if (path.startsWith('/ai/evolution/health/')) {
|
||||
const wfId = path.replace('/ai/evolution/health/', '') || 'default.general'
|
||||
return jsonResponse({
|
||||
workflow_id: wfId,
|
||||
active_revision: 1,
|
||||
is_locked: false,
|
||||
total_runs: 2,
|
||||
completed_runs: 2,
|
||||
failed_runs: 0,
|
||||
success_rate: 1,
|
||||
avg_latency_ms: 420,
|
||||
upvotes: 1,
|
||||
downvotes: 0,
|
||||
recent_models: ['MiniMax-M3.1-Flash'],
|
||||
active_model_profile: { ready: true, provider: 'minimax', model: 'MiniMax-M3.1-Flash', tier: 'fast' },
|
||||
model_drift_detected: false,
|
||||
unused_tools: [],
|
||||
canary: null,
|
||||
signals: [],
|
||||
})
|
||||
}
|
||||
if (path.startsWith('/ai/runs/') && path.endsWith('/feedback')) {
|
||||
return jsonResponse({ id: 'run_smoke_1', workflow_id: 'default.general', status: 'completed' })
|
||||
}
|
||||
if (path.startsWith('/ai/runs/')) {
|
||||
return jsonResponse({ id: 'run_smoke_1', workflow_id: 'default.general', status: 'completed', actor_key: 'admin', question: 'Smoke run question', tool_trace: ['intake', 'default_advisor'], started_at: now })
|
||||
}
|
||||
@@ -1581,7 +1647,7 @@ async function runAdminInteractionChecks(browser, failures, consoleErrors) {
|
||||
await link.click()
|
||||
await expectUrl(page, label, (location) => location.pathname === route.path)
|
||||
if (route.kind === 'earth') {
|
||||
await page.locator('iframe[title="3D Earth"]').waitFor({ state: 'visible', timeout: 10000 })
|
||||
await page.locator('iframe[data-earth-iframe="true"]').waitFor({ state: 'visible', timeout: 10000 })
|
||||
} else if (route.text) {
|
||||
await expectVisibleText(page, route.text, label)
|
||||
}
|
||||
@@ -1666,7 +1732,7 @@ async function runAdminInteractionChecks(browser, failures, consoleErrors) {
|
||||
|
||||
await page.goto(urlFor('/advisor/playground'), { waitUntil: 'domcontentloaded' })
|
||||
await expectVisibleText(page, 'AI 参谋 Playground', 'section tab ai playground')
|
||||
await expectVisibleText(page, '客户端本地上下文', 'section tab ai playground')
|
||||
await expectVisibleText(page, 'AI 参谋对话调试台', 'section tab ai playground')
|
||||
|
||||
await page.goto(urlFor('/collection-management'), { waitUntil: 'domcontentloaded' })
|
||||
await clickFirstVisible(page.getByRole('tab', { name: /采集器/ }), 'section tab collection credentials')
|
||||
@@ -1679,7 +1745,7 @@ async function runAdminInteractionChecks(browser, failures, consoleErrors) {
|
||||
await page.goto(urlFor('/ai?section=integrations'), { waitUntil: 'domcontentloaded' })
|
||||
await expectVisibleText(page, 'LLM 基础地址', 'connection test input ai provider')
|
||||
await clickFirstVisible(page.locator('.an-connection-test-input button'), 'connection test input ai provider')
|
||||
await expectVisibleText(page, 'AI 提供方连通性正常', 'connection test input ai provider')
|
||||
await expectVisibleText(page, 'AI 供应商连通性正常', 'connection test input ai provider')
|
||||
|
||||
await page.goto(urlFor('/ai?section=tools'), { waitUntil: 'domcontentloaded' })
|
||||
await clickFirstVisible(page.getByRole('button', { name: /tavily/i }), 'connection test input websearch provider')
|
||||
@@ -1772,7 +1838,7 @@ async function runAdminInteractionChecks(browser, failures, consoleErrors) {
|
||||
await link.click()
|
||||
await expectUrl(mobilePage, label, (location) => location.pathname === route.path)
|
||||
if (route.kind === 'earth') {
|
||||
await mobilePage.locator('iframe[title="3D Earth"]').waitFor({ state: 'visible', timeout: 10000 })
|
||||
await mobilePage.locator('iframe[data-earth-iframe="true"]').waitFor({ state: 'visible', timeout: 10000 })
|
||||
} else if (route.text) {
|
||||
await expectVisibleText(mobilePage, route.text, label)
|
||||
}
|
||||
@@ -1823,7 +1889,7 @@ async function runAIModelCatalogChecks(browser, failures, consoleErrors) {
|
||||
await openProvider()
|
||||
const drafts = { '默认模型': 'custom-model', 'LLM 基础地址': 'https://custom.example.invalid/v1', 'LLM API Key': 'draft-api-key', '代理 Token': 'draft-service-token' }
|
||||
for (const [label, value] of Object.entries(drafts)) await page.getByLabel(label, { exact: true }).fill(value)
|
||||
await page.getByRole('button', { name: /刷新当前.*模型配置/ }).click()
|
||||
await page.getByRole('button', { name: '刷新模型配置' }).click()
|
||||
await page.getByRole('button', { name: 'MiniMax-M3', exact: true }).waitFor({ state: 'visible' })
|
||||
for (const [label, value] of Object.entries(drafts)) assert.equal(await page.getByLabel(label, { exact: true }).inputValue(), value, `${label} draft was overwritten`)
|
||||
assert.equal(refreshBody.base_url, drafts['LLM 基础地址'], 'refresh must use the draft endpoint')
|
||||
@@ -1840,13 +1906,13 @@ async function runAIModelCatalogChecks(browser, failures, consoleErrors) {
|
||||
await page.screenshot({ path: `${process.env.PLANET_CATALOG_SCREENSHOT_DIR}/catalog-${viewport.width}.png`, fullPage: false })
|
||||
}
|
||||
failRefresh = true
|
||||
await page.getByRole('button', { name: /刷新当前.*模型配置/ }).click()
|
||||
await page.getByRole('button', { name: '刷新模型配置' }).click()
|
||||
await expectVisibleText(page, '模型列表刷新失败,已保留上次模型列表。', 'catalog failure')
|
||||
assert.equal(await page.getByRole('button', { name: 'MiniMax-M3', exact: true }).count(), 1)
|
||||
assert.equal(await page.locator('.an-toast--success').count(), 0, 'failed refresh must not claim success')
|
||||
failRefresh = false
|
||||
failListing = true
|
||||
await page.getByRole('button', { name: /刷新当前.*模型配置/ }).click()
|
||||
await page.getByRole('button', { name: '刷新模型配置' }).click()
|
||||
await expectVisibleText(page, '模型列表加载失败,请重试;已加载的模型列表会保留。', 'catalog listing failure')
|
||||
assert.equal(await page.getByRole('button', { name: 'MiniMax-M3', exact: true }).count(), 1, 'listing failure must preserve models')
|
||||
await checkNoFrameworkOverlay(page, 'AI catalog refresh')
|
||||
@@ -1965,7 +2031,7 @@ async function runDocsInteractionChecks(browser, failures, consoleErrors) {
|
||||
await checkNoGlobalHorizontalOverflow(page, 'docs detail /docs/manual')
|
||||
|
||||
await clickFirstVisible(
|
||||
page.getByRole('group', { name: 'Language' }).getByRole('button', { name: 'EN' }),
|
||||
page.getByRole('group', { name: '语言' }).getByRole('button', { name: 'EN' }),
|
||||
'docs language switch english',
|
||||
)
|
||||
await expectVisibleText(page, 'Intelligent Planet Manual', 'docs language switch english')
|
||||
@@ -2021,7 +2087,7 @@ async function runAuthInteractionChecks(browser, failures, consoleErrors) {
|
||||
await page.getByLabel('邮箱').fill('register@example.invalid')
|
||||
await page.getByLabel('密码').fill('smoke-password')
|
||||
await page.getByRole('button', { name: /^注册$/ }).click()
|
||||
await expectVisibleText(page, '验证码已发送到邮箱', 'register verify login')
|
||||
await expectVisibleText(page, '验证码已发送至邮箱', 'register verify login')
|
||||
await page.getByLabel('验证码').fill('123456')
|
||||
await page.getByRole('button', { name: '验证并登录' }).click()
|
||||
await expectUrl(page, 'register verify login', (location) => location.pathname === '/admin')
|
||||
@@ -2057,6 +2123,210 @@ async function runAuthInteractionChecks(browser, failures, consoleErrors) {
|
||||
})
|
||||
}
|
||||
|
||||
async function runAdvisorWorkflowAndMobileChecks(browser, failures, consoleErrors) {
|
||||
const screenshotDir = process.env.PLANET_ADVISOR_SCREENSHOT_DIR || ''
|
||||
|
||||
// Desktop: verify no infinite refetch loop, node drag persistence + prompt edit retention, and workflow switch stability.
|
||||
{
|
||||
const context = await browser.newContext({ viewport: desktopViewport })
|
||||
await installApiMocks(context)
|
||||
bindConsoleCollection(context, consoleErrors)
|
||||
const page = await context.newPage()
|
||||
await seedAuthenticatedState(page)
|
||||
|
||||
let workflowDetailCalls = 0
|
||||
let runsListCalls = 0
|
||||
page.on('request', (request) => {
|
||||
const { pathname } = new URL(request.url())
|
||||
if (request.method() === 'GET' && pathname.startsWith('/api/v1/ai/workflows/')) {
|
||||
workflowDetailCalls += 1
|
||||
}
|
||||
if (request.method() === 'GET' && pathname === '/api/v1/ai/runs') {
|
||||
runsListCalls += 1
|
||||
}
|
||||
})
|
||||
|
||||
try {
|
||||
smokeProgress('advisor desktop canvas drag and no-loop')
|
||||
await page.goto(urlFor('/advisor/workflows'), { waitUntil: 'domcontentloaded' })
|
||||
await page.locator('.react-flow__node').first().waitFor({ state: 'visible', timeout: 10000 })
|
||||
await page.waitForTimeout(1000)
|
||||
assert.ok(
|
||||
workflowDetailCalls <= 2,
|
||||
`expected at most 2 workflow detail requests without infinite refetch loop, got ${workflowDetailCalls}`,
|
||||
)
|
||||
|
||||
const firstNode = page.locator('.react-flow__node').first()
|
||||
const beforeBox = await firstNode.boundingBox()
|
||||
assert.ok(beforeBox && beforeBox.width > 100, 'first workflow node should render cleanly')
|
||||
|
||||
await firstNode.click()
|
||||
const startX = beforeBox.x + beforeBox.width / 2
|
||||
const startY = beforeBox.y + beforeBox.height / 2
|
||||
await page.mouse.move(startX, startY)
|
||||
await page.mouse.down()
|
||||
await page.mouse.move(startX + 95, startY + 50, { steps: 10 })
|
||||
await page.mouse.up()
|
||||
await page.waitForTimeout(450)
|
||||
|
||||
const afterDragBox = await firstNode.boundingBox()
|
||||
assert.ok(
|
||||
afterDragBox && Math.abs(afterDragBox.x - beforeBox.x) > 35,
|
||||
`dragged workflow node must not snap back (before.x=${beforeBox.x}, after.x=${afterDragBox?.x})`,
|
||||
)
|
||||
|
||||
const promptInputs = page.locator('.an-workflow-inspector textarea.an-advisor-textarea')
|
||||
await promptInputs.last().fill('Updated task prompt after drag')
|
||||
await page.waitForTimeout(250)
|
||||
const afterEditBox = await firstNode.boundingBox()
|
||||
assert.ok(
|
||||
afterEditBox && Math.abs(afterEditBox.x - afterDragBox.x) <= 6,
|
||||
`editing prompt must preserve dragged node coordinates (drag.x=${afterDragBox.x}, edit.x=${afterEditBox?.x})`,
|
||||
)
|
||||
|
||||
await page.locator('.an-workflow-rail button', { hasText: 'location.resolve_unknown' }).click()
|
||||
await page.waitForFunction(
|
||||
() => document.querySelectorAll('.react-flow__node').length === 5,
|
||||
null,
|
||||
{ timeout: 5000 },
|
||||
)
|
||||
await page.waitForTimeout(600)
|
||||
assert.equal(
|
||||
await page.locator('.react-flow__node').count(),
|
||||
5,
|
||||
'branched workflow must stay expanded at 5 nodes without collapsing back',
|
||||
)
|
||||
if (screenshotDir) {
|
||||
await page.screenshot({ path: `${screenshotDir}/desktop-workflows-branched.png`, fullPage: false })
|
||||
}
|
||||
// MiniMap click-to-jump: clicking right vs left side of thumbnail should pan canvas proportionally
|
||||
const miniMapSvg = page.locator('.react-flow__minimap-svg')
|
||||
await miniMapSvg.waitFor({ state: 'visible' })
|
||||
const miniMapBox = await miniMapSvg.boundingBox()
|
||||
assert.ok(miniMapBox && miniMapBox.width >= 100, 'desktop minimap SVG should render cleanly')
|
||||
const readViewportTranslateX = async () => {
|
||||
return page.evaluate(() => {
|
||||
const el = document.querySelector('.react-flow__viewport')
|
||||
if (!(el instanceof HTMLElement)) return 0
|
||||
const raw = getComputedStyle(el).transform
|
||||
const match = raw.match(/matrix\(([^)]+)\)/)
|
||||
if (!match) return 0
|
||||
const parts = match[1].split(',').map((v) => Number(v.trim()))
|
||||
return Number.isFinite(parts[4]) ? parts[4] : 0
|
||||
})
|
||||
}
|
||||
await page.mouse.click(
|
||||
miniMapBox.x + miniMapBox.width * 0.85,
|
||||
miniMapBox.y + miniMapBox.height * 0.5,
|
||||
)
|
||||
await page.waitForTimeout(300)
|
||||
const txRight = await readViewportTranslateX()
|
||||
await page.mouse.click(
|
||||
miniMapBox.x + miniMapBox.width * 0.15,
|
||||
miniMapBox.y + miniMapBox.height * 0.5,
|
||||
)
|
||||
await page.waitForTimeout(300)
|
||||
const txLeft = await readViewportTranslateX()
|
||||
assert.ok(
|
||||
txLeft > txRight + 80,
|
||||
`minimap click must pan canvas between left (${txLeft}) and right (${txRight})`,
|
||||
)
|
||||
await checkNoGlobalHorizontalOverflow(page, 'advisor workflows desktop')
|
||||
|
||||
// Check /advisor/runs row click does not re-fetch /api/v1/ai/runs
|
||||
await page.goto(urlFor('/advisor/runs'), { waitUntil: 'domcontentloaded' })
|
||||
await page.locator('.an-workflow-item').first().waitFor({ state: 'visible' })
|
||||
const runsBeforeClick = runsListCalls
|
||||
await page.locator('.an-workflow-item').nth(1).click()
|
||||
await page.waitForTimeout(300)
|
||||
assert.equal(runsListCalls, runsBeforeClick, 'clicking a run row must not re-fetch /api/v1/ai/runs')
|
||||
await checkNoGlobalHorizontalOverflow(page, 'advisor runs desktop')
|
||||
if (screenshotDir) {
|
||||
await page.screenshot({ path: `${screenshotDir}/desktop-runs.png`, fullPage: false })
|
||||
}
|
||||
|
||||
// English localization sanity sweep on all 3 Advisor pages
|
||||
await page.evaluate(() => {
|
||||
localStorage.setItem('planet-locale', 'en-US')
|
||||
})
|
||||
for (const route of ['/advisor/playground', '/advisor/workflows', '/advisor/runs']) {
|
||||
await page.goto(urlFor(route), { waitUntil: 'domcontentloaded' })
|
||||
await page.locator('.an-advisor-page').waitFor({ state: 'visible' })
|
||||
await checkNoUnexpectedEnglishCjk(page, `advisor english ${route}`)
|
||||
}
|
||||
} catch (error) {
|
||||
failures.push(`advisor desktop: ${formatSmokeError(error)}`)
|
||||
} finally {
|
||||
await context.close()
|
||||
}
|
||||
}
|
||||
|
||||
// Mobile (390x844): verify all 3 AI Advisor pages are clean, switchable, and overflow-free.
|
||||
{
|
||||
const mobileContext = await browser.newContext({ viewport: mobileViewport })
|
||||
await installApiMocks(mobileContext)
|
||||
bindConsoleCollection(mobileContext, consoleErrors)
|
||||
const page = await mobileContext.newPage()
|
||||
await seedAuthenticatedState(page)
|
||||
|
||||
try {
|
||||
smokeProgress('advisor mobile playground')
|
||||
await page.goto(urlFor('/advisor/playground'), { waitUntil: 'domcontentloaded' })
|
||||
await page.locator('.an-chat-messages').waitFor({ state: 'visible' })
|
||||
const chatBox = await page.locator('.an-chat-messages').boundingBox()
|
||||
assert.ok(chatBox && chatBox.height >= 200, `mobile playground chat area too small: ${chatBox?.height}`)
|
||||
await checkNoGlobalHorizontalOverflow(page, 'advisor playground mobile')
|
||||
if (screenshotDir) {
|
||||
await page.screenshot({ path: `${screenshotDir}/mobile-playground-chat.png`, fullPage: false })
|
||||
}
|
||||
await page.getByRole('button', { name: '添加附件' }).click()
|
||||
await page.locator('.an-attach-menu').waitFor({ state: 'visible' })
|
||||
await checkNoGlobalHorizontalOverflow(page, 'advisor playground mobile attach menu')
|
||||
await page.keyboard.press('Escape')
|
||||
await page.locator('.an-attach-menu').waitFor({ state: 'hidden' })
|
||||
await page.locator('.an-chat-messages').waitFor({ state: 'visible' })
|
||||
|
||||
smokeProgress('advisor mobile workflows')
|
||||
await page.goto(urlFor('/advisor/workflows?workflow=location.resolve_unknown'), { waitUntil: 'domcontentloaded' })
|
||||
await page.locator('.react-flow__node').first().waitFor({ state: 'visible', timeout: 10000 })
|
||||
const canvasBox = await page.locator('.an-workflow-canvas-stage').boundingBox()
|
||||
assert.ok(
|
||||
canvasBox && canvasBox.width >= 300 && canvasBox.height >= 240,
|
||||
`mobile workflow canvas too small: ${canvasBox?.width}x${canvasBox?.height}`,
|
||||
)
|
||||
await checkNoGlobalHorizontalOverflow(page, 'advisor workflows mobile canvas')
|
||||
if (screenshotDir) {
|
||||
await page.screenshot({ path: `${screenshotDir}/mobile-workflows-canvas.png`, fullPage: false })
|
||||
}
|
||||
await page.getByRole('tab', { name: /节点配置/ }).click()
|
||||
await page.locator('.an-workflow-inspector').waitFor({ state: 'visible' })
|
||||
await checkNoGlobalHorizontalOverflow(page, 'advisor workflows mobile inspector')
|
||||
await page.getByRole('tab', { name: /工作流/ }).click()
|
||||
await page.locator('.an-workflow-rail').waitFor({ state: 'visible' })
|
||||
|
||||
smokeProgress('advisor mobile runs')
|
||||
await page.goto(urlFor('/advisor/runs'), { waitUntil: 'domcontentloaded' })
|
||||
await page.locator('.an-workflow-item').first().waitFor({ state: 'visible' })
|
||||
const listBox = await page.locator('.an-runs-list-pane').boundingBox()
|
||||
assert.ok(listBox && listBox.height >= 200, `mobile runs list too small: ${listBox?.height}`)
|
||||
await checkNoGlobalHorizontalOverflow(page, 'advisor runs mobile list')
|
||||
await page.locator('.an-workflow-item').first().click()
|
||||
await page.locator('.an-runs-detail-pane').waitFor({ state: 'visible' })
|
||||
await page.getByRole('button', { name: /返回列表/ }).waitFor({ state: 'visible' })
|
||||
if (screenshotDir) {
|
||||
await page.screenshot({ path: `${screenshotDir}/mobile-runs-detail.png`, fullPage: false })
|
||||
}
|
||||
await checkNoGlobalHorizontalOverflow(page, 'advisor runs mobile detail')
|
||||
await page.getByRole('button', { name: /返回列表/ }).click()
|
||||
await page.locator('.an-runs-list-pane').waitFor({ state: 'visible' })
|
||||
} catch (error) {
|
||||
failures.push(`advisor mobile: ${formatSmokeError(error)}`)
|
||||
} finally {
|
||||
await mobileContext.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function runEarthNewsRefreshChecks(browser, failures) {
|
||||
const context = await browser.newContext({ viewport: desktopViewport })
|
||||
await installApiMocks(context)
|
||||
@@ -2229,7 +2499,7 @@ async function main() {
|
||||
await page.goto(urlFor('/'), { waitUntil: 'domcontentloaded' })
|
||||
await expectUrl(page, 'root redirects earth', (location) => location.pathname === '/earth')
|
||||
await checkNoFrameworkOverlay(page, 'root redirects earth')
|
||||
await page.locator('iframe[title="3D Earth"]').waitFor({ state: 'visible', timeout: 10000 })
|
||||
await page.locator('iframe[data-earth-iframe="true"]').waitFor({ state: 'visible', timeout: 10000 })
|
||||
} catch (error) {
|
||||
failures.push(formatSmokeError(error))
|
||||
}
|
||||
@@ -2237,7 +2507,7 @@ async function main() {
|
||||
try {
|
||||
smokeProgress('unknown public route fallback')
|
||||
await page.goto(urlFor('/definitely-not-a-real-route'), { waitUntil: 'domcontentloaded' })
|
||||
await expectVisibleText(page, '登录 Planet 控制台', 'unknown route login fallback')
|
||||
await expectVisibleText(page, '登录智能星球控制台', 'unknown route login fallback')
|
||||
await checkNoFrameworkOverlay(page, 'unknown route login fallback')
|
||||
} catch (error) {
|
||||
failures.push(formatSmokeError(error))
|
||||
@@ -2795,7 +3065,7 @@ async function main() {
|
||||
try {
|
||||
smokeProgress(`guard ${route}`, 'verbose')
|
||||
await page.goto(urlFor(route), { waitUntil: 'domcontentloaded' })
|
||||
await expectVisibleText(page, '登录 Planet 控制台', route)
|
||||
await expectVisibleText(page, '登录智能星球控制台', route)
|
||||
await checkNoFrameworkOverlay(page, route)
|
||||
} catch (error) {
|
||||
failures.push(formatSmokeError(error))
|
||||
@@ -2864,6 +3134,7 @@ async function main() {
|
||||
await runDatasourceSchedulingChecks(browser, failures, consoleErrors)
|
||||
await runDocsInteractionChecks(browser, failures, consoleErrors)
|
||||
await runAuthInteractionChecks(browser, failures, consoleErrors)
|
||||
await runAdvisorWorkflowAndMobileChecks(browser, failures, consoleErrors)
|
||||
await runEarthNewsRefreshChecks(browser, failures)
|
||||
await browser.close()
|
||||
|
||||
|
||||
Reference in new issue
Block a user