WQQ b402e791a7 加载矢量瓦片,添加点击查询功能 2 天之前
..
README.md b402e791a7 加载矢量瓦片,添加点击查询功能 2 天之前
basic.spec.ts b402e791a7 加载矢量瓦片,添加点击查询功能 2 天之前

README.md

Playwright 自动化测试

本项目使用 Playwright 进行前端自动化测试,已配置使用指定的 Chrome 浏览器。

浏览器配置

  • 浏览器路径: D:\Software\chrome-win64\chrome.exe
  • 浏览器类型: Chrome

安装依赖

npm install

运行测试

基础测试(无头模式)

npm test

UI 模式测试

npm run test:ui

有头模式测试(显示浏览器窗口)

npm run test:headed

调试模式

npm run test:debug

查看测试报告

npm run test:report

测试文件结构

tests/
├── basic.spec.ts          # 基础功能测试
└── ...                    # 其他测试文件

配置文件

测试覆盖范围

当前测试包含以下内容:

  1. 基础页面测试

    • 页面加载测试
    • 登录页面测试
    • 响应式布局测试
  2. Cesium 地图测试

    • 地图容器加载测试
    • 地图交互测试
  3. 性能测试

    • 页面加载性能测试
    • 资源加载测试

添加新测试

tests/ 目录下创建新的测试文件,使用 .spec.ts 扩展名:

import { test, expect } from '@playwright/test';

test.describe('测试组名称', () => {
  test('测试用例名称', async ({ page }) => {
    // 测试代码
    await page.goto('/');
    await expect(page).toHaveTitle(/标题/);
  });
});

注意事项

  1. 确保指定的 Chrome 浏览器路径正确
  2. 测试会自动启动开发服务器(npm run dev
  3. 默认端口为 http://localhost:5173
  4. 测试失败时会自动截图和录制视频