diff --git a/tests/e2e/pageobjects/ide/DebugView.ts b/tests/e2e/pageobjects/ide/DebugView.ts index 6468cb9a78..9b1bf8083c 100644 --- a/tests/e2e/pageobjects/ide/DebugView.ts +++ b/tests/e2e/pageobjects/ide/DebugView.ts @@ -13,6 +13,7 @@ import { DriverHelper } from '../../utils/DriverHelper'; import { By, Key, WebElement } from 'selenium-webdriver'; import { Ide } from './Ide'; import { Logger } from '../../utils/Logger'; +import { TestConstants } from '../../TestConstants'; @injectable() @@ -41,16 +42,22 @@ export class DebugView { const runDebugButtonLocator: By = By.xpath('//span[@title=\'Start Debugging\']'); await this.driverHelper.waitAndClick(runDebugButtonLocator); + } + /** + * Waits for number of threads in "Threads" view to be more than 1 - this should mean that the debugger is connected. + * + * @param timeout + */ + async waitForDebuggerToConnect(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { await this.driverHelper.getDriver().wait(async () => { Logger.debug(`Waiting for debugger to connect (threads to appear in "Threads" view)`); const threadElements: WebElement[] = await this.driverHelper.getDriver().findElements(By.xpath(`//div[contains(@class, 'theia-debug-thread')]`)); - if (threadElements.length < 2) { - return false; - } else { + if (threadElements.length > 1) { return true; } - }); + return false; + }, timeout); } } diff --git a/tests/e2e/tests/e2e_happy_path/HappyPath.spec.ts b/tests/e2e/tests/e2e_happy_path/HappyPath.spec.ts index 00d31f2bb6..156d8c55b0 100644 --- a/tests/e2e/tests/e2e_happy_path/HappyPath.spec.ts +++ b/tests/e2e/tests/e2e_happy_path/HappyPath.spec.ts @@ -261,6 +261,7 @@ suite('Validation of debug functionality', async () => { await debugView.clickOnDebugConfigurationDropDown(); await debugView.clickOnDebugConfigurationItem('Debug (Attach) - Remote'); await debugView.clickOnRunDebugButton(); + await debugView.waitForDebuggerToConnect(); await previewWidget.refreshPage(); try { await editor.waitStoppedDebugBreakpoint(weclomeControllerJavaFileName, 27);