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

Implement workaround for Go to Definition feature HappyPath scenario #14570

Merged
merged 10 commits into from
Sep 22, 2019
2 changes: 1 addition & 1 deletion e2e/driver/ChromeDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class ChromeDriver implements IDriver {
.forBrowser('chrome')
.setChromeOptions(options);

// if 'true' run with remote driver
// if 'true' run with remote driver
if (TestConstants.TS_SELENIUM_REMOTE_DRIVER_URL) {
builder = builder.usingServer(TestConstants.TS_SELENIUM_REMOTE_DRIVER_URL);
}
Copy link
Contributor

@dmytro-ndp dmytro-ndp Sep 19, 2019

Choose a reason for hiding this comment

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

It looked more readable with empty line 59.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, it wasn't fixed.

Copy link
Contributor

Choose a reason for hiding this comment

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

I meant empty line between return builder;.

Expand Down
4 changes: 2 additions & 2 deletions e2e/pageobjects/ide/ContextMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export class ContextMenu {
}


async waitContextMenuAndClickOnItem(nameOfitem: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT ) {
const itemLocator: string = `//div[@class='p-Menu-itemLabel' and text()='${nameOfitem}']`;
async waitContextMenuAndClickOnItem(nameOfItem: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT ) {
const itemLocator: string = `//div[@class='p-Menu-itemLabel' and text()='${nameOfItem}']`;
await this.waitContextMenu();
await this.driverHelper.waitAndClick(By.xpath(itemLocator), timeout);
}
Expand Down
52 changes: 26 additions & 26 deletions e2e/pageobjects/ide/Editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ import { Ide } from './Ide';
@injectable()
export class Editor {
private static readonly SUGGESTION_WIDGET_BODY_CSS: string = 'div.visible[widgetId=\'editor.widget.suggestWidget\']';

private static readonly ADDITIONAL_SHIFTING_TO_Y:number = 19;
private static readonly ADDITIONAL_SHIFTING_TO_X: number = 1;


constructor(@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper,
@inject(CLASSES.Ide) private readonly ide: Ide) { }
Expand Down Expand Up @@ -280,7 +284,7 @@ export class Editor {
}


async getLineYCoordinates(lineNumber: number): Promise<number> {
async getLineYCoordinates(lineNumber: number): Promise<number> {
const lineNumberLocator: By = By.xpath(`//div[contains(@class, 'line-numbers') and text()='${lineNumber}']` +
`//parent::div[contains(@style, 'position')]`);

Expand All @@ -298,37 +302,33 @@ export class Editor {
return lineYCoordinate;
}

async clickOnTheTextInDefinedPosition(line: number, column: number) {
const additionalShiftingToY = 19;
async clickOnLineAndChar(line: number, column: number) {

musienko-maxim marked this conversation as resolved.
Show resolved Hide resolved
const additionalShiftingToX = 1;
musienko-maxim marked this conversation as resolved.
Show resolved Hide resolved
const yPosition: number = await this.getLineYCoordinates(line) + additionalShiftingToY;
const xPosition: number = column + additionalShiftingToX;
new ActionSequence(this.driverHelper.getDriver()).
mouseMove({x: xPosition, y: yPosition}).
click().
perform();
}
const yPosition: number = await this.getLineYCoordinates(line) + Editor.ADDITIONAL_SHIFTING_TO_Y;
const xPosition: number = column + Editor.ADDITIONAL_SHIFTING_TO_X;
new ActionSequence(this.driverHelper.getDriver()).
mouseMove({ x: xPosition, y: yPosition }).
click().
perform();
}

async goToDefinitionWithMouseClicking(line: number, column: number) {
musienko-maxim marked this conversation as resolved.
Show resolved Hide resolved
const additionalShiftingToY = 19;
const additionalShiftingToX = 1;
const yPosition: number = await this.getLineYCoordinates(line) + additionalShiftingToY;
new ActionSequence(this.driverHelper.getDriver()).
keyDown(Key.CONTROL).
mouseMove({x: column + additionalShiftingToX, y: yPosition}).
click().
keyDown(Key.CONTROL).
perform();
const yPosition: number = await this.getLineYCoordinates(line) + Editor.ADDITIONAL_SHIFTING_TO_Y;
new ActionSequence(this.driverHelper.getDriver()).
keyDown(Key.CONTROL).
mouseMove({ x: column + Editor.ADDITIONAL_SHIFTING_TO_X, y: yPosition }).
click().
keyDown(Key.CONTROL).
perform();
}

async mouseContextClickInDefinedPosition(line: number, column: number) {
musienko-maxim marked this conversation as resolved.
Show resolved Hide resolved
const additionalShiftingToY = 19;
const additionalShiftingToX = 1;
const yPosition: number = await this.getLineYCoordinates(line) + additionalShiftingToY;
new ActionSequence(this.driverHelper.getDriver()).
mouseMove({x: column + additionalShiftingToX, y: yPosition}).
click(Button.RIGHT).
perform();
const yPosition: number = await this.getLineYCoordinates(line) + Editor.ADDITIONAL_SHIFTING_TO_Y;
new ActionSequence(this.driverHelper.getDriver()).
mouseMove({ x: column + Editor.ADDITIONAL_SHIFTING_TO_X, y: yPosition }).
click(Button.RIGHT).
perform();
}

private getTabWithUnsavedStatus(tabTitle: string): By {
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/e2e/WorkspaceCreationAndLsInitialization.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ suite('E2E', async () => {
await editor.clickOnTab(tabTitle);
await editor.waitEditorAvailable(tabTitle);
await editor.waitTabFocused(tabTitle);
await editor.moveCursorToLineAndChar(tabTitle, 6, 20);
await editor.clickOnLineAndChar(tabTitle, 6, 20);
await editor.pressControlSpaceCombination(tabTitle);
await editor.waitSuggestion(tabTitle, 'append(CharSequence csq, int start, int end) : PrintStream');
});
Expand Down
16 changes: 11 additions & 5 deletions e2e/tests/e2e_happy_path/HappyPath.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
**********************************************************************/

import { e2eContainer } from '../../inversify.config';
import { DriverHelper, } from '../../utils/DriverHelper';
import { DriverHelper } from '../../utils/DriverHelper';
import { TYPES, CLASSES } from '../../inversify.types';
import { Ide, RightToolbarButton } from '../../pageobjects/ide/Ide';
import { ProjectTree } from '../../pageobjects/ide/ProjectTree';
Expand Down Expand Up @@ -121,9 +121,15 @@ suite('Language server validation', async () => {

test('Codenavigation', async () => {
await editor.moveCursorToLineAndChar(javaFileName, 32, 17);
await checkCodeNavigationWithContextMenu();
// await editor.performKeyCombination(javaFileName, Key.chord(Key.CONTROL, Key.F12));
await editor.waitEditorAvailable(codeNavigationClassName);
try {
await editor.performKeyCombination(javaFileName, Key.chord(Key.CONTROL, Key.F12));
await editor.waitEditorAvailable(codeNavigationClassName);
}
catch (err) {
if (err instanceof error.TimeoutError) {
Copy link
Contributor

@dmytro-ndp dmytro-ndp Sep 19, 2019

Choose a reason for hiding this comment

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

It would be clearer to have comment with link to issue.

checkCodeNavigationWithContextMenu();
}
}
});

test.skip('Yaml LS initialization', async () => {
Expand Down Expand Up @@ -295,7 +301,7 @@ async function runTask(task: string) {
async function checkCodeNavigationWithContextMenu() {
musienko-maxim marked this conversation as resolved.
Show resolved Hide resolved
await contextMenu.invokeContextMenuOnActiveElementWithKeys();
await contextMenu.waitContextMenuAndClickOnItem('Go to Definition');
console.log('please check the satus of the known issue: https://github.com/eclipse/che/issues/14520. If it is fixed, we have to return the test to previous state.');
console.log('Known isuue https://github.com/eclipse/che/issues/14520.');
}
// sometimes under high loading the first click can be failed
async function isureClickOnDebugMenu() {
Expand Down