[CHE 6] Rework selenium page objects for Dashboard (#7583)

* changed dashboard selenium page objects
* the WorspaceDetails page object was divided
6.19.x
Sergey Skorik 2017-12-04 15:11:52 +00:00 committed by GitHub
parent f7907fca22
commit bf9df593e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
49 changed files with 1850 additions and 1736 deletions

View File

@ -10,7 +10,7 @@
Red Hat, Inc. - initial API and implementation
-->
<div class="left-sidebar-container">
<div class="left-sidebar-container" id="navbar">
<md-toolbar class="flex-shrink-none">
<md-progress-linear md-mode="indeterminate" ng-hide="navbarController.profile && navbarController.profile.userId"></md-progress-linear>
<div ng-show="navbarController.profile && navbarController.profile.userId"
@ -21,7 +21,7 @@
<section class="navbar-top-logo logo-color-white" layout="column" layout-align="center left" ng-include="branding.logoText">
</section>
<div flex></div>
<navbar-notification></navbar-notification>
<navbar-notification id="navbar-notification-container"></navbar-notification>
</div>
<md-divider md-theme="factory-theme"></md-divider>
@ -32,7 +32,7 @@
<md-list-item flex class="navbar-subsection-item">
<md-button nav-bar-selected flex che-reload-href href="{{navbarController.menuItemUrl.dashboard}}" layout-align="left"
target="_self">
<div class="navbar-item" layout="row" layout-align="start center">
<div class="navbar-item" layout="row" layout-align="start center" id="dashboard-item">
<md-icon md-font-icon="navbar-icon chefont cheico-dashboard" aria-label="Dashboard"></md-icon>
<span>Dashboard</span>
</div>
@ -40,7 +40,7 @@
</md-list-item>
<md-list-item flex class="navbar-subsection-item">
<md-button nav-bar-selected flex che-reload-href href="{{navbarController.menuItemUrl.workspaces}}" layout-align="left">
<div class="navbar-item" layout="row" layout-align="start center">
<div class="navbar-item" layout="row" layout-align="start center" id="workspaces-item">
<md-icon md-font-icon="navbar-icon chefont cheico-workspace"></md-icon>
<span>Workspaces</span>
<span class="navbar-number" ng-show="navbarController.getWorkspacesNumber()">&nbsp;({{navbarController.getWorkspacesNumber()}})</span>
@ -50,7 +50,7 @@
<md-list-item flex class="navbar-subsection-item">
<md-button nav-bar-selected flex che-reload-href
href="{{navbarController.menuItemUrl.stacks}}" layout-align="left">
<div class="navbar-item" layout="row" layout-align="start center">
<div class="navbar-item" layout="row" layout-align="start center" id="stacks-item">
<md-icon md-font-icon="navbar-icon material-design icon-ic_inbox_24px"></md-icon>
<span>Stacks</span>
</div>
@ -59,7 +59,7 @@
<md-list-item flex class="navbar-subsection-item">
<md-button nav-bar-selected flex che-reload-href
href="{{navbarController.menuItemUrl.factories}}" layout-align="left">
<div class="navbar-item" layout="row" layout-align="start center">
<div class="navbar-item" layout="row" layout-align="start center" id="factories-item">
<md-icon md-font-icon="navbar-icon chefont cheico-factory"></md-icon>
<span>Factories</span>
<span class="navbar-number" ng-show="navbarController.getFactoriesNumber()">&nbsp;({{navbarController.getFactoriesNumber()}})</span>
@ -69,7 +69,7 @@
<md-list-item flex class="navbar-subsection-item">
<md-button nav-bar-selected flex che-reload-href
href="{{navbarController.menuItemUrl.administration}}" layout-align="left">
<div class="navbar-item" layout="row" layout-align="start center">
<div class="navbar-item" layout="row" layout-align="start center" id="administration-item">
<md-icon md-font-icon="navbar-icon material-design icon-ic_settings_24px"></md-icon>
<span>Administration</span>
</div>
@ -103,7 +103,7 @@
<md-button nav-bar-selected flex che-reload-href
href="{{navbarController.menuItemUrl.usermanagement}}"
layout-align="left">
<div class="navbar-item" layout="row" layout-align="start center">
<div class="navbar-item" layout="row" layout-align="start center" id="users-item">
<i class="fa fa-user fa-lg navbar-icon"></i>
<span>Users</span>
</div>
@ -113,7 +113,7 @@
ng-if="navbarController.userServices.hasInstallationManagerService">
<md-button nav-bar-selected flex che-reload-href
href="{{navbarController.menuItemUrl.organizations}}" layout-align="left">
<div class="navbar-item" layout="row" layout-align="start center">
<div class="navbar-item" layout="row" layout-align="start center" id="organizations-item">
<md-icon md-font-icon="fa navbar-icon fa-sitemap"></md-icon>
<span>Organizations</span>
<span class="navbar-number" ng-show="navbarController.getRootOrganizationsNumber()">&nbsp;({{navbarController.getRootOrganizationsNumber()}})</span>
@ -139,12 +139,12 @@
navbar-dropdown-items="navbarController.accountItems"
navbar-dropdown-offset="15 -45">
<md-button ng-href="" layout-align="left">
<div class="navbar-item navbar-identity" layout="row" layout-align="start center">
<div class="navbar-item navbar-identity" layout="row" layout-align="start center" id="navbar-user-panel">
<i class="navbar-icon" flex="none">
<img class="developers-face" gravatar-src="navbarController.profile.email"/>
<img class="developers-face" id="developers-face" gravatar-src="navbarController.profile.email"/>
</i>
<span flex style="text-align: left;">{{navbarController.getUserName()}}</span>
<span flex style="text-align: left;" id="user-name">{{navbarController.getUserName()}}</span>
<i class="fa fa-angle-up navbar-icon" aria-hidden="true"></i>
</div>
</md-button>

View File

@ -1,5 +1,6 @@
<che-toolbar che-title="New Workspace">
<che-button-save-flat class="create-workspace-header-button"
id="create-workspace-button"
che-button-title="Create"
ng-click="createWorkspaceController.createWorkspace()"
ng-disabled="createWorkspaceController.isCreateButtonDisabled()"></che-button-save-flat>
@ -23,6 +24,7 @@
<che-input-box ng-init="createWorkspaceController.registerForm('name', workspaceNameForm)"
che-form="workspaceNameForm"
che-name="workspaceName"
id="workspace-name-input"
che-place-holder="Name of the workspace"
aria-label="Name of the workspace"
ng-model="createWorkspaceController.workspaceName"

View File

@ -7,14 +7,19 @@
md-theme="default"
flex-order="2" flex-order-gt-md="1">
<che-toggle-joined-button che-title="Samples"
id="samples-button"
che-value="addImportProjectController.projectSource.SAMPLES"></che-toggle-joined-button>
<che-toggle-joined-button che-title="Blank"
id="blank-button"
che-value="addImportProjectController.projectSource.BLANK"></che-toggle-joined-button>
<che-toggle-joined-button che-title="Git"
id="git-button"
che-value="addImportProjectController.projectSource.GIT"></che-toggle-joined-button>
<che-toggle-joined-button che-title="GitHub"
id="github-button"
che-value="addImportProjectController.projectSource.GITHUB"></che-toggle-joined-button>
<che-toggle-joined-button che-title="Zip"
id="zip-button"
che-value="addImportProjectController.projectSource.ZIP"></che-toggle-joined-button>
</che-toggle-joined>
</div>
@ -38,10 +43,12 @@
<div class="add-import-project-button"
flex layout="row" layout-align="end center">
<che-button-cancel-flat che-button-title="Cancel"
id="cancel-button"
name="cancelButton"
ng-disabled="addImportProjectController.disableSaveAndCancelButtons()"
ng-click="addImportProjectController.projectTemplateOnCancel()"></che-button-cancel-flat>
<che-button-primary che-button-title="Add"
id="add-project-button"
name="addButton"
ng-disabled="addImportProjectForm.$invalid || addImportProjectController.disableSaveAndCancelButtons()"
ng-click="addImportProjectController.projectTemplateOnSave()"></che-button-primary>

View File

@ -4,6 +4,7 @@
<che-input-box ng-init="importGitProjectController.registerForm(importGitProjectForm)"
che-form="importGitProjectForm"
che-name="remoteGitURL"
id="remote-git-url-input"
che-label-name="Git URL"
che-place-holder="Url of the git repository"
aria-label="Url of the git repository"

View File

@ -4,6 +4,7 @@
<che-input-box ng-init="importZipProjectController.registerForm(importZipProjectForm)"
che-form="importZipProjectForm"
che-name="remoteZipURL"
id="remote-zip-url-input"
che-label-name="Zip URL"
che-place-holder="Url of the zip file"
aria-label="Url of the zip file"
@ -17,6 +18,7 @@
<div layout="row" layout-align="left" class="skip-root-container">
<div flex="20"></div>
<md-checkbox ng-model="importZipProjectController.skipFirstLevel"
id="zip-skip-root-folder-checkbox"
ng-change="importZipProjectController.onCheckboxChanged()"
aria-label="Skip the root folder of the archive">
Skip the root folder of the archive

View File

@ -12,6 +12,7 @@
class="che-checkbox-area template-selector-item-checkbox">
<che-list-item-checked ng-model="templateIsChecked[template.name]"
che-aria-label-checkbox="Sample {{template.name}}"
id="sample-{{template.name}}"
ng-click="onTemplateClick()"></che-list-item-checked>
</div>

View File

@ -1,4 +1,4 @@
<div class="project-source-selector">
<div class="project-source-selector" id="project-source-selector">
<!-- Toggle buttons -->
<div class="che-template-checker">

View File

@ -10,12 +10,16 @@
md-theme="default"
flex-order="2" flex-order-gt-md="1">
<che-toggle-joined-button che-title="All"
id="all-stacks-button"
che-value="stackSelectorController.scope.ALL"></che-toggle-joined-button>
<che-toggle-joined-button che-title="Quick Start"
id="quick-start-button"
che-value="stackSelectorController.scope.QUICK_START"></che-toggle-joined-button>
<che-toggle-joined-button che-title="Single Machine"
id="single-machine-button"
che-value="stackSelectorController.scope.SINGLE_MACHINE"></che-toggle-joined-button>
<che-toggle-joined-button che-title="Multi Machine"
id="multi-machine-button"
che-value="stackSelectorController.scope.MULTI_MACHINE"></che-toggle-joined-button>
</che-toggle-joined>
@ -27,6 +31,7 @@
layout="row"
layout-align="start center" layout-align-gt-md="end center">
<toggle-button-popover button-title="Filters"
id="filter-stacks-button"
button-font-icon="fa fa-sliders"
che-popover-trigger-outside-click="true"
ng-class="{'stack-selector-active-tags-filter': stackSelectorController.selectedTags.length}">
@ -36,10 +41,12 @@
</che-stack-library-filter>
</toggle-button-popover>
<che-button-default che-button-title="Add Stack"
id="add-stack-button"
che-button-icon="material-design icon-ic_add_24px"
name="addStack"
ng-click="stackSelectorController.onAddStack()"></che-button-default>
<search-input search-placeholder="Search"
id="search-stack-input"
search-on-change="stackSelectorController.searchChanged(search)"></search-input>
</div>
</div>

View File

@ -1,11 +1,11 @@
<div class="che-workspace-button">
<che-button-default ng-if="showStopButton===false"
id="runButton"
id="run-workspace-button"
ng-disabled="isDisabled"
che-button-title="Run"
ng-click="onRunWorkspace()"></che-button-default>
<che-button-default ng-if="showStopButton"
id="stopButton"
id="stop-workspace-button"
ng-disabled="isDisabled"
che-button-title="Stop"
ng-click="onStopWorkspace()"></che-button-default>

View File

@ -10,6 +10,7 @@
on-stop-workspace="workspaceDetailsController.stopWorkspace()"
on-run-workspace="workspaceDetailsController.runWorkspace()"></workspace-status-button>
<che-button-default ng-if="workspaceDetailsController.editMode === false"
id="open-in-ide-button"
che-button-title="Open"
href="#/ide/{{workspaceDetailsController.namespaceId}}/{{workspaceDetailsController.workspaceName}}"></che-button-default>
</div>

View File

@ -10,18 +10,20 @@
*/
package org.eclipse.che.selenium.pageobject.dashboard;
import static java.lang.String.format;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.LOADER_TIMEOUT_SEC;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.REDRAW_UI_ELEMENTS_TIMEOUT_SEC;
import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOf;
import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOfElementLocated;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import org.eclipse.che.selenium.core.SeleniumWebDriver;
import org.eclipse.che.selenium.core.constant.TestTimeoutsConstants;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
/** @author Ann Shumilova */
@ -36,61 +38,49 @@ public class CreateWorkspace {
PageFactory.initElements(seleniumWebDriver, this);
}
public interface TabNames {
String SETTINGS = "Settings";
String WS_CONFIG = "Workspace Config";
String RUNTIME = "Runtime";
String STACK_LIBRARY = "Stack library";
String STACK_IMPORT = "Stack import";
String STACK_AUTHORING = "Stack authoring";
String PROJECTS = "Projects";
String SHARE = "Share";
}
private interface Locators {
String WORKSPACE_NAME_INPUT = "//input[@name='workspaceName']";
String CREATE_BUTTON = "//che-button-save-flat//span[text()='Create']";
String SEARCH_INPUT = "//input[@placeholder='Search']";
String TOOLBAR_TITLE_ID = "New_Workspace";
String WORKSPACE_NAME_INPUT = "workspace-name-input";
String CREATE_BUTTON = "create-workspace-button";
String SELECT_ALL_STACKS_TAB = "all-stacks-button";
String SELECT_QUICK_START_STACKS_TAB = "quick-start-button";
String SELECT_SINGLE_MACHINE_STACKS_TAB = "single-machine-button";
String SELECT_MULTI_MACHINE_STACKS_TAB = "multi-machine-button";
String ADD_STACK_BUTTON = "search-stack-input";
String FILTER_STACK_BUTTON = "search-stack-input";
String SEARCH_INPUT = "search-stack-input";
String STACK_ROW_XPATH = "//div[@data-stack-id='%s']";
String RAM_INPUT_XPATH = "//input[@name='memory']";
String MACHINE_RAM_ID = "machine-%s-ram";
String SELECT_ALL_STACKS_TAB = "//che-toggle-joined-button[@che-title = 'All']";
String SELECT_QUICK_START_STACKS_TAB =
"//che-toggle-joined-button[@che-title = 'Quick Start']";
String SELECT_SINGLE_MACHINE_STACKS_TAB =
"//che-toggle-joined-button[@che-title = 'Single Machine']";
String SELECT_MULTI_MACHINE_STACKS_TAB =
"//che-toggle-joined-button[@che-title = 'Multi Machine']";
}
@FindBy(id = Locators.TOOLBAR_TITLE_ID)
WebElement toolbarTitle;
@FindBy(xpath = Locators.WORKSPACE_NAME_INPUT)
@FindBy(id = Locators.WORKSPACE_NAME_INPUT)
WebElement workspaceNameInput;
@FindBy(xpath = Locators.CREATE_BUTTON)
@FindBy(id = Locators.CREATE_BUTTON)
WebElement createWorkspaceButton;
@FindBy(xpath = Locators.SEARCH_INPUT)
@FindBy(id = Locators.SEARCH_INPUT)
WebElement searchInput;
@FindBy(xpath = Locators.SELECT_ALL_STACKS_TAB)
@FindBy(id = Locators.SELECT_ALL_STACKS_TAB)
WebElement selectAllStacksTab;
@FindBy(xpath = Locators.SELECT_QUICK_START_STACKS_TAB)
@FindBy(id = Locators.SELECT_QUICK_START_STACKS_TAB)
WebElement selectQuickStartStacksTab;
@FindBy(xpath = Locators.SELECT_SINGLE_MACHINE_STACKS_TAB)
@FindBy(id = Locators.SELECT_SINGLE_MACHINE_STACKS_TAB)
WebElement selectSingleMachineStacksTab;
@FindBy(xpath = Locators.SELECT_MULTI_MACHINE_STACKS_TAB)
@FindBy(id = Locators.SELECT_MULTI_MACHINE_STACKS_TAB)
WebElement selectMultiMachineStacksTab;
public void waitToolbar() {
new WebDriverWait(seleniumWebDriver, TestTimeoutsConstants.LOADER_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOfElementLocated(By.id(Locators.TOOLBAR_TITLE_ID)));
new WebDriverWait(seleniumWebDriver, LOADER_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.id(Locators.TOOLBAR_TITLE_ID)));
}
public void typeToSearchInput(String value) {
@ -99,18 +89,18 @@ public class CreateWorkspace {
public void selectStack(String stackId) {
WebElement stack =
seleniumWebDriver.findElement(By.xpath(String.format(Locators.STACK_ROW_XPATH, stackId)));
seleniumWebDriver.findElement(By.xpath(format(Locators.STACK_ROW_XPATH, stackId)));
new Actions(seleniumWebDriver).moveToElement(stack).perform();
stack.click();
}
public void clickCreate() {
public void clickOnCreateWorkspaceButton() {
createWorkspaceButton.click();
}
public void typeWorkspaceName(String name) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOf(workspaceNameInput));
.until(visibilityOf(workspaceNameInput));
workspaceNameInput.clear();
workspaceNameInput.sendKeys(name);
}
@ -127,32 +117,32 @@ public class CreateWorkspace {
public void setMachineRAM(String machine, String value) {
WebElement ramInput =
seleniumWebDriver.findElement(By.id(String.format(Locators.MACHINE_RAM_ID, machine)));
seleniumWebDriver.findElement(By.id(format(Locators.MACHINE_RAM_ID, machine)));
ramInput.clear();
ramInput.sendKeys(value);
}
public void clickAllStacksTab() {
public void clickOnAllStacksTab() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOf(selectAllStacksTab))
.until(visibilityOf(selectAllStacksTab))
.click();
}
public void clickQuickStartTab() {
public void clickOnQuickStartTab() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOf(selectQuickStartStacksTab))
.until(visibilityOf(selectQuickStartStacksTab))
.click();
}
public void clickSingleMachineTab() {
public void clickOnSingleMachineTab() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOf(selectSingleMachineStacksTab))
.until(visibilityOf(selectSingleMachineStacksTab))
.click();
}
public void clickMultiMachineTab() {
public void clickOnMultiMachineTab() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOf(selectMultiMachineStacksTab))
.until(visibilityOf(selectMultiMachineStacksTab))
.click();
}
}

View File

