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、muse_slice_live(market-publish 旅程已落发布记录)。 * 目的:个人中心补齐市场记录三件套之三——发布记录(账户台账视角,GET /account/publish-records), * 验真后端读通 + 「我的发布」区渲染(反假绿)。不依赖记录条数,故只断言契约与区块存在。 */ const TOKEN = 'test1'; async function seedToken(page: Page): Promise { await page.addInitScript((t) => { window.localStorage.setItem('accessToken', t); window.localStorage.setItem('tenantId', '1'); }, TOKEN); } test('账户中心展示我的发布记录(真实后端)', async ({ page }) => { await seedToken(page); // 进个人中心,捕获真实发布记录读响应(打真后端,非 mock)。 const [resp] = await Promise.all([ page.waitForResponse( (r) => /\/account\/publish-records/.test(r.url()) && r.request().method() === 'GET', { timeout: 15_000 } ), page.goto('/account'), ]); // Yudao 口径:成功为 HTTP 200 + CommonResult{code:0}。 expect(resp.status()).toBe(200); expect((await resp.json()).code).toBe(0); // 「我的发布」区(市场记录三件套之三:购买/授权/发布)渲染。 await expect(page.getByRole('heading', { name: '我的发布' })).toBeVisible({ timeout: 15_000 }); });