Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework ConvertToProjectWithPomFileTest test for checking conversion folders to maven multimodule project #11427

Merged
merged 8 commits into from
Oct 2, 2018

Conversation

musienko-maxim
Copy link
Contributor

@musienko-maxim musienko-maxim commented Oct 1, 2018

What does this PR do?

  • Implement scenario which was described in the issue: [Che-6] Create selenium test for checking add maven project and module #6905
  • Fix getProject method (add authorize header) for correct working on multiuser/OpenShift assemblies
  • Fix template for maven project (artifactId was the same for parent and module and this produces conflict)
  • Add undefined project type for checking autosetting type for projects like this

What issues does this PR fix or reference?

#6905

@benoitf benoitf added status/code-review This issue has a pull request posted for it and is awaiting code review completion by the community. kind/task Internal things, technical debt, and to-do tasks to be performed. labels Oct 1, 2018
*/
package org.eclipse.che.selenium.miscellaneous;

import static java.lang.String.*;
Copy link
Contributor

Choose a reason for hiding this comment

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

As far as I know, the common import is a bad practice. Please import relations directly.

import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

/** @author Aleksandr Shmaraev */
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the author name correct?

convertPredefinedFolderToMavenProjectWithContextMenu(
format("%s/%s", PROJECT_NAME, WEB_APP_MODULE));
testProjectServiceClient.checkProjectType(
workspaceId, format("%s/%s", PROJECT_NAME, WEB_APP_MODULE), "maven");
Copy link
Contributor

Choose a reason for hiding this comment

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

What about move all these items to the upper of the test and declare them as constants.

final String convertPath = format("%s/%s", PROJECT_NAME, WEB_APP_MODULE);

workspaceId, format("%s/%s", PROJECT_NAME, WEB_APP_MODULE), "maven");
addParentConfigurationToPredefinedFolder();
menu.runCommand(
TestMenuCommandsConstants.Project.PROJECT,
Copy link
Contributor

Choose a reason for hiding this comment

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

Static import?

public void shouldNotConvertToMavenProject() {
projectExplorer.waitAndSelectItem(NONE_MAVEN_PROJECT);
menu.runCommand(
TestMenuCommandsConstants.Project.PROJECT,
Copy link
Contributor

Choose a reason for hiding this comment

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

Static import?

@@ -293,6 +293,7 @@ private ProjectConfig getProject(String workspaceId, String projectName) throws
return requestFactory
.fromUrl(workspaceAgentApiEndpointUrlProvider.get(workspaceId) + "project/" + projectName)
.useGetMethod()
.setAuthorizationHeader(machineServiceClient.getMachineApiToken(workspaceId))
Copy link
Contributor

@dmytro-ndp dmytro-ndp Oct 2, 2018

Choose a reason for hiding this comment

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

Should there be added prefix BEARER_TOKEN_PREFIX + as well?

@@ -25,6 +25,7 @@
public static final String CONSOLE_JAVA_SIMPLE = "console_java_simple.json";
public static final String GO = "go.json";
public static final String DOT_NET = "dotNet.json";
public static final String UNDEFINED_PROJECT = "undefined.json";
Copy link
Contributor

Choose a reason for hiding this comment

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

IMHO next name would better reflect template proposal: PROJECT_OF_UNDEFINED_TYPE

@Inject private TestProjectServiceClient testProjectServiceClient;
@Inject private SeleniumWebDriver seleniumWebDriver;
private String workspaceId;
@BeforeClass
Copy link
Contributor

Choose a reason for hiding this comment

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

Please, add empty line to improve readability.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

convertToMavenByhWizard("/" + PROJECT_NAME, WEB_APP_MODULE);
}

private void convertToMavenByhWizard(String pathToDirectory, String convertedFolder) {
Copy link
Contributor

@dmytro-ndp dmytro-ndp Oct 2, 2018

Choose a reason for hiding this comment

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

typo convertToMavenByhWizard
Also, this method could be useful for other tests, and would be better moved into the Wizard page object.

private static final String PROJECT_NAME = NameGenerator.generate("project", 4);
private static final String WEB_APP_MODULE = "my-webapp";
private static final String NONE_MAVEN_PROJECT = NameGenerator.generate("noneMavenProject", 4);
private static final String PARENT_INFORMATION =
Copy link
Contributor

@dmytro-ndp dmytro-ndp Oct 2, 2018

Choose a reason for hiding this comment

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

I would suggest to use more specific name PARENT_ARTIFACT_SECTION.

wizard.waitCloseProjectConfigForm();
}

private void addParentConfigurationToPredefinedFolder() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would suggest to use more specific name addParentArticatSectionIntoPomFile

import org.testng.annotations.Test;

/** @author Aleksandr Shmaraev, Musienko Maxim */
public class CheckConvertingToMavenProjectTest {
Copy link
Contributor

Choose a reason for hiding this comment

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

Test name could be simplified slightly: ConvertToMavenProjectTest

@dmytro-ndp
Copy link
Contributor

ci-build

@musienko-maxim
Copy link
Contributor Author

ci-build

@musienko-maxim musienko-maxim merged commit 4d05e9c into master Oct 2, 2018
@musienko-maxim musienko-maxim deleted the CHE#6905 branch October 2, 2018 15:07
@benoitf benoitf added this to the 6.12.0 milestone Oct 2, 2018
@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 Oct 2, 2018
nickboldt pushed a commit to nickboldt/che that referenced this pull request Oct 3, 2018
…olders to maven multimodule project (eclipse-che#11427)

Rework ConvertToProjectWithPomFileTest test for checking conversion folders to maven multimodule project
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/task Internal things, technical debt, and to-do tasks to be performed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants