diff --git a/tests/e2e/pageobjects/dashboard/CreateWorkspace.ts b/tests/e2e/pageobjects/dashboard/CreateWorkspace.ts index 95cee2e4eb5..86dae0627bc 100644 --- a/tests/e2e/pageobjects/dashboard/CreateWorkspace.ts +++ b/tests/e2e/pageobjects/dashboard/CreateWorkspace.ts @@ -1,5 +1,5 @@ /** ******************************************************************* - * copyright (c) 2019-2023 Red Hat, Inc. + * copyright (c) 2019-2026 Red Hat, Inc. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -21,7 +21,10 @@ import { TrustAuthorPopup } from './TrustAuthorPopup'; export class CreateWorkspace { private static readonly FACTORY_URL: By = By.xpath('//input[@id="git-repo-url"]'); private static readonly GIT_REPO_OPTIONS: By = By.xpath('//span[text()="Git Repo Options"]'); - private static readonly GIT_BRANCH_NAME: By = By.xpath('//input[@aria-label="Git Branch"]'); + private static readonly GIT_BRANCH_NAME: By = By.xpath( + '//div[text()="Select the branch of the Git Repository"]/preceding-sibling::div' + ); + private static readonly GIT_BRANCH_SEARCH_FIELD: By = By.css('input[type="search"]'); private static readonly PATH_TO_DEVFILE: By = By.xpath('//input[@aria-label="Path to Devfile"]'); private static readonly CREATE_AND_OPEN_BUTTON: By = By.xpath('//button[@id="create-and-open-button"]'); private static readonly CREATE_NEW_WORKPACE_CHECKBOX: By = By.xpath('//label[@for="create-new-if-exist-switch"]'); @@ -75,7 +78,7 @@ export class CreateWorkspace { async importFromGitUsingUI( factoryUrl: string, branchName?: string, - timeout: number = TIMEOUT_CONSTANTS.TS_CLICK_DASHBOARD_ITEM_TIMEOUT + timeout: number = TIMEOUT_CONSTANTS.TS_COMMON_DASHBOARD_WAIT_TIMEOUT ): Promise { Logger.debug(`factoryUrl: "${factoryUrl}"`); @@ -85,8 +88,11 @@ export class CreateWorkspace { if (branchName) { await this.driverHelper.waitAndClick(CreateWorkspace.GIT_REPO_OPTIONS, timeout); - await this.driverHelper.waitVisibility(CreateWorkspace.GIT_BRANCH_NAME, timeout); - await this.driverHelper.type(CreateWorkspace.GIT_BRANCH_NAME, Key.chord(branchName, Key.ENTER), timeout); + await this.driverHelper.waitAndClick(CreateWorkspace.GIT_BRANCH_NAME, timeout); + + await this.driverHelper.waitVisibility(CreateWorkspace.GIT_BRANCH_SEARCH_FIELD, timeout); + await this.driverHelper.type(CreateWorkspace.GIT_BRANCH_SEARCH_FIELD, Key.chord(branchName), timeout); + await this.driverHelper.waitAndClick(this.getGitBranchListItemLocator(branchName), timeout); } await this.driverHelper.waitAndClick(CreateWorkspace.CREATE_AND_OPEN_BUTTON, timeout); @@ -189,4 +195,8 @@ export class CreateWorkspace { return By.xpath(`//article[contains(@class, 'sample-card')]//div[text()='${sampleName}']`); } + + private getGitBranchListItemLocator(branchName: string): By { + return By.css(`li[id="${branchName}"] button.pf-c-select__menu-item`); + } } diff --git a/tests/e2e/specs/factory/FactoryWithGitRepoOptions.spec.ts b/tests/e2e/specs/factory/FactoryWithGitRepoOptions.spec.ts index 0f30ac8ab4a..05012e7e7d0 100644 --- a/tests/e2e/specs/factory/FactoryWithGitRepoOptions.spec.ts +++ b/tests/e2e/specs/factory/FactoryWithGitRepoOptions.spec.ts @@ -1,5 +1,5 @@ /** ******************************************************************* - * copyright (c) 2024 Red Hat, Inc. + * copyright (c) 2026 Red Hat, Inc. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0