Skip to content

Commit

Permalink
Temporarily skip flakey action revalidate (#53134)
Browse files Browse the repository at this point in the history
These have been flaking for quite a while so skips them more
consistently until they are investigated.

x-ref:
https://github.com/vercel/next.js/actions/runs/5650048471/job/15305721826#step:27:590
  • Loading branch information
ijjk committed Jul 24, 2023
1 parent a0856eb commit 1c5c0ba
Showing 1 changed file with 79 additions and 86 deletions.
165 changes: 79 additions & 86 deletions test/e2e/app-dir/actions/app-action.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -422,10 +422,8 @@ createNextDescribe(
}, 'https://example.com/')
})

// TODO: investigate flakey behavior on deploy
const skipDeploy = (global as any).isNextDeploy ? it.skip : it

skipDeploy('should handle revalidatePath', async () => {
// TODO: investigate flakey behavior with revalidate
it.skip('should handle revalidatePath', async () => {
const browser = await next.browser('/revalidate')
const randomNumber = await browser.elementByCss('#random-number').text()
const justPutIt = await browser.elementByCss('#justputit').text()
Expand All @@ -450,7 +448,8 @@ createNextDescribe(
}, 'success')
})

skipDeploy('should handle revalidateTag', async () => {
// TODO: investigate flakey behavior with revalidate
it.skip('should handle revalidateTag', async () => {
const browser = await next.browser('/revalidate')
const randomNumber = await browser.elementByCss('#random-number').text()
const justPutIt = await browser.elementByCss('#justputit').text()
Expand All @@ -475,7 +474,7 @@ createNextDescribe(
}, 'success')
})

// TODO: investigate flakey behavior
// TODO: investigate flakey behavior with revalidate
it.skip('should handle revalidateTag + redirect', async () => {
const browser = await next.browser('/revalidate')
const randomNumber = await browser.elementByCss('#random-number').text()
Expand All @@ -501,42 +500,38 @@ createNextDescribe(
}, 'success')
})

skipDeploy(
'should store revalidation data in the prefetch cache',
async () => {
const browser = await next.browser('/revalidate')
const justPutIt = await browser.elementByCss('#justputit').text()
await browser.elementByCss('#revalidate-justputit').click()

// 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')
}
it.skip('should store revalidation data in the prefetch cache', async () => {
const browser = await next.browser('/revalidate')
const justPutIt = await browser.elementByCss('#justputit').text()
await browser.elementByCss('#revalidate-justputit').click()

const newJustPutIt = await browser.elementByCss('#justputit').text()
// 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')
}

await browser
.elementByCss('#navigate-client')
.click()
.waitForElementByCss('#inc')
await browser
.elementByCss('#navigate-revalidate')
.click()
.waitForElementByCss('#revalidate-justputit')
const newJustPutIt = await browser.elementByCss('#justputit').text()

const newJustPutIt2 = await browser.elementByCss('#justputit').text()
await browser
.elementByCss('#navigate-client')
.click()
.waitForElementByCss('#inc')
await browser
.elementByCss('#navigate-revalidate')
.click()
.waitForElementByCss('#revalidate-justputit')

expect(newJustPutIt).toEqual(newJustPutIt2)
}
)
const newJustPutIt2 = await browser.elementByCss('#justputit').text()

skipDeploy('should revalidate when cookies.set is called', async () => {
expect(newJustPutIt).toEqual(newJustPutIt2)
})

// TODO: investigate flakey behavior with revalidate
it.skip('should revalidate when cookies.set is called', async () => {
const browser = await next.browser('/revalidate')
const randomNumber = await browser.elementByCss('#random-cookie').text()

Expand All @@ -551,67 +546,65 @@ createNextDescribe(
}, 'success')
})

skipDeploy(
'should revalidate when cookies.set is called in a client action',
async () => {
const browser = await next.browser('/revalidate')
await browser.refresh()
// TODO: investigate flakey behavior with revalidate
it.skip('should revalidate when cookies.set is called in a client action', async () => {
const browser = await next.browser('/revalidate')
await browser.refresh()

let randomCookie
await check(async () => {
randomCookie = JSON.parse(
await browser.elementByCss('#random-cookie').text()
).value
return randomCookie ? 'success' : 'failure'
}, 'success')
let randomCookie
await check(async () => {
randomCookie = JSON.parse(
await browser.elementByCss('#random-cookie').text()
).value
return randomCookie ? 'success' : 'failure'
}, 'success')

console.log(123, await browser.elementByCss('body').text())
console.log(123, await browser.elementByCss('body').text())

await browser.elementByCss('#another').click()
await check(async () => {
return browser.elementByCss('#title').text()
}, 'another route')
await browser.elementByCss('#another').click()
await check(async () => {
return browser.elementByCss('#title').text()
}, 'another route')

const newRandomCookie = JSON.parse(
await browser.elementByCss('#random-cookie').text()
).value
const newRandomCookie = JSON.parse(
await browser.elementByCss('#random-cookie').text()
).value

console.log(456, await browser.elementByCss('body').text())
console.log(456, await browser.elementByCss('body').text())

// Should be the same value
expect(randomCookie).toEqual(newRandomCookie)
// Should be the same value
expect(randomCookie).toEqual(newRandomCookie)

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

// Modify the cookie
await browser.elementByCss('#set-cookie').click()
// Modify the cookie
await browser.elementByCss('#set-cookie').click()

// Should be different
let revalidatedRandomCookie
await check(async () => {
revalidatedRandomCookie = JSON.parse(
await browser.elementByCss('#random-cookie').text()
).value
return randomCookie !== revalidatedRandomCookie
? 'success'
: 'failure'
}, 'success')
// Should be different
let revalidatedRandomCookie
await check(async () => {
revalidatedRandomCookie = JSON.parse(
await browser.elementByCss('#random-cookie').text()
).value
return randomCookie !== revalidatedRandomCookie
? 'success'
: 'failure'
}, 'success')

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

// The other page should be revalidated too
await check(async () => {
const newRandomCookie = await JSON.parse(
await browser.elementByCss('#random-cookie').text()
).value
return revalidatedRandomCookie === newRandomCookie
? 'success'
: 'failure'
}, 'success')
}
)
// The other page should be revalidated too
await check(async () => {
const newRandomCookie = await JSON.parse(
await browser.elementByCss('#random-cookie').text()
).value
return revalidatedRandomCookie === newRandomCookie
? 'success'
: 'failure'
}, 'success')
})

skipDeploy.each(['tag', 'path'])(
it.skip.each(['tag', 'path'])(
'should invalidate client cache when %s is revalidated',
async (type) => {
const browser = await next.browser('/revalidate')
Expand Down

0 comments on commit 1c5c0ba

Please sign in to comment.