@ -10,12 +10,16 @@
*/
package org.eclipse.che.selenium.pageobject.dashboard;
import static java.lang.String.format;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.ELEMENT_TIMEOUT_SEC;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.EXPECTED_MESS_IN_CONSOLE_SEC;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.LOADER_TIMEOUT_SEC;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.LOAD_PAGE_TIMEOUT_SEC;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.REDRAW_UI_ELEMENTS_TIMEOUT_SEC;
import static org.openqa.selenium.support.ui.ExpectedConditions.invisibilityOfElementLocated;
import static org.openqa.selenium.support.ui.ExpectedConditions.textToBePresentInElement;
import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOf;
import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOfElementLocated;
import com.google.inject.Inject;
import com.google.inject.Singleton;
@ -33,7 +37,6 @@ import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
/** @author Musienko Maxim */
@ -64,39 +67,66 @@ public class Dashboard {
PageFactory.initElements(seleniumWebDriver, this);
}
private interface Locators {
String DASHBOARD_TOOLBAR_TITLE = "div [aria-label='Dashboard']";
String NEW_PROJECT_LINK = "//a[@href='#/create-project']/span[text()='Create Workspace']";
String COLLAPSE_DASH_NAVBAR_BTN = "ide-iframe-button-link";
String DASHBOARD_ITEM_XPATH = "//a[@href='#/']//span[text()='Dashboard']";
String WORKSPACES_ITEM_XPATH = "//a[@href='#/workspaces']//span[text()='Workspaces']";
String FACTORIES_ITEM_XPATH = "//a[@href='#/factories']//span[text()='Factories']";
String NOTIFICATION_CONTAINER = "che-notification-container";
String DEVELOPERS_FACE_XPATH = "//img[@class='developers-face']";
String USER_NAME = "//span[text()='%s']";
String LICENSE_NAG_MESSAGE_XPATH = "//div[contains(@class, 'license-message')]";
public enum MenuItem {
DASHBOARD("Dashboard"),
WORKSPACES("Workspaces"),
STACKS("Stacks"),
FACTORIES("Factories"),
USERS("Users"),
ORGANIZATIONS("Organizations"),
SETTINGS("Settings"),
CREATE_TEAM("Create Team");
private final String title;
MenuItem(String title) {
this.title = title;
}
}
@FindBy(css = Locators.DASHBOARD_TOOLBAR_TITLE)
WebElement dashboardTitle;
private interface Locators {
String DASHBOARD_TOOLBAR_TITLE = "navbar";
String NAVBAR_NOTIFICATION_CONTAINER = "navbar-notification-container";
String COLLAPSE_DASH_NAVBAR_BTN = "ide-iframe-button-link";
String NOTIFICATION_CONTAINER = "che-notification-container";
String DASHBOARD_ITEM = "dashboard-item";
String WORKSPACES_ITEM = "workspaces-item";
String STACKS_ITEM = "stacks-item";
String FACTORIES_ITEM = "factories-item";
String ADMINISTRATION_ITEM = "administration-item";
String ORGANIZATIONS_ITEM = "organization-item";
String RESENT_WS_NAVBAR = "//div[@class='admin-navbar-menu recent-workspaces']";
String LEFT_SIDE_BAR = "//div[@class='left-sidebar-container']";
String USER_PANEL = "navbar-user-panel";
String DEVELOPERS_FACE_XPATH = "developers-face";
String USER_NAME = "user-name";
String LICENSE_NAG_MESSAGE_XPATH = "//div[contains(@class, 'license-message')]";
String TOOLBAR_TITLE_NAME =
"//div[contains(@class,'che-toolbar')]//span[contains(text(),'%s')]";
}
@FindBy(xpath = Locators.NEW_PROJECT_LINK)
WebElement newProjectLink;
@FindBy(id = Locators.DASHBOARD_TOOLBAR_TITLE)
WebElement dashboardTitle;
@FindBy(id = Locators.COLLAPSE_DASH_NAVBAR_BTN)
WebElement collapseDashNavbarBtn;
@FindBy(xpath = Locators.WORKSPACES_ITEM_XPATH)
@FindBy(id = Locators.DASHBOARD_ITEM)
WebElement dashboardItem;
@FindBy(id = Locators.WORKSPACES_ITEM)
WebElement workspacesItem;
@FindBy(xpath = Locators.FACTORIES_ITEM_XPATH)
@FindBy(id = Locators.STACKS_ITEM)
WebElement stacksItem;
@FindBy(id = Locators.FACTORIES_ITEM)
WebElement factoriesItem;
@FindBy(xpath = Locators.DEVELOPERS_FACE_XPATH)
@FindBy(id = Locators.DEVELOPERS_FACE_XPATH)
WebElement developersFace;
@FindBy(xpath = Locators.DASHBOARD_ITEM_XPATH)
WebElement dashboardItem;
@FindBy(id = Locators.USER_NAME)
WebElement userName;
@FindBy(id = Locators.NOTIFICATION_CONTAINER)
WebElement notificationPopUp;
@ -106,33 +136,34 @@ public class Dashboard {
/** wait button with drop dawn icon (left top corner) */
public void waitDashboardToolbarTitle() {
new WebDriverWait(seleniumWebDriver, LOAD_PAGE_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOf(dashboardTitle));
}
public void clickOnNewProjectLinkOnDashboard() {
waitDashboardToolbarTitle();
newProjectLink.click();
}
/** click on the 'Workspaces' item on the dashboard */
public void selectWorkspacesItemOnDashboard() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOf(workspacesItem))
.click();
new WebDriverWait(seleniumWebDriver, LOAD_PAGE_TIMEOUT_SEC).until(visibilityOf(dashboardTitle));
}
/** click on the 'Dashboard' item on the dashboard */
public void selectDashboardItemOnDashboard() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOf(dashboardItem))
.until(visibilityOf(dashboardItem))
.click();
}
/** click on the 'Workspaces' item on the dashboard */
public void selectWorkspacesItemOnDashboard() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOf(workspacesItem))
.click();
}
/** click on the 'Stacks' item on the dashboard */
public void selectStacksItemOnDashboard() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOf(stacksItem))
.click();
}
/** click on the 'Factories' item on the dashboard */
public void selectFactoriesOnDashbord() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOf(factoriesItem))
.until(visibilityOf(factoriesItem))
.click();
}
@ -143,40 +174,38 @@ public class Dashboard {
*/
public void waitNotificationMessage(String notification) {
new WebDriverWait(seleniumWebDriver, EXPECTED_MESS_IN_CONSOLE_SEC)
.until(ExpectedConditions.textToBePresentInElement(notificationPopUp, notification));
.until(textToBePresentInElement(notificationPopUp, notification));
}
/** wait closing of notification pop up */
public void waitNotificationIsClosed() {
WaitUtils.sleepQuietly(1);
new WebDriverWait(seleniumWebDriver, ELEMENT_TIMEOUT_SEC)
.until(
ExpectedConditions.invisibilityOfElementLocated(
By.id(Locators.NOTIFICATION_CONTAINER)));
.until(invisibilityOfElementLocated(By.id(Locators.NOTIFICATION_CONTAINER)));
}
/** wait opening of notification pop up */
public void waitNotificationIsOpen() {
new WebDriverWait(seleniumWebDriver, ELEMENT_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOf(notificationPopUp));
.until(visibilityOf(notificationPopUp));
}
/** Wait developer avatar is present on dashboard */
public void waitDeveloperFaceImg() {
new WebDriverWait(seleniumWebDriver, EXPECTED_MESS_IN_CONSOLE_SEC)
.until(ExpectedConditions.visibilityOf(developersFace));
.until(visibilityOf(developersFace));
}
/**
* Wait user name is present on dashboard
*
* @param userName name of user
* @param name name of user
*/
public void checkUserName(String userName) {
new WebDriverWait(seleniumWebDriver, EXPECTED_MESS_IN_CONSOLE_SEC)
.until(
ExpectedConditions.presenceOfElementLocated(
By.xpath(String.format(Locators.USER_NAME, userName))));
public Boolean checkUserName(String name) {
return new WebDriverWait(seleniumWebDriver, EXPECTED_MESS_IN_CONSOLE_SEC)
.until(visibilityOf(userName))
.getText()
.equals(name);
}
/**
@ -220,6 +249,27 @@ public class Dashboard {
seleniumWebDriver.navigate().to(logoutURL + "?redirect_uri=" + redirectURL);
}
/**
* Wait toolbar name is present on dashboard
*
* @param titleName name of user
*/
public void waitToolbarTitleName(String titleName) {
new WebDriverWait(seleniumWebDriver, LOADER_TIMEOUT_SEC)
.until(
visibilityOfElementLocated(By.xpath(format(Locators.TOOLBAR_TITLE_NAME, titleName))));
}
/** Return true if workspaces present on the navigation panel */
public boolean workspacesIsPresent() {
new WebDriverWait(seleniumWebDriver, LOAD_PAGE_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.xpath(Locators.LEFT_SIDE_BAR)));
List<WebElement> workspaces =
seleniumWebDriver.findElements(By.xpath(Locators.RESENT_WS_NAVBAR));
return !(workspaces.size() == 0);
}
@PreDestroy
public void close() {
seleniumWebDriver.quit();

View File

@ -86,7 +86,7 @@ public class DashboardFactory {
private interface Locators {
String FACTOTY_TAB_XPATH = "//span[text()='Factories']";
String FACTORY_TAB_XPATH = "//span[text()='Factories']";
String FACTORY_LIST_CONTAINER_CSS = "md-content.factories-list-factories";
String CREATE_FACTORY_ICON_XPATH = "//a/span[text()='Create Factory']";
String WORKSPACE_ITEM_XPATH = "//div[@class='project-name']/a[text()='%s']";
@ -112,7 +112,7 @@ public class DashboardFactory {
"//div[@che-label-name='Configure Actions']//span[text()='Add']//parent::button";
}
@FindBy(xpath = Locators.FACTOTY_TAB_XPATH)
@FindBy(xpath = Locators.FACTORY_TAB_XPATH)
WebElement factoryNavBarItem;
@FindBy(css = Locators.FACTORY_LIST_CONTAINER_CSS)

View File

@ -1,303 +0,0 @@
/*
* Copyright (c) 2012-2017 Red Hat, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
*/
package org.eclipse.che.selenium.pageobject.dashboard;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.REDRAW_UI_ELEMENTS_TIMEOUT_SEC;
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.eclipse.che.selenium.pageobject.Loader;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
/** @author Musienko Maxim */
@Singleton
public class DashboardProject {
private final SeleniumWebDriver seleniumWebDriver;
private final Loader loader;
@Inject
public DashboardProject(SeleniumWebDriver seleniumWebDriver, Loader loader) {
this.seleniumWebDriver = seleniumWebDriver;
this.loader = loader;
PageFactory.initElements(seleniumWebDriver, this);
}
public enum Template {
WEB_JAVA_SPRING("web-java-spring"),
CONSOLE_JAVA_SIMPLE("console-java-simple"),
WEB_JAVA_PETCLINIC("web-java-petclinic");
private final String value;
Template(String value) {
this.value = value;
}
/** @return name of template displayed in dashboard. */
public String value() {
return value;
}
}
private interface Locators {
String NAME_WORKSPACE_FIELD = "input[placeholder='Name of the workspace']";
String CREATE_PROJECT_BUTTON = "//button/span[contains(text(), 'Create')]";
String NAME_OF_PROJECT_FIELD = "input[placeholder='Name of the project']";
String CREATE_NEW_WS = "//md-radio-button[@aria-label='Create new workspace from stack']";
String SELECT_EXISTING_WS = "//div[@class='list-item-name ng-binding' and text()='%s']";
String SELECT_TEMPLATE_PROJECT = "//div[text()='%s']";
String NEW_PROJECT_LINK = "//a[@ng-href='#/create-project']/span[text()='Create Workspace']";
String SELECT_SOURCE_ITEM = "//md-radio-button[@aria-label='%s']";
String GIT_URL_INPUT = "//input[@placeholder='Url of the git repository']";
String ZIP_URL_INPUT = "//input[@placeholder='Url of the zip file']";
String LOCATION_TAB = "//span[text()='%s']//parent::md-tab-item";
String EXISTING_WS_RADIO_BUTTON = "//md-radio-button[@value='existing-workspace']";
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 SKIP_ROOT_FOLDER = "//span[text()='Skip the root folder of the archive']";
}
@FindBy(css = Locators.NAME_WORKSPACE_FIELD)
WebElement nameOfWorkspaceField;
@FindBy(css = Locators.NAME_OF_PROJECT_FIELD)
WebElement nameOfProjectField;
@FindBy(xpath = Locators.CREATE_PROJECT_BUTTON)
WebElement createProjectButton;
@FindBy(xpath = Locators.CREATE_NEW_WS)
WebElement createWsFromStack;
@FindBy(xpath = Locators.NEW_PROJECT_LINK)
WebElement newProject;
@FindBy(xpath = Locators.GIT_URL_INPUT)
WebElement gitUrlInput;
@FindBy(xpath = Locators.ZIP_URL_INPUT)
WebElement zipUrlInput;
public void waitNameOfWorkspaceField() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOf(nameOfWorkspaceField));
}
public void waitNameOfProjectField() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOf(nameOfProjectField));
}
public void typeWorkspaceName(String nameOfWs) {
waitNameOfWorkspaceField();
nameOfWorkspaceField.clear();
nameOfWorkspaceField.sendKeys(nameOfWs);
}
public void typeProjectName(String nameOfProject) {
waitNameOfProjectField();
nameOfProjectField.clear();
nameOfProjectField.sendKeys(nameOfProject);
}
/** click on the radio button 'Create new workspace from stack' */
public void selectCreateNewWorkspace() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOf(createWsFromStack))
.click();
}
/** click on create new project button on New project page */
public void clickOnCreateProject() {
loader.waitOnClosed();
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOf(createProjectButton))
.click();
}
/**
* select existing workspace in the 'Select Workspace' tab when create new project
*
* @param wsName is name of the existing workspace
*/
public void selectExistingWs(String wsName) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(Locators.EXISTING_WS_RADIO_BUTTON)))
.click();
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(String.format(Locators.SELECT_EXISTING_WS, wsName))))
.click();
}
/**
* select template project in the 'STACK LIBRARY' tab
*
* @param projectName is name of the existing template project
*/
public void selectTemplateProject(String projectName) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(String.format(Locators.SELECT_TEMPLATE_PROJECT, projectName))))
.click();
}
/**
* Select source in the 'New Project' tab
*
* @param nameSource name os source
*/
public void selectSource(String nameSource) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(String.format(Locators.SELECT_SOURCE_ITEM, nameSource))))
.click();
}
/** Click on '+' button in the 'New Project' tab */
public void clickOnNewProjectButton() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOf(newProject))
.click();
}
/**
* Enter Git URL for project in the 'New Project' tab
*
* @param url URL for project on git repository
*/
public void enterGitURL(String url) {
WebElement input =
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOf(gitUrlInput));
input.clear();
input.sendKeys(url);
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.textToBePresentInElementValue(gitUrlInput, url));
}
/**
* Enter ZIP URL for project in the 'New Project' tab
*
* @param url URL for zip archive
*/
public void enterZipURL(String url) {
WebElement input =
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOf(zipUrlInput));
input.clear();
input.sendKeys(url);
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.textToBePresentInElementValue(zipUrlInput, url));
}
/**
* Select existing location for import project in the 'New Project' tab
*
* @param location name of location
*/
public void selectExistingLocation(String location) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(String.format(Locators.LOCATION_TAB, location))))
.click();
}
/**
* wait the project is present in the 'All projects' tab
*
* @param projectName name of project
*/
public void waitProjectIsPresent(String projectName) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(String.format(Locators.PROJECT_BY_NAME, projectName))));
}
/**
* wait the project is not present in the 'All projects' tab
*
* @param projectName name of project
*/
public void waitProjectIsNotPresent(String projectName) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.invisibilityOfElementLocated(
By.xpath(String.format(Locators.PROJECT_BY_NAME, projectName))));
}
/**
* open settings for project by name in the 'All projects' tab
*
* @param projectName name of project
*/
public void openSettingsForProjectByName(String projectName) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.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)))
.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)))
.click();
}
/** Click on 'Skip the root folder of the archive' */
public void clickOnSkipRootFolder() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(Locators.SKIP_ROOT_FOLDER)))
.click();
}
/**
* Create workspace with new project inside.
*
* @param wsName name of workspace to place the project
* @param template name of project template
* @param projectName name of project
*/
public void createProjectFromTemplate(String wsName, Template template, String projectName) {
clickOnNewProjectButton();
selectExistingWs(wsName);
selectSource("New from blank, template, or sample project");
selectTemplateProject(template.value());
typeProjectName(projectName);
clickOnCreateProject();
}
}

View File

