19 lines
612 B
TypeScript
19 lines
612 B
TypeScript
import { test as setup } from '@playwright/test';
|
|
|
|
const authFile = 'e2e/.auth/user.json';
|
|
|
|
setup('authenticate', async ({ page }) => {
|
|
// 这里可以设置测试账号的登录状态
|
|
// 实际项目中应该使用测试账号登录并保存状态
|
|
|
|
// 示例:登录流程
|
|
// await page.goto('/login');
|
|
// await page.fill('[name="username"]', 'test-user');
|
|
// await page.fill('[name="password"]', 'test-password');
|
|
// await page.click('button[type="submit"]');
|
|
// await page.waitForURL('/purchaser');
|
|
|
|
// 保存登录状态
|
|
// await page.context().storageState({ path: authFile });
|
|
});
|