Skip to content
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

Merged
merged 21 commits into from
May 8, 2018

Conversation

SkorikSergey
Copy link
Contributor

What does this PR do?

This PR creates StacksListTest selenium test.

Test methods will cover next use cases:

  • check documentation, stacks list header, stack info;
  • stacks creating;
  • sorting stacks by name;
  • actions buttons(delete stack, duplicate stack);
  • deleting stacks from the Stacks list;
  • stacks filtering by the Search stacks feature.

selection_239

What issues does this PR fix or reference?

#9517

@SkorikSergey SkorikSergey added kind/task Internal things, technical debt, and to-do tasks to be performed. team/che-qe labels May 3, 2018
@SkorikSergey
Copy link
Contributor Author

ci-test

@benoitf benoitf added the status/code-review This issue has a pull request posted for it and is awaiting code review completion by the community. label May 3, 2018
@codenvy-ci
Copy link

ci-test build report:
Build details
Test report
selenium tests report data
docker image: eclipseche/che-server:9601
https://github.com/orgs/eclipse/teams/eclipse-che-qa please check this 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']";
Copy link
Contributor

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() {
Copy link
Contributor

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

@dmytro-ndp dmytro-ndp May 5, 2018

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();
Copy link
Contributor

@dmytro-ndp dmytro-ndp May 5, 2018

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 =
Copy link
Contributor

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) {
Copy link
Contributor

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) {
Copy link
Contributor

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

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

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";
Copy link
Contributor

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')]";
Copy link
Contributor

@dmytro-ndp dmytro-ndp May 5, 2018

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.

@SkorikSergey SkorikSergey requested a review from olexii4 May 7, 2018 12:34
* @param value name of element value
* @return element text by {@link WebElement#getAttribute(String)}
*/
public String waitVisibilityAndGetValue(By elementLocator, String value) {
Copy link
Contributor

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;
Copy link
Contributor

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

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?

@SkorikSergey
Copy link
Contributor Author

ci-test

@codenvy-ci
Copy link

ci-test build report:
Build details
Test report
selenium tests report data
docker image: eclipseche/che-server:9601
https://github.com/orgs/eclipse/teams/eclipse-che-qa please check this report.

@SkorikSergey SkorikSergey merged commit a3472a9 into master May 8, 2018
@SkorikSergey SkorikSergey deleted the createStacksListTest branch May 8, 2018 11:13
@benoitf benoitf removed the status/code-review This issue has a pull request posted for it and is awaiting code review completion by the community. label May 8, 2018
@benoitf benoitf added this to the 6.5.0 milestone May 8, 2018
hbhargav pushed a commit to hbhargav/che that referenced this pull request Dec 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/task Internal things, technical debt, and to-do tasks to be performed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants