@@ -65,36 +65,49 @@ export class AppCatalogPage extends BasePage {
6565 return false ;
6666 }
6767
68- // Look for Install button
69- const installButton = this . page . getByRole ( 'button' , { name : 'Install' } ) . first ( ) ;
68+ // Look for Install button or link (can be button or link depending on app state)
69+ this . logger . info ( 'App not installed, looking for Install button or link' ) ;
70+ const installButtons = [
71+ this . page . getByTestId ( 'app-details-page__install-button' ) ,
72+ this . page . getByRole ( 'link' , { name : 'Install now' } ) ,
73+ this . page . getByRole ( 'button' , { name : 'Install' } )
74+ ] ;
75+
76+ let installClicked = false ;
77+ for ( const installButton of installButtons ) {
78+ if ( await this . elementExists ( installButton , 3000 ) ) {
79+ await this . smartClick ( installButton , 'Install button/link' ) ;
80+ installClicked = true ;
81+ this . logger . info ( 'Clicked Install button, waiting for install page to load' ) ;
82+
83+ // Wait for URL to change to install page and page to stabilize
84+ await this . page . waitForURL ( / \/ f o u n d r y \/ a p p - c a t a l o g \/ [ ^ \/ ] + \/ i n s t a l l $ / , { timeout : 10000 } ) ;
85+ await this . page . waitForLoadState ( 'domcontentloaded' ) ;
86+ await this . page . waitForLoadState ( 'networkidle' ) ;
7087
71- if ( await this . elementExists ( installButton , 3000 ) ) {
72- await this . smartClick ( installButton , 'Install button' ) ;
73- this . logger . info ( 'Clicked Install button, waiting for install page to load' ) ;
74-
75- // Wait for URL to change to install page and page to stabilize
76- await this . page . waitForURL ( / \/ f o u n d r y \/ a p p - c a t a l o g \/ [ ^ \/ ] + \/ i n s t a l l $ / , { timeout : 10000 } ) ;
77- await this . page . waitForLoadState ( 'domcontentloaded' ) ;
78- await this . page . waitForLoadState ( 'networkidle' ) ;
88+ break ;
89+ }
90+ }
7991
80- // Handle permissions dialog
81- await this . handlePermissionsDialog ( ) ;
92+ if ( ! installClicked ) {
93+ this . logger . warn ( `Could not find Install button for '${ appName } '` ) ;
94+ return false ;
95+ }
8296
83- // Check for ServiceNow configuration screen
84- await this . configureServiceNowIfNeeded ( ) ;
97+ // Handle permissions dialog
98+ await this . handlePermissionsDialog ( ) ;
8599
86- // Click final Install app button
87- await this . clickInstallAppButton ( ) ;
100+ // Check for ServiceNow configuration screen
101+ await this . configureServiceNowIfNeeded ( ) ;
88102
89- // Wait for installation to complete
90- await this . waitForInstallation ( appName ) ;
103+ // Click final Install app button
104+ await this . clickInstallAppButton ( ) ;
91105
92- this . logger . success ( `App '${ appName } ' installed successfully` ) ;
93- return true ;
94- }
106+ // Wait for installation to complete
107+ await this . waitForInstallation ( appName ) ;
95108
96- this . logger . warn ( `Could not find Install button for '${ appName } '`) ;
97- return false ;
109+ this . logger . success ( `App '${ appName } ' installed successfully `) ;
110+ return true ;
98111 }
99112
100113 /**
0 commit comments