Unverified Commit b0ad8adc authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Update app-dir E2E tests for deploy (#42269)

x-ref:
https://github.com/vercel/next.js/actions/runs/3364229800/jobs/5579571814

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
parent c1c3eac3
......@@ -1182,17 +1182,20 @@ describe('app dir', () => {
expect($('#params-not-real').text()).toBe('N/A')
})
it('should have the canonical url search params on rewrite', async () => {
const html = await renderViaHTTP(
next.url,
'/rewritten-use-search-params?first=a&second=b&third=c'
)
const $ = cheerio.load(html)
expect($('#params-first').text()).toBe('a')
expect($('#params-second').text()).toBe('b')
expect($('#params-third').text()).toBe('c')
expect($('#params-not-real').text()).toBe('N/A')
})
// TODO-APP: correct this behavior when deployed
if (!(global as any).isNextDeploy) {
it('should have the canonical url search params on rewrite', async () => {
const html = await renderViaHTTP(
next.url,
'/rewritten-use-search-params?first=a&second=b&third=c'
)
const $ = cheerio.load(html)
expect($('#params-first').text()).toBe('a')
expect($('#params-second').text()).toBe('b')
expect($('#params-third').text()).toBe('c')
expect($('#params-not-real').text()).toBe('N/A')
})
}
})
describe('useRouter', () => {
......@@ -2221,18 +2224,21 @@ describe('app dir', () => {
})
describe('data fetch with response over 16KB with chunked encoding', () => {
it('should load page when fetching a large amount of data', async () => {
const browser = await webdriver(next.url, '/very-large-data-fetch')
expect(
await (await browser.waitForElementByCss('#done', 5000)).text()
).toBe('Hello world')
expect(
await (await browser.waitForElementByCss('#index', 2000)).text()
).toBe('0')
expect(
await (await browser.waitForElementByCss('#random', 2000)).text()
).toBe('5')
})
// TODO-APP: increase timeouts for testing against deploy?
if (!(global as any).isNextDeploy) {
it('should load page when fetching a large amount of data', async () => {
const browser = await webdriver(next.url, '/very-large-data-fetch')
expect(
await (await browser.waitForElementByCss('#done', 5000)).text()
).toBe('Hello world')
expect(
await (await browser.waitForElementByCss('#index', 2000)).text()
).toBe('0')
expect(
await (await browser.waitForElementByCss('#random', 2000)).text()
).toBe('5')
})
}
})
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment