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