@ -1,947 +0,0 @@
/*
* Copyright (c) 2012-2017 Red Hat, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
*/
package org.eclipse.che.selenium.pageobject.dashboard;
import static java.lang.String.format;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.ELEMENT_TIMEOUT_SEC;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.EXPECTED_MESS_IN_CONSOLE_SEC;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.LOADER_TIMEOUT_SEC;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.LOAD_PAGE_TIMEOUT_SEC;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.REDRAW_UI_ELEMENTS_TIMEOUT_SEC;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import java.util.List;
import org.eclipse.che.selenium.core.SeleniumWebDriver;
import org.eclipse.che.selenium.core.utils.WaitUtils;
import org.eclipse.che.selenium.pageobject.Loader;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
/**
* @author Alex
* @author Andrey Chizhikov
*/
@Singleton
public class DashboardWorkspace {
private final SeleniumWebDriver seleniumWebDriver;
private final Loader loader;
private final Dashboard dashboard;
private final DashboardProject dashboardProject;
public interface TabNames {
String OVERVIEW = "Overview";
String PROJECTS = "Projects";
String MACHINES = "Machines";
String SERVERS = "Servers";
String INSTALLERS = "Installers";
String ENV_VARIABLES = "Env Variables";
String CONFIG = "Config";
String SSH = "Ssh";
String SHARE = "Share";
}
private interface Locators {
String NEW_WORKSPACE_BTN =
"//a[contains(@ng-href, 'create-workspace')]/span[text()='Add Workspace']";
String TOOLBAR_TITLE_NAME =
"//div[contains(@class,'che-toolbar')]//span[contains(text(),'%s')]";
String WORKSPACES_LIST = "//ng-transclude[@class='che-list-content']";
String WORKSPACE_ITEM_NAME =
"//div[contains(@class, 'workspace-name-clip')]//div[contains(@data-str, '%s')]";
String EXPORT_WORKSPACE_BTN =
"//button[contains(@class, 'che-button')]/span[text()='Export as a file']";
String DOWNLOAD_WORKSPACE_BTN = "//che-button-default[@che-button-title='download']";
String CLIPBOARD_JSON_WS_BTN = "//che-button-default[@che-button-title='clipboard']";
String HIDE_JSON_WS_BTN = "//span[text()='Close']";
String WORKSPACE_JSON_CONTENT = "//div[@class='CodeMirror-code']";
String IMPORT_WORKSPACE_BTN =
"//md-radio-button[@aria-label='Import an existing workspace configuration']";
String RECIPE_TYPE_BUTTON = "//button/span[text()='%s']";
String RECIPE_URL_FIELD = "//input[@placeholder='URL of the Recipe']";
String OPEN_IN_IDE_WS_BTN = "//che-button-default[@che-button-title='Open']";
String STACK_NAME_XPATH = "//md-card[contains(@ng-class,'%s')]";
String NAME_WORKSPACE_INPUT = "//input[@placeholder='Name of the workspace *']";
String RUN_WORKSPACE_BTN = "//button/span[text()='Run']";
String STOP_WORKSPACE_BTN = "//button/span[contains(text(),'Stop')]";
String DELETE_WORKSPACE_BTN = "//button/span[text()='Delete']";
String WORKSPACE_STATE = "workspace-status";
String WORKSPACE_TITLE = "//div[contains(@class,'toolbar-info')]/span[text()='%s']";
String DELETE_BTN_DIALOG_WIND =
"//button[@ng-click='cheConfirmDialogController.hide()']//span[text()='Delete']";
String CREATE_WS_FROM_STACK =
"//md-radio-button[@aria-label='Create new workspace from stack']";
String STACK_LIBRARY_ITEM = "//div[text()='%s']";
String RESENT_WS_NAVBAR = "//div[@class='admin-navbar-menu recent-workspaces']";
String LEFT_SIDE_BAR = "//div[@class='left-sidebar-container']";
String ADD_DEVLOPER_BTN = "//span[text()='Add Developer']";
String REMOVE_DEVELOPER_ICON =
"//span[text()='%s']//following::div[@tooltip='Remove member'][1]";
String INPUT_SHARE_DIALOG = "//md-chips[contains(@class,'share-user-input')]//input";
String SHARE_BTN_DIALOG = "//che-button-primary[@aria-disabled='false']//span[text()='Share']";
String DEVELOPER_SHARE_ITEM = "//span[text()='%s']";
String RUNTIME_TAB = "//span[text()='Runtime']";
String DEV_MACHINE = "//div[@class='workspace-machine-config']//div[text()='dev-machine']";
String WARNING_MSG = "//div[@class='workspace-environments-input']//div[text()='%s']";
String CONFIG_MACHINE_SWITCH =
"//div[text()='%s']//following::div[@class='config-dev-machine-switch ng-scope'][1]";
String TAB_NAMES_IN_WS = "//md-pagination-wrapper//span[text()='%s']";
String RECIPE_EDITOR =
"//div[contains(@class, 'recipe-editor')]//div[@class='CodeMirror-code']";
String WARNING_DIALOG_DELETE = "//div[@class='ng-binding' and text()=\"%s\"]";
String WS_TIMEOUT_MESSAGE = "//div[@che-label-name='Idle timeout']//div[@ng-transclude]";
String SAVE_BUTTON = "//che-button-save-flat//span[text()='Save']";
String CANCEL_BUTTON = "//che-button-cancel-flat//span[text()='Cancel']";
String DELETE_BUTTON = "//che-button-primary[@che-button-title='Delete']/button";
String ADD_MACHINE_BUTTON = "//che-button-primary[@che-button-title = 'Add machine']/button";
String RAM_WORKSPACE = "//input[contains(@name, 'memory')]";
String MACHINE_NAME = "//span[@machine-name='%s']";
String MACHINE_IMAGE = "//span[@machine-image='%s']";
String EDIT_MACHINE = "//div[@edit-machine='%s']";
String DELETE_MACHINE = "//div[@delete-machine='%s']";
String NEW_MACHINE_NAME = "//div[@che-form='editMachineForm']//input";
String EDIT_MACHINE_NAME_BUTTON = "//che-button-primary[@che-button-title='Edit']/button";
String EDIT_MACHINE_DIALOG_NAME = "//md-dialog/che-popup[@title='Edit the machine']";
String REMOVE_MACHINE_DIALOG_NAME = "//md-dialog/che-popup[@title='Remove machine']";
String ADD_MACHINE_DIALOG_NAME = "//md-dialog/che-popup[@title='Add a new machine']";
String CANCEL_DIALOG_BUTTON = "//md-dialog[@role='dialog']//button/span[text()='Cancel']";
String CLOSE_DIALOG_BUTTON = "//md-dialog[@role='dialog']//button/span[text()='Close']";
String DELETE_DIALOG_BUTTON = "//md-dialog[@role='dialog']//button/span[text()='Delete']";
String UPDATE_DIALOG_BUTTON = "//md-dialog[@role='dialog']//button/span[text()='Update']";
String ADD_DIALOG_BUTTON = "//md-dialog[@role='dialog']//button/span[text()='Add']";
String MACHINE_BUTTON =
"//che-machine-selector[@content-title='%s']//toggle-single-button[@id = 'workspace-machine-%s']//span";
String ENV_VARIABLE = "env-variable-name-%s";
String ADD_ENV_VARIABLE_BUTTON =
"//che-button-primary[@che-button-title='Add Env Variable']/button";
String ADD_ENV_VARIABLE_DIALOG_NAME =
"//md-dialog/che-popup[@title='Add a new environment variable']";
String VARIABLE_CHECKBOX = "//md-checkbox[@aria-label='Environment-Variable-%s']";
String VARIABLE_NAME = "//span[@variable-name='%s']";
String VARIABLE_VALUE = "//div[@id='env-variable-name-%s']//span[@variable-value='%s']";
String NEW_ENV_VARIABLE_NAME = "variable-name-input";
String NEW_ENV_VARIABLE_VALUE = "//textarea[@name='deskvalue']";
String EDIT_ENV_VARIABLE = "//div[@edit-variable='%s']";
String DELETE_ENV_VARIABLE = "//div[@delete-variable='%s']";
String SERVER = "server-name-%s";
String SERVER_REFERENCE = "//span[@server-reference='%s']";
String SERVER_PORT = "//div[@id='server-name-%s']//span[@server-port='%s']";
String SERVER_PROTOCOL = "//div[@id='server-name-%s']//span[@server-protocol='%s']";
String EDIT_SERVER_BUTTON = "//div[@edit-server='%s']";
String DELETE_SERVER_BUTTON = "//div[@delete-server='%s']";
String ADD_SERVER_BUTTON = "//che-button-primary[@che-button-title='Add Server']/button";
String ADD_NEW_SERVER_DIALOG_NAME = "//md-dialog/che-popup[@title='Add a new server']";
String ADD_SERVER_REFERENCE_FIELD = "server-reference-input";
String ADD_SERVER_PORT_FIELD = "server-port-input";
String ADD_SERVER_PROTOCOL_FIELD = "server-protocol-input";
String INSTALLER_NAME = "//span[@agent-name='%s']";
String INSTALLER_DESCRIPTION = "//span[@agent-description='%s']";
String INSTALLER_STATE = "//md-switch[@agent-switch='%s']";
String ADD_NEW_PROJECT_BUTTON = "//che-button-primary[@che-button-title='Add Project']/button";
String ADD_PROJECT_BUTTON = "//che-button-primary[@name='addButton']/button";
String SAMPLE_CHECKBOX_XPATH = "//md-checkbox[@aria-label='Sample %s']";
String WS_NAME_ERROR_MESSAGES = "//che-error-messages";
}
public enum StateWorkspace {
STOPPED("Stopped"),
STARTING("Starting"),
RUNNING("Running"),
STOPPING("Stopping");
private final String status;
StateWorkspace(String status) {
this.status = status;
}
public String getStatus() {
return status;
}
}
@Inject
public DashboardWorkspace(
SeleniumWebDriver seleniumWebDriver,
Loader loader,
Dashboard dashboard,
DashboardProject dashboardProject) {
this.seleniumWebDriver = seleniumWebDriver;
this.loader = loader;
this.dashboard = dashboard;
this.dashboardProject = dashboardProject;
PageFactory.initElements(seleniumWebDriver, this);
}
@FindBy(xpath = Locators.NEW_WORKSPACE_BTN)
WebElement newWorkspaceBtn;
@FindBy(xpath = Locators.WORKSPACES_LIST)
WebElement listOfWorkspaces;
@FindBy(xpath = Locators.EXPORT_WORKSPACE_BTN)
WebElement exportWsButton;
@FindBy(xpath = Locators.DOWNLOAD_WORKSPACE_BTN)
WebElement downloadWsJsonBtn;
@FindBy(xpath = Locators.CLIPBOARD_JSON_WS_BTN)
WebElement clipboardWsJsonBtn;
@FindBy(xpath = Locators.HIDE_JSON_WS_BTN)
WebElement hideJsonWsBtn;
@FindBy(xpath = Locators.IMPORT_WORKSPACE_BTN)
WebElement importWsRadioBtn;
@FindBy(xpath = Locators.WORKSPACE_JSON_CONTENT)
WebElement workspaceJsonContent;
@FindBy(xpath = Locators.RECIPE_URL_FIELD)
WebElement recipeUrlField;
@FindBy(xpath = Locators.OPEN_IN_IDE_WS_BTN)
WebElement openInIdeWsBtn;
@FindBy(xpath = Locators.NAME_WORKSPACE_INPUT)
WebElement nameWorkspaceInput;
@FindBy(xpath = Locators.RUN_WORKSPACE_BTN)
WebElement runWorkspaceBtn;
@FindBy(xpath = Locators.STOP_WORKSPACE_BTN)
WebElement stopWorkspaceBtn;
@FindBy(xpath = Locators.DELETE_WORKSPACE_BTN)
WebElement deleteWorkspaceBtn;
@FindBy(xpath = Locators.DELETE_BTN_DIALOG_WIND)
WebElement deleteItBtn;
@FindBy(xpath = Locators.RAM_WORKSPACE)
WebElement ramWorkspace;
@FindBy(xpath = Locators.SAVE_BUTTON)
WebElement saveBtn;
@FindBy(xpath = Locators.DELETE_BUTTON)
WebElement deleteBtn;
@FindBy(xpath = Locators.CANCEL_BUTTON)
WebElement cancelBtn;
@FindBy(xpath = Locators.WS_TIMEOUT_MESSAGE)
WebElement wsTimeotMessage;
@FindBy(id = Locators.WORKSPACE_STATE)
WebElement workspaceState;
@FindBy(xpath = Locators.WS_NAME_ERROR_MESSAGES)
WebElement errorMessages;
public void waitToolbarTitleName(String titleName) {
new WebDriverWait(seleniumWebDriver, LOADER_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(format(Locators.TOOLBAR_TITLE_NAME, titleName))));
}
public void clickOnNewWorkspaceBtn() {
dashboard.waitNotificationIsClosed();
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOf(newWorkspaceBtn))
.click();
}
public void waitListWorkspacesOnDashboard() {
new WebDriverWait(seleniumWebDriver, LOAD_PAGE_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOf(listOfWorkspaces));
}
public void waitExpTextFromListWsOnDashboard(String expText) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until((WebDriver driver) -> getTextFromListWorkspaces().contains(expText));
}
public String getTextFromListWorkspaces() {
return listOfWorkspaces.getText();
}
public void selectWorkspaceItemName(String wsName) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(format(Locators.WORKSPACE_ITEM_NAME, wsName))))
.click();
}
public void clickExportWorkspaceBtn() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOf(exportWsButton))
.click();
}
public void waitDownloadWorkspaceJsonFileBtn() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.elementToBeClickable(downloadWsJsonBtn));
}
public void waitClipboardWorkspaceJsonFileBtn() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.elementToBeClickable(clipboardWsJsonBtn));
}
public void clickOnHideWorkspaceJsonFileBtn() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOf(hideJsonWsBtn))
.click();
}
public void clickIntoWorkspaceJsonContent() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOf(workspaceJsonContent))
.click();
}
/**
* wait the warning message when there is two or more machines
*
* @param mess is the message into workspace machine config
*/
public void waitWarningMessage(String mess) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(String.format(Locators.WARNING_MSG, mess))));
}
/**
* switch the config machine
*
* @param nameMachine is the machine name
*/
public void switchConfigMachine(String nameMachine) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(String.format(Locators.CONFIG_MACHINE_SWITCH, nameMachine))))
.click();
}
public void waitCustomRecipeUrlField() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOf(recipeUrlField));
}
/** wait 'Open in IDE' btn on All workspaces page' */
public void waitOpenInIdeWsEBtn() {
new WebDriverWait(seleniumWebDriver, EXPECTED_MESS_IN_CONSOLE_SEC)
.until(ExpectedConditions.visibilityOf(openInIdeWsBtn));
}
/** click 'Open in IDE btn on All workspaces page' */
public void clickOpenInIdeWsBtn() {
dashboard.waitNotificationIsClosed();
waitOpenInIdeWsEBtn();
new WebDriverWait(seleniumWebDriver, EXPECTED_MESS_IN_CONSOLE_SEC)
.until(ExpectedConditions.elementToBeClickable(openInIdeWsBtn))
.click();
}
public void enterNameWorkspace(String nameWorkspace) {
new WebDriverWait(seleniumWebDriver, EXPECTED_MESS_IN_CONSOLE_SEC)
.until(ExpectedConditions.visibilityOf(nameWorkspaceInput))
.clear();
new WebDriverWait(seleniumWebDriver, EXPECTED_MESS_IN_CONSOLE_SEC)
.until(ExpectedConditions.visibilityOf(nameWorkspaceInput))
.sendKeys(nameWorkspace);
new WebDriverWait(seleniumWebDriver, EXPECTED_MESS_IN_CONSOLE_SEC)
.until(ExpectedConditions.textToBePresentInElementValue(nameWorkspaceInput, nameWorkspace));
}
/**
* enter value RAM of workspace
*
* @param ram is value of RAM
*/
public void enterRamWorkspace(int ram) {
String ramValue = "//input[@name='memory']";
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOf(ramWorkspace))
.clear();
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOf(ramWorkspace))
.sendKeys(String.valueOf(ram));
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.textToBePresentInElementLocated(
By.xpath(ramValue), String.valueOf(ram)));
}
/**
* Check state of workspace in 'Workspace Information'
*
* @param stateWorkspace expected state of workspace
*/
public void checkStateOfWorkspace(StateWorkspace stateWorkspace) {
new WebDriverWait(seleniumWebDriver, LOADER_TIMEOUT_SEC)
.until(
ExpectedConditions.textToBePresentInElement(
workspaceState, stateWorkspace.getStatus()));
}
/** click on 'RUN' button in 'Workspace Information' */
public void clickOnRunWorkspace() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.elementToBeClickable(runWorkspaceBtn))
.click();
}
/** click on 'STOP' button in 'Workspace Information' */
public void clickOnStopWorkspace() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.elementToBeClickable(stopWorkspaceBtn))
.click();
}
/** click on 'DELETE' button in 'Delete workspace' */
public void clickOnDeleteWorkspace() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.elementToBeClickable(deleteWorkspaceBtn))
.click();
}
/**
* Check name of workspace in 'Workspace' tab
*
* @param nameWorkspace expected name of workspace
*/
public void checkNameWorkspace(String nameWorkspace) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(format(Locators.WORKSPACE_TITLE, nameWorkspace))));
}
/** Click on the delete/remove button in the dialog window */
public void clickOnDeleteItInDialogWindow() {
WaitUtils.sleepQuietly(1);
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.elementToBeClickable(deleteItBtn))
.click();
}
/** wait the workspace is not present on dashboard */
public void waitWorkspaceIsNotPresent(String nameWorkspace) {
new WebDriverWait(seleniumWebDriver, ELEMENT_TIMEOUT_SEC)
.until(
ExpectedConditions.invisibilityOfElementLocated(
By.xpath(format(Locators.WORKSPACE_ITEM_NAME, nameWorkspace))));
}
public void clickOnSaveBtn() {
loader.waitOnClosed();
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOf(saveBtn))
.click();
}
public void clickOnDeleteBtn() {
loader.waitOnClosed();
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOf(deleteBtn))
.click();
}
public void clickOnCancelBtn() {
loader.waitOnClosed();
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOf(cancelBtn))
.click();
}
/** Return true if workspaces present on the navigation panel */
public boolean workspacesIsPresent() {
new WebDriverWait(seleniumWebDriver, LOAD_PAGE_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(Locators.LEFT_SIDE_BAR)));
List<WebElement> workspaces =
seleniumWebDriver.findElements(By.xpath(Locators.RESENT_WS_NAVBAR));
return !(workspaces.size() == 0);
}
/**
* Adds developer to share list
*
* @param email is an email of developer into sharing list
*/
public void addDeveloperToShareList(String email) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(Locators.ADD_DEVLOPER_BTN)))
.click();
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(Locators.INPUT_SHARE_DIALOG)))
.sendKeys(email + ",");
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(Locators.SHARE_BTN_DIALOG)))
.click();
}
/**
* Delete a developer from sharing list
*
* @param email is an email of developer into sharing list
*/
public void deleteDeveloperFromShareList(String email) {
new WebDriverWait(seleniumWebDriver, LOAD_PAGE_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(String.format(Locators.REMOVE_DEVELOPER_ICON, email))))
.click();
}
/** Wait the text into warning dialog delete or remove */
public void waitTextInWarningDialogDelete(String expText) {
new WebDriverWait(seleniumWebDriver, LOAD_PAGE_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(String.format(Locators.WARNING_DIALOG_DELETE, expText))));
}
/**
* Wait the email of developer is present in 'Share' tab
*
* @param email the email of developer
*/
public void waitDeveloperIsPresentInShareTab(String email) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(format(Locators.DEVELOPER_SHARE_ITEM, email))));
}
/**
* Wait the email of developer is not present in 'Share' tab
*
* @param email the email of developer
*/
public void waitDeveloperIsNotPresentInShareTab(String email) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.invisibilityOfElementLocated(
By.xpath(format(Locators.DEVELOPER_SHARE_ITEM, email))));
}
/**
* Select tab into workspace menu
*
* @param tabName is the tab name into workspace menu
*/
public void selectTabInWorspaceMenu(String tabName) {
loader.waitOnClosed();
new WebDriverWait(seleniumWebDriver, LOAD_PAGE_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(String.format(Locators.TAB_NAMES_IN_WS, tabName))))
.click();
}
public void clickNewProjectButtonOnDashboard() throws Exception {
dashboard.clickOnNewProjectLinkOnDashboard();
}
public String getWsTimeoutMessage() {
return new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOf(wsTimeotMessage))
.getText();
}
public void waitWsTimeoutMessage(String expectedMessage) {
new WebDriverWait(seleniumWebDriver, LOAD_PAGE_TIMEOUT_SEC)
.until(
(WebDriver webdriver) -> webdriver.findElement(By.xpath(Locators.WS_TIMEOUT_MESSAGE)))
.getText()
.contains(expectedMessage);
}
/**
* Check if machine exists in machines list
*
* @param machineName the name of machine
*/
public void checkMachineExists(String machineName) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(format(Locators.MACHINE_NAME, machineName))));
loader.waitOnClosed();
}
public void checkMachineIsNotExists(String machineName) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.invisibilityOfElementLocated(
By.xpath(format(Locators.MACHINE_NAME, machineName))));
loader.waitOnClosed();
}
public void clickOnAddMachineButton() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(Locators.ADD_MACHINE_BUTTON)))
.click();
}
/**
* Click on the Edit Machine button
*
* @param machineName the name of machine
*/
public void clickOnEditMachineButton(String machineName) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(format(Locators.EDIT_MACHINE, machineName))))
.click();
}
/**
* Click on the Delete Machine button
*
* @param machineName the name of machine
*/
public void clickOnDeleteMachineButton(String machineName) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(format(Locators.DELETE_MACHINE, machineName))))
.click();
}
/** Check that the Add New Machine dialog is opened */
public void checkAddNewMachineDialogIsOpen() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(Locators.ADD_MACHINE_DIALOG_NAME)));
}
/** Check that the Edit Machine dialog is opened */
public void checkEditTheMachineDialogIsOpen() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(Locators.EDIT_MACHINE_DIALOG_NAME)));
}
public void setMachineNameInDialog(String machineName) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(Locators.NEW_MACHINE_NAME)))
.clear();
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(Locators.NEW_MACHINE_NAME)))
.sendKeys(machineName);
}
public void clickOnEditDialogButton() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(Locators.EDIT_MACHINE_NAME_BUTTON)))
.click();
}
public void clickOnCloseDialogButton() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(By.xpath(Locators.CLOSE_DIALOG_BUTTON)))
.click();
}
public void clickOnCancelDialogButton() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(By.xpath(Locators.CANCEL_DIALOG_BUTTON)))
.click();
}
public void clickOnDeleteDialogButton() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(By.xpath(Locators.DELETE_DIALOG_BUTTON)))
.click();
}
public void clickOnUpdateDialogButton() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(By.xpath(Locators.UPDATE_DIALOG_BUTTON)))
.click();
}
public void clickOnAddDialogButton() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(Locators.ADD_DIALOG_BUTTON)))
.click();
}
public void clickOnAddServerButton() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(Locators.ADD_SERVER_BUTTON)))
.click();
}
public void waitAddServerDialogIsOpen() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(Locators.ADD_NEW_SERVER_DIALOG_NAME)));
}
public void enterReference(String name) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.id(Locators.ADD_SERVER_REFERENCE_FIELD)))
.clear();
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.id(Locators.ADD_SERVER_REFERENCE_FIELD)))
.sendKeys(name);
}
public void enterPort(String name) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOfElementLocated(By.id(Locators.ADD_SERVER_PORT_FIELD)))
.clear();
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOfElementLocated(By.id(Locators.ADD_SERVER_PORT_FIELD)))
.sendKeys(name);
}
public void enterProtocol(String protocol) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.id(Locators.ADD_SERVER_PROTOCOL_FIELD)))
.clear();
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.id(Locators.ADD_SERVER_PROTOCOL_FIELD)))
.sendKeys(protocol);
}
public void checkServerName(String serverName) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(format(Locators.SERVER_REFERENCE, serverName))));
}
public void checkServerExists(String serverName, String port) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(format(Locators.SERVER_PORT, serverName, port))));
loader.waitOnClosed();
}
public void checkServerIsNotExists(String serverName, String port) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.invisibilityOfElementLocated(
By.xpath(format(Locators.SERVER_PORT, serverName, port))));
loader.waitOnClosed();
}
public void clickOnDeleteServerButton(String serverName) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(format(Locators.DELETE_SERVER_BUTTON, serverName))))
.click();
}
public void clickOnEditServerButton(String serverName) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(format(Locators.EDIT_SERVER_BUTTON, serverName))))
.click();
}
public void selectMachine(String tabName, String machineName) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(format(Locators.MACHINE_BUTTON, tabName, machineName))))
.click();
}
public void checkInstallerExists(String installerName) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(format(Locators.INSTALLER_NAME, installerName))));
}
public void switchInstallerState(String installerName) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(format(Locators.INSTALLER_STATE, installerName))))
.click();
}
public Boolean getInstallerState(String installerName) {
String state =
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(format(Locators.INSTALLER_STATE, installerName))))
.getAttribute("aria-checked");
return Boolean.parseBoolean(state);
}
public String checkInstallerDescription(String installerName) {
return new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(format(Locators.INSTALLER_DESCRIPTION, installerName))))
.getText();
}
public void clickOnAddEnvVariableButton() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(Locators.ADD_ENV_VARIABLE_BUTTON)))
.click();
}
public void checkAddNewEnvVarialbleDialogIsOpen() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(Locators.ADD_ENV_VARIABLE_DIALOG_NAME)));
}
public void enterEnvVariableName(String name) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOfElementLocated(By.id(Locators.NEW_ENV_VARIABLE_NAME)))
.clear();
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOfElementLocated(By.id(Locators.NEW_ENV_VARIABLE_NAME)))
.sendKeys(name);
}
public void enterEnvVariableValue(String value) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(Locators.NEW_ENV_VARIABLE_VALUE)))
.clear();
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(Locators.NEW_ENV_VARIABLE_VALUE)))
.sendKeys(value);
}
public void addNewEnvironmentVariable(String name, String value) {
enterEnvVariableName(name);
enterEnvVariableValue(value);
}
public Boolean checkEnvVariableExists(String varName) {
return new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(format(Locators.VARIABLE_NAME, varName))))
.getText()
.equals(varName);
}
public Boolean checkValueExists(String varName, String varValue) {
loader.waitOnClosed();
return new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(format(Locators.VARIABLE_VALUE, varName, varValue))))
.isDisplayed();
}
public void checkValueIsNotExists(String varName, String varValue) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.invisibilityOfElementLocated(
By.xpath(format(Locators.VARIABLE_VALUE, varName, varValue))));
loader.waitOnClosed();
}
public void clickOnDeleteEnvVariableButton(String varName) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(format(Locators.DELETE_ENV_VARIABLE, varName))))
.click();
}
public void clickOnEditEnvVariableButton(String varName) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(format(Locators.EDIT_ENV_VARIABLE, varName))))
.click();
}
public void clickOnEnvVariableCheckbox(String varName) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(format(Locators.VARIABLE_CHECKBOX, varName))))
.click();
}
public void clickOnAddNewProjectButton() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(Locators.ADD_NEW_PROJECT_BUTTON)))
.click();
}
public void clickOnAddProjects() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(Locators.ADD_PROJECT_BUTTON)))
.click();
}
public void selectSample(String name) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.visibilityOfElementLocated(
By.xpath(format(Locators.SAMPLE_CHECKBOX_XPATH, name))))
.click();
}
public Boolean isWorkspaceNameErrorMessageEquals(String message) {
return errorMessages.getText().equals(message);
}
}

View File

@ -10,6 +10,8 @@
*/
package org.eclipse.che.selenium.pageobject.dashboard;
import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOf;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import org.eclipse.che.selenium.core.SeleniumWebDriver;
@ -18,7 +20,6 @@ import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
/** @author Ann Shumilova */
@ -34,11 +35,11 @@ public class ProjectSourcePage {
}
public enum Sources {
SAMPLES("Samples"),
BLANK("Blank"),
GIT("Git"),
GITHUB("Github"),
ZIP("Zip");
SAMPLES("samples"),
BLANK("blank"),
GIT("git"),
GITHUB("github"),
ZIP("zip");
private final String title;
@ -48,67 +49,93 @@ public class ProjectSourcePage {
}
private interface Locators {
String ADD_OR_IMPORT_PROJECT_BUTTON_XPATH = "//*[@id=\"ADD_PROJECT\"]";
String POPOVER_CSS = "project-source-selector";
String POPOVER_XPATH = "project-source-selector";
String ADD_BUTTON_XPATH = "//che-button-primary[@che-button-title='Add']";
String SOURCE_XPATH = "//che-toggle-joined-button//span[text()='%s']";
String SAMPLE_XPATH = "//template-selector-item//span[text()='%s']";
String SAMPLE_CHECKBOX_XPATH = "//md-checkbox[@aria-label='Sample %s']";
String GIT_REPO_XPATH = "//input[@name='remoteGitURL']";
String ZIP_XPATH = "//input[@name='remoteZipURL']";
String ZIP_SKIP_ROOT_XPATH = "//div[contains(@class, 'skip-root-container')]/md-checkbox";
String ADD_OR_IMPORT_PROJECT_BUTTON = "ADD_PROJECT";
String PROJECT_SOURCE_SELECTOR = "project-source-selector";
String SAMPLES_BUTTON = "%s-button";
String SAMPLE_CHECKBOX = "//div[@id='sample-%s']/md-checkbox";
String TEMPLATE_NAME = "//span[contains(@class,'template-selector-item-name')]";
String TEMPLATE_DESCRIPTION = "//span[contains(@class,'template-selector-item-description')]";
String GIT_REPO_XPATH = "remote-git-url-input";
String ZIP_XPATH = "remote-zip-url-input";
String ZIP_SKIP_ROOT_XPATH = "zip-skip-root-folder-checkbox";
String ADD_PROJECT_BUTTON = "add-project-button";
String CANCEL_BUTTON = "cancel-button";
}
@FindBy(xpath = Locators.ADD_OR_IMPORT_PROJECT_BUTTON_XPATH)
public interface Template {
String WEB_JAVA_SPRING = "web-java-spring";
String CONSOLE_JAVA_SIMPLE = "console-java-simple";
String WEB_JAVA_PETCLINIC = "web-java-petclinic";
}
@FindBy(id = Locators.ADD_OR_IMPORT_PROJECT_BUTTON)
WebElement addOrImportProjectButton;
@FindBy(css = Locators.POPOVER_CSS)
WebElement popover;
@FindBy(id = Locators.PROJECT_SOURCE_SELECTOR)
WebElement projectSourceSelector;
@FindBy(xpath = Locators.GIT_REPO_XPATH)
@FindBy(id = Locators.GIT_REPO_XPATH)
WebElement gitRepositoryInput;
@FindBy(xpath = Locators.ZIP_XPATH)
@FindBy(id = Locators.ZIP_XPATH)
WebElement zipLocationInput;
@FindBy(xpath = Locators.ZIP_SKIP_ROOT_XPATH)
@FindBy(id = Locators.ZIP_SKIP_ROOT_XPATH)
WebElement zipSkipRoot;
@FindBy(xpath = Locators.ADD_BUTTON_XPATH)
WebElement addButton;
@FindBy(id = Locators.CANCEL_BUTTON)
WebElement cancelButton;
public void clickAddOrImportProjectButton() {
@FindBy(id = Locators.ADD_PROJECT_BUTTON)
WebElement addProjectButton;
public void clickOnAddOrImportProjectButton() {
addOrImportProjectButton.click();
}
// wait that the Project Source Selector visible
public void waitOpened() {
new WebDriverWait(seleniumWebDriver, TestTimeoutsConstants.LOADER_TIMEOUT_SEC)
.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector(Locators.POPOVER_CSS)));
.until(visibilityOf(projectSourceSelector));
}
/**
* select type of created project
*
* @param source is type of the existing templates
*/
public void selectSourceTab(Sources source) {
WebElement sourceTab =
seleniumWebDriver.findElement(By.xpath(String.format(Locators.SOURCE_XPATH, source.title)));
seleniumWebDriver.findElement(By.id(String.format(Locators.SAMPLES_BUTTON, source.title)));
sourceTab.click();
}
/**
* Select project sample
*
* @param name name of sample
*/
public void selectSample(String name) {
WebElement sample =
seleniumWebDriver.findElement(
By.xpath(String.format(Locators.SAMPLE_CHECKBOX_XPATH, name)));
seleniumWebDriver.findElement(By.xpath(String.format(Locators.SAMPLE_CHECKBOX, name)));
sample.click();
}
/**
* Enter Git URL for project in the 'New Project' tab
*
* @param url URL for project on git repository
*/
public void typeGitRepositoryLocation(String url) {
gitRepositoryInput.clear();
gitRepositoryInput.sendKeys(url);
}
/**
* Enter ZIP URL for project in the 'New Project' tab
*
* @param url URL for zip archive
*/
public void typeZipLocation(String url) {
zipLocationInput.clear();
zipLocationInput.sendKeys(url);
@ -118,7 +145,11 @@ public class ProjectSourcePage {
zipSkipRoot.click();
}
public void clickAdd() {
addButton.click();
public void clickOnAddProjectButton() {
addProjectButton.click();
}
public void clickOnCancelProjectButton() {
cancelButton.click();
}
}

View File

@ -0,0 +1,23 @@
/*
* Copyright (c) 2012-2017 Red Hat, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
*/
package org.eclipse.che.selenium.pageobject.dashboard.workspaces;
import com.google.inject.Inject;
import org.eclipse.che.selenium.core.SeleniumWebDriver;
import org.openqa.selenium.support.PageFactory;
public class WorkspaceConfig {
@Inject
public WorkspaceConfig(SeleniumWebDriver seleniumWebDriver) {
PageFactory.initElements(seleniumWebDriver, this);
}
}

View File

@ -0,0 +1,216 @@
/*
* Copyright (c) 2012-2017 Red Hat, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
*/
package org.eclipse.che.selenium.pageobject.dashboard.workspaces;
import static java.lang.String.format;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.EXPECTED_MESS_IN_CONSOLE_SEC;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.LOADER_TIMEOUT_SEC;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.LOAD_PAGE_TIMEOUT_SEC;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.REDRAW_UI_ELEMENTS_TIMEOUT_SEC;
import static org.openqa.selenium.support.ui.ExpectedConditions.elementToBeClickable;
import static org.openqa.selenium.support.ui.ExpectedConditions.textToBePresentInElement;
import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOf;
import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOfElementLocated;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import org.eclipse.che.selenium.core.SeleniumWebDriver;
import org.eclipse.che.selenium.pageobject.Loader;
import org.eclipse.che.selenium.pageobject.dashboard.Dashboard;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.ui.WebDriverWait;
/**
* @author Alex
* @author Andrey Chizhikov
*/
@Singleton
public class WorkspaceDetails {
private final SeleniumWebDriver seleniumWebDriver;
private final Loader loader;
private final Dashboard dashboard;
public interface TabNames {
String OVERVIEW = "Overview";
String PROJECTS = "Projects";
String MACHINES = "Machines";
String SERVERS = "Servers";
String INSTALLERS = "Installers";
String ENV_VARIABLES = "Env Variables";
String CONFIG = "Config";
String SSH = "Ssh";
String SHARE = "Share";
}
private interface Locators {
String WORKSPACE_STATE = "workspace-status";
String RUN_WORKSPACE_BTN = "run-workspace-button";
String STOP_WORKSPACE_BTN = "stop-workspace-button";
String OPEN_IN_IDE_WS_BTN = "open-in-ide-button";
String TAB_NAMES_IN_WS = "//md-pagination-wrapper//span[text()='%s']";
String SAVE_CHANGED_BUTTON = "//che-button-save-flat//span[text()='Save']";
String CANCEL_CHANGES_BUTTON = "//che-button-cancel-flat//span[text()='Cancel']";
String CANCEL_DIALOG_BUTTON = "//md-dialog[@role='dialog']//button/span[text()='Cancel']";
String CLOSE_DIALOG_BUTTON = "//md-dialog[@role='dialog']//button/span[text()='Close']";
String DELETE_DIALOG_BUTTON = "//md-dialog[@role='dialog']//button/span[text()='Delete']";
String UPDATE_DIALOG_BUTTON = "//md-dialog[@role='dialog']//button/span[text()='Update']";
String ADD_DIALOG_BUTTON = "//md-dialog[@role='dialog']//button/span[text()='Add']";
}
public enum StateWorkspace {
STOPPED("Stopped"),
STARTING("Starting"),
RUNNING("Running"),
STOPPING("Stopping");
private final String status;
StateWorkspace(String status) {
this.status = status;
}
public String getStatus() {
return status;
}
}
@Inject
public WorkspaceDetails(SeleniumWebDriver seleniumWebDriver, Loader loader, Dashboard dashboard) {
this.seleniumWebDriver = seleniumWebDriver;
this.loader = loader;
this.dashboard = dashboard;
PageFactory.initElements(seleniumWebDriver, this);
}
@FindBy(id = Locators.RUN_WORKSPACE_BTN)
WebElement runWorkspaceBtn;
@FindBy(id = Locators.STOP_WORKSPACE_BTN)
WebElement stopWorkspaceBtn;
@FindBy(id = Locators.OPEN_IN_IDE_WS_BTN)
WebElement openInIdeWsBtn;
@FindBy(id = Locators.WORKSPACE_STATE)
WebElement workspaceState;
@FindBy(xpath = Locators.SAVE_CHANGED_BUTTON)
WebElement saveBtn;
@FindBy(xpath = Locators.CANCEL_CHANGES_BUTTON)
WebElement cancelBtn;
@FindBy(xpath = Locators.DELETE_DIALOG_BUTTON)
WebElement deleteBtn;
@FindBy(xpath = Locators.CLOSE_DIALOG_BUTTON)
WebElement closeBtn;
/**
* Check state of workspace in 'Workspace Information'
*
* @param stateWorkspace expected state of workspace
*/
public void checkStateOfWorkspace(StateWorkspace stateWorkspace) {
new WebDriverWait(seleniumWebDriver, LOADER_TIMEOUT_SEC)
.until(textToBePresentInElement(workspaceState, stateWorkspace.getStatus()));
}
/** click on 'RUN' button in 'Workspace Information' */
public void clickOnRunWorkspace() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(elementToBeClickable(runWorkspaceBtn))
.click();
}
/** click on 'STOP' button in 'Workspace Information' */
public void clickOnStopWorkspace() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(elementToBeClickable(stopWorkspaceBtn))
.click();
}
/** wait 'Open in IDE' btn on All workspaces page' */
public void waitOpenInIdeWsEBtn() {
new WebDriverWait(seleniumWebDriver, EXPECTED_MESS_IN_CONSOLE_SEC)
.until(visibilityOf(openInIdeWsBtn));
}
/** click 'Open in IDE btn on All workspaces page' */
public void clickOpenInIdeWsBtn() {
dashboard.waitNotificationIsClosed();
waitOpenInIdeWsEBtn();
new WebDriverWait(seleniumWebDriver, EXPECTED_MESS_IN_CONSOLE_SEC)
.until(elementToBeClickable(openInIdeWsBtn))
.click();
}
/**
* Select tab into workspace menu
*
* @param tabName is the tab name into workspace menu
*/
public void selectTabInWorkspaceMenu(String tabName) {
loader.waitOnClosed();
new WebDriverWait(seleniumWebDriver, LOAD_PAGE_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.xpath(format(Locators.TAB_NAMES_IN_WS, tabName))))
.click();
}
public void clickOnSaveChangesBtn() {
loader.waitOnClosed();
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOf(saveBtn))
.click();
}
public void clickOnCancelChangesBtn() {
loader.waitOnClosed();
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOf(cancelBtn))
.click();
}
/** Click on the delete/remove button in the dialog window */
public void clickOnDeleteButtonInDialogWindow() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOf(deleteBtn))
.click();
}
public void clickOnCloseButtonInDialogWindow() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOf(closeBtn))
.click();
}
public void clickOnCancelButtonInDialogWindow() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.xpath(Locators.CANCEL_DIALOG_BUTTON)))
.click();
}
public void clickOnUpdateButtonInDialogWindow() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.xpath(Locators.UPDATE_DIALOG_BUTTON)))
.click();
}
public void clickOnAddButtonInDialogWindow() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.xpath(Locators.ADD_DIALOG_BUTTON)))
.click();
}
}

