oh-my-muse/muse-studio/e2e/account-security-ack.spec.ts
zizi 6dcabf69fb feat(solo): 收口治理入口并裁剪 studio 表面
完成 2.0.0 S4 的外部 AI、admin、account 与 solo SQL 收口,并推进 S5 studio 市场/handoff/旧编辑器入口裁剪。S5 的前端单测、构建与 route-only e2e 已留证;MSW-off 创作主线 e2e 仍因本地后端活体启动口径待修正,已在总账标为未完成验收。
2026-07-08 11:45:26 +08:00

41 lines
2.0 KiB
TypeScript
Raw Permalink 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.

import { expect, test, type Page } from '@playwright/test';
test.skip(true, '2.0.0 S5 单人版已移除市场、handoff 或多用户前端入口,本 spec 隔离保留待恢复');
/**
* 安全事件确认写路 e2e真实后端MSW off
*
* 前置vite VITE_API_MOCK=false、muse-server 在 48080、`/tmp/SeedSec.java` 已运行
* (事件 B「活体安全事件·待确认演练」每次重置为未确认故本写路测可重复跑UI 每次发新 commandId
* 旅程:个人中心「安全事件」区找到未确认事件 → 点「确认」→ POST /account/security-events/{id}/acknowledge
* → 列表失活重取 → 该行翻为「已确认」rendered-UI 活体证;正路;负路 404/400 已由 curl 实证)。
*/
const TOKEN = 'test1';
async function seedToken(page: Page): Promise<void> {
await page.addInitScript((t) => {
window.localStorage.setItem('accessToken', t);
window.localStorage.setItem('tenantId', '1');
}, TOKEN);
}
test.describe('安全事件确认写路(真实后端, MSW off)', () => {
test('点「确认」→ 真打 acknowledge → 该事件行翻为「已确认」', async ({ page }) => {
await seedToken(page);
await page.goto('/account');
// 定位「待确认演练」事件行(种子保证未确认)。
const row = page.locator('li', { hasText: '活体安全事件·待确认演练' });
await expect(row).toBeVisible({ timeout: 15_000 });
// 未确认事件展示「确认」按钮;已确认事件不展示(写后该按钮即消失,构成 acked→无动作的 UI 不变量)。
const ackButton = row.getByRole('button', { name: '确认', exact: true });
await expect(ackButton).toBeVisible();
await ackButton.click();
// 写入成功后查询失活重取,行状态翻为「已确认」、按钮消失。
await expect(row.getByText('已确认')).toBeVisible({ timeout: 15_000 });
await expect(row.getByRole('button', { name: '确认', exact: true })).toHaveCount(0);
});
});