2021-03-02 17:40:25 +00:00
|
|
|
export const tests = []
|
|
|
|
|
|
|
|
tests.push(async ({ page, eq }) => {
|
|
|
|
// check that the title tag is present & is set with some text
|
|
|
|
const title = await page.$$eval(
|
|
|
|
'title',
|
|
|
|
(nodes) => nodes[0] && nodes[0].innerHTML,
|
|
|
|
)
|
|
|
|
const isValidTitle = title !== undefined && title.length !== 0
|
|
|
|
eq(isValidTitle, true)
|
|
|
|
|
|
|
|
// check the 3 sections have been created with the correct text
|
2021-03-02 17:48:55 +00:00
|
|
|
const elements = await page.$$eval('body', (nodes) =>
|
|
|
|
[...nodes[0].children].map((node) => ({
|
2021-03-02 17:40:25 +00:00
|
|
|
tag: node.tagName.toLowerCase(),
|
|
|
|
text: node.textContent,
|
|
|
|
})),
|
|
|
|
)
|
2021-03-02 17:48:55 +00:00
|
|
|
eq(expectedSections, elements)
|
2021-03-02 17:40:25 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
const expectedSections = [
|
|
|
|
{ tag: 'section', text: 'face' },
|
|
|
|
{ tag: 'section', text: 'upper-body' },
|
|
|
|
{ tag: 'section', text: 'lower-body' },
|
|
|
|
]
|