import { test, expect } from '@playwright/test'; test.describe('登录流程', () => { test('显示登录页面', async ({ page }) => { await page.goto('/#/login'); await expect(page.locator('.ant-card, .ant-form')).toBeVisible(); }); test('空表单提交显示验证错误', async ({ page }) => { await page.goto('/#/login'); await page.click('button[type="submit"]'); // Ant Design 应显示验证错误 await expect(page.locator('.ant-form-item-explain-error')).toHaveCount(2); // 用户名 + 密码 }); });