28 lines
914 B
TypeScript
28 lines
914 B
TypeScript
import { test, expect } from '@playwright/test';
|
|
|
|
test.describe('基础功能测试', () => {
|
|
test('后端健康检查', async ({ request }) => {
|
|
const response = await request.get('http://localhost:8080/actuator/health');
|
|
expect(response.ok()).toBeTruthy();
|
|
|
|
const health = await response.json();
|
|
expect(health.status).toBe('UP');
|
|
});
|
|
|
|
test('前端首页加载', async ({ page }) => {
|
|
await page.goto('/');
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
await expect(page).toHaveURL(/.*login.*/);
|
|
});
|
|
|
|
test('登录页面可访问', async ({ page }) => {
|
|
await page.goto('/login');
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
await expect(page.locator('h2')).toContainText('登录');
|
|
await expect(page.locator('input[placeholder*="用户名"]')).toBeVisible();
|
|
await expect(page.locator('input[placeholder*="密码"]')).toBeVisible();
|
|
});
|
|
});
|