mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
## What? Converts more tests that use `createNext` to `nextTestSetup` Follow-up to #93767 --------- Co-authored-by: Cursor <[email protected]>
34 lines
899 B
TypeScript
34 lines
899 B
TypeScript
import { nextTestSetup } from 'e2e-utils'
|
|
import { retry } from 'next-test-utils'
|
|
|
|
describe('app-dir assetPrefix full URL', () => {
|
|
const { next } = nextTestSetup({
|
|
files: __dirname,
|
|
skipStart: true,
|
|
forcedPort: 'random',
|
|
})
|
|
|
|
beforeAll(async () => {
|
|
const port = next.forcedPort
|
|
await next.patchFile(
|
|
'next.config.js',
|
|
`module.exports = { assetPrefix: 'http://localhost:${port}' }`
|
|
)
|
|
await next.start()
|
|
})
|
|
|
|
it('should not break HMR when asset prefix set to full URL', async () => {
|
|
const browser = await next.browser('/')
|
|
const text = await browser.elementByCss('p').text()
|
|
expect(text).toBe('before edit')
|
|
|
|
await next.patchFile('app/page.tsx', (content) => {
|
|
return content.replace('before', 'after')
|
|
})
|
|
|
|
await retry(async () => {
|
|
expect(await browser.elementByCss('p').text()).toBe('after edit')
|
|
})
|
|
})
|
|
})
|