Skip to content

Commit 31f65ed

Browse files
author
KIvanow
committed
RI-7131 - е2е tests are failing for both app image and docker - testing fix for workbench issues
1 parent 6b589b0 commit 31f65ed

File tree

1 file changed

+42
-6
lines changed

1 file changed

+42
-6
lines changed

tests/e2e/pageObjects/workbench-page.ts

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Selector, t } from 'testcafe';
22
import { InstancePage } from './instance-page';
3+
import { Common } from '../helpers/common';
34

45
export class WorkbenchPage extends InstancePage {
56
//CSS selectors
@@ -48,6 +49,13 @@ export class WorkbenchPage extends InstancePage {
4849
parametersAnchor = Selector('[data-testid=parameters-anchor]');
4950
clearResultsBtn = Selector('[data-testid=clear-history-btn]');
5051

52+
// OVERLAY/LOADING ELEMENTS
53+
// Selector for the problematic overlay that obstructs workbench interactions in CI
54+
overlayContainer = Selector('.RI-flex-group.RI-flex-row').filter((node) => {
55+
const style = node.getAttribute('style');
56+
return !!(style && style.includes('height: 100%'));
57+
});
58+
5159
//ICONS
5260
noCommandHistoryIcon = Selector('[data-testid=wb_no-results__icon]');
5361
groupModeIcon = Selector('[data-testid=group-mode-tooltip]');
@@ -144,16 +152,44 @@ export class WorkbenchPage extends InstancePage {
144152
}
145153

146154
/**
147-
* Send a command in Workbench
155+
* Send a command in Workbench with retry mechanism for CI overlay issues
148156
* @param command The command
149157
* @param speed The speed in seconds. Default is 1
150-
* @param paste
158+
* @param paste Whether to paste the command. Default is true
151159
*/
152160
async sendCommandInWorkbench(command: string, speed = 1, paste = true): Promise<void> {
153-
await t
154-
.click(this.queryInput)
155-
.typeText(this.queryInput, command, { replace: true, speed, paste })
156-
.click(this.submitCommandButton);
161+
const maxRetries = 3;
162+
let lastError: Error | null = null;
163+
164+
for (let i = 0; i < maxRetries; i++) {
165+
try {
166+
// Wait for any loading states to complete before attempting interaction
167+
await Common.waitForElementNotVisible(this.runButtonSpinner);
168+
await Common.waitForElementNotVisible(this.loadedCommand);
169+
170+
// Wait for the problematic overlay to disappear (CI-specific issue)
171+
await Common.waitForElementNotVisible(this.overlayContainer);
172+
173+
// Perform the actual workbench interaction
174+
await t
175+
.click(this.queryInput)
176+
.typeText(this.queryInput, command, { replace: true, speed, paste })
177+
.click(this.submitCommandButton);
178+
179+
return; // Success, exit the retry loop
180+
} catch (error) {
181+
lastError = error as Error;
182+
console.warn(`Workbench command attempt ${i + 1}/${maxRetries} failed:`, error);
183+
184+
if (i === maxRetries - 1) {
185+
// Final attempt failed, throw the error
186+
throw new Error(`Failed to send command "${command}" after ${maxRetries} attempts. Last error: ${lastError.message}`);
187+
}
188+
189+
// Wait before retrying to allow any animations/transitions to complete
190+
await t.wait(1000);
191+
}
192+
}
157193
}
158194

159195
/**

0 commit comments

Comments
 (0)