-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Selenium: cover the Stacks list by selenium test #9601
Conversation
ci-test |
ci-test build report: |
String TOOLBAR_XPATH_PATTERN = "//div[@che-title='%s']"; | ||
String NEW_STACK_NAME = "deskname"; | ||
String SAVE_CHANGES_BUTTON_NAME = "saveButton"; | ||
String TO_ALL_STACKS_LIST_BUTTON_XPATH = "//a[@title='All stacks']"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TO_ALL_STACKS_LIST_BUTTON_XPATH
> ALL_STACKS_BUTTON_XPATH
seleniumWebDriverHelper.waitAndClick(By.name(Locators.SAVE_CHANGES_BUTTON_NAME)); | ||
} | ||
|
||
public void clickOnToAllStacksList() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clickOnToAllStacksList
> clickOnAllStacksButton
stackNameField.click(); | ||
stackNameField.clear(); | ||
stackNameField.sendKeys(stackName); | ||
WaitUtils.sleepQuietly(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can replace three commands here by one: seleniumWebDriverHelper.setValue()
public void setStackName(String stackName) { | ||
WebElement stackNameField = | ||
seleniumWebDriverHelper.waitVisibility(By.name(Locators.NEW_STACK_NAME)); | ||
stackNameField.click(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can replace two commands here by one: seleniumWebDriverHelper.waitAndClick()
} | ||
|
||
public boolean isStackChecked(String workspaceName) { | ||
String attrValue = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would propose to move the code to separate method of SeleniumWebDriverHelper class similar to waitVisibilityAndGetValue.
By.xpath(format(Locators.STACK_ITEM_NAME_XPATH_PATTERN, stackName))); | ||
} | ||
|
||
public Boolean isStackItemExists(String stackName) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isStackItemExists
> isStackItemExisted
By.xpath(format(Locators.STACK_ITEM_NAME_XPATH_PATTERN, stackName))); | ||
} | ||
|
||
public Boolean isDuplicatedStackExists(String stackName) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isDuplicatedStackExists
> isDuplicatedStackExisted
public void typeToSearchInput(String value) { | ||
seleniumWebDriverHelper.waitVisibility(searchStackField).clear(); | ||
searchStackField.sendKeys(value); | ||
WaitUtils.sleepQuietly(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These three commands could by replaced by one: seleniumWebDriverHelper.setText(...)
|
||
public void clickOnSortStacksByNameButton() { | ||
seleniumWebDriverHelper.waitAndClick(By.xpath(Locators.SORT_STACKS_BY_NAME_BUTTON_XPATH)); | ||
WaitUtils.sleepQuietly(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What we are waiting here on?
String DELETE_STACK_BUTTON_ID = "delete-item-button"; | ||
String DELETE_DIALOG_BUTTON_ID = "ok-dialog-button"; | ||
String SEARCH_STACK_FIELD_XPATH = "//input[@ng-placeholder='Search']"; | ||
String STACKS_LIST_HEADER_XPATH = "//md-item[@class='noselect']//span"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's more reliable to have name or id of element to localize stack list header.
String DELETE_DIALOG_BUTTON_ID = "ok-dialog-button"; | ||
String SEARCH_STACK_FIELD_XPATH = "//input[@ng-placeholder='Search']"; | ||
String STACKS_LIST_HEADER_XPATH = "//md-item[@class='noselect']//span"; | ||
String SORT_STACKS_BY_NAME_BUTTON_XPATH = "//span[contains(@class, 'header-sort-direction')]"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's more reliable to have name or id of element to localize sort stack button.
* @param value name of element value | ||
* @return element text by {@link WebElement#getAttribute(String)} | ||
*/ | ||
public String waitVisibilityAndGetValue(By elementLocator, String value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is waitVisibilityAndGetAttribute
method, and value
parameter here is actually attributeName
.
} | ||
|
||
@FindBy(name = Locators.NEW_STACK_NAME) | ||
WebElement stackNameField; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stackNameField
> newStackNameField
|
||
public void clickOnAllStacksButton() { | ||
seleniumWebDriverHelper.waitAndClick(By.xpath(Locators.ALL_STACKS_BUTTON_XPATH)); | ||
WaitUtils.sleepQuietly(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really still need WaitUtils.sleepQuietly(1)
here?
ci-test |
ci-test build report: |
What does this PR do?
This PR creates StacksListTest selenium test.
Test methods will cover next use cases:
What issues does this PR fix or reference?
#9517