Skip to content

Create new test for covering Refactoring ->Rename feature for DotNet LS#11006

Merged
musienko-maxim merged 17 commits intomasterfrom
CHE#10195
Sep 4, 2018
Merged

Create new test for covering Refactoring ->Rename feature for DotNet LS#11006
musienko-maxim merged 17 commits intomasterfrom
CHE#10195

Conversation

@musienko-maxim
Copy link
Copy Markdown
Contributor

@musienko-maxim musienko-maxim commented Aug 31, 2018

What does this PR do?

  • Implement functional test for checking renaming class in DotNet projects.
  • Add new simple (hello world) DotNet project to project templates
  • Add new methods and locators for performing renaming with Cshrp LS.

What issues does this PR fix or reference?

#10195
@dmytro-ndp, @Ohrimenko1988, @SkorikSergey

@musienko-maxim musienko-maxim changed the title Create new test for covering Refactoring ->Rename feature for DotNet LS [WIP] Create new test for covering Refactoring ->Rename feature for DotNet LS Aug 31, 2018
@musienko-maxim musienko-maxim added the status/in-progress This issue has been taken by an engineer and is under active development. label Aug 31, 2018
@benoitf benoitf added the kind/task Internal things, technical debt, and to-do tasks to be performed. label Aug 31, 2018
@musienko-maxim musienko-maxim changed the title [WIP] Create new test for covering Refactoring ->Rename feature for DotNet LS Create new test for covering Refactoring ->Rename feature for DotNet LS Sep 3, 2018
public void checkRenaming() {
String newClassName = "HelloWorld";
String textFragmentAfterRenaming = "public class HelloWorld";
projectExplorer.openItemByPath(PROJECT_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.

This project was already opened in setUp() method(line 71).

*
* @param renamevalue
*/
public void doRenamingByLanguageServerField(String renamevalue) {
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 maybe better to rename variable to 'renameValue'

}

/**
* wait renaming field in the Editor (usually it field is used by language servers) type new
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.

Maybe there need a comma after brackets

* @param renamevalue
*/
public void doRenamingByLanguageServerField(String renamevalue) {
seleniumWebDriverHelper
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 use "SeleniumWebDriverHelper#setText(WebElement webElement, String value)"

editor.waitTextIntoEditor(textFragmentAfterRenaming);
} catch (TimeoutException ex) {
// remove try-catch block after issue has been resolved
fail("Known issue https://github.com/eclipse/che/issues/10180", ex);
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.

Is it permanent failure? If so, it's better to express it in error message like the follow:

Known permanent failure https://github.com/eclipse/che/issues/10180


@BeforeClass
public void setUp() throws Exception {
URL resource = getClass().getResource("/projects/CsharpHelloWorld");
Copy link
Copy Markdown
Contributor

@dmytro-ndp dmytro-ndp Sep 3, 2018

Choose a reason for hiding this comment

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

To be consistent: CsharpHelloWorld > CSharpHelloWorld

* Red Hat, Inc. - initial API and implementation
*/
package org.eclipse.che.selenium.languageserver;
package org.eclipse.che.selenium.languageserver.Csharp;
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.

package name should be in lower case: Csharp > csharp

import static org.eclipse.che.selenium.pageobject.CodenvyEditor.Locators.IMPLEMENTATION_CONTAINER;
import static org.eclipse.che.selenium.pageobject.CodenvyEditor.Locators.ITEM_TAB_LIST;
import static org.eclipse.che.selenium.pageobject.CodenvyEditor.Locators.JAVA_DOC_POPUP;
import static org.eclipse.che.selenium.pageobject.CodenvyEditor.Locators.LANGUAGE_SERVER_RENFACTORING_RENAME_FIELD_CSS;
Copy link
Copy Markdown
Contributor

@dmytro-ndp dmytro-ndp Sep 3, 2018

Choose a reason for hiding this comment

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

typo RENFACTORING

String HOVER_POPUP_XPATH =
"//div[@class='textviewTooltip' and contains(@style,'visibility: visible')]";
String AUTOCOMPLETE_PROPOSAL_DOC_ID = "gwt-debug-content-assistant-doc-popup";
String LANGUAGE_SERVER_RENFACTORING_RENAME_FIELD_CSS = "input.orionCodenvy";
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.

typo RENFACTORING

}

/**
* wait renaming field in the Editor (usually it field is used by language servers), type new
Copy link
Copy Markdown
Contributor

@dmytro-ndp dmytro-ndp Sep 3, 2018

Choose a reason for hiding this comment

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

type new rename value > type new value

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.

Done

}

/**
* wait renaming field in the Editor (usually it field is used by language servers), type new
Copy link
Copy Markdown
Contributor

@dmytro-ndp dmytro-ndp Sep 3, 2018

Choose a reason for hiding this comment

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

What does Language Server Field mean? Did you mean Code Assistant?

Copy link
Copy Markdown
Contributor Author

@musienko-maxim musienko-maxim Sep 4, 2018

Choose a reason for hiding this comment

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

Actually we have 2 UI part for renaming:

  1. For java
    selection_055

  2. For other languages
    selection_056

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.

I see, thank you for the explanation.

String HOVER_POPUP_XPATH =
"//div[@class='textviewTooltip' and contains(@style,'visibility: visible')]";
String AUTOCOMPLETE_PROPOSAL_DOC_ID = "gwt-debug-content-assistant-doc-popup";
String LANGUAGE_SERVER_RENFACTORING_RENAME_FIELD_CSS = "input.orionCodenvy";
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.

input.orionCodenvy style name looks too general IMHO

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 but it is part of Orion component. With this general name of css locator is simple and reliable. If you have other idea for this - we will apply it

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

public class CSharpRenamingTest {
Copy link
Copy Markdown
Contributor

@dmytro-ndp dmytro-ndp Sep 4, 2018

Choose a reason for hiding this comment

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

According to name convention there should be CSharpClassRenamingTest test class name, IMHO.

@dmytro-ndp
Copy link
Copy Markdown
Contributor

dmytro-ndp commented Sep 4, 2018

I see you created separate test class to test C# renaming, but it consumes additional time for creation and starting test workspace, and for resolving #C project dependencies.
How about testing renaming by using CSharpFileEditingTest.java to save time?

@musienko-maxim
Copy link
Copy Markdown
Contributor Author

I totally agree with you but at this moment C# language is very unstable. During the test we can get an error that was described in the issue: #10151. This one totally breaks the test environment. And all tests after that will be broken. In this case we cannot track if the known issue has been fixed or not (because the workspace does not work properly). Also we won't know which feature works, because all tests related to the workspace will fail anyway. So it is temporary solution i think after we stabilize and fix known issues, we can join this into common class

@dmytro-ndp
Copy link
Copy Markdown
Contributor

Got it! Thank you for response.

@musienko-maxim
Copy link
Copy Markdown
Contributor Author

ci-build

@musienko-maxim musienko-maxim merged commit 27075e5 into master Sep 4, 2018
@musienko-maxim musienko-maxim deleted the CHE#10195 branch September 4, 2018 15:43
@benoitf benoitf added this to the 6.11.0 milestone Sep 4, 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. status/in-progress This issue has been taken by an engineer and is under active development.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants