-
Notifications
You must be signed in to change notification settings - Fork 57
Expand file tree
/
Copy pathErrorOnChildNode.test.js
More file actions
43 lines (40 loc) · 2.1 KB
/
ErrorOnChildNode.test.js
File metadata and controls
43 lines (40 loc) · 2.1 KB
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
36
37
38
39
40
41
42
43
describe('ErrorOnChildNode dom ssr', () => {
test('should log that the dom is invalid', async () => {
const page = await browser.newPage()
await page.goto('http://localhost:6969/error-on-child-node?dom=true', { waitUntil: 'networkidle0' })
page.on('console', async (message) => {
expect(message.text()).toMatch(
'THEAD expected tag TH to be child at index 2 but instead found undefined. This error usually happens because of an invalid HTML hierarchy or changes in comparisons after serialization.',
)
})
})
test('Should log that the serialization missmatches the server dom', async () => {
const page = await browser.newPage()
await page.goto('http://localhost:6969/error-on-child-node?serialization=true', { waitUntil: 'networkidle0' })
page.on('console', async (message) => {
expect(message.text()).toMatch(
'DIV expected tag DIV to be child at index 0 but instead found undefined. This error usually happens because of an invalid HTML hierarchy or changes in comparisons after serialization.',
)
})
})
test('hydration errors related to dom should not happen in spa mode', async () => {
const page = await browser.newPage()
await page.goto('http://localhost:6969/', { waitUntil: 'networkidle0' })
await page.click('[href="/error-on-child-node?dom=true"]')
await page.waitForSelector('[data-dom-error]')
await page.click('[data-dom-error]')
await page.waitForSelector('[data-value="Changed Value"]')
const element = await page.$('[data-value="Changed Value"]')
expect(element).toBeTruthy()
})
test('hydration errors related to dom should not happen in spa mode', async () => {
const page = await browser.newPage()
await page.goto('http://localhost:6969/', { waitUntil: 'networkidle0' })
await page.click('[href="/error-on-child-node?serialization=true"]')
await page.waitForSelector('[data-dom-error]')
await page.click('[data-dom-error]')
await page.waitForSelector('[data-value="Changed Value"]')
const element = await page.$('[data-value="Changed Value"]')
expect(element).toBeTruthy()
})
})