@@ -31,14 +31,23 @@ export class AppCatalogPage extends BasePage {
3131 async isAppInstalled ( appName : string ) : Promise < boolean > {
3232 this . logger . step ( `Check if app '${ appName } ' is installed` ) ;
3333
34- // Try different methods to detect installation status
34+ // Navigate to the app's specific catalog page first
35+ const appUrl = `/foundry/app-catalog/${ this . appId } ` ;
36+ await this . navigateToPath ( appUrl , `App catalog page for ${ appName } ` ) ;
37+ await this . page . waitForLoadState ( 'networkidle' ) ;
38+
39+ // Check for installation indicators on the app's page
3540 const installedText = this . page . locator ( 'text=Installed' ) . first ( ) ;
3641 const openButton = this . page . getByRole ( 'button' , { name : / o p e n | l a u n c h / i } ) ;
42+ const installButton = this . page . getByRole ( 'button' , { name : 'Install' } ) ;
3743
3844 const hasInstalledText = await this . elementExists ( installedText , 2000 ) ;
3945 const hasOpenButton = await this . elementExists ( openButton , 2000 ) ;
46+ const hasInstallButton = await this . elementExists ( installButton , 2000 ) ;
4047
41- const isInstalled = hasInstalledText || hasOpenButton ;
48+ // If Install button exists, app is NOT installed
49+ // If Installed text or Open button exists, app IS installed
50+ const isInstalled = ( hasInstalledText || hasOpenButton ) && ! hasInstallButton ;
4251 this . logger . info ( `App '${ appName } ' installation status: ${ isInstalled ? 'Installed' : 'Not installed' } ` ) ;
4352
4453 return isInstalled ;
0 commit comments