Files
next.js/test/e2e/next-form/basepath/next-form-basepath.test.ts
Benjamin WoodruffandGitHub cf1eea49e3 chore(CI): Split next-form tests into smaller suites/files that can be run more-in-parallel (#78891)
Same basic idea as https://github.com/vercel/next.js/pull/78787

This test suite has a lot of timeouts with rspack, which causes it to take a long time to run (though not quite long enough that it breaks the job).

In general, large test suites are good to break up, because they benefit from parallelism.
2025-05-09 16:33:42 -07:00

44 lines
1.4 KiB
TypeScript

import { nextTestSetup } from 'e2e-utils'
describe('app dir - form - with basepath', () => {
const { next } = nextTestSetup({
files: __dirname,
})
it('should add basePath to `action`', async () => {
const session = await next.browser('/base/forms/basic')
const start = Date.now()
await session.eval(`window.__MPA_NAV_ID = ${start}`)
const searchInput = await session.elementByCss('input[name="query"]')
await searchInput.fill('my search')
const submitButton = await session.elementByCss('[type="submit"]')
await submitButton.click()
const result = await session.waitForElementByCss('#search-results').text()
expect(result).toMatch(/query: "my search"/)
expect(await session.eval(`window.__MPA_NAV_ID`)).toEqual(start)
})
it("should not add basePath to a submitter's formAction", async () => {
const session = await next.browser('/base/forms/button-formaction')
const start = Date.now()
await session.eval(`window.__MPA_NAV_ID = ${start}`)
const searchInput = await session.elementByCss('input[name="query"]')
await searchInput.fill('my search')
const submitButton = await session.elementByCss('[type="submit"]')
await submitButton.click()
const result = await session.waitForElementByCss('#search-results').text()
expect(result).toMatch(/query: "my search"/)
expect(await session.eval(`window.__MPA_NAV_ID`)).toEqual(start)
})
})