Files
Janka UrygaandGitHub 4282bc6f91 remove BrowserInterface (#78308)
rip. you served a purpose once, but now you're just getting in the way. this improves typesafety quite a bit, because `BrowserInterface` had a whole bunch of random `any`s everywhere

also
- removes `evalAsync`. no idea why that was needed, but we're happily using promises in normal eval, so it can be dropped
- adds more safety to `chain`
2025-04-18 11:16:15 -07:00

56 lines
1.6 KiB
TypeScript

import { nextTestSetup } from 'e2e-utils'
import { retry } from 'next-test-utils'
describe('rsc-query-routing', () => {
const { next } = nextTestSetup({
files: __dirname,
})
it('should contain rsc query in rsc request when redirect the page', async () => {
const browser = await next.browser('/redirect')
const rscRequestUrls: string[] = []
browser.on('request', (req) => {
if (req.url().includes('?_rsc=')) {
rscRequestUrls.push(req.url())
}
})
// Click redirect link
const link = await browser.elementByCss('a')
await link.click()
// Wait for the page load to be completed
await retry(async () => {
expect(await browser.elementByCss('h1').text()).toBe('Redirect Dest')
})
// The redirect source and dest urls should both contain the rsc query
expect(rscRequestUrls[0]).toContain('/redirect/source')
expect(rscRequestUrls[1]).toContain('/redirect/dest')
})
it('should contain rsc query in rsc request when rewrite the page', async () => {
const browser = await next.browser('/rewrite')
const rscRequestUrls: string[] = []
browser.on('request', (req) => {
if (req.url().includes('?_rsc=')) {
rscRequestUrls.push(req.url())
}
})
// Click redirect link
const link = await browser.elementByCss('a')
await link.click()
// Wait for the page load to be completed
await retry(async () => {
expect(await browser.elementByCss('h1').text()).toBe('Rewrite Dest')
})
// The rewrite source url should contain the rsc query
expect(rscRequestUrls[0]).toContain('/rewrite/source')
})
})