Skip to content

Selenium: Create test 'ImportAndValidateEclipseCheProjectTest'#10558

Merged
artaleks9 merged 12 commits intomasterfrom
che#10107
Jul 27, 2018
Merged

Selenium: Create test 'ImportAndValidateEclipseCheProjectTest'#10558
artaleks9 merged 12 commits intomasterfrom
che#10107

Conversation

@artaleks9
Copy link
Copy Markdown
Contributor

What does this PR do?

  • Create the selenium test 'ImportAndValidateEclipseCheProjectTest'
  • Correct the methods in the 'InformationDialog' using the 'SeleniumWebDriverHelper'
  • Correct the methods in the 'MavenPluginStatusBar' using the 'SeleniumWebDriverHelper'

What issues does this PR fix or reference?

#10107

@artaleks9 artaleks9 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. team/che-qe labels Jul 26, 2018
@artaleks9 artaleks9 requested a review from vparfonov as a code owner July 26, 2018 16:06
@artaleks9
Copy link
Copy Markdown
Contributor Author

ci-test

@riuvshin
Copy link
Copy Markdown
Contributor

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

// TODO it is the workaround, delete it after resolve the issue
// TODO https://github.com/eclipse/che/issues/10515
// close unexpected error information dialog and click on the 'Save' button;
int counterErrorDialog = 0;
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.

please encapsulate this logic to the method for more readability

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.

Even more. Better to use the next construction:

webDriverWaitFactory.get().until((ExpectedCondition<Boolean>) driver -> {
      informationDialog.waitFormToOpen();
      informationDialog.clickOkBtn();
      projectWizard.clickSaveButton();
      loader.waitOnClosed();
      return informationDialog.waitFormIsOpened();
    });

In this case we explicitely provide time for event waiting.
In case of using "while" the infinite loop is possible.

seleniumWebDriverHelper.waitVisibility(dialogForm);
}

public boolean waitFormIsOpened() {
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.

isFormOpened()

loader.waitOnClosed();
}

System.out.println(
Copy link
Copy Markdown
Contributor

@Ohrimenko1988 Ohrimenko1988 Jul 27, 2018

Choose a reason for hiding this comment

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

Looks redundant.

// then open files
// open a java file
projectExplorer.quickRevealToItemWithJavaScript(
String.format("%s/%s", PROJECT_NAME, PATH_TO_JAVA_FILE));
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.

What about creating the constant for this path?


// open a xml file
projectExplorer.quickRevealToItemWithJavaScript(
String.format("%s/%s", PROJECT_NAME, PATH_TO_POM_FILE));
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.

Constant?


// open a ts file
projectExplorer.quickRevealToItemWithJavaScript(
String.format("%s/%s", PROJECT_NAME, PATH_TO_TS_FILE));
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.

Constant?


// open the resolving dependencies form
loader.waitOnClosed();
mavenPluginStatusBar.waitExpectedTextInInfoPanel("Resolving project:", 120);
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.

Please create variable or constant which describes this "magic number". I mean "120"

mavenPluginStatusBar.waitResolveDependenciesFormToOpen();

// wait while dependencies are resolved
mavenPluginStatusBar.waitClosingInfoPanel(2900);
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.

Magic number

@Test(priority = 1)
public void checkErrorMarkersInEditor() {
// check an error marker in the pom.xml file
projectExplorer.openItemByPath(String.format("%s/%s", PROJECT_NAME, PATH_TO_POM_FILE));
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.

Constant

editor.waitMarkerInvisibility(ERROR, 12);

// check error marker in the ts file
projectExplorer.openItemByPath(String.format("%s/%s", PROJECT_NAME, PATH_TO_TS_FILE));
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.

Constant


@Test
public void checkImportAndResolveDependenciesEclipceCheProject() {
int timeoutToOpenInfoPanel = 120;
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.

they should be "final"

final int timeoutToOpenInfoPanel = 120;
final int timeoutToClosingInfoPanel = 2900;

projectExplorer.quickRevealToItemWithJavaScript(
String.format("%s/%s", PROJECT_NAME, PATH_TO_POM_FILE));
projectExplorer.openItemByPath(String.format("%s/%s", PROJECT_NAME, PATH_TO_POM_FILE));
projectExplorer.quickRevealToItemWithJavaScript(PATH_TO_POM_FILE);
Copy link
Copy Markdown
Contributor

@Ohrimenko1988 Ohrimenko1988 Jul 27, 2018

Choose a reason for hiding this comment

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

this place repeats several times:

 projectExplorer.quickRevealToItemWithJavaScript( ... );
 projectExplorer.openItemByPath( ... );

what about to create a private method in the test or public method in the "ProjectExplorer" which will encapsulate this two methods, something like that:

private void quickRevealToItemWithJavaScriptAndOpenFile(String pathToItem){
    projectExplorer.quickRevealToItemWithJavaScript(pathToItem);
    projectExplorer.openItemByPath(pathToItem);
  }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I agree. I think it is better to do in the test.


if (counterErrorDialog > 5) {

Assert.assertEquals(
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.

"assertEquals" looks redundant, in my opinion, "Assert.fail()" is better to use in this case:

fail("The unexpected error information dialog is appeared more than "+ counterErrorDialog +" times");

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

OK

@artaleks9 artaleks9 merged commit 77b39fc into master Jul 27, 2018
@artaleks9 artaleks9 deleted the che#10107 branch July 27, 2018 14:49
@benoitf benoitf added this to the 6.9.0 milestone Jul 27, 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 Jul 27, 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.

5 participants