Skip to content

Fix Git branch selection in CreateWorkspace pageobject from available branches list#23768

Merged
dmytro-ndp merged 4 commits intoeclipse-che:mainfrom
SkorikSergey:selectBranchNameFromList
Mar 13, 2026
Merged

Fix Git branch selection in CreateWorkspace pageobject from available branches list#23768
dmytro-ndp merged 4 commits intoeclipse-che:mainfrom
SkorikSergey:selectBranchNameFromList

Conversation

@SkorikSergey
Copy link
Contributor

@SkorikSergey SkorikSergey commented Mar 11, 2026

What does this PR do?

Now it is possible to select branch from branches list after putting repository url to 'Git repo URL *' field. It will fix FactoryWithGitRepoOptions e2e test failing on DS 3.27.0.

Screenshot/screencast of this PR

Selection_091

What issues does this PR fix or reference?

https://issues.redhat.com/browse/CRW-10367

How to test this PR?

PR Checklist

As the author of this Pull Request I made sure that:

Reviewers

Reviewers, please comment how you tested the PR when approving it.

@SkorikSergey SkorikSergey marked this pull request as ready for review March 12, 2026 11:11
@artaleks9
Copy link
Contributor

Looks good to merge.
One small note: if possible, using CSS instead of XPath is considered good practice.
For example:

By.xpath('//input[@type="search"] -> By.css('input[type="search"]')
By.xpath(`//li[@id="${branchName}"] -> By.css(`li[id="${branchName}"]`)

@SkorikSergey
Copy link
Contributor Author

Looks good to merge. One small note: if possible, using CSS instead of XPath is considered good practice. For example:

By.xpath('//input[@type="search"] -> By.css('input[type="search"]')
By.xpath(`//li[@id="${branchName}"] -> By.css(`li[id="${branchName}"]`)

Thank you. Locators updated to use By.css

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_SEACH_FIELD, timeout);
Copy link
Contributor

@dmytro-ndp dmytro-ndp Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix typo:

Suggested change
await this.driverHelper.waitVisibility(CreateWorkspace.GIT_BRANCH_SEACH_FIELD, timeout);
await this.driverHelper.waitVisibility(CreateWorkspace.GIT_BRANCH_SEARCH_FIELD, timeout);

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_SEACH_FIELD: By = By.css('input[type="search"]');
Copy link
Contributor

@dmytro-ndp dmytro-ndp Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix typo:

Suggested change
private static readonly GIT_BRANCH_SEACH_FIELD: By = By.css('input[type="search"]');
private static readonly GIT_BRANCH_SEARCH_FIELD: By = By.css('input[type="search"]');

await this.driverHelper.waitAndClick(CreateWorkspace.GIT_BRANCH_NAME, timeout);

await this.driverHelper.waitVisibility(CreateWorkspace.GIT_BRANCH_SEACH_FIELD, timeout);
await this.driverHelper.type(CreateWorkspace.GIT_BRANCH_SEACH_FIELD, Key.chord(branchName), timeout);
Copy link
Contributor

@dmytro-ndp dmytro-ndp Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix typo:

Suggested change
await this.driverHelper.type(CreateWorkspace.GIT_BRANCH_SEACH_FIELD, Key.chord(branchName), timeout);
await this.driverHelper.type(CreateWorkspace.GIT_BRANCH_SEARCH_FIELD, Key.chord(branchName), timeout);

}

private getGitBranchListItemLocator(branchName: string): By {
return By.css(`li[id="${branchName}"]`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

li[id="${branchName}"] is quite broad. It matches any <li> on the entire page with that ID, not just ones inside the branch dropdown. If there were another <li id="main"> somewhere else in the DOM, it could match the wrong element.

IMHO the better correct locator is:

return By.css(`li[id="${branchName}"] button.pf-c-select__menu-item`);

@SkorikSergey SkorikSergey force-pushed the selectBranchNameFromList branch from d249e8b to 4ba5191 Compare March 13, 2026 09:08
Copy link
Contributor

@dmytro-ndp dmytro-ndp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dmytro-ndp dmytro-ndp merged commit 6acaeda into eclipse-che:main Mar 13, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants