Files
Tim NeutkensandGitHub e860cec656 test: migrate webdriver callers to next.browser (#93941)
### 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 -->
2026-05-22 14:01:58 +02:00

33 lines
947 B
TypeScript

import { FileRef, nextTestSetup } from 'e2e-utils'
import path from 'path'
const appDir = path.join(__dirname, 'stitches')
describe('New Link Behavior with stitches', () => {
const { next } = nextTestSetup({
files: {
pages: new FileRef(path.join(appDir, 'pages')),
components: new FileRef(path.join(appDir, 'components')),
'next.config.js': new FileRef(path.join(appDir, 'next.config.js')),
'stitches.config.js': new FileRef(
path.join(appDir, 'stitches.config.js')
),
},
dependencies: {
'@stitches/react': '^1.2.6',
next: 'latest',
},
})
it('should render <a>', async () => {
const browser = await next.browser(`/`)
const element = await browser.elementByCss('a[href="/about"]')
const color = await element.getComputedCss('color')
expect(color).toBe('rgb(78, 39, 231)')
const text = await element.text()
expect(text).toBe('Visit About')
})
})