fix: 修测试用例
This commit is contained in:
@ -1,13 +1,18 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
import { test } from '@playwright/test';
|
||||
import { consola } from 'consola';
|
||||
|
||||
test('页面加载正常', async ({ page }, testInfo) => {
|
||||
await page.goto('/');
|
||||
console.log(`page.url() === ${page.url()}`);
|
||||
await expect(page.getByRole('link', { name: '中文-页面.page.vue' })).toBeVisible();
|
||||
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:" 的元素
|
||||
// 查找包含"commit:"文本的元素
|
||||
const commitElement = page.locator('text=commit:').first();
|
||||
// 获取元素的文本内容
|
||||
const innerText = await commitElement.innerText();
|
||||
console.log(`Commit 文本内容: "${innerText}"`);
|
||||
consola.debug(`Commit 文本内容: "${innerText}"`);
|
||||
});
|
||||
|
Reference in New Issue
Block a user