Files
huike-e2e-moicen/tests/admin-tasks.spec.ts

36 lines
1.2 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { expect, test } from './fixtures';
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('管理端 tasksRust 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 });
});
});