Files
vue-ts-example/tests/playwright/test-1.spec.ts
严浩 231249b357 ci: 更新 Playwright 测试工作流
- 在运行测试前添加环境变量输出,提高调试可读性
- 删除测试中不必要的日志输出
2025-08-14 14:18:10 +08:00

18 lines
672 B
TypeScript

import { test } from '@playwright/test';
import { consola } from 'consola';
test('页面加载正常', async ({ page }, testInfo) => {
await page.goto('/Home');
// await expect(page.getByRole('link', { name: '中文-页面.page.vue' })).toBeVisible();
// 截图并将其附加到测试结果
await testInfo.attach('screenshot', { body: await page.screenshot({ fullPage: true }), contentType: 'image/png' });
// 查找包含"commit:"文本的元素
const commitElement = page.locator('text=commit:').first();
// 获取元素的文本内容
const innerText = await commitElement.textContent();
consola.debug(`Commit 文本内容: "${innerText}"`);
});