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
07636dfc
Commit
07636dfc
authored
Oct 31, 2025
by
Tobias Koppers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make scroll test case more stable
parent
2f052b16
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
14 deletions
+20
-14
index.test.js
test/integration/scroll-back-restoration/test/index.test.js
+20
-14
No files found.
test/integration/scroll-back-restoration/test/index.test.js
View file @
07636dfc
...
@@ -9,6 +9,7 @@ import {
...
@@ -9,6 +9,7 @@ import {
nextStart
,
nextStart
,
nextBuild
,
nextBuild
,
check
,
check
,
retry
,
}
from
'next-test-utils'
}
from
'next-test-utils'
const
appDir
=
join
(
__dirname
,
'../'
)
const
appDir
=
join
(
__dirname
,
'../'
)
...
@@ -27,11 +28,14 @@ const runTests = () => {
...
@@ -27,11 +28,14 @@ const runTests = () => {
expect
(
scrollRestoration
).
toBe
(
'manual'
)
expect
(
scrollRestoration
).
toBe
(
'manual'
)
const
scrollX
=
Math
.
floor
(
await
browser
.
eval
(()
=>
window
.
scrollX
))
let
scrollX
,
scrollY
const
scrollY
=
Math
.
floor
(
await
browser
.
eval
(()
=>
window
.
scrollY
))
await
retry
(
async
()
=>
{
scrollX
=
Math
.
floor
(
await
browser
.
eval
(()
=>
window
.
scrollX
))
expect
(
scrollX
).
not
.
toBe
(
0
)
expect
(
scrollX
).
not
.
toBe
(
0
)
scrollY
=
Math
.
floor
(
await
browser
.
eval
(()
=>
window
.
scrollY
))
expect
(
scrollY
).
not
.
toBe
(
0
)
expect
(
scrollY
).
not
.
toBe
(
0
)
})
await
browser
.
eval
(()
=>
window
.
next
.
router
.
push
(
'/another'
))
await
browser
.
eval
(()
=>
window
.
next
.
router
.
push
(
'/another'
))
...
@@ -48,18 +52,20 @@ const runTests = () => {
...
@@ -48,18 +52,20 @@ const runTests = () => {
},
},
})
})
const
newScrollX
=
Math
.
floor
(
await
browser
.
eval
(()
=>
window
.
scrollX
))
await
retry
(
async
()
=>
{
const
newScrollY
=
Math
.
floor
(
await
browser
.
eval
(()
=>
window
.
scrollY
))
const
newScrollX
=
Math
.
floor
(
await
browser
.
eval
(()
=>
window
.
scrollX
))
const
newScrollY
=
Math
.
floor
(
await
browser
.
eval
(()
=>
window
.
scrollY
))
console
.
log
({
console
.
log
({
scrollX
,
scrollX
,
scrollY
,
scrollY
,
newScrollX
,
newScrollX
,
newScrollY
,
newScrollY
,
})
})
expect
(
scrollX
).
toBe
(
newScrollX
)
expect
(
scrollX
).
toBe
(
newScrollX
)
expect
(
scrollY
).
toBe
(
newScrollY
)
expect
(
scrollY
).
toBe
(
newScrollY
)
})
})
})
}
}
...
...
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