2026-04-28 08:45:12 +08:00
|
|
|
|
import { expect, test } from './fixtures';
|
2026-04-26 20:22:17 +08:00
|
|
|
|
|
|
|
|
|
|
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 });
|
|
|
|
|
|
});
|
|
|
|
|
|
});
|