mirror of
https://github.com/vercel/next.js.git
synced 2026-09-20 02:25:18 +08:00
e0966df114
## Summary - migrate Cache Components, PPR, prefetching, prerendering, revalidation, and SSG deployment exclusions to `@force-gate` - remove the corresponding `skipDeployment` options and `skipped` control flow while preserving each suite's rationale This keeps caching-related exclusions together so their deployed semantics can be reviewed by the same owners. ## Verification - verified on the combined top-of-stack tree with `pnpm typescript` - compared ordinary-mode collection before and after: all 4,670 existing test names matched - collected all 510 affected files in deploy mode: 4,578 skipped tests, zero failures <!-- NEXT_JS_LLM -->
41 lines
1.3 KiB
TypeScript
41 lines
1.3 KiB
TypeScript
import { nextTestSetup } from 'e2e-utils'
|
|
import { retry } from 'next-test-utils'
|
|
|
|
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
|
|
// It likely asserts local CLI or runtime output that deploy tests do not expose.
|
|
// @force-gate !deploy
|
|
describe('app-dir - draft-mode-middleware', () => {
|
|
const { next } = nextTestSetup({
|
|
files: __dirname,
|
|
})
|
|
|
|
it('should be able to enable draft mode with middleware present', async () => {
|
|
const browser = await next.browser(
|
|
'/api/draft?secret=secret-token&slug=preview-page'
|
|
)
|
|
|
|
await retry(async () => {
|
|
expect(next.cliOutput).toContain(
|
|
'draftMode().isEnabled from middleware: true'
|
|
)
|
|
})
|
|
|
|
await browser.loadPage(new URL('/preview-page', next.url).toString())
|
|
const draftText = await browser.elementByCss('h1').text()
|
|
expect(draftText).toBe('draft')
|
|
})
|
|
|
|
it('should be able to disable draft mode with middleware present', async () => {
|
|
const browser = await next.browser('/api/disable-draft')
|
|
await retry(async () => {
|
|
expect(next.cliOutput).toContain(
|
|
'draftMode().isEnabled from middleware: false'
|
|
)
|
|
})
|
|
|
|
await browser.loadPage(new URL('/preview-page', next.url).toString())
|
|
const draftText = await browser.elementByCss('h1').text()
|
|
expect(draftText).toBe('none')
|
|
})
|
|
})
|