fix: resolve UAT test issues and improve test infrastructure

This commit is contained in:
张翔
2026-03-25 10:21:47 +08:00
parent f0efbaeabd
commit 6c35ba7fb4
7 changed files with 202 additions and 4 deletions
@@ -0,0 +1,36 @@
import { test, expect } from '@playwright/test';
test.describe('UAT - 基础环境验证', () => {
test('前端服务可访问', async ({ page }) => {
await page.goto('http://localhost:3003');
await page.waitForLoadState('networkidle');
const title = await page.title();
console.log('页面标题:', title);
expect(title).toBeTruthy();
});
test('登录页面可访问', async ({ page }) => {
await page.goto('http://localhost:3003/login');
await page.waitForLoadState('networkidle');
const currentUrl = page.url();
console.log('当前URL:', currentUrl);
expect(currentUrl).toContain('/login');
});
test('登录表单元素存在', async ({ page }) => {
await page.goto('http://localhost:3003/login');
await page.waitForLoadState('networkidle');
const usernameInput = page.locator('input[type="text"], input[placeholder*="用户"]');
const passwordInput = page.locator('input[type="password"]');
const loginButton = page.locator('button:has-text("登录"), button:has-text("登 录")');
await expect(usernameInput).toBeVisible();
await expect(passwordInput).toBeVisible();
await expect(loginButton).toBeVisible();
});
});