mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
## Background Currently in app router during development all pages are dynamic rendered and streamed since we don't know if a page will be prerendered until after the page is rendered. During build time we do a render pass for each path and if it doesn't bail from static generation it is considered prerendered/ISR'd. Since it can be tricky to track all the bail outs for static generation and doing numerous builds to track this isn't feasible we want to have some sort of signal in development to show if it would have been prerendered. ## New Handling To alleviate the above pain point we are planning to bring back the prerendered indicator from pages initially and have a config to disable if desired. We are also going to investigate other possible indicators potentially through headers or similar. <details> <summary>Preview</summary>   </details> --------- Co-authored-by: Jiachi Liu <[email protected]>
48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
import { nextTestSetup } from 'e2e-utils'
|
|
import { check, waitFor, retry } from 'next-test-utils'
|
|
|
|
describe('app-dir action handling', () => {
|
|
const { next } = nextTestSetup({
|
|
files: __dirname,
|
|
})
|
|
|
|
it('should handle actions correctly after navigation / redirection events', async () => {
|
|
const browser = await next.browser('/')
|
|
|
|
await browser.elementByCss('#middleware-redirect').click()
|
|
|
|
expect(await browser.elementByCss('#form').text()).not.toContain(
|
|
'Loading...'
|
|
)
|
|
|
|
await browser.elementByCss('#submit').click()
|
|
|
|
await check(() => {
|
|
return browser.elementByCss('#form').text()
|
|
}, /Loading.../)
|
|
|
|
// wait for 2 seconds, since the action takes a second to resolve
|
|
await waitFor(2000)
|
|
|
|
expect(await browser.elementByCss('#form').text()).not.toContain(
|
|
'Loading...'
|
|
)
|
|
|
|
expect(await browser.elementByCss('#result').text()).toContain(
|
|
'RESULT FROM SERVER ACTION'
|
|
)
|
|
})
|
|
|
|
it('should handle actions correctly after following a relative link', async () => {
|
|
const browser = await next.browser('/nested-folder/products')
|
|
|
|
await browser.elementByCss('a').click()
|
|
|
|
await browser.elementByCss('#submit').click()
|
|
|
|
await retry(async () => {
|
|
expect(await browser.elementById('result').text()).toBe('Added to cart!')
|
|
})
|
|
})
|
|
})
|