View File

@ -0,0 +1,127 @@
/*
* Copyright (c) 2012-2017 Red Hat, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
*/
package org.eclipse.che.selenium.pageobject.dashboard.workspaces;
import static java.lang.String.format;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.REDRAW_UI_ELEMENTS_TIMEOUT_SEC;
import static org.openqa.selenium.support.ui.ExpectedConditions.invisibilityOfElementLocated;
import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOfElementLocated;
import com.google.inject.Inject;
import org.eclipse.che.selenium.core.SeleniumWebDriver;
import org.eclipse.che.selenium.pageobject.Loader;
import org.openqa.selenium.By;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.ui.WebDriverWait;
public class WorkspaceEnvVariables {
private final SeleniumWebDriver seleniumWebDriver;
private final Loader loader;
@Inject
public WorkspaceEnvVariables(SeleniumWebDriver seleniumWebDriver, Loader loader) {
this.seleniumWebDriver = seleniumWebDriver;
this.loader = loader;
PageFactory.initElements(seleniumWebDriver, this);
}
private interface Locators {
String ENV_VARIABLE = "env-variable-name-%s";
String ADD_ENV_VARIABLE_BUTTON =
"//che-button-primary[@che-button-title='Add Env Variable']/button";
String ADD_ENV_VARIABLE_DIALOG_NAME =
"//md-dialog/che-popup[@title='Add a new environment variable']";
String VARIABLE_CHECKBOX = "//md-checkbox[@aria-label='Environment-Variable-%s']";
String VARIABLE_NAME = "//span[@variable-name='%s']";
String VARIABLE_VALUE = "//div[@id='env-variable-name-%s']//span[@variable-value='%s']";
String NEW_ENV_VARIABLE_NAME = "variable-name-input";
String NEW_ENV_VARIABLE_VALUE = "//textarea[@name='deskvalue']";
String EDIT_ENV_VARIABLE = "//div[@edit-variable='%s']";
String DELETE_ENV_VARIABLE = "//div[@delete-variable='%s']";
}
public void clickOnAddEnvVariableButton() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.xpath(Locators.ADD_ENV_VARIABLE_BUTTON)))
.click();
}
public void checkAddNewEnvVarialbleDialogIsOpen() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.xpath(Locators.ADD_ENV_VARIABLE_DIALOG_NAME)));
}
public void enterEnvVariableName(String name) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.id(Locators.NEW_ENV_VARIABLE_NAME)))
.clear();
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.id(Locators.NEW_ENV_VARIABLE_NAME)))
.sendKeys(name);
}
public void enterEnvVariableValue(String value) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.xpath(Locators.NEW_ENV_VARIABLE_VALUE)))
.clear();
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.xpath(Locators.NEW_ENV_VARIABLE_VALUE)))
.sendKeys(value);
}
public void addNewEnvironmentVariable(String name, String value) {
enterEnvVariableName(name);
enterEnvVariableValue(value);
}
public Boolean checkEnvVariableExists(String varName) {
return new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.xpath(format(Locators.VARIABLE_NAME, varName))))
.getText()
.equals(varName);
}
public Boolean checkValueExists(String varName, String varValue) {
loader.waitOnClosed();
return new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
visibilityOfElementLocated(
By.xpath(format(Locators.VARIABLE_VALUE, varName, varValue))))
.isDisplayed();
}
public void checkValueIsNotExists(String varName, String varValue) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
invisibilityOfElementLocated(
By.xpath(format(Locators.VARIABLE_VALUE, varName, varValue))));
loader.waitOnClosed();
}
public void clickOnDeleteEnvVariableButton(String varName) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.xpath(format(Locators.DELETE_ENV_VARIABLE, varName))))
.click();
}
public void clickOnEditEnvVariableButton(String varName) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.xpath(format(Locators.EDIT_ENV_VARIABLE, varName))))
.click();
}
public void clickOnEnvVariableCheckbox(String varName) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.xpath(format(Locators.VARIABLE_CHECKBOX, varName))))
.click();
}
}

View File

@ -0,0 +1,69 @@
/*
* Copyright (c) 2012-2017 Red Hat, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
*/
package org.eclipse.che.selenium.pageobject.dashboard.workspaces;
import static java.lang.String.format;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.REDRAW_UI_ELEMENTS_TIMEOUT_SEC;
import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOfElementLocated;
import com.google.inject.Inject;
import org.eclipse.che.selenium.core.SeleniumWebDriver;
import org.openqa.selenium.By;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.ui.WebDriverWait;
public class WorkspaceInstallers {
private final SeleniumWebDriver seleniumWebDriver;
@Inject
public WorkspaceInstallers(SeleniumWebDriver seleniumWebDriver) {
this.seleniumWebDriver = seleniumWebDriver;
PageFactory.initElements(seleniumWebDriver, this);
}
private interface Locators {
String INSTALLER_NAME = "//span[@agent-name='%s']";
String INSTALLER_DESCRIPTION = "//span[@agent-description='%s']";
String INSTALLER_STATE = "//md-switch[@agent-switch='%s']";
}
public void checkInstallerExists(String installerName) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
visibilityOfElementLocated(By.xpath(format(Locators.INSTALLER_NAME, installerName))));
}
public void switchInstallerState(String installerName) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
visibilityOfElementLocated(By.xpath(format(Locators.INSTALLER_STATE, installerName))))
.click();
}
public Boolean getInstallerState(String installerName) {
String state =
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
visibilityOfElementLocated(
By.xpath(format(Locators.INSTALLER_STATE, installerName))))
.getAttribute("aria-checked");
return Boolean.parseBoolean(state);
}
public String checkInstallerDescription(String installerName) {
return new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
visibilityOfElementLocated(
By.xpath(format(Locators.INSTALLER_DESCRIPTION, installerName))))
.getText();
}
}

View File

@ -0,0 +1,181 @@
/*
* Copyright (c) 2012-2017 Red Hat, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
*/
package org.eclipse.che.selenium.pageobject.dashboard.workspaces;
import static java.lang.String.format;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.REDRAW_UI_ELEMENTS_TIMEOUT_SEC;
import static org.openqa.selenium.support.ui.ExpectedConditions.invisibilityOfElementLocated;
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.visibilityOfElementLocated;
import com.google.inject.Inject;
import org.eclipse.che.selenium.core.SeleniumWebDriver;
import org.eclipse.che.selenium.pageobject.Loader;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.ui.WebDriverWait;
public class WorkspaceMachines {
private final SeleniumWebDriver seleniumWebDriver;
private final Loader loader;
@Inject
public WorkspaceMachines(SeleniumWebDriver seleniumWebDriver, Loader loader) {
this.seleniumWebDriver = seleniumWebDriver;
this.loader = loader;
PageFactory.initElements(seleniumWebDriver, this);
}
private interface Locators {
String MACHINE_BUTTON =
"//che-machine-selector[@content-title='%s']//toggle-single-button[@id = 'workspace-machine-%s']//span";
String MACHINE_NAME = "//span[@machine-name='%s']";
String MACHINE_IMAGE = "//span[@machine-image='%s']";
String EDIT_MACHINE = "//div[@edit-machine='%s']";
String DELETE_MACHINE = "//div[@delete-machine='%s']";
String NEW_MACHINE_NAME = "//div[@che-form='editMachineForm']//input";
String EDIT_MACHINE_NAME_BUTTON = "//che-button-primary[@che-button-title='Edit']/button";
String EDIT_MACHINE_DIALOG_NAME = "//md-dialog/che-popup[@title='Edit the machine']";
String REMOVE_MACHINE_DIALOG_NAME = "//md-dialog/che-popup[@title='Remove machine']";
String ADD_MACHINE_DIALOG_NAME = "//md-dialog/che-popup[@title='Add a new machine']";
String RAM_WORKSPACE = "//input[contains(@name, 'memory')]";
String WARNING_MSG = "//div[@class='workspace-environments-input']//div[text()='%s']";
String CONFIG_MACHINE_SWITCH =
"//div[text()='%s']//following::div[@class='config-dev-machine-switch ng-scope'][1]";
String ADD_MACHINE_BUTTON = "//che-button-primary[@che-button-title = 'Add machine']/button";
}
@FindBy(xpath = Locators.RAM_WORKSPACE)
WebElement ramWorkspace;
public void selectMachine(String tabName, String machineName) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
visibilityOfElementLocated(
By.xpath(format(Locators.MACHINE_BUTTON, tabName, machineName))))
.click();
}
/**
* Check if machine exists in machines list
*
* @param machineName the name of machine
*/
public void checkMachineExists(String machineName) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.xpath(format(Locators.MACHINE_NAME, machineName))));
loader.waitOnClosed();
}
public void checkMachineIsNotExists(String machineName) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(invisibilityOfElementLocated(By.xpath(format(Locators.MACHINE_NAME, machineName))));
loader.waitOnClosed();
}
public void clickOnAddMachineButton() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.xpath(Locators.ADD_MACHINE_BUTTON)))
.click();
}
/**
* Click on the Edit Machine button
*
* @param machineName the name of machine
*/
public void clickOnEditMachineButton(String machineName) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.xpath(format(Locators.EDIT_MACHINE, machineName))))
.click();
}
/**
* Click on the Delete Machine button
*
* @param machineName the name of machine
*/
public void clickOnDeleteMachineButton(String machineName) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.xpath(format(Locators.DELETE_MACHINE, machineName))))
.click();
}
/** Check that the Add New Machine dialog is opened */
public void checkAddNewMachineDialogIsOpen() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.xpath(Locators.ADD_MACHINE_DIALOG_NAME)));
}
/** Check that the Edit Machine dialog is opened */
public void checkEditTheMachineDialogIsOpen() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.xpath(Locators.EDIT_MACHINE_DIALOG_NAME)));
}
public void setMachineNameInDialog(String machineName) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.xpath(Locators.NEW_MACHINE_NAME)))
.clear();
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.xpath(Locators.NEW_MACHINE_NAME)))
.sendKeys(machineName);
}
/**
* enter value RAM of workspace
*
* @param ram is value of RAM
*/
public void enterRamWorkspace(int ram) {
String ramValue = "//input[@name='memory']";
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOf(ramWorkspace))
.clear();
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOf(ramWorkspace))
.sendKeys(String.valueOf(ram));
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(textToBePresentInElementLocated(By.xpath(ramValue), String.valueOf(ram)));
}
/**
* wait the warning message when there is two or more machines
*
* @param mess is the message into workspace machine config
*/
public void waitWarningMessage(String mess) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.xpath(String.format(Locators.WARNING_MSG, mess))));
}
/**
* switch the config machine
*
* @param nameMachine is the machine name
*/
public void switchConfigMachine(String nameMachine) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
visibilityOfElementLocated(
By.xpath(String.format(Locators.CONFIG_MACHINE_SWITCH, nameMachine))))
.click();
}
public void clickOnEditNameDialogButton() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.xpath(Locators.EDIT_MACHINE_NAME_BUTTON)))
.click();
}
}

View File

@ -0,0 +1,135 @@
/*
* Copyright (c) 2012-2017 Red Hat, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
*/
package org.eclipse.che.selenium.pageobject.dashboard.workspaces;
import static java.lang.String.format;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.EXPECTED_MESS_IN_CONSOLE_SEC;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.REDRAW_UI_ELEMENTS_TIMEOUT_SEC;
import static org.openqa.selenium.support.ui.ExpectedConditions.elementToBeClickable;
import static org.openqa.selenium.support.ui.ExpectedConditions.textToBePresentInElementValue;
import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOf;
import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOfElementLocated;
import com.google.inject.Inject;
import org.eclipse.che.selenium.core.SeleniumWebDriver;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.ui.WebDriverWait;
public class WorkspaceOverview {
private final SeleniumWebDriver seleniumWebDriver;
@Inject
public WorkspaceOverview(SeleniumWebDriver seleniumWebDriver) {
this.seleniumWebDriver = seleniumWebDriver;
PageFactory.initElements(seleniumWebDriver, this);
}
private interface Locators {
String NAME_WORKSPACE_INPUT = "//input[@placeholder='Name of the workspace *']";
String DELETE_WORKSPACE_BTN = "//button/span[text()='Delete']";
String WORKSPACE_TITLE = "//div[contains(@class,'toolbar-info')]/span[text()='%s']";
String EXPORT_WORKSPACE_BTN =
"//button[contains(@class, 'che-button')]/span[text()='Export as a file']";
String DOWNLOAD_WORKSPACE_BTN = "//che-button-default[@che-button-title='download']";
String CLIPBOARD_JSON_WS_BTN = "//che-button-default[@che-button-title='clipboard']";
String HIDE_JSON_WS_BTN = "//span[text()='Close']";
String WORKSPACE_JSON_CONTENT = "//div[@class='CodeMirror-code']";
String WS_NAME_ERROR_MESSAGES = "//che-error-messages";
}
@FindBy(xpath = Locators.NAME_WORKSPACE_INPUT)
WebElement nameWorkspaceInput;
@FindBy(xpath = Locators.DELETE_WORKSPACE_BTN)
WebElement deleteWorkspaceBtn;
@FindBy(xpath = Locators.EXPORT_WORKSPACE_BTN)
WebElement exportWsButton;
@FindBy(xpath = Locators.DOWNLOAD_WORKSPACE_BTN)
WebElement downloadWsJsonBtn;
@FindBy(xpath = Locators.CLIPBOARD_JSON_WS_BTN)
WebElement clipboardWsJsonBtn;
@FindBy(xpath = Locators.HIDE_JSON_WS_BTN)
WebElement hideJsonWsBtn;
@FindBy(xpath = Locators.WORKSPACE_JSON_CONTENT)
WebElement workspaceJsonContent;
@FindBy(xpath = Locators.WS_NAME_ERROR_MESSAGES)
WebElement errorMessages;
/**
* Check name of workspace in 'Overview' tab
*
* @param nameWorkspace expected name of workspace
*/
public void checkNameWorkspace(String nameWorkspace) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
visibilityOfElementLocated(By.xpath(format(Locators.WORKSPACE_TITLE, nameWorkspace))));
}
public Boolean isWorkspaceNameErrorMessageEquals(String message) {
return errorMessages.getText().equals(message);
}
public void enterNameWorkspace(String nameWorkspace) {
new WebDriverWait(seleniumWebDriver, EXPECTED_MESS_IN_CONSOLE_SEC)
.until(visibilityOf(nameWorkspaceInput))
.clear();
new WebDriverWait(seleniumWebDriver, EXPECTED_MESS_IN_CONSOLE_SEC)
.until(visibilityOf(nameWorkspaceInput))
.sendKeys(nameWorkspace);
new WebDriverWait(seleniumWebDriver, EXPECTED_MESS_IN_CONSOLE_SEC)
.until(textToBePresentInElementValue(nameWorkspaceInput, nameWorkspace));
}
public void clickExportWorkspaceBtn() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOf(exportWsButton))
.click();
}
/** click on 'DELETE' button in 'Delete workspace' */
public void clickOnDeleteWorkspace() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(elementToBeClickable(deleteWorkspaceBtn))
.click();
}
public void waitDownloadWorkspaceJsonFileBtn() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(elementToBeClickable(downloadWsJsonBtn));
}
public void waitClipboardWorkspaceJsonFileBtn() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(elementToBeClickable(clipboardWsJsonBtn));
}
public void clickOnHideWorkspaceJsonFileBtn() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOf(hideJsonWsBtn))
.click();
}
public void clickIntoWorkspaceJsonContent() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOf(workspaceJsonContent))
.click();
}
}

View File

@ -0,0 +1,103 @@
/*
* Copyright (c) 2012-2017 Red Hat, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
*/
package org.eclipse.che.selenium.pageobject.dashboard.workspaces;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.REDRAW_UI_ELEMENTS_TIMEOUT_SEC;
import static org.openqa.selenium.support.ui.ExpectedConditions.invisibilityOfElementLocated;
import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOfElementLocated;
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 */
@Singleton
public class WorkspaceProjects {
private final SeleniumWebDriver seleniumWebDriver;
@Inject
public WorkspaceProjects(SeleniumWebDriver seleniumWebDriver) {
this.seleniumWebDriver = seleniumWebDriver;
PageFactory.initElements(seleniumWebDriver, this);
}
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 ADD_NEW_PROJECT_BUTTON = "//che-button-primary[@che-button-title='Add Project']/button";
}
/**
* wait the project is present in the 'All projects' tab
*
* @param projectName name of project
*/
public void waitProjectIsPresent(String projectName) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
visibilityOfElementLocated(
By.xpath(String.format(Locators.PROJECT_BY_NAME, projectName))));
}
/**
* wait the project is not present in the 'All projects' tab
*
* @param projectName name of project
*/
public void waitProjectIsNotPresent(String projectName) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
invisibilityOfElementLocated(
By.xpath(String.format(Locators.PROJECT_BY_NAME, projectName))));
}
/**
* open settings for project by name in the 'All projects' tab
*
* @param projectName name of project
*/
public void openSettingsForProjectByName(String projectName) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
ExpectedConditions.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)))
.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)))
.click();
}
/** click on the Add Project button */
public void clickOnAddNewProjectButton() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.xpath(Locators.ADD_NEW_PROJECT_BUTTON)))
.click();
}
}

View File

@ -0,0 +1,120 @@
/*
* Copyright (c) 2012-2017 Red Hat, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
*/
package org.eclipse.che.selenium.pageobject.dashboard.workspaces;
import static java.lang.String.format;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.REDRAW_UI_ELEMENTS_TIMEOUT_SEC;
import static org.openqa.selenium.support.ui.ExpectedConditions.invisibilityOfElementLocated;
import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOfElementLocated;
import com.google.inject.Inject;
import org.eclipse.che.selenium.core.SeleniumWebDriver;
import org.eclipse.che.selenium.pageobject.Loader;
import org.openqa.selenium.By;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.ui.WebDriverWait;
public class WorkspaceServers {
private final SeleniumWebDriver seleniumWebDriver;
private final Loader loader;
@Inject
public WorkspaceServers(SeleniumWebDriver seleniumWebDriver, Loader loader) {
this.seleniumWebDriver = seleniumWebDriver;
this.loader = loader;
PageFactory.initElements(seleniumWebDriver, this);
}
private interface Locators {
String SERVER = "server-name-%s";
String SERVER_REFERENCE = "//span[@server-reference='%s']";
String SERVER_PORT = "//div[@id='server-name-%s']//span[@server-port='%s']";
String SERVER_PROTOCOL = "//div[@id='server-name-%s']//span[@server-protocol='%s']";
String EDIT_SERVER_BUTTON = "//div[@edit-server='%s']";
String DELETE_SERVER_BUTTON = "//div[@delete-server='%s']";
String ADD_SERVER_BUTTON = "//che-button-primary[@che-button-title='Add Server']/button";
String ADD_NEW_SERVER_DIALOG_NAME = "//md-dialog/che-popup[@title='Add a new server']";
String ADD_SERVER_REFERENCE_FIELD = "server-reference-input";
String ADD_SERVER_PORT_FIELD = "server-port-input";
String ADD_SERVER_PROTOCOL_FIELD = "server-protocol-input";
}
public void clickOnAddServerButton() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.xpath(Locators.ADD_SERVER_BUTTON)))
.click();
}
public void waitAddServerDialogIsOpen() {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.xpath(Locators.ADD_NEW_SERVER_DIALOG_NAME)));
}
public void enterReference(String name) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.id(Locators.ADD_SERVER_REFERENCE_FIELD)))
.clear();
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.id(Locators.ADD_SERVER_REFERENCE_FIELD)))
.sendKeys(name);
}
public void enterPort(String name) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.id(Locators.ADD_SERVER_PORT_FIELD)))
.clear();
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.id(Locators.ADD_SERVER_PORT_FIELD)))
.sendKeys(name);
}
public void enterProtocol(String protocol) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.id(Locators.ADD_SERVER_PROTOCOL_FIELD)))
.clear();
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.id(Locators.ADD_SERVER_PROTOCOL_FIELD)))
.sendKeys(protocol);
}
public void checkServerName(String serverName) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.xpath(format(Locators.SERVER_REFERENCE, serverName))));
}
public void checkServerExists(String serverName, String port) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
visibilityOfElementLocated(By.xpath(format(Locators.SERVER_PORT, serverName, port))));
loader.waitOnClosed();
}
public void checkServerIsNotExists(String serverName, String port) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
invisibilityOfElementLocated(By.xpath(format(Locators.SERVER_PORT, serverName, port))));
loader.waitOnClosed();
}
public void clickOnDeleteServerButton(String serverName) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
visibilityOfElementLocated(By.xpath(format(Locators.DELETE_SERVER_BUTTON, serverName))))
.click();
}
public void clickOnEditServerButton(String serverName) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
visibilityOfElementLocated(By.xpath(format(Locators.EDIT_SERVER_BUTTON, serverName))))
.click();
}
}

