Skip to content

Commit

Permalink
Merge branch 'canary' into sam/github-workflow/bankrupt
Browse files Browse the repository at this point in the history
  • Loading branch information
samcx authored Jun 11, 2024
2 parents a31609b + 0c49daa commit 72d5706
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 50 deletions.
2 changes: 0 additions & 2 deletions test/deploy-tests-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"test/production/**/*.test.{t,j}s{,x}"
],
"exclude": [
"test/e2e/app-dir/app-client-cache/client-cache.original.test.ts",
"test/e2e/app-dir/app-routes/app-custom-routes.test.ts",
"test/e2e/app-dir/next-after-app/index.test.ts",
"test/e2e/app-dir/scss/nm-module-nested/nm-module-nested.test.ts",
Expand All @@ -32,7 +31,6 @@
"test/e2e/third-parties/index.test.ts",
"test/e2e/useselectedlayoutsegment-s-in-pages-router/useselectedlayoutsegment-s-in-pages-router.test.ts",
"test/e2e/app-dir/app-prefetch-false-loading/app-prefetch-false-loading.test.ts",
"test/e2e/app-dir/app-client-cache/client-cache.experimental.test.ts",
"test/e2e/app-dir/app-routes-client-component/app-routes-client-component.test.ts",
"test/e2e/app-dir/app-routes/app-custom-route-base-path.test.ts",
"test/e2e/app-dir/mdx/mdx.test.ts",
Expand Down
18 changes: 10 additions & 8 deletions test/e2e/app-dir/app-client-cache/client-cache.defaults.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { nextTestSetup } from 'e2e-utils'
import { check } from 'next-test-utils'
import { check, retry } from 'next-test-utils'
import { BrowserInterface } from 'next-webdriver'
import {
browserConfigWithFixedTime,
Expand Down Expand Up @@ -316,18 +316,20 @@ describe('app dir client cache semantics (default semantics)', () => {
await browser.elementByCss('[href="/null-loading"]').click()

// the page content should disappear immediately
expect(
await browser.hasElementByCssSelector('[href="/null-loading"]')
).toBeFalse()
await retry(async () => {
expect(
await browser.hasElementByCssSelector('[href="/null-loading"]')
).toBe(false)
})

// the root layout should still be visible
expect(await browser.hasElementByCssSelector('#root-layout')).toBeTrue()
expect(await browser.hasElementByCssSelector('#root-layout')).toBe(true)

// the dynamic content should eventually appear
await browser.waitForElementByCss('#random-number')
expect(
await browser.hasElementByCssSelector('#random-number')
).toBeTrue()
expect(await browser.hasElementByCssSelector('#random-number')).toBe(
true
)
})
})

Expand Down
68 changes: 36 additions & 32 deletions test/e2e/app-dir/app-client-cache/client-cache.experimental.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import path from 'path'

describe('app dir client cache semantics (experimental staleTimes)', () => {
describe('dynamic: 0', () => {
const { next, isNextDev } = nextTestSetup({
const { next, isNextDev, isNextDeploy } = nextTestSetup({
files: path.join(__dirname, 'fixtures', 'regular'),
nextConfig: {
experimental: { staleTimes: { dynamic: 0 } },
Expand Down Expand Up @@ -222,27 +222,29 @@ describe('app dir client cache semantics (experimental staleTimes)', () => {
})
})

describe('telemetry', () => {
it('should send staleTimes feature usage event', async () => {
const events = findAllTelemetryEvents(
next.cliOutput,
'NEXT_CLI_SESSION_STARTED'
)
if (!isNextDeploy) {
describe('telemetry', () => {
it('should send staleTimes feature usage event', async () => {
const events = findAllTelemetryEvents(
next.cliOutput,
'NEXT_CLI_SESSION_STARTED'
)

expect(events).toEqual(
expect.arrayContaining([
expect.objectContaining({
staticStaleTime: null,
dynamicStaleTime: 0,
}),
])
)
expect(events).toEqual(
expect.arrayContaining([
expect.objectContaining({
staticStaleTime: null,
dynamicStaleTime: 0,
}),
])
)
})
})
})
}
})

describe('static: 180', () => {
const { next, isNextDev } = nextTestSetup({
const { next, isNextDev, isNextDeploy } = nextTestSetup({
files: path.join(__dirname, 'fixtures', 'regular'),
nextConfig: {
experimental: { staleTimes: { static: 180 } },
Expand Down Expand Up @@ -341,22 +343,24 @@ describe('app dir client cache semantics (experimental staleTimes)', () => {
})
})

describe('telemetry', () => {
it('should send staleTimes feature usage event', async () => {
const events = findAllTelemetryEvents(
next.cliOutput,
'NEXT_CLI_SESSION_STARTED'
)
expect(events).toEqual(
expect.arrayContaining([
expect.objectContaining({
staticStaleTime: 180,
dynamicStaleTime: null,
}),
])
)
if (!isNextDeploy) {
describe('telemetry', () => {
it('should send staleTimes feature usage event', async () => {
const events = findAllTelemetryEvents(
next.cliOutput,
'NEXT_CLI_SESSION_STARTED'
)
expect(events).toEqual(
expect.arrayContaining([
expect.objectContaining({
staticStaleTime: 180,
dynamicStaleTime: null,
}),
])
)
})
})
})
}
})

describe('dynamic: 0, static: 0', () => {
Expand Down
18 changes: 10 additions & 8 deletions test/e2e/app-dir/app-client-cache/client-cache.original.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { nextTestSetup } from 'e2e-utils'
import { check } from 'next-test-utils'
import { check, retry } from 'next-test-utils'
import { BrowserInterface } from 'next-webdriver'
import {
browserConfigWithFixedTime,
Expand Down Expand Up @@ -421,18 +421,20 @@ describe('app dir client cache semantics (30s/5min)', () => {
await browser.elementByCss('[href="/null-loading"]').click()

// the page content should disappear immediately
expect(
await browser.hasElementByCssSelector('[href="/null-loading"]')
).toBeFalse()
await retry(async () => {
expect(
await browser.hasElementByCssSelector('[href="/null-loading"]')
).toBe(false)
})

// the root layout should still be visible
expect(await browser.hasElementByCssSelector('#root-layout')).toBeTrue()
expect(await browser.hasElementByCssSelector('#root-layout')).toBe(true)

// the dynamic content should eventually appear
await browser.waitForElementByCss('#random-number')
expect(
await browser.hasElementByCssSelector('#random-number')
).toBeTrue()
expect(await browser.hasElementByCssSelector('#random-number')).toBe(
true
)
})
})

Expand Down

0 comments on commit 72d5706

Please sign in to comment.