/
home.test.ts
35 lines (30 loc) · 986 Bytes
/
home.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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)
})
})