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(); }); });