@@ -444,6 +444,71 @@ 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+ await deployment . waitForSynced ( ) ;
461+
462+ const login = await common . keycloakLogin (
463+ "zeus" ,
464+ process . env . DEFAULT_USER_PASSWORD ,
465+ ) ;
466+ expect ( login ) . toBe ( "Login successful" ) ;
467+
468+ await uiHelper . verifyTextVisible (
469+ "Logging out due to inactivity" ,
470+ false ,
471+ 60000 ,
472+ ) ;
473+ await page . waitForTimeout ( 5000 ) ;
474+
475+ await page . reload ( ) ;
476+
477+ const cookies = await context . cookies ( ) ;
478+ const authCookie = cookies . find (
479+ ( cookie ) => cookie . name === "oidc-refresh-token" ,
480+ ) ;
481+ expect ( authCookie ) . toBeUndefined ( ) ;
482+ } ) ;
483+
484+ test ( `Enable autologout and user stays logged in after clicking "Don't log me out"` , async ( ) => {
485+ deployment . setAppConfigProperty ( "auth.autologout.enabled" , "true" ) ;
486+ deployment . setAppConfigProperty (
487+ "auth.autologout.idleTimeoutMinutes" ,
488+ "0.5" , // minimum allowed value is 0.5 minutes
489+ ) ;
490+ deployment . setAppConfigProperty (
491+ "auth.autologout.promptBeforeIdleSeconds" ,
492+ "5" ,
493+ ) ;
494+ await deployment . updateAllConfigs ( ) ;
495+ await deployment . restartLocalDeployment ( ) ;
496+ await deployment . waitForDeploymentReady ( ) ;
497+ await deployment . waitForSynced ( ) ;
498+
499+ const login = await common . keycloakLogin (
500+ "zeus" ,
501+ process . env . DEFAULT_USER_PASSWORD ,
502+ ) ;
503+ expect ( login ) . toBe ( "Login successful" ) ;
504+
505+ await uiHelper . clickButtonByText ( "Don't log me out" , { timeout : 60000 } ) ;
506+
507+ await uiHelper . goToPageUrl ( "/settings" , "Settings" ) ;
508+ await uiHelper . verifyHeading ( "Zeus Giove" ) ;
509+ await common . signOut ( ) ;
510+ } ) ;
511+
447512 test . afterAll ( async ( ) => {
448513 console . log ( "[TEST] Starting cleanup..." ) ;
449514 await deployment . killRunningProcess ( ) ;
0 commit comments