a3ab542630
This adds new `build and test` and `build and deploy` workflows in favor of the existing massive `build, test, and deploy` workflow. Since the new workflows will use `pull_request_target` this waits to remove the existing workflow until the new one is tested. While testing this new workflow flakey behavior in tests have also been addressed. Along with the new workflow we will also be leveraging new runners which allow us to run tests against the production binary of `next-swc` so this avoids slight differences in tests we've seen due to running against the dev binary. Furthermore we will have a new flow for allowing workflow runs on PRs from external forks which will either require a comment be checking a box approving the run after each change or a label added by the team. The new flow also no longer relies on `actions/cache` or similar which have proven to be pretty unreliable. Tests runs with the new workflow can be seen here https://github.com/vercel/next.js/actions/runs/5100673508/jobs/9169416949
39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
import { createNextDescribe } from 'e2e-utils'
|
|
|
|
createNextDescribe(
|
|
'app-dir trailingSlash handling',
|
|
{
|
|
files: __dirname,
|
|
skipDeployment: true,
|
|
},
|
|
({ next }) => {
|
|
it('should redirect route when requesting it directly', async () => {
|
|
const res = await next.fetch('/a', {
|
|
redirect: 'manual',
|
|
})
|
|
expect(res.status).toBe(308)
|
|
expect(new URL(res.headers.get('location'), next.url).pathname).toBe(
|
|
'/a/'
|
|
)
|
|
})
|
|
|
|
it('should render link with trailing slash', async () => {
|
|
const $ = await next.render$('/')
|
|
expect($('#to-a-trailing-slash').attr('href')).toBe('/a/')
|
|
})
|
|
|
|
it('should redirect route when requesting it directly by browser', async () => {
|
|
const browser = await next.browser('/a')
|
|
expect(await browser.waitForElementByCss('#a-page').text()).toBe('A page')
|
|
})
|
|
|
|
it('should redirect route when clicking link', async () => {
|
|
const browser = await next.browser('/')
|
|
await browser
|
|
.elementByCss('#to-a-trailing-slash')
|
|
.click()
|
|
.waitForElementByCss('#a-page')
|
|
expect(await browser.waitForElementByCss('#a-page').text()).toBe('A page')
|
|
})
|
|
}
|
|
)
|