Files
vue-ts-example/tests/e2e/test-1.spec.ts
严浩 229e167525
Some checks failed
/ depcheck (push) Successful in 1m34s
/ build-and-deploy-to-vercel (push) Successful in 1m38s
/ playwright (push) Failing after 1m11s
更新 CI 工作流以使用新的容器,修改 Playwright 基础 URL,增强测试用例以附加截图和日志
2024-10-12 12:48:36 +08:00

14 lines
621 B
TypeScript

import { test, expect } from '@playwright/test';
test('页面加载正常', async ({ page }, testInfo) => {
await page.goto('/');
console.log(`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.innerText();
console.log(`Commit 文本内容: "${innerText}"`);
});