mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
### What? Migrate remaining direct `next-webdriver` test callers that have a `NextInstance` to `next.browser()`, and expose the shared `Playwright` browser type from `e2e-utils`. ### Why? `NextInstance.browser` should be the supported browser-opening interface for test fixtures, with `next-webdriver` kept as the private implementation detail. ### How? Updated affected development, e2e, and production tests to call `next.browser()` directly, passing `baseUrl` where tests intentionally target a manually spawned or proxied server. Shared helpers now receive browser callbacks from the test context, and browser types import `Playwright` from `e2e-utils` instead of deriving from `next.browser` or importing from private paths. <!-- NEXT_JS_LLM_PR -->
28 lines
712 B
TypeScript
28 lines
712 B
TypeScript
import { nextTestSetup } from 'e2e-utils'
|
|
import { waitFor } from 'next-test-utils'
|
|
|
|
describe('getServerSideProps returns notFound: true', () => {
|
|
const { next } = nextTestSetup({
|
|
files: {
|
|
'pages/index.js': `
|
|
const Home = () => null
|
|
export default Home
|
|
|
|
export function getServerSideProps() {
|
|
console.log("gssp called")
|
|
return { notFound: true }
|
|
}
|
|
`,
|
|
},
|
|
dependencies: {},
|
|
})
|
|
|
|
it('should not poll indefinitely', async () => {
|
|
const browser = await next.browser('/')
|
|
await waitFor(3000)
|
|
await browser.close()
|
|
const logOccurrences = next.cliOutput.split('gssp called').length - 1
|
|
expect(logOccurrences).toBe(1)
|
|
})
|
|
})
|