View File

@ -0,0 +1,102 @@
/*
* Copyright (c) 2012-2017 Red Hat, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
*/
package org.eclipse.che.selenium.pageobject.dashboard.workspaces;
import static java.lang.String.format;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.LOAD_PAGE_TIMEOUT_SEC;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.REDRAW_UI_ELEMENTS_TIMEOUT_SEC;
import static org.openqa.selenium.support.ui.ExpectedConditions.invisibilityOfElementLocated;
import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOfElementLocated;
import com.google.inject.Inject;
import org.eclipse.che.selenium.core.SeleniumWebDriver;
import org.openqa.selenium.By;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.ui.WebDriverWait;
public class WorkspaceShare {
private final SeleniumWebDriver seleniumWebDriver;
@Inject
public WorkspaceShare(SeleniumWebDriver seleniumWebDriver) {
this.seleniumWebDriver = seleniumWebDriver;
PageFactory.initElements(seleniumWebDriver, this);
}
private interface Locators {
String ADD_DEVELOPER_BTN = "//span[text()='Add Developer']";
String REMOVE_DEVELOPER_ICON =
"//span[text()='%s']//following::div[@tooltip='Remove member'][1]";
String INPUT_SHARE_DIALOG = "//md-chips[contains(@class,'share-user-input')]//input";
String SHARE_BTN_DIALOG = "//che-button-primary[@aria-disabled='false']//span[text()='Share']";
String DEVELOPER_SHARE_ITEM = "//span[text()='%s']";
String WARNING_DIALOG_DELETE = "//div[@class='ng-binding' and text()=\"%s\"]";
}
/**
* Adds developer to share list
*
* @param email is an email of developer into sharing list
*/
public void addDeveloperToShareList(String email) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.xpath(Locators.ADD_DEVELOPER_BTN)))
.click();
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.xpath(Locators.INPUT_SHARE_DIALOG)))
.sendKeys(email + ",");
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.xpath(Locators.SHARE_BTN_DIALOG)))
.click();
}
/**
* Delete a developer from sharing list
*
* @param email is an email of developer into sharing list
*/
public void deleteDeveloperFromShareList(String email) {
new WebDriverWait(seleniumWebDriver, LOAD_PAGE_TIMEOUT_SEC)
.until(
visibilityOfElementLocated(
By.xpath(String.format(Locators.REMOVE_DEVELOPER_ICON, email))))
.click();
}
/** Wait the text into warning dialog delete or remove */
public void waitTextInWarningDialogDelete(String expText) {
new WebDriverWait(seleniumWebDriver, LOAD_PAGE_TIMEOUT_SEC)
.until(
visibilityOfElementLocated(
By.xpath(String.format(Locators.WARNING_DIALOG_DELETE, expText))));
}
/**
* Wait the email of developer is present in 'Share' tab
*
* @param email the email of developer
*/
public void waitDeveloperIsPresentInShareTab(String email) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.xpath(format(Locators.DEVELOPER_SHARE_ITEM, email))));
}
/**
* Wait the email of developer is not present in 'Share' tab
*
* @param email the email of developer
*/
public void waitDeveloperIsNotPresentInShareTab(String email) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(
invisibilityOfElementLocated(By.xpath(format(Locators.DEVELOPER_SHARE_ITEM, email))));
}
}

View File

@ -0,0 +1,25 @@
/*
* Copyright (c) 2012-2017 Red Hat, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
*/
package org.eclipse.che.selenium.pageobject.dashboard.workspaces;
import com.google.inject.Inject;
import org.eclipse.che.selenium.core.SeleniumWebDriver;
import org.openqa.selenium.support.PageFactory;
public class WorkspaceSsh {
private final SeleniumWebDriver seleniumWebDriver;
@Inject
public WorkspaceSsh(SeleniumWebDriver seleniumWebDriver) {
this.seleniumWebDriver = seleniumWebDriver;
PageFactory.initElements(seleniumWebDriver, this);
}
}

View File

@ -0,0 +1,105 @@
/*
* Copyright (c) 2012-2017 Red Hat, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
*/
package org.eclipse.che.selenium.pageobject.dashboard.workspaces;
import static java.lang.String.format;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.ELEMENT_TIMEOUT_SEC;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.LOADER_TIMEOUT_SEC;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.LOAD_PAGE_TIMEOUT_SEC;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.REDRAW_UI_ELEMENTS_TIMEOUT_SEC;
import static org.openqa.selenium.support.ui.ExpectedConditions.invisibilityOfElementLocated;
import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOf;
import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOfElementLocated;
import com.google.inject.Inject;
import org.eclipse.che.selenium.core.SeleniumWebDriver;
import org.eclipse.che.selenium.pageobject.dashboard.Dashboard;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.ui.WebDriverWait;
public class Workspaces {
private final SeleniumWebDriver seleniumWebDriver;
private final Dashboard dashboard;
@Inject
public Workspaces(SeleniumWebDriver seleniumWebDriver, Dashboard dashboard) {
this.seleniumWebDriver = seleniumWebDriver;
this.dashboard = dashboard;
PageFactory.initElements(seleniumWebDriver, this);
}
private interface Locators {
String WORKSPACES_LIST = "//ng-transclude[@class='che-list-content']";
String WORKSPACE_ITEM_NAME =
"//div[contains(@class, 'workspace-name-clip')]//div[contains(@data-str, '%s')]";
String TOOLBAR_TITLE_NAME =
"//div[contains(@class,'che-toolbar')]//span[contains(text(),'%s')]";
String ADD_WORKSPACE_BTN =
"//a[contains(@ng-href, 'create-workspace')]/span[text()='Add Workspace']";
}
@FindBy(xpath = Locators.WORKSPACES_LIST)
WebElement listOfWorkspaces;
@FindBy(xpath = Locators.ADD_WORKSPACE_BTN)
WebElement addWorkspaceBtn;
public void waitListWorkspacesOnDashboard() {
new WebDriverWait(seleniumWebDriver, LOAD_PAGE_TIMEOUT_SEC)
.until(visibilityOf(listOfWorkspaces));
}
public String getTextFromListWorkspaces() {
return listOfWorkspaces.getText();
}
public void waitExpTextFromListWsOnDashboard(String expText) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until((WebDriver driver) -> getTextFromListWorkspaces().contains(expText));
}
public void selectWorkspaceItemName(String wsName) {
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.xpath(format(Locators.WORKSPACE_ITEM_NAME, wsName))))
.click();
}
/** wait the workspace is not present on dashboard */
public void waitWorkspaceIsNotPresent(String nameWorkspace) {
new WebDriverWait(seleniumWebDriver, ELEMENT_TIMEOUT_SEC)
.until(
invisibilityOfElementLocated(
By.xpath(format(Locators.WORKSPACE_ITEM_NAME, nameWorkspace))));
}
/**
* Wait toolbar name is present on dashboard
*
* @param titleName name of user
*/
public void waitToolbarTitleName(String titleName) {
new WebDriverWait(seleniumWebDriver, LOADER_TIMEOUT_SEC)
.until(
visibilityOfElementLocated(By.xpath(format(Locators.TOOLBAR_TITLE_NAME, titleName))));
}
// Click on the Add Workspace button
public void clickOnNewWorkspaceBtn() {
dashboard.waitNotificationIsClosed();
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
.until(visibilityOf(addWorkspaceBtn))
.click();
}
}

View File

@ -11,6 +11,9 @@
package org.eclipse.che.selenium.dashboard;
import static org.eclipse.che.selenium.pageobject.ProjectExplorer.FolderTypes.PROJECT_FOLDER;
import static org.eclipse.che.selenium.pageobject.dashboard.ProjectSourcePage.Template.CONSOLE_JAVA_SIMPLE;
import static org.eclipse.che.selenium.pageobject.dashboard.ProjectSourcePage.Template.WEB_JAVA_SPRING;
import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.TabNames.PROJECTS;
import com.google.inject.Inject;
import java.util.concurrent.ExecutionException;
@ -25,10 +28,11 @@ import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel;
import org.eclipse.che.selenium.pageobject.ProjectExplorer;
import org.eclipse.che.selenium.pageobject.dashboard.CreateWorkspace;
import org.eclipse.che.selenium.pageobject.dashboard.Dashboard;
import org.eclipse.che.selenium.pageobject.dashboard.DashboardProject;
import org.eclipse.che.selenium.pageobject.dashboard.DashboardWorkspace;
import org.eclipse.che.selenium.pageobject.dashboard.NavigationBar;
import org.eclipse.che.selenium.pageobject.dashboard.ProjectSourcePage;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceProjects;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.Workspaces;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@ -39,8 +43,8 @@ public class CreateAndDeleteProjectsTest {
private final String WORKSPACE = NameGenerator.generate("workspace", 4);
@Inject private Dashboard dashboard;
@Inject private DashboardProject dashboardProject;
@Inject private DashboardWorkspace dashboardWorkspace;
@Inject private WorkspaceProjects workspaceProjects;
@Inject private WorkspaceDetails workspaceDetails;
@Inject private NavigationBar navigationBar;
@Inject private CreateWorkspace createWorkspace;
@Inject private ProjectSourcePage projectSourcePage;
@ -51,6 +55,7 @@ public class CreateAndDeleteProjectsTest {
@Inject private TestUser defaultTestUser;
@Inject private NotificationsPopupPanel notificationsPopupPanel;
@Inject private MavenPluginStatusBar mavenPluginStatusBar;
@Inject private Workspaces workspaces;
@BeforeClass
public void setUp() {
@ -64,44 +69,43 @@ public class CreateAndDeleteProjectsTest {
@Test
public void createAndDeleteProjectTest() throws ExecutionException, InterruptedException {
navigationBar.waitNavigationBar();
navigationBar.clickOnMenu(NavigationBar.MenuItem.WORKSPACES);
dashboardWorkspace.clickOnNewWorkspaceBtn();
dashboard.waitDashboardToolbarTitle();
dashboard.selectWorkspacesItemOnDashboard();
workspaces.clickOnNewWorkspaceBtn();
createWorkspace.waitToolbar();
createWorkspace.selectStack(TestStacksConstants.JAVA.getId());
createWorkspace.typeWorkspaceName(WORKSPACE);
projectSourcePage.clickAddOrImportProjectButton();
projectSourcePage.selectSample(DashboardProject.Template.WEB_JAVA_SPRING.value());
projectSourcePage.selectSample(DashboardProject.Template.CONSOLE_JAVA_SIMPLE.value());
projectSourcePage.clickAdd();
createWorkspace.clickCreate();
projectSourcePage.clickOnAddOrImportProjectButton();
projectSourcePage.selectSample(WEB_JAVA_SPRING);
projectSourcePage.selectSample(CONSOLE_JAVA_SIMPLE);
projectSourcePage.clickOnAddProjectButton();
createWorkspace.clickOnCreateWorkspaceButton();
String dashboardWindow = seleniumWebDriver.getWindowHandle();
seleniumWebDriver.switchFromDashboardIframeToIde();
loader.waitOnClosed();
explorer.waitProjectExplorer();
explorer.waitItem(DashboardProject.Template.CONSOLE_JAVA_SIMPLE.value());
explorer.waitItem(CONSOLE_JAVA_SIMPLE);
notificationsPopupPanel.waitPopUpPanelsIsClosed();
mavenPluginStatusBar.waitClosingInfoPanel();
explorer.waitFolderDefinedTypeOfFolderByPath(
DashboardProject.Template.CONSOLE_JAVA_SIMPLE.value(), PROJECT_FOLDER);
explorer.waitFolderDefinedTypeOfFolderByPath(
DashboardProject.Template.WEB_JAVA_SPRING.value(), PROJECT_FOLDER);
explorer.waitFolderDefinedTypeOfFolderByPath(CONSOLE_JAVA_SIMPLE, PROJECT_FOLDER);
explorer.waitFolderDefinedTypeOfFolderByPath(WEB_JAVA_SPRING, PROJECT_FOLDER);
switchToWindow(dashboardWindow);
dashboard.selectWorkspacesItemOnDashboard();
dashboardWorkspace.selectWorkspaceItemName(WORKSPACE);
dashboardWorkspace.selectTabInWorspaceMenu(DashboardWorkspace.TabNames.PROJECTS);
dashboardProject.waitProjectIsPresent(DashboardProject.Template.WEB_JAVA_SPRING.value());
dashboardProject.waitProjectIsPresent(DashboardProject.Template.CONSOLE_JAVA_SIMPLE.value());
dashboardProject.openSettingsForProjectByName(
DashboardProject.Template.WEB_JAVA_SPRING.value());
dashboardProject.clickOnDeleteProject();
dashboardProject.clickOnDeleteItInDialogWindow();
dashboardProject.waitProjectIsNotPresent(DashboardProject.Template.WEB_JAVA_SPRING.value());
dashboardProject.openSettingsForProjectByName(
DashboardProject.Template.CONSOLE_JAVA_SIMPLE.value());
dashboardProject.clickOnDeleteProject();
dashboardProject.clickOnDeleteItInDialogWindow();
dashboardProject.waitProjectIsNotPresent(DashboardProject.Template.CONSOLE_JAVA_SIMPLE.value());
workspaces.selectWorkspaceItemName(WORKSPACE);
workspaceDetails.selectTabInWorkspaceMenu(PROJECTS);
workspaceProjects.waitProjectIsPresent(WEB_JAVA_SPRING);
workspaceProjects.waitProjectIsPresent(CONSOLE_JAVA_SIMPLE);
workspaceProjects.openSettingsForProjectByName(WEB_JAVA_SPRING);
workspaceProjects.clickOnDeleteProject();
workspaceProjects.clickOnDeleteItInDialogWindow();
workspaceProjects.waitProjectIsNotPresent(WEB_JAVA_SPRING);
workspaceProjects.openSettingsForProjectByName(CONSOLE_JAVA_SIMPLE);
workspaceProjects.clickOnDeleteProject();
workspaceProjects.clickOnDeleteItInDialogWindow();
workspaceProjects.waitProjectIsNotPresent(CONSOLE_JAVA_SIMPLE);
}
private void switchToWindow(String windowHandle) {

View File

@ -10,13 +10,19 @@
*/
package org.eclipse.che.selenium.dashboard;
import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.StateWorkspace.RUNNING;
import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.StateWorkspace.STOPPING;
import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.TabNames.OVERVIEW;
import com.google.inject.Inject;
import org.eclipse.che.selenium.core.client.TestWorkspaceServiceClient;
import org.eclipse.che.selenium.core.user.TestUser;
import org.eclipse.che.selenium.core.workspace.TestWorkspace;
import org.eclipse.che.selenium.pageobject.Loader;
import org.eclipse.che.selenium.pageobject.dashboard.Dashboard;
import org.eclipse.che.selenium.pageobject.dashboard.DashboardWorkspace;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceOverview;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.Workspaces;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@ -24,11 +30,13 @@ import org.testng.annotations.Test;
public class DeleteRunningWorkspaceTest {
@Inject private Dashboard dashboard;
@Inject private DashboardWorkspace dashboardWorkspace;
@Inject private WorkspaceDetails workspaceDetails;
@Inject private TestWorkspace ws;
@Inject private Loader loader;
@Inject private TestUser user;
@Inject private TestWorkspaceServiceClient workspaceServiceClient;
@Inject private Workspaces workspaces;
@Inject private WorkspaceOverview workspaceOverview;
private String workspaceName;
@ -41,14 +49,14 @@ public class DeleteRunningWorkspaceTest {
@Test
public void deleteRunningWorkspaceTest() {
dashboard.selectWorkspacesItemOnDashboard();
dashboardWorkspace.selectWorkspaceItemName(workspaceName);
dashboardWorkspace.waitToolbarTitleName(workspaceName);
dashboardWorkspace.selectTabInWorspaceMenu(DashboardWorkspace.TabNames.OVERVIEW);
dashboardWorkspace.checkStateOfWorkspace(DashboardWorkspace.StateWorkspace.RUNNING);
dashboardWorkspace.clickOnDeleteWorkspace();
dashboardWorkspace.clickOnDeleteItInDialogWindow();
dashboardWorkspace.checkStateOfWorkspace(DashboardWorkspace.StateWorkspace.STOPPING);
dashboardWorkspace.waitToolbarTitleName("Workspaces");
dashboardWorkspace.waitWorkspaceIsNotPresent(workspaceName);
workspaces.selectWorkspaceItemName(workspaceName);
workspaces.waitToolbarTitleName(workspaceName);
workspaceDetails.selectTabInWorkspaceMenu(OVERVIEW);
workspaceDetails.checkStateOfWorkspace(RUNNING);
workspaceOverview.clickOnDeleteWorkspace();
workspaceDetails.clickOnDeleteButtonInDialogWindow();
workspaceDetails.checkStateOfWorkspace(STOPPING);
dashboard.waitToolbarTitleName("Workspaces");
workspaces.waitWorkspaceIsNotPresent(workspaceName);
}
}

View File

@ -10,10 +10,16 @@
*/
package org.eclipse.che.selenium.dashboard;
import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.StateWorkspace.RUNNING;
import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.StateWorkspace.STOPPED;
import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.TabNames.OVERVIEW;
import com.google.inject.Inject;
import org.eclipse.che.selenium.core.workspace.TestWorkspace;
import org.eclipse.che.selenium.pageobject.dashboard.Dashboard;
import org.eclipse.che.selenium.pageobject.dashboard.DashboardWorkspace;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceOverview;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.Workspaces;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@ -21,8 +27,10 @@ import org.testng.annotations.Test;
public class DeleteStoppingWorkspaceTest {
@Inject private Dashboard dashboard;
@Inject private DashboardWorkspace dashboardWorkspace;
@Inject private WorkspaceDetails workspaceDetails;
@Inject private TestWorkspace ws;
@Inject private Workspaces workspaces;
@Inject private WorkspaceOverview workspaceOverview;
private String workspaceName;
@ -35,16 +43,16 @@ public class DeleteStoppingWorkspaceTest {
@Test
public void deleteStoppingWorkspaceTest() {
dashboard.selectWorkspacesItemOnDashboard();
dashboardWorkspace.waitToolbarTitleName("Workspaces");
dashboardWorkspace.selectWorkspaceItemName(workspaceName);
dashboardWorkspace.waitToolbarTitleName(workspaceName);
dashboardWorkspace.selectTabInWorspaceMenu(DashboardWorkspace.TabNames.OVERVIEW);
dashboardWorkspace.checkStateOfWorkspace(DashboardWorkspace.StateWorkspace.RUNNING);
dashboardWorkspace.clickOnStopWorkspace();
dashboardWorkspace.checkStateOfWorkspace(DashboardWorkspace.StateWorkspace.STOPPED);
dashboardWorkspace.clickOnDeleteWorkspace();
dashboardWorkspace.clickOnDeleteItInDialogWindow();
dashboardWorkspace.waitWorkspaceIsNotPresent(workspaceName);
dashboardWorkspace.waitToolbarTitleName("Workspaces");
dashboard.waitToolbarTitleName("Workspaces");
workspaces.selectWorkspaceItemName(workspaceName);
workspaces.waitToolbarTitleName(workspaceName);
workspaceDetails.selectTabInWorkspaceMenu(OVERVIEW);
workspaceDetails.checkStateOfWorkspace(RUNNING);
workspaceDetails.clickOnStopWorkspace();
workspaceDetails.checkStateOfWorkspace(STOPPED);
workspaceOverview.clickOnDeleteWorkspace();
workspaceDetails.clickOnDeleteButtonInDialogWindow();
workspaces.waitWorkspaceIsNotPresent(workspaceName);
dashboard.waitToolbarTitleName("Workspaces");
}
}

View File

@ -10,6 +10,8 @@
*/
package org.eclipse.che.selenium.dashboard;
import static org.eclipse.che.selenium.pageobject.dashboard.ProjectSourcePage.Sources.GIT;
import com.google.inject.Inject;
import java.util.concurrent.ExecutionException;
import org.eclipse.che.commons.lang.NameGenerator;
@ -21,9 +23,10 @@ import org.eclipse.che.selenium.pageobject.Loader;
import org.eclipse.che.selenium.pageobject.ProjectExplorer;
import org.eclipse.che.selenium.pageobject.dashboard.CreateWorkspace;
import org.eclipse.che.selenium.pageobject.dashboard.Dashboard;
import org.eclipse.che.selenium.pageobject.dashboard.DashboardWorkspace;
import org.eclipse.che.selenium.pageobject.dashboard.NavigationBar;
import org.eclipse.che.selenium.pageobject.dashboard.ProjectSourcePage;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.Workspaces;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@ -34,7 +37,7 @@ public class ImportMavenProjectFromGitHubTest {
private static final String PROJECT_NAME = "guess-project";
@Inject private Dashboard dashboard;
@Inject private DashboardWorkspace dashboardWorkspace;
@Inject private WorkspaceDetails workspaceDetails;
@Inject private Loader loader;
@Inject private ProjectExplorer explorer;
@Inject private NavigationBar navigationBar;
@ -43,6 +46,7 @@ public class ImportMavenProjectFromGitHubTest {
@Inject private SeleniumWebDriver seleniumWebDriver;
@Inject private TestWorkspaceServiceClient workspaceServiceClient;
@Inject private TestUser defaultTestUser;
@Inject private Workspaces workspaces;
@BeforeClass
public void setUp() {
@ -56,21 +60,21 @@ public class ImportMavenProjectFromGitHubTest {
@Test
public void checkAbilityImportMavenProjectTest() throws ExecutionException, InterruptedException {
navigationBar.waitNavigationBar();
navigationBar.clickOnMenu(NavigationBar.MenuItem.WORKSPACES);
dashboard.waitDashboardToolbarTitle();
dashboard.selectWorkspacesItemOnDashboard();
dashboardWorkspace.clickOnNewWorkspaceBtn();
workspaces.clickOnNewWorkspaceBtn();
createWorkspace.waitToolbar();
createWorkspace.selectStack(TestStacksConstants.JAVA.getId());
createWorkspace.typeWorkspaceName(WORKSPACE);
projectSourcePage.clickAddOrImportProjectButton();
projectSourcePage.clickOnAddOrImportProjectButton();
projectSourcePage.selectSourceTab(ProjectSourcePage.Sources.GIT);
projectSourcePage.selectSourceTab(GIT);
projectSourcePage.typeGitRepositoryLocation("https://github.com/iedexmain1/guess-project.git");
projectSourcePage.clickAdd();
projectSourcePage.clickOnAddProjectButton();
createWorkspace.clickCreate();
createWorkspace.clickOnCreateWorkspaceButton();
seleniumWebDriver.switchFromDashboardIframeToIde();

View File

@ -10,6 +10,8 @@
*/
package org.eclipse.che.selenium.dashboard;
import static org.eclipse.che.selenium.pageobject.dashboard.ProjectSourcePage.Sources.ZIP;
import com.google.inject.Inject;
import java.util.concurrent.ExecutionException;
import org.eclipse.che.commons.lang.NameGenerator;
@ -21,9 +23,10 @@ import org.eclipse.che.selenium.pageobject.Loader;
import org.eclipse.che.selenium.pageobject.ProjectExplorer;
import org.eclipse.che.selenium.pageobject.dashboard.CreateWorkspace;
import org.eclipse.che.selenium.pageobject.dashboard.Dashboard;
import org.eclipse.che.selenium.pageobject.dashboard.DashboardWorkspace;
import org.eclipse.che.selenium.pageobject.dashboard.NavigationBar;
import org.eclipse.che.selenium.pageobject.dashboard.ProjectSourcePage;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.Workspaces;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@ -34,7 +37,7 @@ public class ImportProjectFromZipTest {
private static final String PROJECT_NAME = "master";
@Inject private Dashboard dashboard;
@Inject private DashboardWorkspace dashboardWorkspace;
@Inject private WorkspaceDetails workspaceDetails;
@Inject private Loader loader;
@Inject private ProjectExplorer explorer;
@Inject private NavigationBar navigationBar;
@ -43,6 +46,7 @@ public class ImportProjectFromZipTest {
@Inject private SeleniumWebDriver seleniumWebDriver;
@Inject private TestWorkspaceServiceClient workspaceServiceClient;
@Inject private TestUser defaultTestUser;
@Inject private Workspaces workspaces;
@BeforeClass
public void setUp() {
@ -56,27 +60,23 @@ public class ImportProjectFromZipTest {
@Test
public void importProjectFromZipTest() throws ExecutionException, InterruptedException {
navigationBar.waitNavigationBar();
navigationBar.clickOnMenu(NavigationBar.MenuItem.WORKSPACES);
dashboard.waitDashboardToolbarTitle();
dashboard.selectWorkspacesItemOnDashboard();
dashboardWorkspace.clickOnNewWorkspaceBtn();
workspaces.clickOnNewWorkspaceBtn();
createWorkspace.waitToolbar();
createWorkspace.selectStack(TestStacksConstants.JAVA.getId());
createWorkspace.typeWorkspaceName(WORKSPACE);
projectSourcePage.clickAddOrImportProjectButton();
projectSourcePage.selectSourceTab(ProjectSourcePage.Sources.ZIP);
projectSourcePage.clickOnAddOrImportProjectButton();
projectSourcePage.selectSourceTab(ZIP);
projectSourcePage.typeZipLocation(
"https://github.com/iedexmain1/multimodule-project/archive/master.zip");
projectSourcePage.skipRootFolder();
projectSourcePage.clickAdd();
createWorkspace.clickCreate();
projectSourcePage.clickOnAddProjectButton();
createWorkspace.clickOnCreateWorkspaceButton();
seleniumWebDriver.switchFromDashboardIframeToIde();
loader.waitOnClosed();
explorer.waitItem(PROJECT_NAME);
explorer.selectItem(PROJECT_NAME);

View File

@ -11,8 +11,9 @@
package org.eclipse.che.selenium.dashboard;
import static org.eclipse.che.commons.lang.NameGenerator.generate;
import static org.eclipse.che.selenium.pageobject.dashboard.DashboardWorkspace.StateWorkspace.STARTING;
import static org.eclipse.che.selenium.pageobject.dashboard.DashboardWorkspace.StateWorkspace.STOPPING;
import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.StateWorkspace.STARTING;
import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.StateWorkspace.STOPPING;
import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.TabNames.OVERVIEW;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
@ -22,7 +23,9 @@ import org.eclipse.che.selenium.core.client.TestWorkspaceServiceClient;
import org.eclipse.che.selenium.core.user.TestUser;
import org.eclipse.che.selenium.core.workspace.TestWorkspace;
import org.eclipse.che.selenium.pageobject.dashboard.Dashboard;
import org.eclipse.che.selenium.pageobject.dashboard.DashboardWorkspace;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceOverview;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.Workspaces;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@ -39,10 +42,12 @@ public class RenameWorkspaceTest {
("The name has to be less than 101 characters long.");
@Inject private Dashboard dashboard;
@Inject private DashboardWorkspace dashboardWorkspace;
@Inject private WorkspaceDetails workspaceDetails;
@Inject private TestWorkspace ws;
@Inject private TestUser user;
@Inject private TestWorkspaceServiceClient workspaceServiceClient;
@Inject private Workspaces workspaces;
@Inject private WorkspaceOverview workspaceOverview;
private String workspaceName;
@ -62,22 +67,22 @@ public class RenameWorkspaceTest {
@Test
public void renameNameWorkspaceTest() throws IOException {
dashboard.selectWorkspacesItemOnDashboard();
dashboardWorkspace.waitToolbarTitleName("Workspaces");
dashboardWorkspace.selectWorkspaceItemName(workspaceName);
dashboardWorkspace.waitToolbarTitleName(workspaceName);
dashboardWorkspace.selectTabInWorspaceMenu(DashboardWorkspace.TabNames.OVERVIEW);
dashboard.waitToolbarTitleName("Workspaces");
workspaces.selectWorkspaceItemName(workspaceName);
workspaces.waitToolbarTitleName(workspaceName);
workspaceDetails.selectTabInWorkspaceMenu(OVERVIEW);
// type name with 1 characters and check error message that this name is too short
dashboardWorkspace.enterNameWorkspace("w");
assertTrue(dashboardWorkspace.isWorkspaceNameErrorMessageEquals(WS_NAME_TOO_SHORT));
dashboardWorkspace.clickOnCancelBtn();
dashboardWorkspace.checkNameWorkspace(workspaceName);
workspaceOverview.enterNameWorkspace("w");
assertTrue(workspaceOverview.isWorkspaceNameErrorMessageEquals(WS_NAME_TOO_SHORT));
workspaceDetails.clickOnCancelChangesBtn();
workspaceOverview.checkNameWorkspace(workspaceName);
// type name with 101 characters and check error message that this name is too long
dashboardWorkspace.enterNameWorkspace(MAX_WORKSPACE_NAME + "a");
assertTrue(dashboardWorkspace.isWorkspaceNameErrorMessageEquals(WS_NAME_TOO_LONG));
dashboardWorkspace.clickOnCancelBtn();
dashboardWorkspace.checkNameWorkspace(workspaceName);
workspaceOverview.enterNameWorkspace(MAX_WORKSPACE_NAME + "a");
assertTrue(workspaceOverview.isWorkspaceNameErrorMessageEquals(WS_NAME_TOO_LONG));
workspaceDetails.clickOnCancelChangesBtn();
workspaceOverview.checkNameWorkspace(workspaceName);
// type a name with min possible size and check that the workspace renamed
renameWorkspace(MIN_WORKSPACE_NAME);
@ -87,17 +92,17 @@ public class RenameWorkspaceTest {
}
private void renameWorkspace(String name) {
dashboardWorkspace.enterNameWorkspace(name);
assertFalse(dashboardWorkspace.isWorkspaceNameErrorMessageEquals(WS_NAME_TOO_SHORT));
assertFalse(dashboardWorkspace.isWorkspaceNameErrorMessageEquals(WS_NAME_TOO_LONG));
workspaceOverview.enterNameWorkspace(name);
assertFalse(workspaceOverview.isWorkspaceNameErrorMessageEquals(WS_NAME_TOO_SHORT));
assertFalse(workspaceOverview.isWorkspaceNameErrorMessageEquals(WS_NAME_TOO_LONG));
saveAndWaitWorkspaceRestarted();
dashboardWorkspace.checkNameWorkspace(name);
workspaceOverview.checkNameWorkspace(name);
}
private void saveAndWaitWorkspaceRestarted() {
dashboardWorkspace.clickOnSaveBtn();
dashboardWorkspace.checkStateOfWorkspace(STOPPING);
dashboardWorkspace.checkStateOfWorkspace(STARTING);
workspaceDetails.clickOnSaveChangesBtn();
workspaceDetails.checkStateOfWorkspace(STOPPING);
workspaceDetails.checkStateOfWorkspace(STARTING);
dashboard.waitNotificationMessage("Workspace updated");
dashboard.waitNotificationIsClosed();
}

View File

@ -11,6 +11,15 @@
package org.eclipse.che.selenium.dashboard;
import static org.eclipse.che.selenium.pageobject.ProjectExplorer.FolderTypes.PROJECT_FOLDER;
import static org.eclipse.che.selenium.pageobject.dashboard.ProjectSourcePage.Template.WEB_JAVA_PETCLINIC;
import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.StateWorkspace.RUNNING;
import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.StateWorkspace.STOPPED;
import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.TabNames.ENV_VARIABLES;
import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.TabNames.INSTALLERS;
import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.TabNames.MACHINES;
import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.TabNames.OVERVIEW;
import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.TabNames.PROJECTS;
import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.TabNames.SERVERS;
import com.google.inject.Inject;
import java.util.HashMap;
@ -27,11 +36,15 @@ import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel;
import org.eclipse.che.selenium.pageobject.ProjectExplorer;
import org.eclipse.che.selenium.pageobject.dashboard.CreateWorkspace;
import org.eclipse.che.selenium.pageobject.dashboard.Dashboard;
import org.eclipse.che.selenium.pageobject.dashboard.DashboardProject;
import org.eclipse.che.selenium.pageobject.dashboard.DashboardProject.Template;
import org.eclipse.che.selenium.pageobject.dashboard.DashboardWorkspace;
import org.eclipse.che.selenium.pageobject.dashboard.DashboardWorkspace.TabNames;
import org.eclipse.che.selenium.pageobject.dashboard.NavigationBar;
import org.eclipse.che.selenium.pageobject.dashboard.ProjectSourcePage;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceEnvVariables;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceInstallers;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceMachines;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceProjects;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceServers;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.Workspaces;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
@ -51,12 +64,18 @@ public class WorkspaceDetailsTest {
@Inject private NavigationBar navigationBar;
@Inject private CreateWorkspace createWorkspace;
@Inject private Dashboard dashboard;
@Inject private DashboardWorkspace dashboardWorkspace;
@Inject private WorkspaceDetails workspaceDetails;
@Inject private SeleniumWebDriver seleniumWebDriver;
@Inject private TestWorkspaceServiceClient workspaceServiceClient;
@Inject private NotificationsPopupPanel notificationsPopupPanel;
@Inject private DashboardProject dashboardProject;
@Inject private WorkspaceProjects workspaceProjects;
@Inject private Consoles consoles;
@Inject private Workspaces workspaces;
@Inject private ProjectSourcePage projectSourcePage;
@Inject private WorkspaceMachines workspaceMachines;
@Inject private WorkspaceServers workspaceServers;
@Inject private WorkspaceInstallers workspaceInstallers;
@Inject private WorkspaceEnvVariables workspaceEnvVariables;
@BeforeClass
public void setUp() throws Exception {
@ -71,39 +90,39 @@ public class WorkspaceDetailsTest {
@Test
public void workingWithEnvVariables() {
dashboardWorkspace.selectTabInWorspaceMenu(TabNames.ENV_VARIABLES);
workspaceDetails.selectTabInWorkspaceMenu(ENV_VARIABLES);
// create a new variable, save changes and check it exists
dashboardWorkspace.selectMachine("Environment variables", "dev-machine");
dashboardWorkspace.clickOnAddEnvVariableButton();
dashboardWorkspace.checkAddNewEnvVarialbleDialogIsOpen();
dashboardWorkspace.addNewEnvironmentVariable("logi", "admin");
dashboardWorkspace.clickOnAddDialogButton();
workspaceMachines.selectMachine("Environment variables", "dev-machine");
workspaceEnvVariables.clickOnAddEnvVariableButton();
workspaceEnvVariables.checkAddNewEnvVarialbleDialogIsOpen();
workspaceEnvVariables.addNewEnvironmentVariable("logi", "admin");
workspaceDetails.clickOnAddButtonInDialogWindow();
clickOnSaveButton();
Assert.assertTrue(dashboardWorkspace.checkEnvVariableExists("logi"));
Assert.assertTrue(workspaceEnvVariables.checkEnvVariableExists("logi"));
// rename the variable, save changes and check it is renamed
Assert.assertTrue(dashboardWorkspace.checkValueExists("logi", "admin"));
dashboardWorkspace.clickOnEditEnvVariableButton("logi");
dashboardWorkspace.enterEnvVariableName("login");
dashboardWorkspace.clickOnUpdateDialogButton();
Assert.assertTrue(workspaceEnvVariables.checkValueExists("logi", "admin"));
workspaceEnvVariables.clickOnEditEnvVariableButton("logi");
workspaceEnvVariables.enterEnvVariableName("login");
workspaceDetails.clickOnUpdateButtonInDialogWindow();
clickOnSaveButton();
Assert.assertTrue(dashboardWorkspace.checkValueExists("login", "admin"));
Assert.assertTrue(workspaceEnvVariables.checkValueExists("login", "admin"));
// delete the variable, save changes and check it is not exists
dashboardWorkspace.clickOnEnvVariableCheckbox("login");
dashboardWorkspace.clickOnDeleteBtn();
dashboardWorkspace.clickOnDeleteDialogButton();
workspaceEnvVariables.clickOnEnvVariableCheckbox("login");
workspaceEnvVariables.clickOnDeleteEnvVariableButton("login");
workspaceDetails.clickOnDeleteButtonInDialogWindow();
clickOnSaveButton();
dashboardWorkspace.checkValueIsNotExists("login", "admin");
workspaceEnvVariables.checkValueIsNotExists("login", "admin");
// delete all variable from db machine, check they don't exist and save changes
dashboardWorkspace.selectMachine("Environment variables", "db");
workspaceMachines.selectMachine("Environment variables", "db");
variables.forEach(
(name, value) -> {
dashboardWorkspace.clickOnDeleteEnvVariableButton(name);
dashboardWorkspace.clickOnDeleteDialogButton();
dashboardWorkspace.checkValueIsNotExists(name, value);
workspaceEnvVariables.clickOnDeleteEnvVariableButton(name);
workspaceDetails.clickOnDeleteButtonInDialogWindow();
workspaceEnvVariables.checkValueIsNotExists(name, value);
});
clickOnSaveButton();
@ -112,32 +131,32 @@ public class WorkspaceDetailsTest {
variables.forEach(
(name, value) -> {
loader.waitOnClosed();
dashboardWorkspace.clickOnAddEnvVariableButton();
dashboardWorkspace.checkAddNewEnvVarialbleDialogIsOpen();
dashboardWorkspace.addNewEnvironmentVariable(name, value);
dashboardWorkspace.clickOnAddDialogButton();
Assert.assertTrue(dashboardWorkspace.checkEnvVariableExists(name));
Assert.assertTrue(dashboardWorkspace.checkValueExists(name, value));
workspaceEnvVariables.clickOnAddEnvVariableButton();
workspaceEnvVariables.checkAddNewEnvVarialbleDialogIsOpen();
workspaceEnvVariables.addNewEnvironmentVariable(name, value);
workspaceDetails.clickOnAddButtonInDialogWindow();
Assert.assertTrue(workspaceEnvVariables.checkEnvVariableExists(name));
Assert.assertTrue(workspaceEnvVariables.checkValueExists(name, value));
});
clickOnSaveButton();
}
@Test
public void workingWithInstallers() {
dashboardWorkspace.selectTabInWorspaceMenu(TabNames.INSTALLERS);
workspaceDetails.selectTabInWorkspaceMenu(INSTALLERS);
// check all needed installers in dev-machine exist
dashboardWorkspace.selectMachine("Workspace Installers", "dev-machine");
workspaceMachines.selectMachine("Workspace Installers", "dev-machine");
installers.forEach(
(name, value) -> {
dashboardWorkspace.checkInstallerExists(name);
workspaceInstallers.checkInstallerExists(name);
});
// switch all installers and save changes
installers.forEach(
(name, value) -> {
Assert.assertEquals(dashboardWorkspace.getInstallerState(name), value);
dashboardWorkspace.switchInstallerState(name);
Assert.assertEquals(workspaceInstallers.getInstallerState(name), value);
workspaceInstallers.switchInstallerState(name);
WaitUtils.sleepQuietly(1);
});
clickOnSaveButton();
@ -146,44 +165,44 @@ public class WorkspaceDetailsTest {
// Java-MySql stack)
installers.forEach(
(name, value) -> {
dashboardWorkspace.switchInstallerState(name);
workspaceInstallers.switchInstallerState(name);
loader.waitOnClosed();
});
clickOnSaveButton();
installers.forEach(
(name, value) -> {
Assert.assertEquals(dashboardWorkspace.getInstallerState(name), value);
Assert.assertEquals(workspaceInstallers.getInstallerState(name), value);
});
}
@Test
public void workingWithServers() {
dashboardWorkspace.selectTabInWorspaceMenu(TabNames.SERVERS);
workspaceDetails.selectTabInWorkspaceMenu(SERVERS);
// add a new server to db machine, save changes and check it exists
dashboardWorkspace.selectMachine("Servers", "db");
dashboardWorkspace.clickOnAddServerButton();
dashboardWorkspace.waitAddServerDialogIsOpen();
dashboardWorkspace.enterReference("agen");
dashboardWorkspace.enterPort("8080");
dashboardWorkspace.enterProtocol("https");
dashboardWorkspace.clickOnAddDialogButton();
workspaceMachines.selectMachine("Servers", "db");
workspaceServers.clickOnAddServerButton();
workspaceServers.waitAddServerDialogIsOpen();
workspaceServers.enterReference("agen");
workspaceServers.enterPort("8080");
workspaceServers.enterProtocol("https");
workspaceDetails.clickOnAddButtonInDialogWindow();
clickOnSaveButton();
dashboardWorkspace.checkServerExists("agen", "8080");
workspaceServers.checkServerExists("agen", "8080");
// edit the server and check it exists
dashboardWorkspace.clickOnEditServerButton("agen");
dashboardWorkspace.enterReference("agent");
dashboardWorkspace.enterPort("80");
dashboardWorkspace.enterProtocol("http");
dashboardWorkspace.clickOnUpdateDialogButton();
dashboardWorkspace.checkServerExists("agent", "80");
workspaceServers.clickOnEditServerButton("agen");
workspaceServers.enterReference("agent");
workspaceServers.enterPort("80");
workspaceServers.enterProtocol("http");
workspaceDetails.clickOnUpdateButtonInDialogWindow();
workspaceServers.checkServerExists("agent", "80");
// delete the server and check it is not exist
dashboardWorkspace.clickOnDeleteServerButton("agent");
dashboardWorkspace.clickOnDeleteDialogButton();
workspaceServers.clickOnDeleteServerButton("agent");
workspaceDetails.clickOnDeleteButtonInDialogWindow();
clickOnSaveButton();
dashboardWorkspace.checkServerIsNotExists("agent", "80");
workspaceServers.checkServerIsNotExists("agent", "80");
}
@Test
@ -191,49 +210,48 @@ public class WorkspaceDetailsTest {
String machineName = "new_machine";
// check that all machines of the Java-MySql stack created by default exist
dashboardWorkspace.selectTabInWorspaceMenu(TabNames.MACHINES);
dashboardWorkspace.checkMachineExists("db");
dashboardWorkspace.checkMachineExists("dev-machine");
workspaceDetails.selectTabInWorkspaceMenu(MACHINES);
workspaceMachines.checkMachineExists("db");
workspaceMachines.checkMachineExists("dev-machine");
// create a new machine, delete and check it is not exist
createMachine(machineName);
dashboardWorkspace.clickOnDeleteMachineButton(machineName);
dashboardWorkspace.clickOnCloseDialogButton();
workspaceMachines.clickOnDeleteMachineButton(machineName);
workspaceDetails.clickOnCloseButtonInDialogWindow();
loader.waitOnClosed();
dashboardWorkspace.clickOnDeleteMachineButton(machineName);
dashboardWorkspace.clickOnDeleteDialogButton();
dashboardWorkspace.checkMachineIsNotExists(machineName);
workspaceMachines.clickOnDeleteMachineButton(machineName);
workspaceDetails.clickOnDeleteButtonInDialogWindow();
workspaceMachines.checkMachineIsNotExists(machineName);
// create a new machine, edit(change the name) and save changes
createMachine(machineName);
dashboardWorkspace.clickOnEditMachineButton(machineName);
dashboardWorkspace.checkEditTheMachineDialogIsOpen();
dashboardWorkspace.setMachineNameInDialog("machine");
dashboardWorkspace.clickOnEditDialogButton();
dashboardWorkspace.checkMachineExists("machine");
workspaceMachines.clickOnEditMachineButton(machineName);
workspaceMachines.checkEditTheMachineDialogIsOpen();
workspaceMachines.setMachineNameInDialog("machine");
workspaceMachines.clickOnEditNameDialogButton();
workspaceMachines.checkMachineExists("machine");
clickOnSaveButton();
}
@Test(priority = 1)
public void workingWithProjects() {
dashboardWorkspace.selectTabInWorspaceMenu(TabNames.PROJECTS);
workspaceDetails.selectTabInWorkspaceMenu(PROJECTS);
// create a new project and save changes
dashboardWorkspace.clickOnAddNewProjectButton();
dashboardWorkspace.selectSample("web-java-petclinic");
dashboardWorkspace.clickOnAddProjects();
workspaceProjects.clickOnAddNewProjectButton();
projectSourcePage.selectSample(PROJECT_NAME);
projectSourcePage.clickOnAddProjectButton();
clickOnSaveButton();
// check that project exists(workspace will restart)
dashboardProject.waitProjectIsPresent(Template.WEB_JAVA_PETCLINIC.value());
workspaceProjects.waitProjectIsPresent(WEB_JAVA_PETCLINIC);
// start the workspace and check that the new project exists
dashboardWorkspace.clickOpenInIdeWsBtn();
workspaceDetails.clickOpenInIdeWsBtn();
seleniumWebDriver.switchFromDashboardIframeToIde();
projectExplorer.waitProjectExplorer();
projectExplorer.waitItem(PROJECT_NAME);
projectExplorer.waitFolderDefinedTypeOfFolderByPath(
Template.WEB_JAVA_PETCLINIC.value(), PROJECT_FOLDER);
projectExplorer.waitFolderDefinedTypeOfFolderByPath(WEB_JAVA_PETCLINIC, PROJECT_FOLDER);
// check that created machine exists in the Process Console tree
consoles.waitProcessInProcessConsoleTree("machine");
@ -261,7 +279,7 @@ public class WorkspaceDetailsTest {
}
private void clickOnSaveButton() {
dashboardWorkspace.clickOnSaveBtn();
workspaceDetails.clickOnSaveChangesBtn();
dashboard.waitNotificationMessage("Workspace updated");
dashboard.waitNotificationIsClosed();
}
@ -269,15 +287,15 @@ public class WorkspaceDetailsTest {
private void createWsFromJavaMySqlStack() {
// create and start a workspace from the Java-MySql stack
dashboard.open();
navigationBar.waitNavigationBar();
navigationBar.clickOnMenu(NavigationBar.MenuItem.WORKSPACES);
dashboardWorkspace.waitToolbarTitleName("Workspaces");
dashboardWorkspace.clickOnNewWorkspaceBtn();
dashboard.waitDashboardToolbarTitle();
dashboard.selectWorkspacesItemOnDashboard();
dashboard.waitToolbarTitleName("Workspaces");
workspaces.clickOnNewWorkspaceBtn();
createWorkspace.waitToolbar();
loader.waitOnClosed();
createWorkspace.selectStack(TestStacksConstants.JAVA_MYSQL.getId());
createWorkspace.typeWorkspaceName(WORKSPACE);
createWorkspace.clickCreate();
createWorkspace.clickOnCreateWorkspaceButton();
seleniumWebDriver.switchFromDashboardIframeToIde(60);
loader.waitOnClosed();
@ -286,21 +304,21 @@ public class WorkspaceDetailsTest {
dashboard.open();
dashboard.waitDashboardToolbarTitle();
dashboard.selectWorkspacesItemOnDashboard();
dashboardWorkspace.waitToolbarTitleName("Workspaces");
dashboardWorkspace.selectWorkspaceItemName(WORKSPACE);
dashboardWorkspace.waitToolbarTitleName(WORKSPACE);
dashboardWorkspace.selectTabInWorspaceMenu(TabNames.OVERVIEW);
dashboardWorkspace.checkStateOfWorkspace(DashboardWorkspace.StateWorkspace.RUNNING);
dashboardWorkspace.clickOnStopWorkspace();
dashboardWorkspace.checkStateOfWorkspace(DashboardWorkspace.StateWorkspace.STOPPED);
dashboard.waitToolbarTitleName("Workspaces");
workspaces.selectWorkspaceItemName(WORKSPACE);
workspaces.waitToolbarTitleName(WORKSPACE);
workspaceDetails.selectTabInWorkspaceMenu(OVERVIEW);
workspaceDetails.checkStateOfWorkspace(RUNNING);
workspaceDetails.clickOnStopWorkspace();
workspaceDetails.checkStateOfWorkspace(STOPPED);
}
private void createMachine(String machineName) {
// add new machine and check it exists
dashboardWorkspace.clickOnAddMachineButton();
dashboardWorkspace.checkAddNewMachineDialogIsOpen();
dashboardWorkspace.setMachineNameInDialog(machineName);
dashboardWorkspace.clickOnAddDialogButton();
dashboardWorkspace.checkMachineExists(machineName);
workspaceMachines.clickOnAddMachineButton();
workspaceMachines.checkAddNewMachineDialogIsOpen();
workspaceMachines.setMachineNameInDialog(machineName);
workspaceDetails.clickOnAddButtonInDialogWindow();
workspaceMachines.checkMachineExists(machineName);
}
}

View File

@ -10,10 +10,11 @@
*/
package org.eclipse.che.selenium.workspaces;
import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.STOP_WORKSPACE;
import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.WORKSPACE;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.LOADER_TIMEOUT_SEC;
import com.google.inject.Inject;
import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants;
import org.eclipse.che.selenium.core.workspace.TestWorkspace;
import org.eclipse.che.selenium.pageobject.Ide;
import org.eclipse.che.selenium.pageobject.Loader;
@ -43,9 +44,7 @@ public class CheckStopStartWsTest {
public void checkStopStartWorkspaceTest() {
projectExplorer.waitProjectExplorer();
loader.waitOnClosed();
menu.runCommand(
TestMenuCommandsConstants.Workspace.WORKSPACE,
TestMenuCommandsConstants.Workspace.STOP_WORKSPACE);
menu.runCommand(WORKSPACE, STOP_WORKSPACE);
toastLoader.waitExpectedTextInToastLoader("Stopping the workspace");
toastLoader.waitExpectedTextInToastLoader("Workspace is not running", 60);
toastLoader.clickOnStartButton();

View File

@ -10,20 +10,21 @@
*/
package org.eclipse.che.selenium.workspaces;
import static org.eclipse.che.selenium.core.constant.TestStacksConstants.JAVA;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.LOADER_TIMEOUT_SEC;
import com.google.inject.Inject;
import org.eclipse.che.commons.lang.NameGenerator;
import org.eclipse.che.selenium.core.SeleniumWebDriver;
import org.eclipse.che.selenium.core.client.TestWorkspaceServiceClient;
import org.eclipse.che.selenium.core.constant.TestStacksConstants;
import org.eclipse.che.selenium.core.user.TestUser;
import org.eclipse.che.selenium.pageobject.Loader;
import org.eclipse.che.selenium.pageobject.ProjectExplorer;
import org.eclipse.che.selenium.pageobject.dashboard.CreateWorkspace;
import org.eclipse.che.selenium.pageobject.dashboard.Dashboard;
import org.eclipse.che.selenium.pageobject.dashboard.DashboardWorkspace;
import org.eclipse.che.selenium.pageobject.dashboard.NavigationBar;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.Workspaces;
import org.eclipse.che.selenium.pageobject.machineperspective.MachineTerminal;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;
@ -39,9 +40,10 @@ public class CreateWorkspaceOnDashboardTest {
@Inject private Loader loader;
@Inject private MachineTerminal terminal;
@Inject private Dashboard dashboard;
@Inject private DashboardWorkspace dashboardWorkspace;
@Inject private WorkspaceDetails workspaceDetails;
@Inject private SeleniumWebDriver seleniumWebDriver;
@Inject private TestWorkspaceServiceClient workspaceServiceClient;
@Inject private Workspaces workspaces;
@AfterClass
public void tearDown() throws Exception {
@ -51,16 +53,20 @@ public class CreateWorkspaceOnDashboardTest {
@Test
public void createWorkspaceOnDashboardTest() {
dashboard.open();
navigationBar.waitNavigationBar();
navigationBar.clickOnMenu(NavigationBar.MenuItem.WORKSPACES);
dashboardWorkspace.waitToolbarTitleName("Workspaces");
dashboardWorkspace.clickOnNewWorkspaceBtn();
dashboard.waitDashboardToolbarTitle();
dashboard.selectWorkspacesItemOnDashboard();
dashboard.waitToolbarTitleName("Workspaces");
workspaces.clickOnNewWorkspaceBtn();
createWorkspace.waitToolbar();
createWorkspace.typeWorkspaceName(WORKSPACE);
createWorkspace.selectStack(TestStacksConstants.JAVA.getId());
createWorkspace.selectStack(JAVA.getId());
createWorkspace.setMachineRAM("2");
createWorkspace.clickCreate();
createWorkspace.clickOnCreateWorkspaceButton();
seleniumWebDriver.switchFromDashboardIframeToIde();
projectExplorer.waitProjectExplorer();
terminal.waitTerminalTab(LOADER_TIMEOUT_SEC);
}

View File

@ -10,12 +10,15 @@
*/
package org.eclipse.che.selenium.workspaces;
import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.STOP_WORKSPACE;
import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.WORKSPACE;
import com.google.inject.Inject;
import java.net.URL;
import java.nio.file.Paths;
import org.eclipse.che.commons.lang.NameGenerator;
import org.eclipse.che.selenium.core.SeleniumWebDriver;
import org.eclipse.che.selenium.core.client.TestProjectServiceClient;
import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants;
import org.eclipse.che.selenium.core.project.ProjectTemplates;
import org.eclipse.che.selenium.core.workspace.TestWorkspace;
import org.eclipse.che.selenium.pageobject.CodenvyEditor;
@ -29,7 +32,7 @@ import org.testng.annotations.Test;
/** @author Andrey chizhikov */
public class ProjectStateAfterRefreshTest {
private static final String PROJECT_NAME = ProjectStateAfterRefreshTest.class.getSimpleName();
private static final String PROJECT_NAME = NameGenerator.generate("project", 5);
@Inject private TestWorkspace workspace;
@Inject private Ide ide;
@ -72,9 +75,7 @@ public class ProjectStateAfterRefreshTest {
projectExplorer.waitProjectExplorer();
projectExplorer.quickExpandWithJavaScript();
openFilesInEditor();
menu.runCommand(
TestMenuCommandsConstants.Workspace.WORKSPACE,
TestMenuCommandsConstants.Workspace.STOP_WORKSPACE);
menu.runCommand(WORKSPACE, STOP_WORKSPACE);
toastLoader.waitToastLoaderIsOpen();
toastLoader.waitExpectedTextInToastLoader("Workspace is not running");
toastLoader.clickOnStartButton();
@ -86,6 +87,8 @@ public class ProjectStateAfterRefreshTest {
@Test(priority = 2)
public void checkRestoreStateOfProjectIfPomXmlFileOpened() throws Exception {
projectExplorer.waitProjectExplorer();
projectExplorer.waitItem(PROJECT_NAME);
projectExplorer.selectItem(PROJECT_NAME);
projectExplorer.quickExpandWithJavaScript();
projectExplorer.waitItem(PROJECT_NAME + "/pom.xml");
projectExplorer.waitItem(PROJECT_NAME + "/src/main/webapp/WEB-INF");
@ -93,7 +96,9 @@ public class ProjectStateAfterRefreshTest {
projectExplorer.openItemByPath(PROJECT_NAME + "/pom.xml");
editor.waitActiveEditor();
projectExplorer.waitProjectExplorer();
seleniumWebDriver.navigate().refresh();
projectExplorer.waitProjectExplorer();
projectExplorer.waitItem(PROJECT_NAME);
editor.waitTabIsPresent("qa-spring-sample");

View File

@ -10,6 +10,8 @@
*/
package org.eclipse.che.selenium.workspaces;
import static org.eclipse.che.selenium.core.constant.TestWorkspaceConstants.RUNNING_WORKSPACE_MESS;
import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.StateWorkspace.RUNNING;
import static org.testng.Assert.fail;
import com.google.inject.Inject;
@ -19,7 +21,6 @@ import org.eclipse.che.commons.lang.NameGenerator;
import org.eclipse.che.selenium.core.SeleniumWebDriver;
import org.eclipse.che.selenium.core.client.TestProjectServiceClient;
import org.eclipse.che.selenium.core.client.TestWorkspaceServiceClient;
import org.eclipse.che.selenium.core.constant.TestWorkspaceConstants;
import org.eclipse.che.selenium.core.project.ProjectTemplates;
import org.eclipse.che.selenium.core.workspace.TestWorkspace;
import org.eclipse.che.selenium.pageobject.CodenvyEditor;
@ -28,7 +29,9 @@ import org.eclipse.che.selenium.pageobject.Ide;
import org.eclipse.che.selenium.pageobject.Loader;
import org.eclipse.che.selenium.pageobject.ProjectExplorer;
import org.eclipse.che.selenium.pageobject.dashboard.Dashboard;
import org.eclipse.che.selenium.pageobject.dashboard.DashboardWorkspace;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceOverview;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.Workspaces;
import org.openqa.selenium.TimeoutException;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
@ -36,7 +39,7 @@ import org.testng.annotations.Test;
/** @author Aleksandr Shmaraev */
public class ProjectStateAfterRenameWorkspaceTest {
private static final String PROJECT_NAME = NameGenerator.generate("ProjectAfterRenameWs", 4);
private static final String PROJECT_NAME = NameGenerator.generate("project", 4);
private static final String WORKSPACE_NEW_NAME = NameGenerator.generate("rename_ws", 4);
@Inject private TestWorkspace testWorkspace;
@ -45,11 +48,13 @@ public class ProjectStateAfterRenameWorkspaceTest {
@Inject private Loader loader;
@Inject private CodenvyEditor editor;
@Inject private Dashboard dashboard;
@Inject private DashboardWorkspace dashboardWorkspace;
@Inject private WorkspaceDetails workspaceDetails;
@Inject private Events events;
@Inject private SeleniumWebDriver seleniumWebDriver;
@Inject private TestProjectServiceClient testProjectServiceClient;
@Inject private TestWorkspaceServiceClient testWorkspaceServiceClient;
@Inject private Workspaces workspaces;
@Inject private WorkspaceOverview workspaceOverview;
@BeforeClass
public void setUp() throws Exception {
@ -86,17 +91,19 @@ public class ProjectStateAfterRenameWorkspaceTest {
dashboard.open();
dashboard.waitDashboardToolbarTitle();
dashboard.selectWorkspacesItemOnDashboard();
dashboardWorkspace.waitToolbarTitleName("Workspaces");
dashboardWorkspace.selectWorkspaceItemName(testWorkspace.getName());
dashboardWorkspace.enterNameWorkspace(WORKSPACE_NEW_NAME);
dashboardWorkspace.clickOnSaveBtn();
dashboardWorkspace.checkStateOfWorkspace(DashboardWorkspace.StateWorkspace.RUNNING);
dashboardWorkspace.waitToolbarTitleName(WORKSPACE_NEW_NAME);
dashboard.waitToolbarTitleName("Workspaces");
workspaces.selectWorkspaceItemName(testWorkspace.getName());
workspaceOverview.enterNameWorkspace(WORKSPACE_NEW_NAME);
workspaceDetails.clickOnSaveChangesBtn();
workspaceDetails.checkStateOfWorkspace(RUNNING);
workspaceOverview.checkNameWorkspace(WORKSPACE_NEW_NAME);
// open the IDE, check state of the project
dashboardWorkspace.clickOpenInIdeWsBtn();
loader.waitOnClosed();
workspaceDetails.clickOpenInIdeWsBtn();
seleniumWebDriver.switchFromDashboardIframeToIde();
projectExplorer.waitProjectExplorer();
projectExplorer.waitItem(PROJECT_NAME);
try {
@ -109,7 +116,7 @@ public class ProjectStateAfterRenameWorkspaceTest {
projectExplorer.waitItem(
PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/AppController.java");
events.clickEventLogBtn();
events.waitExpectedMessage(TestWorkspaceConstants.RUNNING_WORKSPACE_MESS);
events.waitExpectedMessage(RUNNING_WORKSPACE_MESS);
editor.waitTabIsPresent("index.jsp");
editor.waitTabIsPresent("AppController");
editor.waitActiveEditor();

View File

@ -10,12 +10,14 @@
*/
package org.eclipse.che.selenium.workspaces;
import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.STOP_WORKSPACE;
import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.WORKSPACE;
import com.google.inject.Inject;
import java.net.URL;
import java.nio.file.Paths;
import org.eclipse.che.commons.lang.NameGenerator;
import org.eclipse.che.selenium.core.client.TestProjectServiceClient;
import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants;
import org.eclipse.che.selenium.core.project.ProjectTemplates;
import org.eclipse.che.selenium.core.workspace.TestWorkspace;
import org.eclipse.che.selenium.pageobject.CodenvyEditor;
@ -30,7 +32,7 @@ import org.testng.annotations.Test;
/** @author Aleksandr Shmaraev on 10.03.16 */
public class ProjectStateAfterWorkspaceRestartTest {
private static final String PROJECT_NAME = NameGenerator.generate("Spring_Simple", 4);
private static final String PROJECT_NAME = NameGenerator.generate("project", 4);
private static final String EXP_TEXT_NOT_PRESENT =
"@Override\n" + " public ModelAndView handleRequest";
private boolean passedState = false;
@ -64,7 +66,7 @@ public class ProjectStateAfterWorkspaceRestartTest {
// create workspace from dashboard
projectExplorer.waitProjectExplorer();
projectExplorer.waitItem(PROJECT_NAME);
loader.waitOnClosed();
projectExplorer.selectItem(PROJECT_NAME);
projectExplorer.quickExpandWithJavaScript();
projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/webapp/index.jsp");
editor.waitActiveEditor();
@ -74,9 +76,7 @@ public class ProjectStateAfterWorkspaceRestartTest {
loader.waitOnClosed();
// stop and start workspace
menu.runCommand(
TestMenuCommandsConstants.Workspace.WORKSPACE,
TestMenuCommandsConstants.Workspace.STOP_WORKSPACE);
menu.runCommand(WORKSPACE, STOP_WORKSPACE);
loader.waitOnClosed();
toastLoader.waitToastLoaderIsOpen();
toastLoader.waitExpectedTextInToastLoader("Workspace is not running");

View File

@ -17,9 +17,6 @@ import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.LOADE
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.LOAD_PAGE_TIMEOUT_SEC;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.PREPARING_WS_TIMEOUT_SEC;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.UPDATING_PROJECT_TIMEOUT_SEC;
import static org.eclipse.che.selenium.pageobject.Consoles.CommandsGoal.COMMON;
import static org.eclipse.che.selenium.pageobject.Consoles.CommandsGoal.RUN;
import static org.eclipse.che.selenium.pageobject.dashboard.NavigationBar.MenuItem.WORKSPACES;
import static org.openqa.selenium.Keys.ENTER;
import static org.openqa.selenium.support.ui.ExpectedConditions.presenceOfElementLocated;
import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOfElementLocated;
@ -37,9 +34,10 @@ import org.eclipse.che.selenium.pageobject.Loader;
import org.eclipse.che.selenium.pageobject.ProjectExplorer;
import org.eclipse.che.selenium.pageobject.dashboard.CreateWorkspace;
import org.eclipse.che.selenium.pageobject.dashboard.Dashboard;
import org.eclipse.che.selenium.pageobject.dashboard.DashboardWorkspace;
import org.eclipse.che.selenium.pageobject.dashboard.NavigationBar;
import org.eclipse.che.selenium.pageobject.dashboard.ProjectSourcePage;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.Workspaces;
import org.eclipse.che.selenium.pageobject.machineperspective.MachineTerminal;
import org.openqa.selenium.By;
import org.openqa.selenium.support.ui.WebDriverWait;
@ -67,11 +65,12 @@ public class WorkingWithJavaMySqlStackTest {
@Inject private CreateWorkspace createWorkspace;
@Inject private ProjectSourcePage projectSourcePage;
@Inject private Dashboard dashboard;
@Inject private DashboardWorkspace dashboardWorkspace;
@Inject private WorkspaceDetails workspaceDetails;
@Inject private AskDialog askDialog;
@Inject private MachineTerminal terminal;
@Inject private SeleniumWebDriver seleniumWebDriver;
@Inject private TestWorkspaceServiceClient workspaceServiceClient;
@Inject private Workspaces workspaces;
@AfterClass
public void tearDown() throws Exception {
@ -82,19 +81,19 @@ public class WorkingWithJavaMySqlStackTest {
public void checkJavaMySqlAndRunApp() {
String currentWindow;
// create a workspace from the Java-MySql stack with the web-java-petclinic project
// Create a workspace from the Java-MySql stack with the web-java-petclinic project
dashboard.open();
navigationBar.waitNavigationBar();
navigationBar.clickOnMenu(WORKSPACES);
dashboardWorkspace.waitToolbarTitleName("Workspaces");
dashboardWorkspace.clickOnNewWorkspaceBtn();
dashboard.waitDashboardToolbarTitle();
dashboard.selectWorkspacesItemOnDashboard();
dashboard.waitToolbarTitleName("Workspaces");
workspaces.clickOnNewWorkspaceBtn();
createWorkspace.waitToolbar();
createWorkspace.selectStack(JAVA_MYSQL.getId());
createWorkspace.typeWorkspaceName(WORKSPACE);
projectSourcePage.clickAddOrImportProjectButton();
projectSourcePage.clickOnAddOrImportProjectButton();
projectSourcePage.selectSample(PROJECT_NAME);
projectSourcePage.clickAdd();
createWorkspace.clickCreate();
projectSourcePage.clickOnAddProjectButton();
createWorkspace.clickOnCreateWorkspaceButton();
seleniumWebDriver.switchFromDashboardIframeToIde(LOADER_TIMEOUT_SEC);
currentWindow = seleniumWebDriver.getWindowHandle();
@ -103,14 +102,15 @@ public class WorkingWithJavaMySqlStackTest {
projectExplorer.selectItem(PROJECT_NAME);
// Select the db machine and perform 'show databases'
consoles.startCommandFromProcessesArea("db", COMMON, "show databases");
consoles.startCommandFromProcessesArea("db", Consoles.CommandsGoal.COMMON, "show databases");
consoles.waitTabNameProcessIsPresent("db");
for (String text : infoDataBases) {
consoles.waitExpectedTextIntoConsole(text);
}
// Build and deploy the web application
consoles.startCommandFromProcessesArea("dev-machine", RUN, BUIL_AND_DEPLOY_PROCESS);
consoles.startCommandFromProcessesArea(
"dev-machine", Consoles.CommandsGoal.RUN, BUIL_AND_DEPLOY_PROCESS);
consoles.waitTabNameProcessIsPresent(BUIL_AND_DEPLOY_PROCESS);
consoles.waitProcessInProcessConsoleTree(BUIL_AND_DEPLOY_PROCESS);
consoles.waitExpectedTextIntoConsole(BUILD_SUCCESS, UPDATING_PROJECT_TIMEOUT_SEC);
@ -141,7 +141,7 @@ public class WorkingWithJavaMySqlStackTest {
terminal.waitExpectedTextNotPresentTerminal("catalina.startup.Bootstrap start");
}
/** check main elements of the web-java-petclinic */
// Check main elements of the web-java-petclinic
private void checkWebJavaPetclinicAppl() {
new WebDriverWait(seleniumWebDriver, LOADER_TIMEOUT_SEC)
.until(visibilityOfElementLocated(By.xpath("//h2[text()='Welcome']")));

View File

@ -10,6 +10,7 @@
*/
package org.eclipse.che.selenium.workspaces;
import static org.eclipse.che.selenium.core.constant.TestStacksConstants.NODE;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.APPLICATION_START_TIMEOUT_SEC;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.LOAD_PAGE_TIMEOUT_SEC;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.PREPARING_WS_TIMEOUT_SEC;
@ -22,7 +23,6 @@ import com.google.inject.Inject;
import org.eclipse.che.commons.lang.NameGenerator;
import org.eclipse.che.selenium.core.SeleniumWebDriver;
import org.eclipse.che.selenium.core.client.TestWorkspaceServiceClient;
import org.eclipse.che.selenium.core.constant.TestStacksConstants;
import org.eclipse.che.selenium.core.user.TestUser;
import org.eclipse.che.selenium.pageobject.AskDialog;
import org.eclipse.che.selenium.pageobject.Consoles;
@ -30,9 +30,10 @@ import org.eclipse.che.selenium.pageobject.Ide;
import org.eclipse.che.selenium.pageobject.ProjectExplorer;
import org.eclipse.che.selenium.pageobject.dashboard.CreateWorkspace;
import org.eclipse.che.selenium.pageobject.dashboard.Dashboard;
import org.eclipse.che.selenium.pageobject.dashboard.DashboardWorkspace;
import org.eclipse.che.selenium.pageobject.dashboard.NavigationBar;
import org.eclipse.che.selenium.pageobject.dashboard.ProjectSourcePage;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.Workspaces;
import org.openqa.selenium.By;
import org.openqa.selenium.TimeoutException;
import org.openqa.selenium.support.ui.WebDriverWait;
@ -56,10 +57,11 @@ public class WorkingWithNodeWsTest {
@Inject private CreateWorkspace createWorkspace;
@Inject private ProjectSourcePage projectSourcePage;
@Inject private Dashboard dashboard;
@Inject private DashboardWorkspace dashboardWorkspace;
@Inject private WorkspaceDetails workspaceDetails;
@Inject private AskDialog askDialog;
@Inject private SeleniumWebDriver seleniumWebDriver;
@Inject private TestWorkspaceServiceClient workspaceServiceClient;
@Inject private Workspaces workspaces;
@AfterClass
public void tearDown() throws Exception {
@ -70,19 +72,19 @@ public class WorkingWithNodeWsTest {
public void checkNodeJsWsAndRunApp() {
String currentWindow;
// create a workspace from the Node stack with the web-nodejs-simple project
// Create a workspace from the Node stack with the web-nodejs-simple project
dashboard.open();
navigationBar.waitNavigationBar();
navigationBar.clickOnMenu(NavigationBar.MenuItem.WORKSPACES);
dashboardWorkspace.waitToolbarTitleName("Workspaces");
dashboardWorkspace.clickOnNewWorkspaceBtn();
dashboard.waitDashboardToolbarTitle();
dashboard.selectWorkspacesItemOnDashboard();
dashboard.waitToolbarTitleName("Workspaces");
workspaces.clickOnNewWorkspaceBtn();
createWorkspace.waitToolbar();
createWorkspace.selectStack(TestStacksConstants.NODE.getId());
createWorkspace.selectStack(NODE.getId());
createWorkspace.typeWorkspaceName(WORKSPACE);
projectSourcePage.clickAddOrImportProjectButton();
projectSourcePage.clickOnAddOrImportProjectButton();
projectSourcePage.selectSample(PROJECT_NAME);
projectSourcePage.clickAdd();
createWorkspace.clickCreate();
projectSourcePage.clickOnAddProjectButton();
createWorkspace.clickOnCreateWorkspaceButton();
seleniumWebDriver.switchFromDashboardIframeToIde();
currentWindow = seleniumWebDriver.getWindowHandle();

View File

@ -10,8 +10,6 @@
*/
package org.eclipse.che.selenium.workspaces.notjavastack;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.PREPARING_WS_TIMEOUT_SEC;
import com.google.inject.Inject;
import org.eclipse.che.commons.lang.NameGenerator;
import org.eclipse.che.selenium.core.SeleniumWebDriver;
@ -22,8 +20,9 @@ import org.eclipse.che.selenium.pageobject.Loader;
import org.eclipse.che.selenium.pageobject.ProjectExplorer;
import org.eclipse.che.selenium.pageobject.dashboard.CreateWorkspace;
import org.eclipse.che.selenium.pageobject.dashboard.Dashboard;
import org.eclipse.che.selenium.pageobject.dashboard.DashboardWorkspace;
import org.eclipse.che.selenium.pageobject.dashboard.NavigationBar;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.Workspaces;
import org.eclipse.che.selenium.pageobject.machineperspective.MachineTerminal;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
@ -37,12 +36,13 @@ public class CreateWorkspaceWithAndroidStackTest {
@Inject private NavigationBar navigationBar;
@Inject private CreateWorkspace createWorkspace;
@Inject private Dashboard dashboard;
@Inject private DashboardWorkspace dashboardWorkspace;
@Inject private WorkspaceDetails workspaceDetails;
@Inject private ProjectExplorer projectExplorer;
@Inject private Loader loader;
@Inject private MachineTerminal terminal;
@Inject private SeleniumWebDriver seleniumWebDriver;
@Inject private TestWorkspaceServiceClient workspaceServiceClient;
@Inject private Workspaces workspaces;
@BeforeClass
public void setUp() {
@ -56,21 +56,21 @@ public class CreateWorkspaceWithAndroidStackTest {
@Test
public void createWorkspaceWithAndroidStackTest() {
navigationBar.clickOnMenu(NavigationBar.MenuItem.WORKSPACES);
dashboardWorkspace.waitToolbarTitleName("Workspaces");
dashboardWorkspace.clickOnNewWorkspaceBtn();
dashboard.waitDashboardToolbarTitle();
dashboard.selectWorkspacesItemOnDashboard();
dashboard.waitToolbarTitleName("Workspaces");
workspaces.clickOnNewWorkspaceBtn();
createWorkspace.waitToolbar();
createWorkspace.typeWorkspaceName(WORKSPACE);
createWorkspace.selectStack(TestStacksConstants.ANDROID.getId());
createWorkspace.setMachineRAM("2");
createWorkspace.clickCreate();
createWorkspace.clickOnCreateWorkspaceButton();
dashboard.waitNotificationIsClosed();
seleniumWebDriver.switchFromDashboardIframeToIde();
projectExplorer.waitProjectExplorer();
loader.waitOnClosed();
terminal.waitTerminalConsole(PREPARING_WS_TIMEOUT_SEC);
terminal.waitTerminalTab(60);
}
}

View File

@ -10,8 +10,6 @@
*/
package org.eclipse.che.selenium.workspaces.notjavastack;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.PREPARING_WS_TIMEOUT_SEC;
import com.google.inject.Inject;
import org.eclipse.che.commons.lang.NameGenerator;
import org.eclipse.che.selenium.core.SeleniumWebDriver;
@ -22,8 +20,9 @@ import org.eclipse.che.selenium.pageobject.Loader;
import org.eclipse.che.selenium.pageobject.ProjectExplorer;
import org.eclipse.che.selenium.pageobject.dashboard.CreateWorkspace;
import org.eclipse.che.selenium.pageobject.dashboard.Dashboard;
import org.eclipse.che.selenium.pageobject.dashboard.DashboardWorkspace;
import org.eclipse.che.selenium.pageobject.dashboard.NavigationBar;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.Workspaces;
import org.eclipse.che.selenium.pageobject.machineperspective.MachineTerminal;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
@ -36,12 +35,13 @@ public class CreateWorkspaceWithBlankStackTest {
@Inject private NavigationBar navigationBar;
@Inject private CreateWorkspace createWorkspace;
@Inject private Dashboard dashboard;
@Inject private DashboardWorkspace dashboardWorkspace;
@Inject private WorkspaceDetails workspaceDetails;
@Inject private ProjectExplorer projectExplorer;
@Inject private Loader loader;
@Inject private MachineTerminal terminal;
@Inject private SeleniumWebDriver seleniumWebDriver;
@Inject private TestWorkspaceServiceClient workspaceServiceClient;
@Inject private Workspaces workspaces;
@BeforeClass
public void setUp() {
@ -55,21 +55,21 @@ public class CreateWorkspaceWithBlankStackTest {
@Test
public void createWorkspaceWithBlankStackTest() {
navigationBar.clickOnMenu(NavigationBar.MenuItem.WORKSPACES);
dashboardWorkspace.waitToolbarTitleName("Workspaces");
dashboardWorkspace.clickOnNewWorkspaceBtn();
dashboard.waitDashboardToolbarTitle();
dashboard.selectWorkspacesItemOnDashboard();
dashboard.waitToolbarTitleName("Workspaces");
workspaces.clickOnNewWorkspaceBtn();
createWorkspace.waitToolbar();
createWorkspace.typeWorkspaceName(WORKSPACE);
createWorkspace.selectStack(TestStacksConstants.BLANK.getId());
createWorkspace.setMachineRAM("2");
createWorkspace.clickCreate();
createWorkspace.clickOnCreateWorkspaceButton();
dashboard.waitNotificationIsClosed();
seleniumWebDriver.switchFromDashboardIframeToIde();
projectExplorer.waitProjectExplorer();
loader.waitOnClosed();
terminal.waitTerminalConsole(PREPARING_WS_TIMEOUT_SEC);
terminal.waitTerminalTab(60);
}
}

View File

@ -10,8 +10,6 @@
*/
package org.eclipse.che.selenium.workspaces.notjavastack;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.PREPARING_WS_TIMEOUT_SEC;
import com.google.inject.Inject;
import org.eclipse.che.commons.lang.NameGenerator;
import org.eclipse.che.selenium.core.SeleniumWebDriver;
@ -22,8 +20,9 @@ import org.eclipse.che.selenium.pageobject.Loader;
import org.eclipse.che.selenium.pageobject.ProjectExplorer;
import org.eclipse.che.selenium.pageobject.dashboard.CreateWorkspace;
import org.eclipse.che.selenium.pageobject.dashboard.Dashboard;
import org.eclipse.che.selenium.pageobject.dashboard.DashboardWorkspace;
import org.eclipse.che.selenium.pageobject.dashboard.NavigationBar;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.Workspaces;
import org.eclipse.che.selenium.pageobject.machineperspective.MachineTerminal;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
@ -37,12 +36,13 @@ public class CreateWorkspaceWithCppStackTest {
@Inject private NavigationBar navigationBar;
@Inject private CreateWorkspace createWorkspace;
@Inject private Dashboard dashboard;
@Inject private DashboardWorkspace dashboardWorkspace;
@Inject private WorkspaceDetails workspaceDetails;
@Inject private ProjectExplorer projectExplorer;
@Inject private Loader loader;
@Inject private MachineTerminal terminal;
@Inject private SeleniumWebDriver seleniumWebDriver;
@Inject private TestWorkspaceServiceClient workspaceServiceClient;
@Inject private Workspaces workspaces;
@BeforeClass
public void setUp() {
@ -56,21 +56,21 @@ public class CreateWorkspaceWithCppStackTest {
@Test
public void createWorkspaceWithCppStackTest() {
navigationBar.clickOnMenu(NavigationBar.MenuItem.WORKSPACES);
dashboardWorkspace.waitToolbarTitleName("Workspaces");
dashboardWorkspace.clickOnNewWorkspaceBtn();
dashboard.waitDashboardToolbarTitle();
dashboard.selectWorkspacesItemOnDashboard();
dashboard.waitToolbarTitleName("Workspaces");
workspaces.clickOnNewWorkspaceBtn();
createWorkspace.waitToolbar();
createWorkspace.typeWorkspaceName(WORKSPACE);
createWorkspace.selectStack(TestStacksConstants.CPP.getId());
createWorkspace.setMachineRAM("2");
createWorkspace.clickCreate();
createWorkspace.clickOnCreateWorkspaceButton();
dashboard.waitNotificationIsClosed();
seleniumWebDriver.switchFromDashboardIframeToIde();
projectExplorer.waitProjectExplorer();
loader.waitOnClosed();
terminal.waitTerminalConsole(PREPARING_WS_TIMEOUT_SEC);
terminal.waitTerminalTab(60);
}
}

View File

@ -10,8 +10,6 @@
*/
package org.eclipse.che.selenium.workspaces.notjavastack;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.PREPARING_WS_TIMEOUT_SEC;
import com.google.inject.Inject;
import org.eclipse.che.commons.lang.NameGenerator;
import org.eclipse.che.selenium.core.SeleniumWebDriver;
@ -22,8 +20,9 @@ import org.eclipse.che.selenium.pageobject.Loader;
import org.eclipse.che.selenium.pageobject.ProjectExplorer;
import org.eclipse.che.selenium.pageobject.dashboard.CreateWorkspace;
import org.eclipse.che.selenium.pageobject.dashboard.Dashboard;
import org.eclipse.che.selenium.pageobject.dashboard.DashboardWorkspace;
import org.eclipse.che.selenium.pageobject.dashboard.NavigationBar;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.Workspaces;
import org.eclipse.che.selenium.pageobject.machineperspective.MachineTerminal;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
@ -37,12 +36,13 @@ public class CreateWorkspaceWithNetStackTest {
@Inject private NavigationBar navigationBar;
@Inject private CreateWorkspace createWorkspace;
@Inject private Dashboard dashboard;
@Inject private DashboardWorkspace dashboardWorkspace;
@Inject private WorkspaceDetails workspaceDetails;
@Inject private ProjectExplorer projectExplorer;
@Inject private Loader loader;
@Inject private MachineTerminal terminal;
@Inject private SeleniumWebDriver seleniumWebDriver;
@Inject private TestWorkspaceServiceClient workspaceServiceClient;
@Inject private Workspaces workspaces;
@BeforeClass
public void setUp() {
@ -56,21 +56,21 @@ public class CreateWorkspaceWithNetStackTest {
@Test
public void createWorkspaceWithNetStackTest() {
navigationBar.clickOnMenu(NavigationBar.MenuItem.WORKSPACES);
dashboardWorkspace.waitToolbarTitleName("Workspaces");
dashboardWorkspace.clickOnNewWorkspaceBtn();
dashboard.waitDashboardToolbarTitle();
dashboard.selectWorkspacesItemOnDashboard();
dashboard.waitToolbarTitleName("Workspaces");
workspaces.clickOnNewWorkspaceBtn();
createWorkspace.waitToolbar();
createWorkspace.typeWorkspaceName(WORKSPACE);
createWorkspace.selectStack(TestStacksConstants.DOTNET.getId());
createWorkspace.setMachineRAM("2");
createWorkspace.clickCreate();
createWorkspace.clickOnCreateWorkspaceButton();
dashboard.waitNotificationIsClosed();
seleniumWebDriver.switchFromDashboardIframeToIde();
projectExplorer.waitProjectExplorer();
loader.waitOnClosed();
terminal.waitTerminalConsole(PREPARING_WS_TIMEOUT_SEC);
terminal.waitTerminalTab(60);
}
}

View File

@ -10,8 +10,6 @@
*/
package org.eclipse.che.selenium.workspaces.notjavastack;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.EXPECTED_MESS_IN_CONSOLE_SEC;
import com.google.inject.Inject;
import org.eclipse.che.commons.lang.NameGenerator;
import org.eclipse.che.selenium.core.SeleniumWebDriver;
@ -22,8 +20,9 @@ import org.eclipse.che.selenium.pageobject.Loader;
import org.eclipse.che.selenium.pageobject.ProjectExplorer;
import org.eclipse.che.selenium.pageobject.dashboard.CreateWorkspace;
import org.eclipse.che.selenium.pageobject.dashboard.Dashboard;
import org.eclipse.che.selenium.pageobject.dashboard.DashboardWorkspace;
import org.eclipse.che.selenium.pageobject.dashboard.NavigationBar;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.Workspaces;
import org.eclipse.che.selenium.pageobject.machineperspective.MachineTerminal;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
@ -37,12 +36,13 @@ public class CreateWorkspaceWithNodeStackTest {
@Inject private NavigationBar navigationBar;
@Inject private CreateWorkspace createWorkspace;
@Inject private Dashboard dashboard;
@Inject private DashboardWorkspace dashboardWorkspace;
@Inject private WorkspaceDetails workspaceDetails;
@Inject private ProjectExplorer projectExplorer;
@Inject private Loader loader;
@Inject private MachineTerminal terminal;
@Inject private SeleniumWebDriver seleniumWebDriver;
@Inject private TestWorkspaceServiceClient workspaceServiceClient;
@Inject private Workspaces workspaces;
@BeforeClass
public void setUp() {
@ -56,21 +56,21 @@ public class CreateWorkspaceWithNodeStackTest {
@Test
public void createWorkspaceWithNodeStackTest() {
navigationBar.clickOnMenu(NavigationBar.MenuItem.WORKSPACES);
dashboardWorkspace.waitToolbarTitleName("Workspaces");
dashboardWorkspace.clickOnNewWorkspaceBtn();
dashboard.waitDashboardToolbarTitle();
dashboard.selectWorkspacesItemOnDashboard();
dashboard.waitToolbarTitleName("Workspaces");
workspaces.clickOnNewWorkspaceBtn();
createWorkspace.waitToolbar();
createWorkspace.typeWorkspaceName(WORKSPACE);
createWorkspace.selectStack(TestStacksConstants.NODE.getId());
createWorkspace.setMachineRAM("2");
createWorkspace.clickCreate();
createWorkspace.clickOnCreateWorkspaceButton();
dashboard.waitNotificationIsClosed();
seleniumWebDriver.switchFromDashboardIframeToIde();
projectExplorer.waitProjectExplorer();
loader.waitOnClosed();
terminal.waitTerminalConsole(EXPECTED_MESS_IN_CONSOLE_SEC);
terminal.waitTerminalTab(60);
}
}

View File

@ -10,8 +10,6 @@
*/
package org.eclipse.che.selenium.workspaces.notjavastack;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.PREPARING_WS_TIMEOUT_SEC;
import com.google.inject.Inject;
import org.eclipse.che.commons.lang.NameGenerator;
import org.eclipse.che.selenium.core.SeleniumWebDriver;
@ -22,8 +20,9 @@ import org.eclipse.che.selenium.pageobject.Loader;
import org.eclipse.che.selenium.pageobject.ProjectExplorer;
import org.eclipse.che.selenium.pageobject.dashboard.CreateWorkspace;
import org.eclipse.che.selenium.pageobject.dashboard.Dashboard;
import org.eclipse.che.selenium.pageobject.dashboard.DashboardWorkspace;
import org.eclipse.che.selenium.pageobject.dashboard.NavigationBar;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.Workspaces;
import org.eclipse.che.selenium.pageobject.machineperspective.MachineTerminal;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
@ -37,12 +36,13 @@ public class CreateWorkspaceWithPHPStackTest {
@Inject private NavigationBar navigationBar;
@Inject private CreateWorkspace createWorkspace;
@Inject private Dashboard dashboard;
@Inject private DashboardWorkspace dashboardWorkspace;
@Inject private WorkspaceDetails workspaceDetails;
@Inject private ProjectExplorer projectExplorer;
@Inject private Loader loader;
@Inject private MachineTerminal terminal;
@Inject private SeleniumWebDriver seleniumWebDriver;
@Inject private TestWorkspaceServiceClient workspaceServiceClient;
@Inject private Workspaces workspaces;
@BeforeClass
public void setUp() {
@ -56,21 +56,21 @@ public class CreateWorkspaceWithPHPStackTest {
@Test
public void createWorkspaceWithPHPStackTest() {
navigationBar.clickOnMenu(NavigationBar.MenuItem.WORKSPACES);
dashboardWorkspace.waitToolbarTitleName("Workspaces");
dashboardWorkspace.clickOnNewWorkspaceBtn();
dashboard.waitDashboardToolbarTitle();
dashboard.selectWorkspacesItemOnDashboard();
dashboard.waitToolbarTitleName("Workspaces");
workspaces.clickOnNewWorkspaceBtn();
createWorkspace.waitToolbar();
createWorkspace.typeWorkspaceName(WORKSPACE);
createWorkspace.selectStack(TestStacksConstants.PHP.getId());
createWorkspace.setMachineRAM("2");
createWorkspace.clickCreate();
createWorkspace.clickOnCreateWorkspaceButton();
dashboard.waitNotificationIsClosed();
seleniumWebDriver.switchFromDashboardIframeToIde();
projectExplorer.waitProjectExplorer();
loader.waitOnClosed();
terminal.waitTerminalConsole(PREPARING_WS_TIMEOUT_SEC);
terminal.waitTerminalTab(60);
}
}

View File

@ -10,8 +10,6 @@
*/
package org.eclipse.che.selenium.workspaces.notjavastack;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.PREPARING_WS_TIMEOUT_SEC;
import com.google.inject.Inject;
import org.eclipse.che.commons.lang.NameGenerator;
import org.eclipse.che.selenium.core.SeleniumWebDriver;
@ -22,8 +20,9 @@ import org.eclipse.che.selenium.pageobject.Loader;
import org.eclipse.che.selenium.pageobject.ProjectExplorer;
import org.eclipse.che.selenium.pageobject.dashboard.CreateWorkspace;
import org.eclipse.che.selenium.pageobject.dashboard.Dashboard;
import org.eclipse.che.selenium.pageobject.dashboard.DashboardWorkspace;
import org.eclipse.che.selenium.pageobject.dashboard.NavigationBar;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.Workspaces;
import org.eclipse.che.selenium.pageobject.machineperspective.MachineTerminal;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
@ -37,12 +36,13 @@ public class CreateWorkspaceWithPythonStackTest {
@Inject private NavigationBar navigationBar;
@Inject private CreateWorkspace createWorkspace;
@Inject private Dashboard dashboard;
@Inject private DashboardWorkspace dashboardWorkspace;
@Inject private WorkspaceDetails workspaceDetails;
@Inject private ProjectExplorer projectExplorer;
@Inject private Loader loader;
@Inject private MachineTerminal terminal;
@Inject private SeleniumWebDriver seleniumWebDriver;
@Inject private TestWorkspaceServiceClient workspaceServiceClient;
@Inject private Workspaces workspaces;
@BeforeClass
public void setUp() {
@ -56,21 +56,21 @@ public class CreateWorkspaceWithPythonStackTest {
@Test
public void createWorkspaceWithPythonStackTest() {
navigationBar.clickOnMenu(NavigationBar.MenuItem.WORKSPACES);
dashboardWorkspace.waitToolbarTitleName("Workspaces");
dashboardWorkspace.clickOnNewWorkspaceBtn();
dashboard.waitDashboardToolbarTitle();
dashboard.selectWorkspacesItemOnDashboard();
dashboard.waitToolbarTitleName("Workspaces");
workspaces.clickOnNewWorkspaceBtn();
createWorkspace.waitToolbar();
createWorkspace.typeWorkspaceName(WORKSPACE);
createWorkspace.selectStack(TestStacksConstants.PYTHON.getId());
createWorkspace.setMachineRAM("2");
createWorkspace.clickCreate();
createWorkspace.clickOnCreateWorkspaceButton();
dashboard.waitNotificationIsClosed();
seleniumWebDriver.switchFromDashboardIframeToIde();
projectExplorer.waitProjectExplorer();
loader.waitOnClosed();
terminal.waitTerminalConsole(PREPARING_WS_TIMEOUT_SEC);
terminal.waitTerminalTab(60);
}
}

View File

@ -10,8 +10,6 @@
*/
package org.eclipse.che.selenium.workspaces.notjavastack;
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.PREPARING_WS_TIMEOUT_SEC;
import com.google.inject.Inject;
import org.eclipse.che.commons.lang.NameGenerator;
import org.eclipse.che.selenium.core.SeleniumWebDriver;
@ -22,8 +20,9 @@ import org.eclipse.che.selenium.pageobject.Loader;
import org.eclipse.che.selenium.pageobject.ProjectExplorer;
import org.eclipse.che.selenium.pageobject.dashboard.CreateWorkspace;
import org.eclipse.che.selenium.pageobject.dashboard.Dashboard;
import org.eclipse.che.selenium.pageobject.dashboard.DashboardWorkspace;
import org.eclipse.che.selenium.pageobject.dashboard.NavigationBar;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails;
import org.eclipse.che.selenium.pageobject.dashboard.workspaces.Workspaces;
import org.eclipse.che.selenium.pageobject.machineperspective.MachineTerminal;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
@ -37,12 +36,13 @@ public class CreateWorkspaceWithRailsStackTest {
@Inject private NavigationBar navigationBar;
@Inject private CreateWorkspace createWorkspace;
@Inject private Dashboard dashboard;
@Inject private DashboardWorkspace dashboardWorkspace;
@Inject private WorkspaceDetails workspaceDetails;
@Inject private ProjectExplorer projectExplorer;
@Inject private Loader loader;
@Inject private MachineTerminal terminal;
@Inject private SeleniumWebDriver seleniumWebDriver;
@Inject private TestWorkspaceServiceClient workspaceServiceClient;
@Inject private Workspaces workspaces;
@BeforeClass
public void setUp() {
@ -56,21 +56,21 @@ public class CreateWorkspaceWithRailsStackTest {
@Test
public void createWorkspaceWithRailsStackTest() {
navigationBar.clickOnMenu(NavigationBar.MenuItem.WORKSPACES);
dashboardWorkspace.waitToolbarTitleName("Workspaces");
dashboardWorkspace.clickOnNewWorkspaceBtn();
dashboard.waitDashboardToolbarTitle();
dashboard.selectWorkspacesItemOnDashboard();
dashboard.waitToolbarTitleName("Workspaces");
workspaces.clickOnNewWorkspaceBtn();
createWorkspace.waitToolbar();
createWorkspace.typeWorkspaceName(WORKSPACE);
createWorkspace.selectStack(TestStacksConstants.RAILS.getId());
createWorkspace.setMachineRAM("2");
createWorkspace.clickCreate();
createWorkspace.clickOnCreateWorkspaceButton();
dashboard.waitNotificationIsClosed();
seleniumWebDriver.switchFromDashboardIframeToIde();
projectExplorer.waitProjectExplorer();
loader.waitOnClosed();
terminal.waitTerminalConsole(PREPARING_WS_TIMEOUT_SEC);
terminal.waitTerminalTab(60);
}
}