Skip to content

Selenium: cover workspace creation from CentOS stacks by selenium tests#10255

Merged
SkorikSergey merged 16 commits intomasterfrom
createTestsFromCentosStacks
Jul 9, 2018
Merged

Selenium: cover workspace creation from CentOS stacks by selenium tests#10255
SkorikSergey merged 16 commits intomasterfrom
createTestsFromCentosStacks

Conversation

@SkorikSergey
Copy link
Copy Markdown
Contributor

@SkorikSergey SkorikSergey commented Jul 4, 2018

What does this PR do?

This PR creates selenium tests that cover workspace creation from next CentOS stacks:

  • CentOS blank
  • CentOS Go
  • CentOS nodejs
  • CentOS WildFly Swarm
  • Java CentOS
  • Java-MySQL CentOS
  • Android
  • Ceylon with Java JavaScript Dart on CentOS
  • Eclipse Vert.x
  • Spring Boot

What issues does this PR fix or reference?

#10250, #10050

Release Notes

Docs PR

@SkorikSergey SkorikSergey added status/in-progress This issue has been taken by an engineer and is under active development. kind/task Internal things, technical debt, and to-do tasks to be performed. team/che-qe labels Jul 4, 2018
@SkorikSergey SkorikSergey requested a review from vparfonov as a code owner July 4, 2018 07:20
@SkorikSergey
Copy link
Copy Markdown
Contributor Author

ci-test

@codenvy-ci
Copy link
Copy Markdown

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

@SkorikSergey
Copy link
Copy Markdown
Contributor Author

ci-test

@codenvy-ci
Copy link
Copy Markdown

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

@SkorikSergey
Copy link
Copy Markdown
Contributor Author

ci-test

@codenvy-ci
Copy link
Copy Markdown

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

@SkorikSergey SkorikSergey requested a review from dmytro-ndp July 5, 2018 11:54
@SkorikSergey SkorikSergey added status/code-review This issue has a pull request posted for it and is awaiting code review completion by the community. and removed status/in-progress This issue has been taken by an engineer and is under active development. labels Jul 5, 2018
public static final String BUILD_FAILED = "[INFO] BUILD FAILURE";
public static final String SERVER_STARTUP_IN = "Server startup in";
public static final String LISTENING_AT_ADDRESS = "Listening for transport dt_socket at address";
public static final String LISTENING_AT_ADDRESS_8000 =
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can simplify it as follow:
LISTENING_AT_ADDRESS_8000 = LISTENING_AT_ADDRESS + ": 8000";

String machineName,
ContextMenuCommandGoals commandGoal,
String commandName,
String expectedMessageInTerminal) {
Copy link
Copy Markdown
Contributor

@dmytro-ndp dmytro-ndp Jul 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Console or Terminal? Consistent names make the code clearer.

return switchToIdeAndWaitWorkspaceIsReadyToUse(APPLICATION_START_TIMEOUT_SEC);
}

public String switchToIdeAndWaitWorkspaceIsReadyToUse(int timeout) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

timeoutInSec name helps to understand metric of variable.

}

@Test(priority = 1)
public void checkDesktopGoSimpleProjectCommandsStack() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too complex name IMHO. It would be better to have it rewrote with "of".

}

@Test(priority = 1)
public void checkWebGoSimpleProjectCommandsStack() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too complex name IMHO. It would be better to have it rewrote with "of".

RUN_GOAL,
BUILD_AND_RUN_COMMAND_ITEM.getItem(WEB_JAVA_SPRING),
SERVER_STARTUP_IN);
consoles.checkWebElementVisibilityAtPreviewPage(By.xpath("//span[text()='Enter your name: ']"));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Define "//span[text()='Enter your name: ']" string as a constant will make the code clear, IMHO, and will allow to avoid duplication.

consoles.selectProcessInProcessConsoleTreeByName("Terminal");
terminal.typeIntoTerminal("ps ax");
terminal.typeIntoTerminal(ENTER.toString());
terminal.waitExpectedTextNotPresentTerminal("/bin/bash -c $TOMCAT_HOME/bin/catalina.sh");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not quite clear what "/bin/bash -c $TOMCAT_HOME/bin/catalina.sh" is about. From this point it would be better to name the string.

