Skip to content

Commit

Permalink
Selenium: add selenium test to check the workspace details of workspa…
Browse files Browse the repository at this point in the history
…ce with single machine (#7946)

* WorkspaceDetailsTest selenium test splitted to WorkspaceDetailsComposeTest and WorkspaceDetailsSingleMachineTest
* created tests added to CheSuite.xml test suite
  • Loading branch information
Sergey Skorik committed Dec 19, 2017
1 parent d311512 commit 33feb47
Show file tree
Hide file tree
Showing 6 changed files with 344 additions and 159 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@
import static org.openqa.selenium.support.ui.ExpectedConditions.textToBePresentInElement;
import static org.openqa.selenium.support.ui.ExpectedConditions.textToBePresentInElementLocated;
import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOf;
import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOfAllElementsLocatedBy;
import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOfElementLocated;

import com.google.inject.Inject;
import com.google.inject.Singleton;
import java.util.List;
import org.eclipse.che.selenium.core.SeleniumWebDriver;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
Expand Down Expand Up @@ -177,6 +179,21 @@ public void waitReferenceIsNotPresent(String referenceId) {
redrawDriverWait.until(invisibilityOfElementLocated(By.id(referenceId)));
}

public boolean checkThatServerExists(String serverName) {
List<WebElement> webElements =
loadPageDriverWait.until(
visibilityOfAllElementsLocatedBy(
By.xpath("//div[contains(@id, 'runtime-info-reference-')]")));

for (WebElement we : webElements) {
if (we.getText().equals(serverName)) {
return true;
}
}

return false;
}

public void waitExpectedTextIntoPreviewUrl(String expectedText) {
redrawDriverWait.until(textToBePresentInElement(previewUrl, expectedText));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ public void clickOnDeleteWorkspace() {
.click();
}

public void isDeleteWorkspaceButtonExists() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOf(deleteWorkspaceBtn));
}

public void waitDownloadWorkspaceJsonFileBtn() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(elementToBeClickable(downloadWsJsonBtn));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@
import com.google.inject.Inject;
import com.google.inject.Singleton;
import org.eclipse.che.selenium.core.SeleniumWebDriver;
import org.eclipse.che.selenium.core.utils.WaitUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

/** @author Musienko Maxim */
Expand All @@ -38,8 +36,10 @@ public WorkspaceProjects(SeleniumWebDriver seleniumWebDriver) {
private interface Locators {
String PROJECT_BY_NAME = "//div[contains(@ng-click, 'projectItem')]/span[text()='%s']";
String DELETE_PROJECT = "//button/span[text()='Delete']";
String DELETE_IT_PROJECT = "//che-button-primary[@che-button-title='Delete']/button";
String DELETE_SELECTED_PROJECTS = "//che-button-primary[@che-button-title='Delete']/button";
String DELETE_IT_PROJECT = "//md-dialog//che-button-primary[@che-button-title='Delete']/button";
String ADD_NEW_PROJECT_BUTTON = "//che-button-primary[@che-button-title='Add Project']/button";
String PROJECT_CHECKBOX = "//md-checkbox[contains(@aria-label, 'Project %s')]";
}

/**
Expand Down Expand Up @@ -74,23 +74,28 @@ public void waitProjectIsNotPresent(String projectName) {
public void openSettingsForProjectByName(String projectName) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
visibilityOfElementLocated(
By.xpath(String.format(Locators.PROJECT_BY_NAME, projectName))))
.click();
}

/** click on 'DELETE' button in settings of project */
public void clickOnDeleteProject() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(Locators.DELETE_PROJECT)))
.until(visibilityOfElementLocated(By.xpath(Locators.DELETE_PROJECT)))
.click();
}

/** click on 'DELETE IT!' button in the confirming window */
public void clickOnDeleteItInDialogWindow() {
WaitUtils.sleepQuietly(1);
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(Locators.DELETE_IT_PROJECT)))
.until(visibilityOfElementLocated(By.xpath(Locators.DELETE_IT_PROJECT)))
.click();
}

public void clickOnDeleteProjectButton() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.xpath(Locators.DELETE_SELECTED_PROJECTS)))
.click();
}

Expand All @@ -100,4 +105,13 @@ public void clickOnAddNewProjectButton() {
.until(visibilityOfElementLocated(By.xpath(Locators.ADD_NEW_PROJECT_BUTTON)))
.click();
}

/** click on the Add Project button */
public void selectProject(String projectName) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
visibilityOfElementLocated(
By.xpath(String.format(Locators.PROJECT_CHECKBOX, projectName))))
.click();
}
}
Loading

0 comments on commit 33feb47

Please sign in to comment.