-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Changes from 9 commits
dadb74b
0df4f39
e72ef12
e22f798
2d4a1d4
c6bf827
5b45a7a
557d787
dd2f6f8
e74332e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import 'reflect-metadata'; | ||
import { injectable, inject } from 'inversify'; | ||
import { DriverHelper } from '../../utils/DriverHelper'; | ||
import { CLASSES } from '../../inversify.types'; | ||
import { WebElement, Button, By, Key } from 'selenium-webdriver'; | ||
import { TestConstants } from '../../TestConstants'; | ||
|
||
|
||
|
||
@injectable() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Broken formatting in file. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is absent line before |
||
export class ContextMenu { | ||
private static readonly SUGGESTION_WIDGET_BODY_CSS: string = 'ul.p-Menu-content'; | ||
|
||
constructor(@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) { } | ||
|
||
|
||
async invokeContextMenuOnTheElementWithMouse(elementLocator: By, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { | ||
const webElement: WebElement = await this.driverHelper.waitVisibility(elementLocator, timeout); | ||
await this.driverHelper.getAction().click(webElement, Button.RIGHT).perform(); | ||
this.waitContextMenu(timeout); | ||
} | ||
async invokeContextMenuOnActiveElementWithKeys(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { | ||
this.driverHelper.getDriver().switchTo().activeElement().sendKeys(Key.SHIFT + Key.F10); | ||
this.waitContextMenu(timeout); | ||
} | ||
|
||
|
||
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); | ||
} | ||
|
||
async waitContextMenu(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { | ||
await this.driverHelper.waitVisibility(By.css(ContextMenu.SUGGESTION_WIDGET_BODY_CSS), timeout); | ||
} | ||
|
||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,13 +26,15 @@ import { Terminal } from '../../pageobjects/ide/Terminal'; | |
import { OpenWorkspaceWidget } from '../../pageobjects/ide/OpenWorkspaceWidget'; | ||
import { ICheLoginPage } from '../../pageobjects/login/ICheLoginPage'; | ||
import * as fs from 'fs'; | ||
import { ContextMenu } from '../../pageobjects/ide/ContextMenu'; | ||
|
||
const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper); | ||
const ide: Ide = e2eContainer.get(CLASSES.Ide); | ||
const projectTree: ProjectTree = e2eContainer.get(CLASSES.ProjectTree); | ||
const topMenu: TopMenu = e2eContainer.get(CLASSES.TopMenu); | ||
const quickOpenContainer: QuickOpenContainer = e2eContainer.get(CLASSES.QuickOpenContainer); | ||
const editor: Editor = e2eContainer.get(CLASSES.Editor); | ||
const contextMenu: ContextMenu = e2eContainer.get(CLASSES.ContextMenu); | ||
const previewWidget: PreviewWidget = e2eContainer.get(CLASSES.PreviewWidget); | ||
const rightToolbar: RightToolbar = e2eContainer.get(CLASSES.RightToolbar); | ||
const terminal: Terminal = e2eContainer.get(CLASSES.Terminal); | ||
|
@@ -116,11 +118,18 @@ suite('Language server validation', async () => { | |
await editor.waitSuggestion(javaFileName, 'run(Class<?> primarySource, String... args) : ConfigurableApplicationContext'); | ||
}); | ||
|
||
// it's skipped because of issue https://github.com/eclipse/che/issues/14520 | ||
test.skip('Codenavigation', async () => { | ||
|
||
test('Codenavigation', async () => { | ||
await editor.moveCursorToLineAndChar(javaFileName, 32, 17); | ||
await editor.performKeyCombination(javaFileName, Key.chord(Key.CONTROL, Key.F12)); | ||
await editor.waitEditorAvailable(codeNavigationClassName); | ||
// workaround for issue: https://github.com/eclipse/che/issues/14520 | ||
try { | ||
await editor.performKeyCombination(javaFileName, Key.chord(Key.CONTROL, Key.F12)); | ||
await editor.waitEditorAvailable(codeNavigationClassName); | ||
} catch (err) { | ||
if (err instanceof error.TimeoutError) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 () => { | ||
|
@@ -290,6 +299,12 @@ async function runTask(task: string) { | |
await quickOpenContainer.clickOnContainerItem('Continue without scanning the task output'); | ||
} | ||
|
||
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('Known isuue https://github.com/eclipse/che/issues/14520.'); | ||
} | ||
|
||
// sometimes under high loading the first click can be failed | ||
async function isureClickOnDebugMenu() { | ||
try { await topMenu.selectOption('Debug', 'Open Configurations'); } catch (e) { | ||
|
@@ -312,10 +327,8 @@ async function checkJavaPathCompletion() { | |
|
||
await projectTree.expandPathAndOpenFile(projectName, classPathFilename); | ||
await editor.waitEditorAvailable(classPathFilename); | ||
|
||
await editor.type(classPathFilename, Key.chord(Key.CONTROL, 'a'), 1); | ||
await editor.performKeyCombination(classPathFilename, Key.DELETE); | ||
|
||
await editor.type(classPathFilename, classpathText, 1); | ||
await editor.waitTabWithSavedStatus(classPathFilename); | ||
} | ||
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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;
.