@@ -77,12 +77,14 @@ function encodeFrontToken(frontToken) {
7777}
7878
7979async function didSessionRefresh ( page ) {
80+ await page . waitForNetworkIdle ( { idleTime : 500 , timeout : 10000 } ) ;
8081 const cookies = await page . cookies ( ) ;
8182 const refreshTokenIndicatorCookie = cookies . find ( ( c ) => c . name === SSR_REFRESH_SESSION_INDICATOR_COOKIE_NAME ) ;
8283 assert . equal ( refreshTokenIndicatorCookie ?. value , "true" ) ;
8384}
8485
8586async function wasSessionRevoked ( page ) {
87+ await page . waitForNetworkIdle ( { idleTime : 500 , timeout : 10000 } ) ;
8688 let newCookies = await page . cookies ( ) ;
8789 const refreshTokenIndicatorCookie = newCookies . find ( ( c ) => c . name === SSR_REVOKE_SESSION_INDICATOR_COOKIE_NAME ) ;
8890 assert . equal ( refreshTokenIndicatorCookie ?. value , "true" ) ;
@@ -96,9 +98,10 @@ async function hasServerComponentUserId(page) {
9698
9799async function triggerServerAction ( page ) {
98100 const actionButton = await page . waitForSelector ( "[data-testid='getServerActionSession-button']" ) ;
99- await actionButton . click ( ) ;
100- await new Promise ( ( res ) => setTimeout ( res , 1000 ) ) ;
101- const userIdElement = await page . waitForSelector ( "[data-testid='getServerActionSession-result']" ) ;
101+ await Promise . all ( [ await actionButton . click ( ) , await page . waitForNetworkIdle ( { idleTime : 500 , timeout : 10000 } ) ] ) ;
102+ const userIdElement = await page . waitForSelector ( "[data-testid='getServerActionSession-result']" , {
103+ timeout : 10000 ,
104+ } ) ;
102105 const textContent = await userIdElement . evaluate ( ( el ) => el . textContent ) ;
103106 const [ status , userId ] = textContent . split ( ":" ) ;
104107 return { userId : userId . trim ( ) , status : status . trim ( ) } ;
0 commit comments