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
986 B

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()
])
expect(h1Contents).toEqual(['Lorem Ipsum #'])
expect(h2Contents).toEqual([
'What is Lorem Ipsum? #',
'Where does it come from? #',
'Why do we use it? #',
'Where can I get some? #'
])
expect(pContents).toMatchSnapshot()
})
test('outline', async () => {
const outlineLinksLocator = page.locator(
'.VPDocAsideOutline .root .outline-link'
)
const outlineLinksCount = await outlineLinksLocator.count()
expect(outlineLinksCount).toEqual(4)
})
})