Skip to content

Commit

Permalink
Update flakey app-actions deploy tests (#49667)
Browse files Browse the repository at this point in the history
We'll need to investigate these flakes more but skipping so other tests
can run properly.

x-ref:
https://github.com/vercel/next.js/actions/runs/4944133723/jobs/8839614011
  • Loading branch information
ijjk committed May 11, 2023
1 parent 5781401 commit ec6cdb3
Showing 1 changed file with 57 additions and 39 deletions.
96 changes: 57 additions & 39 deletions test/e2e/app-dir/actions/app-action.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ createNextDescribe(
{
files: __dirname,
},
({ next, isNextDev, isNextStart }) => {
({ next, isNextDev, isNextStart, isNextDeploy }) => {
it('should handle basic actions correctly', async () => {
const browser = await next.browser('/server')

Expand Down Expand Up @@ -72,13 +72,19 @@ createNextDescribe(

const browser = await next.browser('/client')
await browser.elementByCss('#get-header').click()
await check(() => {
return logs.some((log) =>
log.includes('accept header: text/x-component')
)
? 'yes'
: ''
}, 'yes')

// we don't have access to runtime logs on deploy
if (!isNextDeploy) {
await check(() => {
return logs.some((log) =>
log.includes('accept header: text/x-component')
)
? 'yes'
: ''
}, 'yes')
}

await check(() => browser.eval('document.cookie'), /test-cookie/)

expect(
await browser.eval('+document.cookie.match(/test-cookie=(\\d+)/)[1]')
Expand Down Expand Up @@ -161,11 +167,16 @@ createNextDescribe(

await browser.elementByCss('#upload').click()

await check(() => {
return logs.some((log) => log.includes('File name: hello.txt size: 5'))
? 'yes'
: ''
}, 'yes')
// we don't have access to runtime logs on deploy
if (!isNextDeploy) {
await check(() => {
return logs.some((log) =>
log.includes('File name: hello.txt size: 5')
)
? 'yes'
: ''
}, 'yes')
}
})

it('should support hoc auth wrappers', async () => {
Expand Down Expand Up @@ -389,21 +400,24 @@ createNextDescribe(

await browser.elementByCss('#revalidate-justputit').click()

await check(async () => {
const newRandomNumber = await browser
.elementByCss('#random-number')
.text()
const newJustPutIt = await browser.elementByCss('#justputit').text()
const newThankYouNext = await browser
.elementByCss('#thankyounext')
.text()

return newRandomNumber !== randomNumber &&
justPutIt !== newJustPutIt &&
thankYouNext === newThankYouNext
? 'success'
: 'failure'
}, 'success')
// TODO: investigate flakiness when deployed
if (!isNextDeploy) {
await check(async () => {
const newRandomNumber = await browser
.elementByCss('#random-number')
.text()
const newJustPutIt = await browser.elementByCss('#justputit').text()
const newThankYouNext = await browser
.elementByCss('#thankyounext')
.text()

expect(newRandomNumber).not.toBe(randomNumber)
expect(newJustPutIt).not.toBe(justPutIt)
expect(newThankYouNext).toBe(thankYouNext)

return 'success'
}, 'success')
}
})

it('should handle revalidateTag + redirect', async () => {
Expand All @@ -423,23 +437,27 @@ createNextDescribe(
.elementByCss('#thankyounext')
.text()

return newRandomNumber === randomNumber &&
justPutIt !== newJustPutIt &&
thankYouNext === newThankYouNext
? 'success'
: 'failure'
expect(newRandomNumber).toBe(randomNumber)
expect(newJustPutIt).not.toBe(justPutIt)
expect(newThankYouNext).toBe(thankYouNext)

return 'success'
}, 'success')
})

it('should store revalidation data in the prefetch cache', async () => {
const browser = await next.browser('/client')
await browser.elementByCss('#navigate-revalidate').click()
const browser = await next.browser('/revalidate')
const justPutIt = await browser.elementByCss('#justputit').text()
await browser.elementByCss('#revalidate-justputit').click()
await check(async () => {
const newJustPutIt = await browser.elementByCss('#justputit').text()
return newJustPutIt !== justPutIt ? 'success' : 'failure'
}, 'success')

// TODO: investigate flakiness when deployed
if (!isNextDeploy) {
await check(async () => {
const newJustPutIt = await browser.elementByCss('#justputit').text()
expect(newJustPutIt).not.toBe(justPutIt)
return 'success'
}, 'success')
}

const newJustPutIt = await browser.elementByCss('#justputit').text()

Expand Down

0 comments on commit ec6cdb3

Please sign in to comment.