Skip to content

Commit 55abc67

Browse files
committed
tests: add package replacement tests
1 parent 25f99e6 commit 55abc67

File tree

2 files changed

+2130
-0
lines changed

2 files changed

+2130
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { expect, test } from './test-utils'
2+
3+
test.describe('Package Replacement Suggestions', () => {
4+
test('/package/strip-ansi shows a replacement suggestion with a link to e18e docs', async ({
5+
page,
6+
goto,
7+
}) => {
8+
await goto('/package/strip-ansi', { waitUntil: 'hydration' })
9+
10+
// Wait for the package page to load
11+
await expect(page.locator('h1')).toContainText('strip-ansi', { timeout: 15_000 })
12+
13+
// The replacement component renders a "Learn more" anchor driven by resolveReplacementUrl.
14+
// For strip-ansi the url.type is 'e18e', so the href resolves to:
15+
// https://e18e.dev/docs/replacements/strip-ansi
16+
//
17+
// useLazyFetch is used, so the suggestion arrives after hydration — use a generous timeout.
18+
const replacementLink = page.locator('a[href="https://e18e.dev/docs/replacements/strip-ansi"]')
19+
await expect(replacementLink).toBeVisible({ timeout: 15_000 })
20+
})
21+
})

0 commit comments

Comments
 (0)