Skip to content

Commit 2349611

Browse files
committed
Improve E2E test install wait logic
- Update AppCatalogPage waitForInstallation() to wait for both 'installing' and 'installed' toast messages sequentially - Throw clear error if 'installing' message never appears - Wait up to 60s for final 'installed' or 'error' message - Detect and report installation failures immediately
1 parent 5d0b484 commit 2349611

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

e2e/src/pages/AppCatalogPage.ts

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,14 +204,36 @@ export class AppCatalogPage extends BasePage {
204204
this.page.waitForLoadState('networkidle', { timeout: 15000 })
205205
]).catch(() => {});
206206

207-
// Look for "installing" message
207+
// Look for first "installing" message
208208
const installingMessage = this.page.getByText(/installing/i).first();
209209

210210
try {
211211
await installingMessage.waitFor({ state: 'visible', timeout: 30000 });
212-
this.logger.success('Installation started - success message appeared');
212+
this.logger.success('Installation started - "installing" message appeared');
213213
} catch (error) {
214-
this.logger.warn('Installation message not visible, assuming installation succeeded');
214+
throw new Error(`Installation failed to start for app '${appName}' - "installing" message never appeared. Installation may have failed immediately.`);
215+
}
216+
217+
// Wait for second toast with final status (installed or error)
218+
// Try to find success message first
219+
const installedMessage = this.page.getByText(/installed/i).first();
220+
const errorMessage = this.page.getByText(/error.*install/i).first();
221+
222+
try {
223+
await Promise.race([
224+
installedMessage.waitFor({ state: 'visible', timeout: 60000 }).then(() => 'success'),
225+
errorMessage.waitFor({ state: 'visible', timeout: 60000 }).then(() => 'error')
226+
]).then(result => {
227+
if (result === 'error') {
228+
throw new Error(`Installation failed for app '${appName}' - error message appeared`);
229+
}
230+
this.logger.success('Installation completed successfully - "installed" message appeared');
231+
});
232+
} catch (error) {
233+
if (error.message.includes('Installation failed')) {
234+
throw error;
235+
}
236+
throw new Error(`Installation status unclear for app '${appName}' - timed out waiting for "installed" or "error" message after 60 seconds`);
215237
}
216238
}
217239

0 commit comments

Comments
 (0)