Files
PicAnalysis/frontend/e2e/visit.spec.ts

25 lines
696 B
TypeScript
Raw Normal View History

import { test } from '@playwright/test';
test('访问前端应用并截图', async ({ page }) => {
console.log('📄 访问 http://localhost:3000');
// 访问前端应用
await page.goto('http://localhost:3000', { waitUntil: 'networkidle' });
// 截图保存
await page.screenshot({ path: 'screenshots/visit-frontend.png', fullPage: true });
console.log('✅ 截图已保存到 screenshots/visit-frontend.png');
// 获取页面标题
const title = await page.title();
console.log(`📋 页面标题: ${title}`);
// 获取页面 URL
const url = page.url();
console.log(`🔗 当前 URL: ${url}`);
// 等待 2 秒查看页面
await page.waitForTimeout(2000);
});