Skip to content

Commit

Permalink
Selenium: Correct the e2e selenium tests related to changes on dashbo…
Browse files Browse the repository at this point in the history
…ard (#13884)
  • Loading branch information
artaleks9 authored Jul 17, 2019
1 parent adcf347 commit e965a9d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

import static org.eclipse.che.commons.lang.NameGenerator.generate;
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.WorkspaceDetailsTab.PROJECTS;

import com.google.inject.Inject;
Expand All @@ -40,7 +39,7 @@
public class CreateAndDeleteProjectsTest {

private static final String WORKSPACE = generate("workspace", 4);
private static final String SECOND_WEB_JAVA_SPRING_PROJECT_NAME = WEB_JAVA_SPRING + "-1";
private static final String SECOND_CONSOLE_JAVA_SIMPLE_PROJECT_NAME = CONSOLE_JAVA_SIMPLE + "-1";

private String dashboardWindow;

Expand Down Expand Up @@ -82,18 +81,13 @@ public void createProjectTest() {
// we are selecting 'Java' stack from the 'All Stack' tab for compatibility with OSIO
newWorkspace.selectStack(Stack.JAVA_MAVEN);
newWorkspace.typeWorkspaceName(WORKSPACE);
projectSourcePage.waitCreatedProjectButton(CONSOLE_JAVA_SIMPLE);

// create 'web-java-spring' and 'console-java-simple' projects
// create 'console-java-simple-1' project
projectSourcePage.clickOnAddOrImportProjectButton();
projectSourcePage.selectSample(WEB_JAVA_SPRING);
projectSourcePage.selectSample(CONSOLE_JAVA_SIMPLE);
projectSourcePage.clickOnAddProjectButton();

// create 'web-java-spring-1' project
projectSourcePage.clickOnAddOrImportProjectButton();
projectSourcePage.selectSample(WEB_JAVA_SPRING);
projectSourcePage.clickOnAddProjectButton();

newWorkspace.clickOnCreateButtonAndOpenInIDE();
// store info about created workspace to make SeleniumTestHandler.captureTestWorkspaceLogs()
// possible to read logs in case of test failure
Expand All @@ -110,8 +104,8 @@ public void createProjectTest() {
theiaProjectTree.clickOnFilesTab();
theiaProjectTree.waitProjectsRootItem();
theiaProjectTree.waitProjectAreaOpened();
theiaProjectTree.waitItem(WEB_JAVA_SPRING);
theiaProjectTree.waitItem(CONSOLE_JAVA_SIMPLE);
theiaProjectTree.waitItem(SECOND_CONSOLE_JAVA_SIMPLE_PROJECT_NAME);
}

@Test(priority = 1)
Expand All @@ -124,20 +118,16 @@ public void deleteProjectsFromDashboardTest() {
workspaces.selectWorkspaceItemName(WORKSPACE);
workspaceDetails.selectTabInWorkspaceMenu(PROJECTS);

deleteProject(WEB_JAVA_SPRING);

workspaceProjects.waitProjectIsPresent(SECOND_WEB_JAVA_SPRING_PROJECT_NAME);

deleteProject(CONSOLE_JAVA_SIMPLE);

workspaceProjects.waitProjectIsPresent(SECOND_CONSOLE_JAVA_SIMPLE_PROJECT_NAME);
}

private void deleteProject(String projectName) {
workspaceProjects.waitProjectIsPresent(projectName);

workspaceProjects.clickOnCheckbox(projectName);
workspaceProjects.clickOnDeleteButton();
workspaceDetails.clickOnDeleteButtonInDialogWindow();

workspaceProjects.waitProjectIsNotPresent(projectName);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
package org.eclipse.che.selenium.dashboard;

import static org.eclipse.che.selenium.pageobject.dashboard.ProjectSourcePage.Template.WEB_JAVA_SPRING;
import static org.eclipse.che.selenium.pageobject.dashboard.ProjectSourcePage.Template.CONSOLE_JAVA_SIMPLE;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;

Expand Down Expand Up @@ -39,11 +39,8 @@ public class CreateWorkspaceTest {
private static final String WS_NAME_TOO_LONG =
("The name has to be less than 100 characters long.");

private String projectName = WEB_JAVA_SPRING;
private String projectName = CONSOLE_JAVA_SIMPLE;
private String newProjectName = projectName + "-1";
private String projectDescription =
"A basic example using Spring servlets. The app returns values entered into a submit form.";
private String newProjectDescription = "This is " + projectDescription;

@Inject private Dashboard dashboard;
@Inject private NewWorkspace newWorkspace;
Expand All @@ -66,53 +63,39 @@ private void openNewWorkspacePage() {
public void checkWorkspaceName() {
newWorkspace.typeWorkspaceName(TOO_SHORT_WORKSPACE_NAME);
newWorkspace.waitErrorMessage(WS_NAME_TOO_SHORT);

newWorkspace.waitBottomCreateWorkspaceButtonDisabled();

newWorkspace.typeWorkspaceName(TOO_LONG_WORKSPACE_NAME);
newWorkspace.waitErrorMessage(WS_NAME_TOO_LONG);
newWorkspace.waitBottomCreateWorkspaceButtonDisabled();

// type valid names and check that the Create button is enabled
newWorkspace.typeWorkspaceName(MIN_VALID_WORKSPACE_NAME);
newWorkspace.waitBottomCreateWorkspaceButtonEnabled();

newWorkspace.typeWorkspaceName(WORKSPACE_NAME);
newWorkspace.waitBottomCreateWorkspaceButtonEnabled();

newWorkspace.typeWorkspaceName(MAX_VALID_WORKSPACE_NAME);
newWorkspace.waitBottomCreateWorkspaceButtonEnabled();
}

@Test
public void checkProjectSourcePage() {
// add a project from the 'web-java-spring' sample
// add a project from the 'console-java-simple' sample
newWorkspace.selectStack(Stack.JAVA_MAVEN);
projectSourcePage.clickOnAddOrImportProjectButton();
projectSourcePage.selectSample(projectName);
projectSourcePage.clickOnAddProjectButton();
projectSourcePage.waitOpened();
projectSourcePage.waitCreatedProjectButton(projectName);
projectSourcePage.clickOnCreateProjectButton(projectName);

// change the added project's name and cancel changes
assertEquals(projectSourcePage.getProjectName(), projectName);
assertEquals(projectSourcePage.getProjectDescription(), projectDescription);
projectSourcePage.changeProjectName(newProjectName);
projectSourcePage.changeProjectDescription(newProjectDescription);
assertEquals(projectSourcePage.getProjectDescription(), newProjectDescription);
assertEquals(projectSourcePage.getProjectName(), newProjectName);
projectSourcePage.clickOnCancelChangesButton();
assertEquals(projectSourcePage.getProjectName(), projectName);
assertEquals(projectSourcePage.getProjectDescription(), projectDescription);
projectSourcePage.waitCreatedProjectButton(projectName);

// change the added project's name and description
projectSourcePage.changeProjectName(newProjectName);
projectSourcePage.changeProjectDescription(newProjectDescription);
assertEquals(projectSourcePage.getProjectDescription(), newProjectDescription);
assertEquals(projectSourcePage.getProjectName(), newProjectName);
projectSourcePage.clickOnSaveChangesButton();
assertEquals(projectSourcePage.getProjectDescription(), newProjectDescription);
assertEquals(projectSourcePage.getProjectName(), newProjectName);
projectSourcePage.waitCreatedProjectButton(newProjectName);

Expand Down

0 comments on commit e965a9d

Please sign in to comment.