Files
vue-ts-example/tests/playwright/test-1.spec.ts
严浩 302151eea8
Some checks failed
/ build-and-deploy-to-vercel (push) Successful in 2m30s
/ lint-build-and-check (push) Successful in 4m28s
/ surge (push) Successful in 2m43s
/ playwright (push) Failing after 14m27s
fix: 修正页面加载路径,确保测试正确访问首页
2025-04-01 12:14:45 +08:00

19 lines
720 B
TypeScript

import { test } from '@playwright/test';
import { consola } from 'consola';
test('页面加载正常', async ({ page }, testInfo) => {
await page.goto('/Home');
consola.info(`page.url() === ${page.url()}`);
// 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}"`);
});