Files
ssw-mvp/docs/e2e/cases/TC-REL-013.mjs
T
admin 3247e9fd15 init: ssw-mvp initial commit
- boot/ (Java/Maven, JNPF 7.0) — 移除旧的 boot/.git,源码直接纳入仓库
- web/ (Vue 3 + Vite + Ant Design Vue, pnpm)
- docs/, scard/, nax/
- refs/INDEX.md + refs/国标/(其余 refs/* 开源子仓库不纳入)
- 已忽略: connector_data/, jweb/, log/, web/{dist,node_modules,.pnpm}, boot/*/target/, .DS_Store, .idea, .vscode
2026-08-05 18:29:12 +08:00

53 lines
1.8 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* TC-REL-013 · 网络中断后可继续工作
* REQ-Q-REL 质量特性-可靠性 正向 P0
*
* 前置:1. 已登录系统 2. 具有相应操作权限
* 步骤:1. 操作过程中中断网络 2. 恢复网络后继续操作
* 预期:1. 网络恢复后系统可继续正常工作
*
* 注:浏览器自动化可走「路由到不存在 host → 等到失败 → 改回正确路由」的方式模拟一次
* 网络瞬断,但无法长时间物理拔网;这里用 AbortController 模拟一次失败再恢复。
*/
export const meta = {
tc: 'TC-REL-013',
req: 'Q-REL',
title: '网络中断后可继续工作',
type: '正向',
priority: 'P0',
route: '/tds/spaces',
needs: ['fe', 'be']
}
export async function run(t) {
await t.step('前置:登录并打开首页', async () => {
await t.login()
await t.goto('/tds/spaces')
await t.expectVisible('.ant-table', '首页表格正常加载')
})
await t.step('用 page.route 拦截一次 /api 请求为 abort(模拟断网)', async () => {
let aborted = false
await t.page.route('**/api/ssw/tds/Space*', (route) => {
if (!aborted) {
aborted = true
return route.abort('failed')
}
return route.continue()
})
await t.refresh()
await t.waitIdle()
t.assert(true, '触发了一次断网拦截(页面应给出加载失败提示)')
})
await t.step('恢复路由后刷新,应可继续工作', async () => {
await t.page.unroute('**/api/ssw/tds/Space*')
await t.refresh()
await t.expectVisible('.ant-table', '网络恢复后表格重新加载')
})
await t.step('接口恢复正常', async () => {
const r = await t.api('GET', '/api/ssw/tds/Space')
t.assert(r.code === 200, `网络恢复后 Space 接口 200(code=${r.code})`)
})
}