@@ -21,7 +21,10 @@ import { TrustAuthorPopup } from './TrustAuthorPopup';
2121export class CreateWorkspace {
2222 private static readonly FACTORY_URL : By = By . xpath ( '//input[@id="git-repo-url"]' ) ;
2323 private static readonly GIT_REPO_OPTIONS : By = By . xpath ( '//span[text()="Git Repo Options"]' ) ;
24- private static readonly GIT_BRANCH_NAME : By = By . xpath ( '//input[@aria-label="Git Branch"]' ) ;
24+ private static readonly GIT_BRANCH_NAME : By = By . xpath (
25+ '//div[text()="Select the branch of the Git Repository"]/preceding-sibling::div'
26+ ) ;
27+ private static readonly GIT_BRANCH_SEARCH_FIELD : By = By . css ( 'input[type="search"]' ) ;
2528 private static readonly PATH_TO_DEVFILE : By = By . xpath ( '//input[@aria-label="Path to Devfile"]' ) ;
2629 private static readonly CREATE_AND_OPEN_BUTTON : By = By . xpath ( '//button[@id="create-and-open-button"]' ) ;
2730 private static readonly CREATE_NEW_WORKPACE_CHECKBOX : By = By . xpath ( '//label[@for="create-new-if-exist-switch"]' ) ;
@@ -75,7 +78,7 @@ export class CreateWorkspace {
7578 async importFromGitUsingUI (
7679 factoryUrl : string ,
7780 branchName ?: string ,
78- timeout : number = TIMEOUT_CONSTANTS . TS_CLICK_DASHBOARD_ITEM_TIMEOUT
81+ timeout : number = TIMEOUT_CONSTANTS . TS_COMMON_DASHBOARD_WAIT_TIMEOUT
7982 ) : Promise < void > {
8083 Logger . debug ( `factoryUrl: "${ factoryUrl } "` ) ;
8184
@@ -85,8 +88,11 @@ export class CreateWorkspace {
8588 if ( branchName ) {
8689 await this . driverHelper . waitAndClick ( CreateWorkspace . GIT_REPO_OPTIONS , timeout ) ;
8790
88- await this . driverHelper . waitVisibility ( CreateWorkspace . GIT_BRANCH_NAME , timeout ) ;
89- await this . driverHelper . type ( CreateWorkspace . GIT_BRANCH_NAME , Key . chord ( branchName , Key . ENTER ) , timeout ) ;
91+ await this . driverHelper . waitAndClick ( CreateWorkspace . GIT_BRANCH_NAME , timeout ) ;
92+
93+ await this . driverHelper . waitVisibility ( CreateWorkspace . GIT_BRANCH_SEARCH_FIELD , timeout ) ;
94+ await this . driverHelper . type ( CreateWorkspace . GIT_BRANCH_SEARCH_FIELD , Key . chord ( branchName ) , timeout ) ;
95+ await this . driverHelper . waitAndClick ( this . getGitBranchListItemLocator ( branchName ) , timeout ) ;
9096 }
9197
9298 await this . driverHelper . waitAndClick ( CreateWorkspace . CREATE_AND_OPEN_BUTTON , timeout ) ;
@@ -209,4 +215,8 @@ export class CreateWorkspace {
209215
210216 return By . xpath ( `//article[contains(@class, 'sample-card')]//div[text()='${ sampleName } ']` ) ;
211217 }
218+
219+ private getGitBranchListItemLocator ( branchName : string ) : By {
220+ return By . css ( `li[id="${ branchName } "] button.pf-c-select__menu-item` ) ;
221+ }
212222}
0 commit comments