modify playwright scripts
This commit is contained in:
parent
5bd0209ca6
commit
f51dbb400a
@ -11,9 +11,13 @@ export async function testEntryCards(
|
|||||||
const card = page.locator(`.mantine-Card-root:has-text("${entry.label}")`);
|
const card = page.locator(`.mantine-Card-root:has-text("${entry.label}")`);
|
||||||
await expect(card).toBeVisible({ timeout: 10000 });
|
await expect(card).toBeVisible({ timeout: 10000 });
|
||||||
|
|
||||||
// 检查卡片内部的链接
|
// 检查卡片内部的链接,忽略端口号
|
||||||
const link = card.locator('a');
|
const link = card.locator('a');
|
||||||
await expect(link).toHaveAttribute('href', entry.href);
|
const href = await link.getAttribute('href');
|
||||||
|
|
||||||
|
// 正则:保留协议和 host,忽略端口号
|
||||||
|
const expectedHrefPattern = entry.href.replace(/:(\d+)/, '(:\\d+)?');
|
||||||
|
expect(href).toMatch(new RegExp(`^${expectedHrefPattern}$`));
|
||||||
|
|
||||||
// 检查图标
|
// 检查图标
|
||||||
const img = card.locator('img');
|
const img = card.locator('img');
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user