18 lines
576 B
TypeScript
Executable File
18 lines
576 B
TypeScript
Executable File
import { test as base } from '@playwright/test';
|
|
import { TEST_USERS } from '../utils/test-data';
|
|
|
|
export const test = base.extend({
|
|
async authenticatedPage({ page }, use) {
|
|
// 登录
|
|
await page.goto('/');
|
|
await page.fill('input[placeholder="请输入用户名"]', TEST_USERS.admin.username);
|
|
await page.fill('input[placeholder="请输入密码"]', TEST_USERS.admin.password);
|
|
await page.click('button:has-text("登录")');
|
|
await page.waitForURL(/.*(dashboard|home).*/);
|
|
|
|
await use(page);
|
|
},
|
|
});
|
|
|
|
export { expect } from '@playwright/test';
|