mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +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 -->
37 lines
1.0 KiB
TypeScript
37 lines
1.0 KiB
TypeScript
import * as path from 'path'
|
|
import { nextTestSetup, type Playwright } from 'e2e-utils'
|
|
|
|
async function assertNoConsoleErrors(browser: Playwright) {
|
|
const logs = await browser.log()
|
|
const warningsAndErrors = logs.filter((log) => {
|
|
return log.source === 'warning' || log.source === 'error'
|
|
})
|
|
|
|
expect(warningsAndErrors).toEqual([])
|
|
}
|
|
|
|
describe('view-transitions', () => {
|
|
const { next } = nextTestSetup({
|
|
files: path.join(__dirname, 'fixtures/default'),
|
|
})
|
|
|
|
it('smoketest', async () => {
|
|
const browser = await next.browser('/basic')
|
|
|
|
await assertNoConsoleErrors(browser)
|
|
})
|
|
|
|
it('transitionTypes smoketest', async () => {
|
|
const browser = await next.browser('/transition-types')
|
|
|
|
await assertNoConsoleErrors(browser)
|
|
|
|
// Click the link to navigate to page two
|
|
// The first link causes a sliding transition
|
|
// The second link causes a default transition (cross-fade)
|
|
await browser.elementByCss('a[href="/transition-types/page-two"]').click()
|
|
|
|
await assertNoConsoleErrors(browser)
|
|
})
|
|
})
|