mirror of
https://github.com/ThearchyHelios/AgentLab.git
synced 2026-11-20 05:22:01 +00:00
端到端验收修复与指标出具:
- 身份与工具:登录页建第一个管理员(认人接口的 401 说明能不能建);搭建者有只读的人和组名录,选人给候选并核对名字;授权三行带标题;端点请求头名校验(空名、非法名存不进、发不出时说清原因);写入能力在工具页试运行一律演练、不发送,HTTP 状态照实说成败;写记忆不算只读、查询能力只能选同一端点上的只读能力;审批与遮罩的说法和实际规则一致;开登录时不要署名、导入和发布记登录的人;使用者不显示推演等只给搭建者的操作,403 按是否开登录说话;登录页只认一次人 - 流程与实例:图里用到的岗位(派给谁、超时升级给谁、发送确认派给谁)全部派生、没绑人的发布时报错;写外部系统的参数按能力声明的类型收拢后再算哈希和发送,收不成就不发;发起人的实例页只看这一步的状态,处理人才给待办卡;会签进度带登录核实和时间,升级后照实写规则;实例状态写流程的结论(已退回、未确认、等待核实写入结果),核实生效后不再挂失败原因;流程应用首页不派生最近封存运行的结果块,看板没数据时是安静的空态;样例⑩的金额带类型和下限、待办标题带金额,表单上下限前后端一起生效 - 看板与证据:定时任务模板加 ISO 周、上一 ISO 周、本月、上月;出处链穿过原样解析查询结果的整形节点,追不到原始数据的照实说停在哪里,样例⑨改用 cell();应用首页和版本历史都能做成应用;指标块单位不重复;版本列表带退役说明;定时任务页头跟着刷新;删视图要确认、新视图能起名;编辑器属性用中文名、术语带解释 - 指标出具(用户 2026-10-15 拍板):契约只写「指标来自」、上游没有报告撰写节点、成果里没有模型写的话时按指标出具——必需指标齐、指标输入追到原始数据、成果字段里的数回指得上才完整出具;受管级要求每个指标静态地追到原始数据(governed.metric_untraced);出具横幅和应用印章写明按指标 - 受管工作流降为已发布只给管理员(Q8 顺延,服务端同样拦);工作流接口带当前发布版的级别,画布上改过之后也认得出受管工作流
This commit is contained in:
+161
-16
@@ -10,7 +10,9 @@
|
||||
// 有视图在生成时自动重取;
|
||||
// - 入口页:必填没填本地拦下、错误挂到字段下面;服务端 422 的 {errors:[{path, code, message}]} 按 path 挂回字段,
|
||||
// 对不上字段的列在表单顶上;⌘/Ctrl+Enter 发起;成功后进实例页;需升级时不让发起;
|
||||
// - 实例页:状态、印章、进度、本实例的待办卡(就地处理)、动作状态(哈希前 8 位、环境);
|
||||
// - 实例页:状态(服务端给的说法:结果未知写「等待核实写入结果」)、印章、进度(结果未知的那一步不写「完成」)、
|
||||
// 本实例的待办卡(就地处理);不是处理人的待办表单只画这一步的状态、不去取待办;动作状态(哈希前 8 位、环境;
|
||||
// 结果未知的经过记一笔,不当失败原因);
|
||||
// - 窄屏(390px)不出横向滚动。
|
||||
//
|
||||
// 页面是真页面(走真的应用外壳),/api/apps/**、/api/tasks/**、指标链接口在浏览器层答掉,数据是这里虚构的
|
||||
@@ -77,9 +79,16 @@ const HOME = {
|
||||
tree: [
|
||||
{ id: 'stamp', type: 'stamp', props: {}, data: { view: 'wk', state: 'ok', stamp: STAMP } },
|
||||
{ id: 'kpis', type: 'columns', props: { count: 2 }, children: [
|
||||
{ id: 'gmv', type: 'metric', props: { label: '销售额' },
|
||||
data: { state: 'ok', text: '45.68 万元', name: '销售额', unit: '', evidence: metricEv('gmv') } },
|
||||
// 绑定指标:服务端交来的字已经按口径卡带着单位(render_metric),data.unit 说明是哪个单位;派生时属性里也写了单位
|
||||
{ id: 'gmv', type: 'metric', props: { label: '销售额', unit: '万元' },
|
||||
data: { state: 'ok', text: '45.68 万元', name: '销售额', unit: '万元', evidence: metricEv('gmv') } },
|
||||
{ id: 'orders', type: 'metric', props: { label: '订单数' }, data: { state: 'ok', text: '1,284 单', name: '订单数' } },
|
||||
// 绑定单元格:字不带单位(render_cell),单位是搭建者在属性里填的
|
||||
{ id: 'shops', type: 'metric', props: { label: '门店数', unit: '家' },
|
||||
data: { state: 'ok', text: '128', evidence: { run_id: RUN, kind: 'cell', node: 'q1', artifact: 'art_q1', eid: 'ev:cell:shops' } } },
|
||||
// 绑定指标、口径卡没写单位:服务端照样带 unit(空串),字里没有单位,写搭建者在属性里填的
|
||||
{ id: 'aov', type: 'metric', props: { label: '客单价', unit: '元' },
|
||||
data: { state: 'ok', text: '356.2', name: '客单价', unit: '', evidence: metricEv('aov') } },
|
||||
] },
|
||||
{ id: 'trend', type: 'series', props: { label: '销售额趋势' }, data: {
|
||||
state: 'ok', mode: 'incomparable', unit: '万元',
|
||||
@@ -126,7 +135,8 @@ const CLAIM_HOME = {
|
||||
|
||||
const TASK = {
|
||||
id: 'task_fin', approval_id: 'ap_fin', run_id: 'run_claim_1', node_id: 'finance', app_id: 'app_claim', app_name: '报销审批',
|
||||
app_version: 2, workflow_name: '报销流程', kind: 'approve', title: '财务审批', form: null, policy: { kind: 'all' },
|
||||
app_version: 2, workflow_name: '报销流程', instance_title: '张三 的报销', kind: 'approve', title: '财务审批', form: null,
|
||||
policy: { kind: 'all' },
|
||||
status: 'pending', due_at: new Date(Date.now() + 3600_000).toISOString(), escalation_level: 0,
|
||||
payload: { kind: 'human_node', message: '张三报销差旅 **1,200 元**,请审批' },
|
||||
assignments: [
|
||||
@@ -141,6 +151,8 @@ const TASK = {
|
||||
const INSTANCE = {
|
||||
run_id: 'run_claim_1', title: '张三 的报销', entry_id: 'apply', status: 'interrupted', started_by: '张三',
|
||||
created_at: ago(1800_000), finished_at: null, pending_tasks: 1, tier: null,
|
||||
// 给人看的状态服务端说(apps/resolve.instance_state):结果未知时是在等核实,不是「等待审批」
|
||||
status_code: 'waiting', status_text: '等待核实写入结果',
|
||||
view: {
|
||||
format: 'agentlab.view/1',
|
||||
app: { id: 'app_claim', name: '报销审批', version: 2, level: 'published', needs_upgrade: false },
|
||||
@@ -148,30 +160,65 @@ const INSTANCE = {
|
||||
sources: { inst: { state: 'running', run_id: 'run_claim_1', stamp: null, message: '正在运行,完成后刷新页面' } },
|
||||
tree: [
|
||||
{ id: 'inst_header', type: 'instance_header', props: {}, data: {
|
||||
state: 'ok', run_id: 'run_claim_1', title: '张三 的报销', status: 'interrupted', status_text: '等待处理',
|
||||
started_by: '张三', created_at: ago(1800_000), finished_at: null, pending_tasks: 1, stamp: null } },
|
||||
state: 'ok', run_id: 'run_claim_1', title: '张三 的报销', status: 'interrupted', status_code: 'waiting',
|
||||
status_text: '等待核实写入结果', started_by: '张三', created_at: ago(1800_000), finished_at: null, pending_tasks: 1,
|
||||
stamp: null } },
|
||||
{ id: 'inst_timeline', type: 'instance_timeline', props: {}, data: {
|
||||
state: 'ok', status: 'interrupted', status_text: '等待处理', steps: [
|
||||
{ node: 'input', title: '报销单', state: 'done', at: ago(1790_000) },
|
||||
{ node: 'finance', title: '财务审批', state: 'waiting', at: ago(1700_000) },
|
||||
state: 'ok', status: 'interrupted', status_code: 'waiting', status_text: '等待核实写入结果', steps: [
|
||||
{ node: 'input', title: '报销单', state: 'done', text: '完成', at: ago(1790_000) },
|
||||
{ node: 'finance', title: '财务审批', state: 'waiting', text: '等待审批', at: ago(1700_000) },
|
||||
{ node: 'pay', title: '付款', state: 'unknown', text: '结果未知,等待核实', at: ago(600_000) },
|
||||
] } },
|
||||
// 发起人不是这条待办的处理人:服务端解析时判定(handler 为假),只给这一步的状态,界面不去取待办
|
||||
{ id: 'review', type: 'task_form', props: {}, bind: { task: 'review' }, data: {
|
||||
state: 'ok', handler: false, task_ui: {},
|
||||
task: { id: 'task_other', run_id: 'run_claim_1', node_id: 'review', kind: 'approve', title: '复核', status: 'pending',
|
||||
due_at: new Date(Date.now() + 3600_000).toISOString(), policy: { kind: 'all' }, escalation_level: 1,
|
||||
created_at: ago(1700_000), instance_title: '张三 的报销', form: null },
|
||||
assignments: [
|
||||
{ id: 'r1', principal_kind: 'user', principal: 'lisi', source: 'slot:finance', status: 'responded', responded_by: 'lisi',
|
||||
responded_at: ago(900_000), decision: 'approve', verified: true },
|
||||
{ id: 'r2', principal_kind: 'user', principal: 'wangwu', source: 'slot:finance', status: 'pending', responded_by: null,
|
||||
responded_at: null, decision: null, verified: false },
|
||||
{ id: 'r3', principal_kind: 'user', principal: 'zhaoliu', source: 'escalation', status: 'pending', responded_by: null,
|
||||
responded_at: null, decision: null, verified: false },
|
||||
],
|
||||
progress: { policy: 'all', voters: 2, need: 2, agreed: 1, rejected: 0,
|
||||
escalation: { slot: 'director', assignees: [{ kind: 'user', name: 'zhaoliu' }], decided: null, by: null } },
|
||||
my_response: null } },
|
||||
{ id: 'inst_tasks', type: 'task_list', props: { scope: 'instance' }, data: { scope: 'instance', items: [] } },
|
||||
{ id: 'pay', type: 'action_status', props: { label: '付款' }, data: { state: 'ok', node: 'pay', records: [
|
||||
{ id: 'act1', state: 'unknown', environment: 'prod', attempt: 1, payload_hash: '9c1e44ab', error: '请求超时' },
|
||||
{ id: 'act1', state: 'unknown', environment: 'prod', attempt: 1, payload_hash: '9c1e44ab',
|
||||
note: '发送时没有拿到确定的结果(请求超时),等待核实:在外部系统里可能已经生效,不会自动重发' },
|
||||
] } },
|
||||
],
|
||||
forms: {}, problems: [],
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
* 指标链照服务端的形状(api/evidence 的 _metric_chain)。销售额按位置取数据整形的结果(vars.q.rows[0][0]),整形节点不是
|
||||
* 原样解析,出处追到它为止:untraced 写明停在哪个节点。复算照样一致——「有出处」和「追到原始数据」是两件事
|
||||
*/
|
||||
const UNTRACED_INPUT = { path: 'vars.q.rows[0][0]', value: 456800, node_id: 'parse', via: 'transform', field: 'rows[0][0]', status: 'ok' }
|
||||
const METRIC_CHAIN = {
|
||||
chain: [
|
||||
{ step: 'metric', node_id: 'kpi', metric: 'gmv', name: '销售额', value: 456800, formula: 'sum(amount)',
|
||||
substituted: 'sum(…) = 456800', inputs: [] },
|
||||
{ step: 'metric', node_id: 'kpi', metric: 'gmv', name: '销售额', value: 456800, expression: 'vars.q.rows[0][0]',
|
||||
substituted: '456800', recompute_ok: true, inputs: [UNTRACED_INPUT],
|
||||
untraced: [{ path: 'vars.q.rows[0][0]', node_id: 'parse', label: '解析查询结果', type: 'transform' }] },
|
||||
{ step: 'input', ...UNTRACED_INPUT },
|
||||
],
|
||||
seal: { sealed: true, ok: true, covered: true },
|
||||
redacted: { columns: [] },
|
||||
}
|
||||
/** 同一个指标,整形节点原样解析查询结果:按位置取的格卡上记成单元格取数,穿过整形节点接上查询快照 */
|
||||
const TRACED_INPUT = { path: 'vars.q.rows[0][0]', value: 456800, node_id: 'fetch', via: 'tool_cell', through: 'parse',
|
||||
through_label: '解析查询结果', artifact: 'art_q1', locator: { row: 0, column: 'gmv' }, eid: 'ev:cell:gmv', status: 'verified',
|
||||
query: 'Q1', cell: 'Q1.r0.gmv' }
|
||||
const METRIC_CHAIN_TRACED = {
|
||||
...METRIC_CHAIN,
|
||||
chain: [{ ...METRIC_CHAIN.chain[0], inputs: [TRACED_INPUT], untraced: [] }, { step: 'input', ...TRACED_INPUT }],
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- 浏览器
|
||||
|
||||
@@ -187,6 +234,7 @@ async function open({ width = 1280, height = 900, state }) {
|
||||
const r = route.request()
|
||||
const url = new URL(r.url())
|
||||
const p = url.pathname
|
||||
if (r.method() === 'GET' && p.startsWith('/api/tasks/')) (state.taskReads ??= []).push(p)
|
||||
if (r.method() !== 'GET') {
|
||||
state.writes.push({ method: r.method(), path: p, body: r.postData() })
|
||||
if (p === '/api/apps/app_claim/entries/apply') {
|
||||
@@ -204,7 +252,7 @@ async function open({ width = 1280, height = 900, state }) {
|
||||
}
|
||||
return route.fulfill({ status: 503, json: { detail: '检查脚本拦下了写请求' } })
|
||||
}
|
||||
if (p === '/api/auth/me') return route.fulfill({ json: { mode: 'off', username: null, display_name: null, role: 'admin', groups: [], verified: false } })
|
||||
if (p === '/api/auth/me') return route.fulfill({ json: state.me ?? { mode: 'off', username: null, display_name: null, role: 'admin', groups: [], verified: false } })
|
||||
if (p === '/api/apps') return route.fulfill({ json: { items: APPS } })
|
||||
if (p === '/api/apps/app_weekly/pages/home') {
|
||||
state.pageHits = (state.pageHits ?? 0) + 1
|
||||
@@ -216,7 +264,7 @@ async function open({ width = 1280, height = 900, state }) {
|
||||
if (p === '/api/apps/app_claim/instances/run_claim_1') return route.fulfill({ json: INSTANCE })
|
||||
if (p === `/api/runs/${RUN}/evidence/metrics/kpi/gmv`) {
|
||||
state.chainHits = (state.chainHits ?? 0) + 1
|
||||
return route.fulfill({ json: METRIC_CHAIN })
|
||||
return route.fulfill({ json: state.traced ? METRIC_CHAIN_TRACED : METRIC_CHAIN })
|
||||
}
|
||||
if (p === '/api/tasks/count') return route.fulfill({ json: { mine: 1, apps: 1, other: 0 } })
|
||||
if (p === '/api/tasks') return route.fulfill({ json: { items: url.searchParams.get('status') === 'resolved' ? [] : [TASK] } })
|
||||
@@ -241,6 +289,9 @@ await section('首页:三个页签、关登录说明、需升级', async () =>
|
||||
check('关登录时挂一行说明(自报署名)', /未开启登录/.test(await page.locator('[data-auth-off]').innerText()))
|
||||
check('待办按应用分组', (await page.locator('[data-inbox-group="app_claim"]').count()) === 1)
|
||||
check('会签的待办写进度', /1\/2 已同意/.test(await page.locator('[data-inbox-signoffs]').innerText()))
|
||||
check('待办一行写所属实例和开出的时间(同标题的分得开)',
|
||||
/张三 的报销 · .*发起/.test(await page.locator('[data-inbox-meta]').first().innerText()),
|
||||
await page.locator('[data-inbox-meta]').first().innerText())
|
||||
await tabs.getByRole('tab', { name: /应用/ }).click()
|
||||
check('页签记在地址上', /tab=apps/.test(page.url()), page.url())
|
||||
await page.locator('[data-app]').first().waitFor({ timeout: 5000 })
|
||||
@@ -249,11 +300,24 @@ await section('首页:三个页签、关登录说明、需升级', async () =>
|
||||
check('能管理的应用有「编辑」,只能用的没有',
|
||||
(await page.locator('[data-app="app_weekly"] a[href$="/edit"]').count()) === 1
|
||||
&& (await page.locator('[data-app="app_claim"] a[href$="/edit"]').count()) === 0)
|
||||
// 新建应用是新建向导的起点:搭建者及以上在页头看得到(关登录时所有人等同管理员),点进去先选工作流和版本
|
||||
const create = page.locator('header [data-app-create]')
|
||||
check('页头有「新建应用」,链到新建页(不带工作流、版本:先选)', await create.count() === 1
|
||||
&& (await create.innerText()).includes('新建应用') && await create.getAttribute('href') === '/apps/new/edit',
|
||||
`${await create.count()} | ${await create.getAttribute('href').catch(() => '')}`)
|
||||
await page.getByRole('tab', { name: '我发起的' }).click()
|
||||
await page.locator('[data-mine] [data-instance]').first().waitFor({ timeout: 5000 })
|
||||
check('我发起的:合各应用的实例,链到实例页',
|
||||
(await page.locator('[data-mine] a[href="/apps/app_claim/i/run_claim_1"]').count()) === 1)
|
||||
check('没有未捕获的运行时错误', page.errors.length === 0, page.errors[0] ?? '')
|
||||
|
||||
// 开了登录的使用者:没有「新建应用」(搭建是搭建者及以上的事)
|
||||
const user = { writes: [], me: { mode: 'local', username: 'zhangsan', display_name: '张三', role: 'user', groups: [], verified: true } }
|
||||
const u = await open({ state: user })
|
||||
await u.page.goto(`${WEB}/apps?tab=apps`)
|
||||
await u.page.locator('[data-app]').first().waitFor({ timeout: 15000 })
|
||||
check('使用者的应用首页没有「新建应用」', await u.page.locator('[data-app-create], [data-app-create-empty]').count() === 0)
|
||||
check('……没有未捕获的运行时错误', u.page.errors.length === 0, u.page.errors[0] ?? '')
|
||||
})
|
||||
|
||||
// ---------------------------------------------------------------- 应用页
|
||||
@@ -272,11 +336,25 @@ await section('应用页:印章、指标、出处、趋势、表格、未知
|
||||
|
||||
const gmv = page.locator('[data-node="gmv"] button[data-evidence="metric"]')
|
||||
check('指标块的数是按钮', (await gmv.innerText()).includes('45.68 万元'))
|
||||
const gmvText = await page.locator('[data-node="gmv"] [data-component="metric"]').innerText()
|
||||
check('绑定指标:单位只写在数里,下面不再重复一行', gmvText.split('万元').length === 2, gmvText.replace(/\s+/g, ' '))
|
||||
const shops = page.locator('[data-node="shops"] [data-component="metric"]')
|
||||
check('绑定单元格:数不带单位,单位写在下面', (await shops.innerText()).replace(/\s+/g, ' ').trim() === '门店数 128 家',
|
||||
(await shops.innerText()).replace(/\s+/g, ' '))
|
||||
const aov = (await page.locator('[data-node="aov"] [data-component="metric"]').innerText()).replace(/\s+/g, ' ').trim()
|
||||
check('绑定指标、口径卡没写单位:写搭建者在属性里填的单位,不吞掉', aov === '客单价 356.2 元', aov)
|
||||
check('没有出处的数照实标「无证据」', (await page.locator('[data-node="orders"] [data-evidence="none"]').innerText()).includes('无证据'))
|
||||
await gmv.click()
|
||||
const panel = page.locator('[data-evidence-panel]')
|
||||
check('点数字打开出处面板', await panel.waitFor({ timeout: 5000 }).then(() => true, () => false))
|
||||
check('走的是指标链接口', state.chainHits === 1, `${state.chainHits ?? 0} 次`)
|
||||
// 有出处(口径卡确定性复算一致)和追到原始数据分开说:追不到的不能只写「有出处」
|
||||
const origin = panel.locator('[data-ev-origin]')
|
||||
check('复算一致照写', (await panel.locator('[data-ev-recompute]').getAttribute('data-ev-recompute')) === 'ok')
|
||||
check('输入追不到原始数据:照实说追到哪个节点为止', await origin.getAttribute('data-ev-origin') === 'untraced'
|
||||
&& (await origin.innerText()).includes('vars.q.rows[0][0] 的出处追到「解析查询结果」(数据整形)为止,没追到原始数据'),
|
||||
await origin.innerText().catch(() => ''))
|
||||
check('……指标那一行另挂「未追到原始数据」', (await panel.locator('[data-ev-untraced-chip]').innerText()) === '未追到原始数据')
|
||||
await page.keyboard.press('Escape')
|
||||
|
||||
const series = page.locator('[data-component="series"]')
|
||||
@@ -300,6 +378,21 @@ await section('应用页:印章、指标、出处、趋势、表格、未知
|
||||
check('服务端解析出错的组件列在顶上', (await page.locator('[data-view-problems]').innerText()).includes('解析出错'))
|
||||
check('出错的组件就地说明', (await page.locator('[data-node="broken"] [data-block-state="error"]').count()) === 1)
|
||||
check('没有未捕获的运行时错误', page.errors.length === 0, page.errors[0] ?? '')
|
||||
|
||||
// 整形节点原样解析查询结果:按位置取的格穿过它接上查询快照,面板写明经过哪个节点、输入都追到了原始数据
|
||||
const traced = { writes: [], traced: true }
|
||||
const t = await open({ state: traced })
|
||||
await t.page.goto(`${WEB}/apps/app_weekly`)
|
||||
await t.page.locator('[data-node="gmv"] button[data-evidence="metric"]').click()
|
||||
const tp = t.page.locator('[data-evidence-panel]')
|
||||
await tp.locator('[data-ev-origin]').waitFor({ timeout: 5000 })
|
||||
check('穿过原样解析的整形节点:输入都追到了原始数据,不挂「未追到」', await tp.locator('[data-ev-origin]').getAttribute('data-ev-origin') === 'traced'
|
||||
&& (await tp.locator('[data-ev-origin]').innerText()).includes('输入都追到了原始数据')
|
||||
&& await tp.locator('[data-ev-untraced-chip]').count() === 0)
|
||||
const source = tp.locator('[data-ev-source="vars.q.rows[0][0]"]')
|
||||
check('……输入来源写明经过哪个整形节点、落在哪一格', (await source.innerText()).includes('经「解析查询结果」原样解析')
|
||||
&& (await source.innerText()).includes('与快照一致'), (await source.innerText().catch(() => '')).replace(/\s+/g, ' '))
|
||||
check('……没有未捕获的运行时错误', t.page.errors.length === 0, t.page.errors[0] ?? '')
|
||||
})
|
||||
|
||||
await section('应用页:视图生成中自动重取、需升级提示', async () => {
|
||||
@@ -336,8 +429,13 @@ await section('入口:本地校验、422 挂回字段、发起后进实例页'
|
||||
check('错误挂在字段下面', (await form.locator('[data-field="amount"] [data-field-error="required"]').count()) === 1)
|
||||
await form.locator('[data-field="amount"] input').fill('1.')
|
||||
check('数字框能打出小数点', (await form.locator('[data-field="amount"] input').inputValue()) === '1.')
|
||||
await form.locator('[data-field="amount"] input').fill('9000')
|
||||
await form.locator('[data-field="amount"] input').fill('-5')
|
||||
await form.locator('[data-field="reason"] textarea').fill('出差深圳')
|
||||
await page.locator('[data-entry-submit]').click()
|
||||
check('金额低于下限(minimum)本地拦下,不发请求',
|
||||
(await form.locator('[data-field="amount"] [data-field-error="minimum"]').count()) === 1
|
||||
&& !state.writes.some((w) => w.path.endsWith('/entries/apply')))
|
||||
await form.locator('[data-field="amount"] input').fill('9000')
|
||||
state.reject422 = true
|
||||
await page.locator('[data-entry-submit]').click()
|
||||
await form.locator('[data-field="amount"] [data-field-error="maximum"]').waitFor({ timeout: 5000 }).catch(() => {})
|
||||
@@ -369,11 +467,25 @@ await section('实例页:状态、进度、待办卡、动作状态', async ()
|
||||
await page.goto(`${WEB}/apps/app_claim/i/run_claim_1`)
|
||||
await page.locator('[data-view-renderer]').waitFor({ timeout: 15000 })
|
||||
check('写出发起人', (await page.locator('[data-instance-page]').innerText()).includes('由「张三」发起'))
|
||||
check('进度按节点列出', (await page.locator('[data-timeline-step]').count()) === 2)
|
||||
check('实例状态按服务端的说法写(结果未知:等待核实写入结果,不是「等待审批」)',
|
||||
(await page.locator('[data-component="instance_header"] [data-status]').innerText()).includes('等待核实写入结果')
|
||||
&& !(await page.locator('[data-component="instance_header"]').innerText()).includes('等待审批'))
|
||||
check('进度按节点列出', (await page.locator('[data-timeline-step]').count()) === 3)
|
||||
check('结果未知的那一步写「结果未知」,不写「完成」',
|
||||
(await page.locator('[data-timeline-step="unknown"]').innerText()).includes('结果未知'))
|
||||
const other = page.locator('[data-component="task_form"][data-task-handler="no"]')
|
||||
check('不是处理人:只画这一步的状态(在等谁、会签进度、升级后的规则),不出红框',
|
||||
(await other.locator('[data-task-state="pending"]').count()) === 1 && (await other.locator('[role="alert"]').count()) === 0
|
||||
&& (await other.innerText()).includes('等待 wangwu、zhaoliu 处理') && (await other.innerText()).includes('1/2 已同意')
|
||||
&& (await other.innerText()).includes('已升级给岗位「director」'), (await other.innerText()).replace(/\n/g, ' '))
|
||||
check('……也不去取那条待办', !(state.taskReads ?? []).includes('/api/tasks/task_other'), JSON.stringify(state.taskReads))
|
||||
await page.locator('[data-component="task_list"] [data-task]').waitFor({ timeout: 5000 })
|
||||
check('本实例的待办就地处理(完整的待办卡)', (await page.locator('[data-component="task_list"] [data-task-approve]').count()) === 1)
|
||||
check('动作状态写结果未知和环境', /结果未知/.test(await page.locator('[data-action="unknown"]').innerText())
|
||||
&& /生产环境/.test(await page.locator('[data-action="unknown"]').innerText()))
|
||||
check('结果未知的经过记一笔,不当「失败原因」',
|
||||
(await page.locator('[data-action="unknown"] [data-action-error]').count()) === 0
|
||||
&& /不会自动重发/.test(await page.locator('[data-action="unknown"] [data-action-note]').innerText()))
|
||||
check('关登录(等同管理员)时接运行流', (await page.locator('[data-instance-follow]').getAttribute('data-instance-follow')) === 'stream')
|
||||
check('没有未捕获的运行时错误', page.errors.length === 0, page.errors[0] ?? '')
|
||||
})
|
||||
@@ -388,6 +500,39 @@ await section('窄屏:390px 不出横向滚动', async () => {
|
||||
}
|
||||
})
|
||||
|
||||
// 推演、请模型判断只给搭建者及以上(接口同样只给):使用者的出处面板里不挂这些按钮,不让人点了再被拒(V1-93)。
|
||||
// 同一个面板、关登录时照常有「推演」,两头对照
|
||||
await section('使用者的出处面板:不给推演,遮罩说明按使用者说', async () => {
|
||||
// 指标链带一列遮罩:面板底下的遮罩说明对谁说什么
|
||||
const masked = (page) => page.route(`**/api/runs/${RUN}/evidence/metrics/kpi/gmv`,
|
||||
(route) => route.fulfill({ json: { ...METRIC_CHAIN, redacted: { columns: ['phone'] } } }))
|
||||
const off = await open({ state: { writes: [] } })
|
||||
await masked(off.page)
|
||||
await off.page.goto(`${WEB}/apps/app_weekly`)
|
||||
await off.page.locator('[data-node="gmv"] button[data-evidence="metric"]').click()
|
||||
const offPanel = off.page.locator('[data-evidence-panel]')
|
||||
await offPanel.locator('[data-ev-metric]').waitFor({ timeout: 8000 })
|
||||
check('关登录(所有人等同管理员):指标上有「推演」', await offPanel.locator('[data-whatif-toggle]').count() === 1)
|
||||
check('关登录:遮罩只减少暴露,不是安全边界', (await offPanel.locator('[data-ev-mask-note]').innerText().catch(() => ''))
|
||||
.includes('遮罩只减少暴露,不是安全边界'))
|
||||
|
||||
const state = { writes: [], me: { mode: 'local', username: 'zhangsan', display_name: '张三', role: 'user', groups: [], verified: true } }
|
||||
const { page } = await open({ state })
|
||||
await masked(page)
|
||||
await page.goto(`${WEB}/apps/app_weekly`)
|
||||
await page.locator('[data-node="gmv"] button[data-evidence="metric"]').click()
|
||||
const panel = page.locator('[data-evidence-panel]')
|
||||
await panel.locator('[data-ev-metric]').waitFor({ timeout: 8000 })
|
||||
check('使用者:出处照常看,没有「推演」', await panel.locator('[data-whatif-toggle]').count() === 0)
|
||||
check('使用者:没有「请模型判断」', await panel.locator('[data-ev-judge-ask]').count() === 0)
|
||||
const note = panel.locator('[data-ev-mask-note]')
|
||||
check('使用者:遮罩对他是边界,不说「完整快照中仍为原值」', await note.getAttribute('data-ev-mask-note') === 'user'
|
||||
&& (await note.innerText()).includes('原值不对使用者开放') && !(await note.innerText()).includes('仍为原值'), await note.innerText().catch(() => ''))
|
||||
check('没有发出只给搭建者的请求', !state.writes.some((w) => /whatif|evidence\/judge|inquiries/.test(w.path)),
|
||||
state.writes.map((w) => w.path).join(','))
|
||||
check('没有未捕获的运行时错误', page.errors.length === 0, page.errors[0] ?? '')
|
||||
})
|
||||
|
||||
await browser.close()
|
||||
console.log(failed ? `\n✗ ${failed} 项未通过` : '\n✓ 全部通过')
|
||||
process.exit(failed ? 1 : 0)
|
||||
|
||||
Reference in New Issue
Block a user