forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.test.ts
58 lines (46 loc) · 1.38 KB
/
index.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import { createNext, FileRef } from 'e2e-utils'
import { NextInstance } from 'test/lib/next-modes/base'
import { join } from 'path'
import { BrowserInterface } from '../../lib/browsers/base'
import webdriver from 'next-webdriver'
import { waitFor } from 'next-test-utils'
describe('app-dir-prefetch-non-iso-url', () => {
let next: NextInstance
beforeAll(async () => {
next = await createNext({
files: {
'next.config.js': new FileRef(join(__dirname, 'next.config.js')),
app: new FileRef(join(__dirname, 'app')),
},
})
})
afterAll(() => next.destroy())
it('should go to iso url', async () => {
let browser: BrowserInterface
try {
browser = await webdriver(next.appPort, '/')
await browser.elementByCss('#to-iso').click()
const text = await browser.elementByCss('#page').text()
await waitFor(3000)
expect(text).toBe('/[slug]')
} finally {
if (browser) {
await browser.close()
}
}
})
it('should go to non-iso url', async () => {
let browser: BrowserInterface
try {
browser = await webdriver(next.appPort, '/')
await browser.elementByCss('#to-non-iso').click()
const text = await browser.elementByCss('#page').text()
await waitFor(3000)
expect(text).toBe('/[slug]')
} finally {
if (browser) {
await browser.close()
}
}
})
})