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 -->
26 lines
591 B
TypeScript
26 lines
591 B
TypeScript
import { nextTestSetup } from 'e2e-utils'
|
|
|
|
describe('Dotenv default expansion', () => {
|
|
const { next } = nextTestSetup({
|
|
files: {
|
|
'pages/index.js': `
|
|
export default function Page() {
|
|
return <p>{process.env.NEXT_PUBLIC_TEST}</p>
|
|
}
|
|
`,
|
|
'.env': `
|
|
NEXT_PUBLIC_TEST=\${MISSING_KEY:-default}
|
|
`,
|
|
},
|
|
dependencies: {},
|
|
})
|
|
|
|
it('should work', async () => {
|
|
const browser = await next.browser('/')
|
|
const text = await browser.elementByCss('p').text()
|
|
expect(text).toBe('default')
|
|
|
|
await browser.close()
|
|
})
|
|
})
|