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
af42dadd
Unverified
Commit
af42dadd
authored
Jul 15, 2025
by
Hendrik Liebau
Committed by
GitHub
Jul 15, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow `beforePageLoad` to be async (#81650)
parent
3c6591c1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
10 deletions
+11
-10
segment-cache-stale-time.test.ts
.../segment-cache/staleness/segment-cache-stale-time.test.ts
+6
-5
playwright.ts
test/lib/browsers/playwright.ts
+2
-2
base.ts
test/lib/next-modes/base.ts
+2
-2
next-webdriver.ts
test/lib/next-webdriver.ts
+1
-1
No files found.
test/e2e/app-dir/segment-cache/staleness/segment-cache-stale-time.test.ts
View file @
af42dadd
...
...
@@ -81,16 +81,17 @@ describe('segment cache (staleness)', () => {
it
(
'reuses dynamic data up to the staleTimes.dynamic threshold'
,
async
()
=>
{
let
page
:
Playwright
.
Page
const
startDate
=
Date
.
now
()
const
browser
=
await
next
.
browser
(
'/'
,
{
beforePageLoad
(
p
:
Playwright
.
Page
)
{
async
beforePageLoad
(
p
:
Playwright
.
Page
)
{
page
=
p
await
page
.
clock
.
install
()
await
page
.
clock
.
setFixedTime
(
startDate
)
},
})
const
act
=
createRouterAct
(
page
)
await
page
.
clock
.
install
()
const
startDate
=
Date
.
now
()
await
page
.
clock
.
setFixedTime
(
startDate
)
const
act
=
createRouterAct
(
page
)
// Navigate to the dynamic page
await
act
(
...
...
test/lib/browsers/playwright.ts
View file @
af42dadd
...
...
@@ -228,7 +228,7 @@ export class Playwright<TCurrent = undefined> {
disableCache
?:
boolean
cpuThrottleRate
?:
number
pushErrorAsConsoleLog
?:
boolean
beforePageLoad
?:
(
page
:
Page
)
=>
void
beforePageLoad
?:
(
page
:
Page
)
=>
void
|
Promise
<
void
>
}
)
{
await
this
.
close
()
...
...
@@ -310,7 +310,7 @@ export class Playwright<TCurrent = undefined> {
})
})
opts
?.
beforePageLoad
?.(
page
)
await
opts
?.
beforePageLoad
?.(
page
)
await
page
.
goto
(
url
,
{
waitUntil
:
'load'
})
}
...
...
test/lib/next-modes/base.ts
View file @
af42dadd
...
...
@@ -703,8 +703,8 @@ export class NextInstance {
const
[
browser
,
response
]
=
await
Promise
.
all
([
webdriver
(
this
.
url
,
url
,
{
...
options
,
beforePageLoad
(
page
:
Page
)
{
options
.
beforePageLoad
?.(
page
)
async
beforePageLoad
(
page
:
Page
)
{
await
options
.
beforePageLoad
?.(
page
)
page
.
on
(
'response'
,
async
(
response
)
=>
{
if
(
response
.
url
()
===
absoluteUrl
)
{
...
...
test/lib/next-webdriver.ts
View file @
af42dadd
...
...
@@ -62,7 +62,7 @@ export interface WebdriverOptions {
* @param page
* @returns
*/
beforePageLoad
?:
(
page
:
Page
)
=>
void
beforePageLoad
?:
(
page
:
Page
)
=>
void
|
Promise
<
void
>
/**
* browser locale
*/
...
...
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