You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
vitepress/__tests__/e2e/home.test.ts

36 lines
1.0 KiB

describe('render correct content', async () => {
beforeAll(async () => {
await goto('/home')
})
test('main content', async () => {
const h1Locator = page.locator('.VPContent h1')
const h2Locator = page.locator('.VPContent h2')
const pLocator = page.locator('.VPContent p')
const [h1Contents, h2Contents, pContents] = await Promise.all([
h1Locator.allTextContents(),
h2Locator.allTextContents(),
pLocator.allTextContents()
])
2 years ago
expect(h1Contents).toEqual(['Lorem Ipsum \u200b'])
expect(h2Contents.map((s) => s.trim())).toEqual([
'What is Lorem Ipsum? \u200b',
'Where does it come from? \u200b',
'Why do we use it? \u200b',
'Where can I get some? \u200b'
])
expect(pContents).toMatchSnapshot()
})
test('outline', async () => {
const outlineLinksLocator = page.locator(
'.VPDocAsideOutline .root .outline-link'
)
const outlineLinksCount = await outlineLinksLocator.count()
expect(outlineLinksCount).toEqual(4)
})
})