mirror of
https://github.com/ThearchyHelios/AgentLab.git
synced 2026-11-18 09:11:59 +00:00
复测收尾:账号密码登录时应用检查和授权接口核对名录(没有的、已停用的报错或拒收,单点登录只提醒),名录口径收成 auth/directory 一处;受管发布版在页头、版本历史、选择器、发布前检查里按发布级别写,草稿和发布版内容相同时照实说;写入能力在工具库写「只演练」;印章的「截至」只写一次;走驳回出口到达的结局不用成功样式;停着等人时说在等哪一步,同页已有会签进度时待办状态不再画一遍,名单写显示名;应用编辑器可以归档(写清后果),已归档的应用拒收草稿修改和发布;受管发布成功的提示写明受管;权限测试按 id 取应用,不撞别的测试留下的同名应用
This commit is contained in:
@@ -101,7 +101,7 @@ const LINT = [
|
||||
|
||||
async function open({ path = '/apps/app-ae/edit/pages', publish = 'disposition', stream = [], spec = SPEC, lint = LINT,
|
||||
versions = [], versionSpec = null, hooks = [], conversation = { id: 'conv-ae', kind: 'app', title: '', turns: [] },
|
||||
backfill = undefined, plan = null } = {}) {
|
||||
backfill = undefined, plan = null, status = 'active' } = {}) {
|
||||
const ctx = await browser.newContext({ viewport: { width: 1440, height: 900 } })
|
||||
opened.add(ctx)
|
||||
await ctx.addInitScript(() => { try { localStorage.setItem('agentlab_actor', '检查脚本') } catch { /* noop */ } })
|
||||
@@ -110,11 +110,12 @@ async function open({ path = '/apps/app-ae/edit/pages', publish = 'disposition',
|
||||
const errors = []
|
||||
page.on('pageerror', (e) => errors.push(e.message))
|
||||
const json = (route, body, status = 200) => route.fulfill({ status, contentType: 'application/json', body: JSON.stringify(body) })
|
||||
const app = { id: 'app-ae', name: SPEC.name, description: '', icon: 'app', status: 'active', published_version: 2, level: 'published',
|
||||
const app = { id: 'app-ae', name: SPEC.name, description: '', icon: 'app', status, published_version: 2, level: 'published',
|
||||
needs_upgrade: false, pending_tasks: 0, my_role: 'manage', updated_at: '2026-10-10T02:00:00Z', draft: clone(spec),
|
||||
draft_bindings: { slots: {} }, created_by: '检查脚本', ...(backfill ? { backfill } : {}) }
|
||||
const state = { app, patches: [], lints: 0, publishes: [], derives: [], creates: [], streams: [], pages: [],
|
||||
hooks: clone(hooks), rotates: [], hookPatches: [], hookDeletes: [], backfills: [], turns: [], turnPatches: [], conversations: 0 }
|
||||
hooks: clone(hooks), rotates: [], hookPatches: [], hookDeletes: [], backfills: [], turns: [], turnPatches: [], conversations: 0,
|
||||
archives: 0 }
|
||||
|
||||
await page.route(/\/api\//, (route) => {
|
||||
const req = route.request()
|
||||
@@ -151,6 +152,11 @@ async function open({ path = '/apps/app-ae/edit/pages', publish = 'disposition',
|
||||
state.app = { ...state.app, ...(body.draft ? { draft: body.draft } : {}), ...(body.draft_bindings ? { draft_bindings: body.draft_bindings } : {}) }
|
||||
return json(route, state.app)
|
||||
}
|
||||
if (sub === 'archive') {
|
||||
state.archives += 1
|
||||
state.app = { ...state.app, status: 'archived' }
|
||||
return json(route, state.app)
|
||||
}
|
||||
if (sub === 'lint') {
|
||||
state.lints += 1
|
||||
return json(route, { level: null, issues: lint })
|
||||
@@ -603,6 +609,37 @@ await section('岗位与授权:三档各写标题和说明;搭建者从名
|
||||
check('名录只取一次,几个选择器共用', asked.length === 1, String(asked.length))
|
||||
})
|
||||
|
||||
// 归档(api/apps.py 的 archive_app):后果照服务端的实际行为写;没有恢复的接口,界面上也不给「恢复」
|
||||
await section('归档:确认框写明后果;归档后顶部写明已归档,保存和发布置灰', async () => {
|
||||
const { page, state, errors } = await open({ path: '/apps/app-ae/edit/publish' })
|
||||
const archive = page.locator('[data-app-archive]')
|
||||
check('编辑器给「归档」', await archive.count() === 1)
|
||||
await archive.click()
|
||||
const dlg = page.getByRole('dialog')
|
||||
await dlg.waitFor({ timeout: 3000 }).catch(() => {})
|
||||
const text = (await dlg.innerText().catch(() => '')).replace(/\s+/g, ' ')
|
||||
check('确认框写明后果:列表不再列出、入口不再接受新实例、钩子拒收、进行中的照常走完、不能再改和发布、没有恢复',
|
||||
['应用列表里不再列出', '入口不再接受新实例', '入站钩子一律拒收', '进行中的实例照常走完', '不能再修改草稿、发布新版本', '没有恢复']
|
||||
.every((k) => text.includes(k)), text)
|
||||
await dlg.getByRole('button', { name: '取消' }).click()
|
||||
await page.waitForTimeout(200)
|
||||
check('……取消就不归档', state.archives === 0 && await page.locator('[data-app-archived]').count() === 0)
|
||||
await archive.click()
|
||||
await page.getByRole('dialog').getByRole('button', { name: '归档应用' }).click()
|
||||
check('确认后发归档请求', await waitFor(page, async () => state.archives === 1))
|
||||
const banner = page.locator('[data-app-archived]')
|
||||
check('归档后顶部写明已归档', await waitFor(page, async () => await banner.count() === 1)
|
||||
&& (await banner.innerText()).includes('已归档'))
|
||||
check('……不再给「归档」', await page.locator('[data-app-archive]').count() === 0)
|
||||
check('……保存和发布置灰', await page.locator('[data-app-save]').isDisabled() && await page.locator('[data-app-publish-submit]').isDisabled()
|
||||
&& ((await page.locator('[data-app-publish-submit]').getAttribute('title')) ?? '').includes('已归档'))
|
||||
check('没有运行时报错', errors.length === 0, errors.slice(0, 2).join(' | '))
|
||||
|
||||
const again = await open({ path: '/apps/app-ae/edit/pages', status: 'archived' })
|
||||
check('打开已归档的应用:一进来就写明已归档,没有「归档」,保存置灰', await again.page.locator('[data-app-archived]').count() === 1
|
||||
&& await again.page.locator('[data-app-archive]').count() === 0 && await again.page.locator('[data-app-save]').isDisabled())
|
||||
})
|
||||
|
||||
check('检查没有写库(兜底拦下的写请求)', writes.length === 0, writes.slice(0, 4).join('、'))
|
||||
console.log(failed ? `\n${failed} 项未通过` : '\n全部通过')
|
||||
await browser.close()
|
||||
|
||||
+33
-10
@@ -148,7 +148,16 @@ const TASK = {
|
||||
can_respond: true, outcome: null, resolved_by: null, resolved_at: null, created_at: ago(1800_000),
|
||||
}
|
||||
|
||||
const INSTANCE = {
|
||||
/** 会签组件和待办表单绑同一条待办:页面解析给的数据一样,只有待办表单带 signoffs_on_page */
|
||||
function withSignoffsData(instance) {
|
||||
const tree = instance.view.tree
|
||||
const form = tree.find((n) => n.id === 'review')
|
||||
const { signoffs_on_page: _, ...data } = form.data
|
||||
tree.find((n) => n.id === 'signs').data = data
|
||||
return instance
|
||||
}
|
||||
|
||||
const INSTANCE = withSignoffsData({
|
||||
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):结果未知时是在等核实,不是「等待审批」
|
||||
@@ -157,7 +166,7 @@ const INSTANCE = {
|
||||
format: 'agentlab.view/1',
|
||||
app: { id: 'app_claim', name: '报销审批', version: 2, level: 'published', needs_upgrade: false },
|
||||
page: { id: 'instance', title: '实例' }, pages: [{ id: 'home', title: '报销' }, { id: 'instance', title: '实例' }],
|
||||
sources: { inst: { state: 'running', run_id: 'run_claim_1', stamp: null, message: '正在运行,完成后刷新页面' } },
|
||||
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_code: 'waiting',
|
||||
@@ -169,9 +178,11 @@ const INSTANCE = {
|
||||
{ node: 'finance', title: '财务审批', state: 'waiting', text: '等待审批', at: ago(1700_000) },
|
||||
{ node: 'pay', title: '付款', state: 'unknown', text: '结果未知,等待核实', at: ago(600_000) },
|
||||
] } },
|
||||
// 发起人不是这条待办的处理人:服务端解析时判定(handler 为假),只给这一步的状态,界面不去取待办
|
||||
// 发起人不是这条待办的处理人:服务端解析时判定(handler 为假),只给这一步的状态,界面不去取待办。同一页上另有绑
|
||||
// 同一条待办的会签组件(signs):服务端说一声(signoffs_on_page),待办表单不再画会签进度。人名服务端给显示名(people)
|
||||
{ id: 'review', type: 'task_form', props: {}, bind: { task: 'review' }, data: {
|
||||
state: 'ok', handler: false, task_ui: {},
|
||||
state: 'ok', handler: false, task_ui: {}, signoffs_on_page: true,
|
||||
people: { lisi: '李四', wangwu: '王五', zhaoliu: '赵六' },
|
||||
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 },
|
||||
@@ -186,6 +197,7 @@ const INSTANCE = {
|
||||
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: 'signs', type: 'signoffs', props: {}, bind: { task: 'review' }, data: 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',
|
||||
@@ -194,7 +206,7 @@ const INSTANCE = {
|
||||
],
|
||||
forms: {}, problems: [],
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
/**
|
||||
* 指标链照服务端的形状(api/evidence 的 _metric_chain)。销售额按位置取数据整形的结果(vars.q.rows[0][0]),整形节点不是
|
||||
@@ -330,6 +342,10 @@ await section('应用页:印章、指标、出处、趋势、表格、未知
|
||||
const stamp = page.locator('[data-stamp]').first()
|
||||
const stampText = await stamp.innerText()
|
||||
check('印章四项:截至、口径、出具档位、来源', ['截至', '口径', '出具档位', '来源'].every((k) => stampText.includes(k)), stampText.replace(/\n/g, ' '))
|
||||
// 截至是服务端给的整句(自己带着「截至」):完整、紧凑两种印章都只写一次,不写成「截至 截至 …」
|
||||
const stampTexts = await page.locator('[data-stamp]').allInnerTexts()
|
||||
check('印章里「截至」只出现一次(完整和紧凑两种)', stampTexts.length > 0 && stampTexts.every((t) => t.split('截至').length === 2),
|
||||
stampTexts.map((t) => t.replace(/\s+/g, ' ').slice(0, 40)).join(' | '))
|
||||
check('印章写口径名和哈希前 8 位', stampText.includes('周销售 v7 · 3fa2c1d0') && stampText.includes('周销售口径 v3'))
|
||||
check('服务端标出的错位照写', (await stamp.locator('[data-stamp-note]').innerText()).includes('固定在 v7'))
|
||||
check('页面有两页:页签', (await page.getByRole('tab').count()) >= 2)
|
||||
@@ -397,8 +413,8 @@ await section('应用页:印章、指标、出处、趋势、表格、未知
|
||||
|
||||
await section('应用页:视图生成中自动重取、需升级提示', async () => {
|
||||
const running = { ...HOME, app: { ...HOME.app, needs_upgrade: true },
|
||||
sources: { wk: { state: 'running', run_id: RUN, stamp: null, message: '正在运行,完成后刷新页面' } },
|
||||
tree: [{ id: 'stamp', type: 'stamp', props: {}, data: { view: 'wk', state: 'running', stamp: null, message: '正在运行,完成后刷新页面' } }] }
|
||||
sources: { wk: { state: 'running', run_id: RUN, stamp: null, message: '正在运行,完成后自动刷新' } },
|
||||
tree: [{ id: 'stamp', type: 'stamp', props: {}, data: { view: 'wk', state: 'running', stamp: null, message: '正在运行,完成后自动刷新' } }] }
|
||||
const state = { writes: [], home: running }
|
||||
const { page } = await open({ state })
|
||||
await page.goto(`${WEB}/apps/app_weekly`)
|
||||
@@ -474,10 +490,17 @@ await section('实例页:状态、进度、待办卡、动作状态', async ()
|
||||
check('结果未知的那一步写「结果未知」,不写「完成」',
|
||||
(await page.locator('[data-timeline-step="unknown"]').innerText()).includes('结果未知'))
|
||||
const other = page.locator('[data-component="task_form"][data-task-handler="no"]')
|
||||
check('不是处理人:只画这一步的状态(在等谁、会签进度、升级后的规则),不出红框',
|
||||
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, ' '))
|
||||
&& (await other.innerText()).includes('等待 王五、赵六 处理'), (await other.innerText()).replace(/\n/g, ' '))
|
||||
check('……等待名单写显示名,悬停给用户名', (await other.locator('[data-task-waiting-on]').getAttribute('title')) === 'wangwu、zhaoliu')
|
||||
const signs = page.locator('[data-component="signoffs"]')
|
||||
check('同一页上有会签组件:待办表单不再画会签进度,会签进度只画一遍', (await other.locator('[data-signoff-head]').count()) === 0
|
||||
&& (await signs.locator('[data-signoff-head]').count()) === 1 && (await signs.innerText()).includes('1/2 已同意')
|
||||
&& (await signs.innerText()).includes('已升级给岗位「director」'), (await signs.innerText()).replace(/\n/g, ' '))
|
||||
const lisi = signs.locator('[data-assignee]').first()
|
||||
check('……会签名单写显示名,悬停给用户名', (await lisi.innerText()) === '李四' && (await lisi.getAttribute('title')) === 'lisi'
|
||||
&& (await signs.innerText()).includes('赵六'), (await signs.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)
|
||||
|
||||
@@ -3976,11 +3976,14 @@ await section('工具', async () => {
|
||||
const brokenProblem = '参数定义格式有误:参数 store 应写成 {"type": "string"} 这样的对象,不能直接写 "string"'
|
||||
const brokenTool = { id: 'broken_demo', name: 'broken_demo', description: '检查脚本的坏工具', category: '自定义 · http',
|
||||
source: 'custom', dangerous: true, runtime_approval: false, schema: { properties: { store: 'string' } }, problem: brokenProblem }
|
||||
// 写外部系统的能力:服务端在工具项上给 write_rehearsal(和执行接口同一个判断),在工具库里执行只演练
|
||||
const payTool = { id: 'pay_demo', name: 'pay_demo', description: '检查脚本的写入能力', category: '自定义 · http',
|
||||
source: 'custom', dangerous: true, runtime_approval: true, write_rehearsal: true, schema: { properties: { amount: { type: 'number' } } } }
|
||||
const brokenRow = { id: 'check-manage-broken', name: 'broken_demo', kind: 'http', description: '检查脚本的坏工具',
|
||||
parameters: { properties: { store: 'string' } }, config: { method: 'GET', url: 'https://example.com/x' }, enabled: true, problem: brokenProblem }
|
||||
const { page, sent, natives, errors, close } = await open(danger ? `/tools/library/${danger.id}` : '/tools', {
|
||||
handlers: [
|
||||
[/^GET \/tools$/, async (route) => json([...await (await route.fetch()).json(), brokenTool])(route)],
|
||||
[/^GET \/tools$/, async (route) => json([...await (await route.fetch()).json(), brokenTool, payTool])(route)],
|
||||
[/^GET \/custom-tools$/, async (route) => json([...await (await route.fetch()).json(), brokenRow])(route)],
|
||||
[/^POST \/tools\/[^/]+\/run$/, (route, { body }) => {
|
||||
calls++
|
||||
@@ -4031,6 +4034,20 @@ await section('工具', async () => {
|
||||
check('参数名被纠正过:成功结果下面用 warn 写出来,提醒先改对再抄进工作流', note.includes('cuont') && note.includes('修正参数名称'), note)
|
||||
check('……结果和提醒落在看得见的地方(不用自己滚)', await inView(page.locator('[data-tool-note]')))
|
||||
}
|
||||
{
|
||||
// 写入能力在这里只演练(执行不先确认、也不真的发出):提示条不说「请求会实际发出」;别的外接工具照旧
|
||||
await page.locator('nav[aria-label="工具列表"] button', { hasText: 'pay_demo' }).first().click()
|
||||
await page.waitForTimeout(300)
|
||||
const bar = page.locator('[data-tool-side-effect]')
|
||||
const barText = await bar.innerText().catch(() => '')
|
||||
check('写入能力:提示条写这里只演练、不真的发送,不说请求会实际发出', await bar.getAttribute('data-tool-side-effect') === 'rehearsal'
|
||||
&& barText.includes('这里只演练,不真的发送') && !barText.includes('实际发出') && !barText.includes('确认后才会执行'), barText)
|
||||
await page.locator('nav[aria-label="工具列表"] button', { hasText: 'broken_demo' }).first().click()
|
||||
await page.waitForTimeout(300)
|
||||
const other = await bar.innerText().catch(() => '')
|
||||
check('……不是写入能力的自定义工具照旧警示请求会实际发出', await bar.getAttribute('data-tool-side-effect') === 'send'
|
||||
&& other.includes('请求会实际发出'), other)
|
||||
}
|
||||
{
|
||||
const item = page.locator('nav[aria-label="工具列表"] button', { hasText: 'broken_demo' }).first()
|
||||
const chip = item.locator('[data-tool-problem]')
|
||||
|
||||
@@ -876,6 +876,11 @@ await section('auto:修完没有错了,发布按钮才可用;发布只在
|
||||
await submit(page).click()
|
||||
await waitFor(page, async () => state.publishes.length === 1)
|
||||
check('人点了「发布为受管」才发出一次发布', state.publishes.length === 1 && state.publishes[0].level === 'governed', JSON.stringify(state.publishes))
|
||||
// 受管级发布成功:弹窗标题写明受管(和工具栏「受管 vN」、发布提示同一种说法),不只写「已发布 vN」
|
||||
const done = dialog(page).locator('[data-publish-done-level="governed"]')
|
||||
check('受管发布成功:弹窗换成成功的说明', await waitFor(page, async () => await done.count() === 1))
|
||||
const head = await dialog(page).innerText().catch(() => '')
|
||||
check('……标题写明受管', head.includes(`已发布 v${state.version} · 受管`), head.split('\n')[0])
|
||||
})
|
||||
|
||||
await section('choice:没选之前不能应用;选了之后载荷里是选的值', async () => {
|
||||
@@ -1967,6 +1972,9 @@ await section('应用平台:发布成功做成应用;已发布版本的使
|
||||
await waitFor(page, async () => state.publishes.length === 1)
|
||||
const done = dialog(page).locator('[data-publish-done]')
|
||||
check('发布成功:弹窗不关,换成成功的说明', await waitFor(page, async () => await done.count() === 1))
|
||||
const head = await dialog(page).innerText().catch(() => '')
|
||||
check('……已发布级的标题不写受管', head.includes(`已发布 v${state.version}`) && !head.includes('受管')
|
||||
&& await done.getAttribute('data-publish-done-level') === 'published', head.split('\n')[0])
|
||||
const make = dialog(page).locator('[data-publish-make-app]')
|
||||
check('……给「做成应用」的入口', await make.count() === 1 && (await make.innerText()).includes('做成应用'))
|
||||
await make.click()
|
||||
|
||||
@@ -135,6 +135,7 @@ const wf = (id, extra) => ({
|
||||
id, name: extra.name, description: extra.description ?? '检查脚本伪造的工作流', graph: extra.graph ?? GRAPH,
|
||||
tags: extra.tags ?? [], version: extra.version ?? 3, is_template: !!extra.is_template,
|
||||
status: extra.status ?? 'draft', published_version: extra.published_version ?? null,
|
||||
published_level: extra.published_level ?? null, same_as_published: !!extra.same_as_published,
|
||||
published_by: extra.published_by ?? null, run_count: 0,
|
||||
created_at: '2026-09-20T02:00:00Z', updated_at: '2026-09-26T02:00:00Z',
|
||||
})
|
||||
@@ -2979,6 +2980,52 @@ await section('应用平台:人工节点的流程配置、入口字段的类
|
||||
}
|
||||
})
|
||||
|
||||
await section('受管工作流在画布上改过之后:页头、版本历史、选择器照当前发布版的级别写「受管」;和发布版内容相同时不写领先', async () => {
|
||||
// 画布上改过之后 status 回到草稿,当前发布版仍是受管级(published_level)。st-govs:撤回改动后保存出来的 v8,
|
||||
// 服务端按图哈希比出和 v6 相同(same_as_published);st-gova:真的改过、领先 2 版
|
||||
FAKES['st-govs'] = wf('st-govs', { name: '__studio_check_gov_same__', version: 8, published_version: 6, published_level: 'governed', same_as_published: true })
|
||||
FAKES['st-gova'] = wf('st-gova', { name: '__studio_check_gov_ahead__', version: 8, published_version: 6, published_level: 'governed' })
|
||||
const versions = [8, 7, 6, 5].map((n) => ({ id: `gv${n}`, version: n, note: '', created_at: '2026-10-15T02:00:00Z',
|
||||
published: n === 6, level: n === 6 ? 'governed' : n === 5 ? 'published' : null }))
|
||||
const before = (page) => page.route(/\/api\/workflows\/st-gov[sa]\/versions$/, (route) =>
|
||||
route.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify(versions) }))
|
||||
try {
|
||||
const same = await open({ path: '/studio/st-govs', before })
|
||||
const label = (p) => p.locator('[data-version-label]').innerText().then((t) => t.replace(/\s+/g, ' '), () => '')
|
||||
const sameText = await label(same.page)
|
||||
check('内容和发布版相同:写「与发布版 v6 内容相同」,不写领先', sameText.includes('草稿 v8') && sameText.includes('与发布版 v6 内容相同')
|
||||
&& !sameText.includes('领先'), sameText)
|
||||
check('……发布版写「受管 v6」,不写「已发布」', sameText.includes('受管 v6') && !sameText.includes('已发布'), sameText)
|
||||
await blur(same.page)
|
||||
await same.page.keyboard.press('Alt+KeyH')
|
||||
const v6 = same.page.locator('ol[aria-label="版本"] > li').nth(2)
|
||||
await v6.waitFor({ timeout: 3000 }).catch(() => {})
|
||||
const v6Text = await v6.innerText().catch(() => '')
|
||||
check('版本历史:当前发布版按这一版自己的级别写「受管」', await v6.locator('[data-version-published="governed"]').count() === 1
|
||||
&& v6Text.includes('受管') && !v6Text.includes('已发布'), v6Text.replace(/\s+/g, ' '))
|
||||
check('没有运行时报错', same.errors.length === 0, same.errors.slice(0, 2).join(' | '))
|
||||
await same.ctx.close()
|
||||
|
||||
const ahead = await open({ path: '/studio/st-gova', before })
|
||||
const aheadText = await label(ahead.page)
|
||||
check('真的改过:照旧写领先 2 版,发布版写「受管 v6」', aheadText.includes('领先 2 版') && aheadText.includes('受管 v6')
|
||||
&& !aheadText.includes('内容相同') && !aheadText.includes('已发布'), aheadText)
|
||||
await ahead.page.locator('button[title^="切换、新建"]').click()
|
||||
await ahead.page.waitForTimeout(300)
|
||||
await ahead.page.keyboard.type('__studio_check_gov_ahead__')
|
||||
await ahead.page.waitForTimeout(200)
|
||||
const row = ahead.page.locator('li[role="option"]', { has: ahead.page.locator('span.truncate', { hasText: /^__studio_check_gov_ahead__$/ }) })
|
||||
const chips = await row.locator('.chip').allInnerTexts()
|
||||
check('选择器:草稿之外写「受管 v6」', chips.includes('草稿') && chips.some((t) => t.includes('受管 v6')) && !chips.some((t) => t.includes('已发布')),
|
||||
chips.join(' | '))
|
||||
await ahead.page.keyboard.press('Escape')
|
||||
await ahead.ctx.close()
|
||||
} finally {
|
||||
delete FAKES['st-govs']
|
||||
delete FAKES['st-gova']
|
||||
}
|
||||
})
|
||||
|
||||
check('整个检查没有弹出原生 confirm / prompt', dialogs === 0, `${dialogs} 次`)
|
||||
check('检查没有写库(兜底拦下的写请求)', writes.length === 0, writes.slice(0, 4).join('、'))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user