import { expect, test, type Page } from '@playwright/test' // 后台管理列表「创建时间 + 更新时间」两列验收(2026-09-19 需求): // 8 个实体管理列表统一展示创建/更新时间,数据取自各列表 VO。 // mock 夹具统一给 createdAt=2026-03-01 09:15:00、updatedAt=2026-09-18 16:42:30, // 页面统一经 formatDateTime 归一为「YYYY-MM-DD HH:mm:ss」。 const CREATED = '2026-03-01 09:15:00' const UPDATED = '2026-09-18 16:42:30' const PAGES: Array<{ title: string; path: string; heading: string }> = [ { title: '用户管理', path: '/admin-vue/account/users', heading: '用户列表' }, { title: '菜单管理', path: '/admin-vue/account/menus', heading: '菜单' }, { title: '密钥管理', path: '/admin-vue/account/user-secrets', heading: '用户密钥列表' }, { title: '不符合ASIN数据', path: '/admin-vue/asin-center/invalid', heading: '品牌数据列表' }, { title: '数据去重总数据', path: '/admin-vue/asin-center/registry', heading: '数据去重总数据' }, { title: '查询ASIN', path: '/admin-vue/asin-center/query', heading: '查询' }, { title: '最低价ASIN', path: '/admin-vue/asin-center/skip-price', heading: '最低价' }, { title: '商品类目', path: '/admin-vue/asin-center/categories', heading: '商品类目' }, ] async function openPage(page: Page, path: string) { await page.goto(path) await expect(page.locator('.panel-box table tbody tr').first()).toBeVisible({ timeout: 15000 }) } for (const spec of PAGES) { test(`${spec.title}:表格展示创建时间与更新时间`, async ({ page }) => { const errors: string[] = [] page.on('pageerror', (error) => errors.push(error.message)) await openPage(page, spec.path) const table = page.locator('.panel-box table').first() // 表头出现两列 await expect(table.locator('thead')).toContainText('创建时间') await expect(table.locator('thead')).toContainText('更新时间') // 数据行渲染出真实时间值(非空、非占位符) await expect(table.locator('tbody')).toContainText(CREATED) await expect(table.locator('tbody')).toContainText(UPDATED) expect(errors).toEqual([]) }) }