public class CreateWorkspaceFromJavaMySqlCentosStackTest {

private static final String WORKSPACE_NAME = generate("workspace", 4);
private static final String WEB_JAVA_PETCLINIC = "web-java-petclinic";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If web-java-petclinic is the name of project, let's name the constant WEB_JAVA_PROJECT.

public void checkWebJavaPetclinicProjectCommands() {
projectExplorer.openItemByPath(WEB_JAVA_PETCLINIC);

consoles.executeCommandFromProcessesArea(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not quite clear what next sequence of command is doing exactly. Could you, please, comment it in the code?

"db", COMMON_GOAL, "show databases", "information_schema");

consoles.executeCommandFromProcessesArea(
"dev-machine", COMMON_GOAL, BUILD_COMMAND, BUILD_SUCCESS);
Copy link
Copy Markdown
Contributor

@dmytro-ndp dmytro-ndp Jul 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defining "dev-machine" string as a constant will make the code clear, IMHO, and will allow to avoid duplication.

consoles.selectProcessInProcessConsoleTreeByName("Terminal");
terminal.typeIntoTerminal("ps ax");
terminal.typeIntoTerminal(ENTER.toString());
terminal.waitExpectedTextNotPresentTerminal("$TOMCAT_HOME/bin/catalina.sh");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not quite clear what "$TOMCAT_HOME/bin/catalina.sh" is about. From this point it would be better to name the string.

RUN_GOAL,
BUILD_AND_DEPLOY_COMMAND_ITEM.getItem(WEB_JAVA_PETCLINIC),
"Server startup in");
consoles.checkWebElementVisibilityAtPreviewPage(By.xpath("//h2[text()='Welcome']"));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not quite clear what "//h2[text()='Welcome']" is about. From this point it would be better to name the string.

STOP_TOMCAT_COMMAND_ITEM.getItem(WEB_JAVA_PETCLINIC),
"dev-machine");
consoles.selectProcessInProcessConsoleTreeByName("Terminal");
terminal.typeIntoTerminal("ps ax");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not quite clear what "ps ax" is about. From this point it would be better to name the string.

public class CreateWorkspaceFromJavaStackTest {

private static final String WORKSPACE_NAME = generate("workspace", 4);
private static final String CONSOLE_JAVA_SIMPLE = "console-java-simple";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If console-java-simple is the name of project, let's name the constant CONSOLE_JAVA_PROJECT.


private static final String WORKSPACE_NAME = generate("workspace", 4);
private static final String CONSOLE_JAVA_SIMPLE = "console-java-simple";
private static final String WEB_JAVA_SPRING = "web-java-spring";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If web-java-spring is the name of project, let's name the constant WEB_JAVA_SPRING_PROJECT.

public class CreateWorkspaceFromSpringBootStackTest {

private static final String WORKSPACE_NAME = generate("workspace", 4);
private static final String SPRING_BOOT_HEALTH_CHECK_BOOSTER = "spring-boot-health-check-booster";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SPRING_BOOT_HEALTH_CHECK_PROJECT?


private static final String WORKSPACE_NAME = generate("workspace", 4);
private static final String SPRING_BOOT_HEALTH_CHECK_BOOSTER = "spring-boot-health-check-booster";
private static final String SPRING_BOOT_HTTP_BOOSTER = "spring-boot-http-booster";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SPRING_BOOT_HTTP_PROJECT?

createWorkspaceHelper.createWorkspaceFromStackWithProjects(
SPRING_BOOT, WORKSPACE_NAME, projects);

ide.switchToIdeAndWaitWorkspaceIsReadyToUse(PREPARING_WS_TIMEOUT_SEC * 2);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to comment on the * 2 why it's needed here.


@Test(priority = 1)
public void checkSpringBootHealthCheckBoosterProjectCommands() {
consoles.executeCommandFromProjectExplorer(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not quite clear what next sequence of command is doing exactly. Could you, please, comment it in the code?

consoles.executeCommandFromProjectExplorer(
SPRING_BOOT_HEALTH_CHECK_BOOSTER, RUN_GOAL, RUN_COMMAND, "Started BoosterApplication in");
consoles.checkWebElementVisibilityAtPreviewPage(
By.xpath("//h2[text()='Health Check Booster']"));
Copy link
Copy Markdown
Contributor

@dmytro-ndp dmytro-ndp Jul 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defining "//h2[text()='Health Check Booster']" string as a constant will make the code clear, IMHO, and will allow to avoid duplication.


@Test(priority = 1)
public void checkSpringBooHttpBoosterProjectCommands() {
consoles.executeCommandFromProjectExplorer(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not quite clear what next sequence of command is doing exactly. Could you, please, comment it in the code?

@SkorikSergey SkorikSergey requested a review from artaleks9 July 6, 2018 06:26
@SkorikSergey
Copy link
Copy Markdown
Contributor Author

ci-build

@codenvy-ci
Copy link
Copy Markdown

@SkorikSergey SkorikSergey merged commit 14e3048 into master Jul 9, 2018
@SkorikSergey SkorikSergey deleted the createTestsFromCentosStacks branch July 9, 2018 15:26
@benoitf benoitf removed the status/code-review This issue has a pull request posted for it and is awaiting code review completion by the community. label Jul 9, 2018
@benoitf benoitf added this to the 6.8.0 milestone Jul 9, 2018
hbhargav pushed a commit to hbhargav/che that referenced this pull request Dec 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/task Internal things, technical debt, and to-do tasks to be performed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants