Implement selenium test for covering LS server for TypeScript language#9969
Implement selenium test for covering LS server for TypeScript language#9969musienko-maxim merged 10 commits intomasterfrom
Conversation
| } | ||
|
|
||
| /** | ||
| * Waits marker with specified {@code markerLocator} on the defined {@code position} and move |
There was a problem hiding this comment.
position could confuse a little so as it's about the line number, not just about specific position in line.
| } | ||
|
|
||
| private void checkCodeValidation() { | ||
| final int expectedValueOfErrorMarkers = 9; |
There was a problem hiding this comment.
from the readability point it's better to divide verification by given/when/then sections.
There was a problem hiding this comment.
Maybe "expectedCountOfErrorMarkers" better?
| } | ||
|
|
||
| private void checkCodeAssistant() { | ||
| String textFromWholeCodeAssistantScope = |
There was a problem hiding this comment.
from the readability point it's better to divide verification by given/when/then sections
There was a problem hiding this comment.
I have not quite understood what do you mean?
use something like that:
// when
projectExplorer.openItemByPath(PATH_TO_PROGRAM);
editor.setInactiveBreakpoint(22);
editor.closeAllTabs();
commandsPalette.openCommandPalette();
commandsPalette.startCommandByDoubleClick(MAKE_AND_DEBUG_COMMAND_NAME);
consoles.waitExpectedTextIntoConsole("Listening on port 8001");
menu.runCommandByXpath(
TestMenuCommandsConstants.Run.RUN_MENU,
TestMenuCommandsConstants.Run.DEBUG,
getXpathForDebugConfigurationMenuItem());
notifications.waitExpectedMessageOnProgressPanelAndClosed(
String.format("Remote debugger connected\nConnected to: localhost:%s.", DEBUG_PORT));
// then
editor.waitTabFileWithSavedStatus("hello.cc");
debugPanel.waitDebugHighlightedText(" return \"Hello World, \" + name + \"!\";");
debugPanel.waitTextInVariablesPanel("name =");
debugPanel.waitTextInVariablesPanel("\"man\"");| editor.waitTextIntoAutocompleteContainer(textFromWholeCodeAssistantScope); | ||
| editor.closeAutocomplete(); | ||
| editor.typeTextIntoEditor(ENTER.toString()); | ||
| editor.typeTextIntoEditor("greeter."); |
There was a problem hiding this comment.
it's hard to understand test case here
Could you, please, name string "greeter." somehow to make its propose an obvious?
There was a problem hiding this comment.
In the test based on simple Greeter example like:
Greeter example
class Greeter {
greeting: string;
constructor(message: string) {
this.greeting = message;
}
greet() {
return "Hello, " + this.greeting;
}
testPrint(): void {
const printVar = new Print();
printVar.print("test print");
}
}
let greeter = new Greeter("world");and i cannot see difficult parts for understanding
There was a problem hiding this comment.
To protect the test from occasional breaking down we need to have clear vision why it cann't be "hello", "buy" and any other string :-)
There was a problem hiding this comment.
Ok, your proposal?
| import static org.eclipse.che.selenium.core.workspace.WorkspaceTemplate.ECLIPSE_NODEJS; | ||
| import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.ERROR; | ||
| import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.ERROR_OVERVIEW; | ||
| import static org.openqa.selenium.Keys.*; |
There was a problem hiding this comment.
This is a kind of anti-pattern, please use direct static import
| "The expected value of errors marker should be %d but actual %d", | ||
| expectedValueOfErrorMarkers, actualValueErrorMarkers)); | ||
| editor.waitMarkerInPositionAndMoveCursor(ERROR_OVERVIEW, 13); | ||
| editor.waitTextInToolTipPopup("Cannot find name 'c'"); |
There was a problem hiding this comment.
it's hard to understand test case here
Could you, please, name string "Cannot find name 'c'" somehow to make its propose an obvious?
There was a problem hiding this comment.
This message is returned by Language Server and we can not control this one in this case
There was a problem hiding this comment.
I didn't mean control - I meant name this string somehow to make its propose clear, and we can do it in our test.
| } | ||
|
|
||
| private void checkGoToDefinition() { | ||
| editor.goToPosition(24, 20); |
There was a problem hiding this comment.
Could you, please, comment in the code which definition we a going to here?
| * @param markerLocator marker's type, defined in {@link MarkerLocator} | ||
| * @param position line's number, where marker is expected | ||
| */ | ||
| public void waitMarkerInPositionAndMoveCursor(MarkerLocator markerLocator, int position) { |
There was a problem hiding this comment.
moveCursorToLineWithMarker(MarkerLocator markerLocator, int line) would explain the propose of method better, IMHO
| } | ||
|
|
||
| private void checkCodeAssistant() { | ||
|
|
|
|
||
| String nameOfGreeterClassRef = "greeter."; | ||
|
|
||
| editor.goToPosition(28, 36); |
There was a problem hiding this comment.
could you, please divide separate steps by empty lines to improve readability?
|
ci-build |
|
Build success. https://ci.codenvycorp.com/job/che-pullrequests-build/4551/ |
|
ci-test |
|
ci-test build report: |
eclipse-che#9969) * finish the test and adapt files from resources for the test
What does this PR do?
This PR implements simple scenario: create a workspace with enabled TypeScript LS installer, open simple TypeScript project, check initialization TypeScript LS by UI, checks code validation, autocompletion, go to definition features.
What issues does this PR fix or reference?
#9918