Skip to content

Commit b359fa3

Browse files
committed
Fix uninstall implementation to use 3-dot menu pattern
Updated AppCatalogPage.uninstallApp() to follow the proven pattern from foundry-sample-detection-translation: 1. Search and navigate to app's catalog page 2. Check if app is actually installed before attempting uninstall 3. Click "Open menu" button (3-dot menu) 4. Click "Uninstall app" menuitem 5. Confirm uninstallation in modal 6. Wait for success message This fixes the "Could not find Uninstall button" warning by correctly navigating through the Foundry UI's menu structure.
1 parent a9c2671 commit b359fa3

File tree

1 file changed

+35
-10
lines changed

1 file changed

+35
-10
lines changed

e2e/src/pages/AppCatalogPage.ts

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -283,21 +283,46 @@ export class AppCatalogPage extends BasePage {
283283
async uninstallApp(appName: string): Promise<void> {
284284
this.logger.step(`Uninstall app '${appName}'`);
285285

286-
const uninstallButton = this.page.getByRole('button', { name: 'Uninstall' }).first();
286+
try {
287+
// Search for and navigate to the app's catalog page
288+
await this.searchAndNavigateToApp(appName);
287289

288-
if (await this.elementExists(uninstallButton, 3000)) {
289-
await this.smartClick(uninstallButton, 'Uninstall button');
290+
// Check if app is actually installed
291+
const installedStatus = this.page.getByTestId('status-text').filter({ hasText: /^Installed$/i });
292+
const isInstalled = await this.elementExists(installedStatus, 3000);
290293

291-
// Confirm uninstallation if prompted
292-
const confirmButton = this.page.getByRole('button', { name: 'Confirm' });
293-
if (await this.elementExists(confirmButton, 2000)) {
294-
await this.smartClick(confirmButton, 'Confirm button');
294+
if (!isInstalled) {
295+
this.logger.info(`App '${appName}' is already uninstalled`);
296+
return;
295297
}
296298

297-
await this.waiter.delay(2000);
299+
// Click the 3-dot menu button
300+
const openMenuButton = this.page.getByRole('button', { name: 'Open menu' });
301+
await this.waiter.waitForVisible(openMenuButton, { description: 'Open menu button' });
302+
await this.smartClick(openMenuButton, 'Open menu button');
303+
304+
// Click "Uninstall app" menuitem
305+
const uninstallMenuItem = this.page.getByRole('menuitem', { name: 'Uninstall app' });
306+
await this.waiter.waitForVisible(uninstallMenuItem, { description: 'Uninstall app menuitem' });
307+
await this.smartClick(uninstallMenuItem, 'Uninstall app menuitem');
308+
309+
// Confirm uninstallation in modal
310+
const uninstallButton = this.page.getByRole('button', { name: 'Uninstall' });
311+
await this.waiter.waitForVisible(uninstallButton, { description: 'Uninstall confirmation button' });
312+
await this.smartClick(uninstallButton, 'Uninstall button');
313+
314+
// Wait for success message
315+
const successMessage = this.page.getByText(/has been uninstalled/i);
316+
await this.waiter.waitForVisible(successMessage, {
317+
description: 'Uninstall success message',
318+
timeout: 10000
319+
});
320+
298321
this.logger.success(`App '${appName}' uninstalled successfully`);
299-
} else {
300-
this.logger.warn(`Could not find Uninstall button for '${appName}'`);
322+
323+
} catch (error) {
324+
this.logger.warn(`Failed to uninstall app '${appName}': ${error.message}`);
325+
throw error;
301326
}
302327
}
303328
}

0 commit comments

Comments
 (0)