test(admin): moicen 管理端 /tasks Playwright 与 .env 样例
MOICEN_ADMIN_* 与 HUIKE_ADMIN_BASE_URL;凭据仅本地 .env.e2e(gitignore)。 Made-with: Cursor
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
|
||||
const adminUser = process.env.MOICEN_ADMIN_USER?.trim();
|
||||
const adminPassword = process.env.MOICEN_ADMIN_PASSWORD?.trim();
|
||||
const adminBase =
|
||||
process.env.HUIKE_ADMIN_BASE_URL?.trim() || 'https://admin.moicen.com';
|
||||
|
||||
test.describe('管理端 tasks(Rust TS)', () => {
|
||||
test.skip(
|
||||
!adminUser || !adminPassword,
|
||||
'需要 MOICEN_ADMIN_USER / MOICEN_ADMIN_PASSWORD(见 .env.e2e.example → .env.e2e)'
|
||||
);
|
||||
|
||||
test('登录后可打开 /tasks 并出现任务页结构', async ({ page }) => {
|
||||
await page.goto(`${adminBase}/login`, {
|
||||
waitUntil: 'domcontentloaded',
|
||||
timeout: 60_000,
|
||||
});
|
||||
await page.locator('#username_field').fill(adminUser!);
|
||||
await page.locator('#password_field').fill(adminPassword!);
|
||||
await page.locator('#submit_btn').click();
|
||||
await page.waitForURL((u) => !u.pathname.endsWith('/login'), {
|
||||
timeout: 60_000,
|
||||
});
|
||||
|
||||
await page.goto(`${adminBase}/tasks`, {
|
||||
waitUntil: 'domcontentloaded',
|
||||
timeout: 60_000,
|
||||
});
|
||||
await expect(page.locator('#app')).toBeVisible({ timeout: 30_000 });
|
||||
await expect(
|
||||
page.getByRole('columnheader', { name: 'Task ID' })
|
||||
).toBeVisible({ timeout: 45_000 });
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user