@@ -444,6 +444,67 @@ test.describe("Configure OIDC provider (using RHBK)", async () => {
444444 await context . clearCookies ( ) ;
445445 } ) ;
446446
447+ test ( `Enable autologout and user is logged out after inactivity` , async ( ) => {
448+ deployment . setAppConfigProperty ( "auth.autologout.enabled" , "true" ) ;
449+ deployment . setAppConfigProperty (
450+ "auth.autologout.idleTimeoutMinutes" ,
451+ "0.5" , // minimum allowed value is 0.5 minutes
452+ ) ;
453+ deployment . setAppConfigProperty (
454+ "auth.autologout.promptBeforeIdleSeconds" ,
455+ "3" ,
456+ ) ;
457+ await deployment . updateAllConfigs ( ) ;
458+ await deployment . restartLocalDeployment ( ) ;
459+ await deployment . waitForDeploymentReady ( ) ;
460+
461+ await deployment . waitForSynced ( ) ;
462+
463+ const login = await common . keycloakLogin (
464+ "zeus" ,
465+ process . env . DEFAULT_USER_PASSWORD ,
466+ ) ;
467+ expect ( login ) . toBe ( "Login successful" ) ;
468+
469+ // Wait for the inactivity popup to appear
470+ const inactivityPopup = page . locator ( "text=Logging out due to inactivity" ) ;
471+ await expect ( inactivityPopup ) . toBeVisible ( { timeout : 35000 } ) ;
472+ await page . waitForTimeout ( 5000 ) ;
473+
474+ await page . reload ( ) ;
475+
476+ const cookies = await context . cookies ( ) ;
477+ const authCookie = cookies . find (
478+ ( cookie ) => cookie . name === "oidc-refresh-token" ,
479+ ) ;
480+ expect ( authCookie ) . toBeUndefined ( ) ;
481+ } ) ;
482+
483+ test ( `Enable autologout and user stays logged in after clicking "Don't log me out"` , async ( ) => {
484+ const login = await common . keycloakLogin (
485+ "zeus" ,
486+ process . env . DEFAULT_USER_PASSWORD ,
487+ ) ;
488+ expect ( login ) . toBe ( "Login successful" ) ;
489+
490+ // Wait for the inactivity popup to appear
491+ const inactivityPopup = page . locator ( "text=Logging out due to inactivity" ) ;
492+ await expect ( inactivityPopup ) . toBeVisible ( { timeout : 35000 } ) ;
493+
494+ const stayLoggedInButton = page . locator (
495+ 'button:has-text("Don\'t log me out")' ,
496+ ) ;
497+ await stayLoggedInButton . click ( ) ;
498+
499+ // Verify popup is dismissed
500+ await expect ( inactivityPopup ) . toBeHidden ( ) ;
501+
502+ // Navigate to settings to verify user is still authenticated
503+ await uiHelper . goToPageUrl ( "/settings" , "Settings" ) ;
504+ await uiHelper . verifyHeading ( "Zeus Giove" ) ;
505+ await common . signOut ( ) ;
506+ } ) ;
507+
447508 test . afterAll ( async ( ) => {
448509 console . log ( "[TEST] Starting cleanup..." ) ;
449510 await deployment . killRunningProcess ( ) ;
0 commit comments