mirror of
https://github.com/vercel/next.js.git
synced 2026-09-20 02:25:18 +08:00
e860cec656
### 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 -->
47 lines
1.3 KiB
TypeScript
47 lines
1.3 KiB
TypeScript
import { join } from 'path'
|
|
import { FileRef, nextTestSetup } from 'e2e-utils'
|
|
import { retry } from 'next-test-utils'
|
|
|
|
// TODO: Somehow the warning doesn't show up with Turbopack, even though the transform is not enabled.
|
|
// TODO: It no longer shows up with Webpack either in tests.
|
|
describe.skip('styled-components SWC transform', () => {
|
|
const { next } = nextTestSetup({
|
|
files: {
|
|
'next.config.js': new FileRef(
|
|
join(__dirname, 'styled-components-disabled/next.config.js')
|
|
),
|
|
pages: new FileRef(join(__dirname, 'styled-components-disabled/pages')),
|
|
},
|
|
dependencies: {
|
|
'styled-components': '6.1.16',
|
|
},
|
|
})
|
|
|
|
it('should have hydration mismatch with styled-components transform disabled', async () => {
|
|
let browser
|
|
try {
|
|
// Compile /_error
|
|
browser = await next.browser('/404')
|
|
await browser.loadPage(new URL('/', next.url).toString())
|
|
|
|
await retry(async () => {
|
|
const logs = await browser.log()
|
|
expect(logs).toEqual(
|
|
expect.arrayContaining([
|
|
{
|
|
message: expect.stringContaining(
|
|
'https://react.dev/link/hydration-mismatch'
|
|
),
|
|
source: 'error',
|
|
},
|
|
])
|
|
)
|
|
})
|
|
} finally {
|
|
if (browser) {
|
|
await browser.close()
|
|
}
|
|
}
|
|
})
|
|
})
|