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
efcfe05a
Unverified
Commit
efcfe05a
authored
Mar 13, 2026
by
Sebastian "Sebbie" Silbermann
Committed by
GitHub
Mar 13, 2026
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[test] Deflake `instant-navs-devtools` (#91256)
parent
0e6ab3f5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
95 deletions
+61
-95
instant-navs-devtools.test.ts
...p-dir/instant-navs-devtools/instant-navs-devtools.test.ts
+37
-95
tsconfig.json
test/development/app-dir/instant-navs-devtools/tsconfig.json
+24
-0
No files found.
test/development/app-dir/instant-navs-devtools/instant-navs-devtools.test.ts
View file @
efcfe05a
import
{
nextTestSetup
}
from
'e2e-utils'
import
{
nextTestSetup
}
from
'e2e-utils'
import
{
import
{
retry
,
toggleDevToolsIndicatorPopover
}
from
'next-test-utils'
retry
,
import
{
Playwright
}
from
'next-webdriver'
waitForDevToolsIndicator
,
toggleDevToolsIndicatorPopover
,
}
from
'next-test-utils'
describe
(
'instant-nav-panel'
,
()
=>
{
describe
(
'instant-nav-panel'
,
()
=>
{
const
{
next
}
=
nextTestSetup
({
const
{
next
}
=
nextTestSetup
({
files
:
__dirname
,
files
:
__dirname
,
})
})
async
function
clearInstantModeCookie
(
browser
:
any
)
{
async
function
waitForPanelRouterTransition
()
{
await
browser
.
eval
(()
=>
{
// Run all the necessary CSS transitions
document
.
cookie
=
'next-instant-navigation-testing=; path=/; max-age=0'
// and click-outside event handler adjustment due to cascading update.
})
// TODO: Consider disabling transitions entirely in Next.js tests.
}
await
new
Promise
((
resolve
)
=>
setTimeout
(
async
function
clickInstantNavMenuItem
(
browser
:
any
)
{
resolve
,
await
browser
.
eval
(()
=>
{
// MENU_DURATION_MS
const
portal
=
[].
slice
200
.
call
(
document
.
querySelectorAll
(
'nextjs-portal'
))
)
.
find
((
p
:
any
)
=>
)
p
.
shadowRoot
.
querySelector
(
'[data-nextjs-toast]'
)
)
as
any
portal
?.
shadowRoot
?.
querySelector
(
'[data-instant-nav]'
)?.
click
()
})
}
}
async
function
cl
ickStartClientNav
(
browser
:
any
)
{
async
function
cl
earInstantModeCookie
(
browser
:
Playwright
)
{
await
browser
.
eval
(()
=>
{
await
browser
.
eval
(()
=>
{
const
portal
=
[].
slice
document
.
cookie
=
'next-instant-navigation-testing=; path=/; max-age=0'
.
call
(
document
.
querySelectorAll
(
'nextjs-portal'
))
.
find
((
p
:
any
)
=>
p
.
shadowRoot
.
querySelector
(
'[data-nextjs-toast]'
)
)
as
any
portal
?.
shadowRoot
?.
querySelector
(
'[data-instant-nav-client]'
)?.
click
()
})
})
}
}
async
function
getBadgeStatus
(
browser
:
any
):
Promise
<
string
>
{
async
function
clickInstantNavMenuItem
(
browser
:
Playwright
)
{
return
browser
.
eval
(()
=>
{
await
browser
.
elementByCss
(
'[data-instant-nav]'
).
click
()
const
portal
=
[].
slice
.
call
(
document
.
querySelectorAll
(
'nextjs-portal'
))
.
find
((
p
:
any
)
=>
p
.
shadowRoot
.
querySelector
(
'[data-nextjs-toast]'
)
)
as
any
return
(
portal
?.
shadowRoot
?.
querySelector
(
'[data-next-badge]'
)
?.
getAttribute
(
'data-status'
)
||
''
)
})
}
}
async
function
getPanelText
(
browser
:
any
):
Promise
<
string
>
{
async
function
clickStartClientNav
(
browser
:
Playwright
)
{
return
browser
.
eval
(()
=>
{
await
browser
.
elementByCssInstant
(
'[data-instant-nav-client]'
).
click
()
const
portal
=
[].
slice
.
call
(
document
.
querySelectorAll
(
'nextjs-portal'
))
.
find
((
p
:
any
)
=>
p
.
shadowRoot
.
querySelector
(
'[data-nextjs-toast]'
)
)
as
any
const
panel
=
portal
?.
shadowRoot
?.
querySelector
(
'.instant-nav-panel'
)
return
panel
?.
innerText
||
''
})
}
}
async
function
hasPanelOpen
(
browser
:
any
):
Promise
<
boolean
>
{
async
function
getInstantNavPanelText
(
browser
:
Playwright
):
Promise
<
string
>
{
return
browser
.
eval
(()
=>
{
return
browser
.
elementByCssInstant
(
'.instant-nav-panel'
).
text
()
const
portal
=
[].
slice
.
call
(
document
.
querySelectorAll
(
'nextjs-portal'
))
.
find
((
p
:
any
)
=>
p
.
shadowRoot
.
querySelector
(
'[data-nextjs-toast]'
)
)
as
any
return
!!
portal
?.
shadowRoot
?.
querySelector
(
'.instant-nav-panel'
)
})
}
}
async
function
closePanelViaHeader
(
browser
:
any
)
{
async
function
closePanelViaHeader
(
browser
:
Playwright
)
{
await
browser
.
eval
(()
=>
{
return
browser
.
elementByCss
(
'#_next-devtools-panel-close'
).
click
()
const
portal
=
[].
slice
.
call
(
document
.
querySelectorAll
(
'nextjs-portal'
))
.
find
((
p
:
any
)
=>
p
.
shadowRoot
.
querySelector
(
'[data-nextjs-toast]'
)
)
as
any
portal
?.
shadowRoot
?.
querySelector
(
'#_next-devtools-panel-close'
)?.
click
()
})
}
}
async
function
openInstantNavPanel
(
browser
:
any
)
{
async
function
openInstantNavPanel
(
browser
:
Playwright
)
{
await
waitForDevToolsIndicator
(
browser
)
await
toggleDevToolsIndicatorPopover
(
browser
)
await
toggleDevToolsIndicatorPopover
(
browser
)
await
waitForPanelRouterTransition
()
await
clickInstantNavMenuItem
(
browser
)
await
clickInstantNavMenuItem
(
browser
)
await
retry
(
async
()
=>
{
await
browser
.
elementByCssInstant
(
'.instant-nav-panel'
)
},
5
_000
,
500
)
await
waitForPanelRouterTransition
()
}
}
it
(
'should open panel in waiting state without setting cookie'
,
async
()
=>
{
it
(
'should open panel in waiting state without setting cookie'
,
async
()
=>
{
...
@@ -98,17 +62,11 @@ describe('instant-nav-panel', () => {
...
@@ -98,17 +62,11 @@ describe('instant-nav-panel', () => {
await
clearInstantModeCookie
(
browser
)
await
clearInstantModeCookie
(
browser
)
await
browser
.
waitForElementByCss
(
'[data-testid="home-title"]'
)
await
browser
.
waitForElementByCss
(
'[data-testid="home-title"]'
)
// Wait for initial compilation to settle
await
retry
(
async
()
=>
{
const
status
=
await
getBadgeStatus
(
browser
)
expect
(
status
).
toBe
(
'none'
)
})
await
openInstantNavPanel
(
browser
)
await
openInstantNavPanel
(
browser
)
// Panel should show waiting state with Page load and Client navigation sections
// Panel should show waiting state with Page load and Client navigation sections
await
retry
(
async
()
=>
{
await
retry
(
async
()
=>
{
const
text
=
await
getPanelText
(
browser
)
const
text
=
await
get
InstantNav
PanelText
(
browser
)
expect
(
text
).
toContain
(
'Page load'
)
expect
(
text
).
toContain
(
'Page load'
)
expect
(
text
).
toContain
(
'Client navigation'
)
expect
(
text
).
toContain
(
'Client navigation'
)
})
})
...
@@ -126,19 +84,8 @@ describe('instant-nav-panel', () => {
...
@@ -126,19 +84,8 @@ describe('instant-nav-panel', () => {
await
clearInstantModeCookie
(
browser
)
await
clearInstantModeCookie
(
browser
)
await
browser
.
waitForElementByCss
(
'[data-testid="home-title"]'
)
await
browser
.
waitForElementByCss
(
'[data-testid="home-title"]'
)
// Wait for initial compilation to settle (tsconfig creation triggers Fast Refresh)
await
retry
(
async
()
=>
{
const
status
=
await
getBadgeStatus
(
browser
)
expect
(
status
).
toBe
(
'none'
)
})
await
openInstantNavPanel
(
browser
)
await
openInstantNavPanel
(
browser
)
// Wait for panel to be open
await
retry
(
async
()
=>
{
expect
(
await
hasPanelOpen
(
browser
)).
toBe
(
true
)
})
// Click Start to enter client-nav-waiting state
// Click Start to enter client-nav-waiting state
await
clickStartClientNav
(
browser
)
await
clickStartClientNav
(
browser
)
...
@@ -150,7 +97,7 @@ describe('instant-nav-panel', () => {
...
@@ -150,7 +97,7 @@ describe('instant-nav-panel', () => {
// Panel should show client-nav-waiting state
// Panel should show client-nav-waiting state
await
retry
(
async
()
=>
{
await
retry
(
async
()
=>
{
const
text
=
await
getPanelText
(
browser
)
const
text
=
await
get
InstantNav
PanelText
(
browser
)
expect
(
text
).
toContain
(
'Client navigation'
)
expect
(
text
).
toContain
(
'Client navigation'
)
expect
(
text
).
toContain
(
'Click any link'
)
expect
(
text
).
toContain
(
'Click any link'
)
})
})
...
@@ -162,7 +109,7 @@ describe('instant-nav-panel', () => {
...
@@ -162,7 +109,7 @@ describe('instant-nav-panel', () => {
// Panel should transition to client-nav state
// Panel should transition to client-nav state
await
retry
(
async
()
=>
{
await
retry
(
async
()
=>
{
const
text
=
await
getPanelText
(
browser
)
const
text
=
await
get
InstantNav
PanelText
(
browser
)
expect
(
text
).
toContain
(
'Client navigation'
)
expect
(
text
).
toContain
(
'Client navigation'
)
expect
(
text
).
toContain
(
'prefetched UI'
)
expect
(
text
).
toContain
(
'prefetched UI'
)
expect
(
text
).
toContain
(
'Continue rendering'
)
expect
(
text
).
toContain
(
'Continue rendering'
)
...
@@ -179,11 +126,6 @@ describe('instant-nav-panel', () => {
...
@@ -179,11 +126,6 @@ describe('instant-nav-panel', () => {
await
openInstantNavPanel
(
browser
)
await
openInstantNavPanel
(
browser
)
// Wait for panel to be open
await
retry
(
async
()
=>
{
expect
(
await
hasPanelOpen
(
browser
)).
toBe
(
true
)
})
// Click Start to activate the navigation lock
// Click Start to activate the navigation lock
await
clickStartClientNav
(
browser
)
await
clickStartClientNav
(
browser
)
...
...
test/development/app-dir/instant-navs-devtools/tsconfig.json
0 → 100644
View file @
efcfe05a
{
"compilerOptions"
:
{
"target"
:
"ES2017"
,
"lib"
:
[
"dom"
,
"dom.iterable"
,
"esnext"
],
"allowJs"
:
true
,
"skipLibCheck"
:
true
,
"strict"
:
false
,
"noEmit"
:
true
,
"incremental"
:
true
,
"module"
:
"esnext"
,
"esModuleInterop"
:
true
,
"moduleResolution"
:
"node"
,
"resolveJsonModule"
:
true
,
"isolatedModules"
:
true
,
"jsx"
:
"react-jsx"
,
"plugins"
:
[
{
"name"
:
"next"
}
]
},
"include"
:
[
"next-env.d.ts"
,
"**/*.mts"
,
"**/*.ts"
,
"**/*.tsx"
],
"exclude"
:
[
"node_modules"
,
"**/*.test.ts"
,
"**/*.test.tsx"
]
}
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