mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
rip. you served a purpose once, but now you're just getting in the way. this improves typesafety quite a bit, because `BrowserInterface` had a whole bunch of random `any`s everywhere also - removes `evalAsync`. no idea why that was needed, but we're happily using promises in normal eval, so it can be dropped - adds more safety to `chain`
49 lines
1.2 KiB
TypeScript
49 lines
1.2 KiB
TypeScript
import { createNext, FileRef } from 'e2e-utils'
|
|
import { NextInstance } from 'e2e-utils'
|
|
import { join } from 'path'
|
|
import { Playwright } from 'next-webdriver'
|
|
import webdriver from 'next-webdriver'
|
|
import { check } 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: Playwright
|
|
|
|
try {
|
|
browser = await webdriver(next.url, '/')
|
|
await browser.elementByCss('#to-iso').click()
|
|
await check(() => browser.elementByCss('#page').text(), '/[slug]')
|
|
} finally {
|
|
if (browser) {
|
|
await browser.close()
|
|
}
|
|
}
|
|
})
|
|
|
|
it('should go to non-iso url', async () => {
|
|
let browser: Playwright
|
|
|
|
try {
|
|
browser = await webdriver(next.url, '/')
|
|
await browser.elementByCss('#to-non-iso').click()
|
|
await check(() => browser.elementByCss('#page').text(), '/[slug]')
|
|
} finally {
|
|
if (browser) {
|
|
await browser.close()
|
|
}
|
|
}
|
|
})
|
|
})
|