Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
8e1534c1
Commit
8e1534c1
authored
Oct 20, 2025
by
Janka Uryga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Cache Components] test labels when caching is disabled
parent
ff7fbe1a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
10 deletions
+24
-10
react-performance-track.test.ts
...r/react-performance-track/react-performance-track.test.ts
+24
-10
No files found.
test/development/app-dir/react-performance-track/react-performance-track.test.ts
View file @
8e1534c1
import
{
nextTestSetup
}
from
'e2e-utils'
describe
(
'react-performance-track'
,
()
=>
{
describe
.
each
([
{
description
:
'caching enabled'
,
enableCache
:
true
,
},
{
description
:
'caching disabled'
,
enableCache
:
false
,
},
])(
'react-performance-track - $description'
,
({
enableCache
})
=>
{
// false is the default when visiting pages as an ordinary user.
// true is the default when having Chrome DevTools open.
// Hardcoded for now since most of the actual behavior is not intended.
const
disableCache
=
false
const
extraHTTPHeaders
=
disableCache
?
{
'Cache-Control'
:
'no-cache'
}
:
undefined
const
extraHTTPHeaders
=
enableCache
?
undefined
:
{
'Cache-Control'
:
'no-cache'
}
const
{
next
}
=
nextTestSetup
({
files
:
__dirname
,
})
// We only get the "Prefetchable" label when caches are enabled.
// If caches are disabled, the environement will be "Server",
// which react doesn't display because it's the default.
// So we can't check the label, but we'll still test that the API resulted in an IO entry.
const
PREFETCHABLE_LABEL
=
enableCache
?
' [Prefetchable]'
:
''
it
(
'should show setTimeout'
,
async
()
=>
{
const
browser
=
await
next
.
browser
(
'/set-timeout'
,
{
extraHTTPHeaders
})
await
browser
.
elementByCss
(
'[data-react-server-requests-done]'
,
{
...
...
@@ -61,7 +75,7 @@ describe('react-performance-track', () => {
expect
(
track
).
toEqual
(
expect
.
arrayContaining
([
{
name
:
'
\
u200bparams [Prefetchable]'
,
name
:
`\u200bparams
${
PREFETCHABLE_LABEL
}
`
,
properties
:
[],
},
])
...
...
@@ -80,7 +94,7 @@ describe('react-performance-track', () => {
expect
(
track
).
toEqual
(
expect
.
arrayContaining
([
{
name
:
'
\
u200bsearchParams [Prefetchable]'
,
name
:
`\u200bsearchParams
${
PREFETCHABLE_LABEL
}
`
,
properties
:
[],
},
])
...
...
@@ -97,7 +111,7 @@ describe('react-performance-track', () => {
expect
(
track
).
toEqual
(
expect
.
arrayContaining
([
{
name
:
'
\
u200bcookies [Prefetchable]'
,
name
:
`\u200bcookies
${
PREFETCHABLE_LABEL
}
`
,
properties
:
[],
},
// TODO: The error message makes this seem like it shouldn't pop up here.
...
...
@@ -123,7 +137,7 @@ describe('react-performance-track', () => {
})
const
track
=
await
browser
.
eval
(
'window.reactServerRequests.getSnapshot()'
)
//
TODO: Should include "draftMode [Prefetchable]"
.
//
draftMode should not show up as IO
.
expect
(
track
).
toEqual
([
{
name
:
'
\
u200b'
,
...
...
@@ -142,7 +156,7 @@ describe('react-performance-track', () => {
expect
(
track
).
toEqual
(
expect
.
arrayContaining
([
{
name
:
'
\
u200bheaders [Prefetchable]'
,
name
:
`\u200bheaders
${
PREFETCHABLE_LABEL
}
`
,
properties
:
[],
},
// TODO: The error message makes this seem like it shouldn't pop up here.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment