All checks were successful
ERP-Deploy-Demo / deploy-demo (push) Successful in 55s
16 lines
612 B
TypeScript
16 lines
612 B
TypeScript
import { Page, expect } from '@playwright/test';
|
|
|
|
/**
|
|
* 共用登入函式
|
|
* 使用測試帳號登入 Star ERP 系統
|
|
*/
|
|
export async function login(page: Page, username = 'admin', password = 'password') {
|
|
await page.goto('/');
|
|
await page.fill('#username', username);
|
|
await page.fill('#password', password);
|
|
await page.getByRole('button', { name: '登入系統' }).click();
|
|
// 等待儀表板載入完成 (改用更穩定的側邊欄文字或 URL)
|
|
await page.waitForURL('**/');
|
|
await expect(page.getByRole('link', { name: '儀表板' }).first()).toBeVisible({ timeout: 15000 });
|
|
}
|