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/examples/minimal/__test__/content.spec.ts

39 lines
1.0 KiB

import { beforeAll, expect, test } from 'vitest'
import { page, waitForLayout } from '~utils'
describe('render corrent content', () => {
beforeAll(async () => {
await waitForLayout()
})
test('main content', async () => {
const h1Locator = page.locator('h1')
const h2Locator = page.locator('h2')
const pLocator = page.locator('.Layout p')
const [h1Contents, h2Conetents, pContents] = await Promise.all([
h1Locator.allTextContents(),
h2Locator.allTextContents(),
pLocator.allTextContents()
])
expect(h1Contents).toEqual(['Lorem Ipsum #'])
expect(h2Conetents).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)
})
})