Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions tests/e2e/pageobjects/dashboard/CreateWorkspace.ts
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"]');
Expand Down Expand Up @@ -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<void> {
Logger.debug(`factoryUrl: "${factoryUrl}"`);

Expand All @@ -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);
Expand Down Expand Up @@ -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`);
}
}
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Loading