Skip to content

Commit 5fb5abd

Browse files
committed
fix: Improve app installation detection to check specific app page
1 parent f8667a7 commit 5fb5abd

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

e2e/src/pages/AppCatalogPage.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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: /open|launch/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;

e2e/tests/app-install.setup.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import { test as setup } from '../src/fixtures';
22

33
setup('install Functions with Python app', async ({ appCatalogPage, appName }) => {
4-
// The app should already be installed - just verify it exists
5-
// ServiceNow API integration will use dummy values if prompted
6-
await appCatalogPage.navigateToPath('/foundry/app-catalog', 'App Catalog');
7-
4+
// Check if app is already installed (this navigates to the app page)
85
const isInstalled = await appCatalogPage.isAppInstalled(appName);
96

107
if (!isInstalled) {

0 commit comments

Comments
 (0)