[TS_SELENIUM] Create image for the "Happy Path" tests based on the "quay.io/eclipse/che-java11-maven" image (#14779)

Signed-off-by: Ihor Okhrimenko <iokhrime@redhat.com>
7.20.x
Igor Ohrimenko 2019-10-16 09:59:08 +03:00 committed by GitHub
parent daae1cf5fe
commit ffe7ecdea0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 83 additions and 21 deletions

View File

@ -27,9 +27,7 @@ components:
app.kubernetes.io/component: database
- type: dockerimage
alias: maven-container
image: bujhtr5555/maven-with-artifacts:latest
command: ["sleep"]
args: ["infinity"]
image: quay.io/eclipse/happy-path:nightly
env:
- name: MAVEN_CONFIG
value: /home/user/.m2
@ -50,8 +48,7 @@ commands:
actions:
- type: exec
component: maven-container
command: mkdir -p /projects/petclinic/?/.m2 && cp -r /.m2/* /projects/petclinic/?/.m2 && cd /projects/petclinic && mvn package >> build-output.txt && tail -n 40 /projects/petclinic/build-output.txt | grep 'BUILD SUCCESS' > /projects/petclinic/result-build-output.txt
workdir: /projects/petclinic
command: cd /projects/petclinic && mvn package >> build-output.txt && tail -n 40 /projects/petclinic/build-output.txt | grep 'BUILD SUCCESS' > /projects/petclinic/result-build-output.txt
- name: run
actions:
- type: exec

View File

@ -40,18 +40,31 @@ export class Editor {
await this.driverHelper.waitDisappearanceWithTimeout(By.css(Editor.SUGGESTION_WIDGET_BODY_CSS));
}
public async scrollAndSearchSuggestion(editorTabTitle: string, suggestionLocator: By, timeout: number = 10000) {
await this.driverHelper.getDriver().wait(async () => {
await this.waitSuggestionContainer();
if (await this.driverHelper.isVisible(suggestionLocator)) {
return true;
}
public async waitSuggestion(editorTabTitle: string,
suggestionText: string,
timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
await this.performKeyCombination(editorTabTitle, Key.ARROW_DOWN);
Logger.debug(`Editor.waitSuggestion tabTitle: "${editorTabTitle}" suggestion: "${suggestionText}"`);
const suggestionLocator: By = this.getSuggestionLineXpathLocator(suggestionText);
await this.driverHelper.getDriver().wait(async () => {
try {
await this.driverHelper.waitVisibility(suggestionLocator, 5000);
return true;
} catch (err) {
if (!(err instanceof error.TimeoutError)) {
throw err;
}
await this.pressEscapeButton(editorTabTitle);
await this.waitSuggestionContainerClosed();
await this.pressControlSpaceCombination(editorTabTitle);
}
}, timeout);
}
public async waitSuggestion(editorTabTitle: string,
public async waitSuggestionWithScrolling(editorTabTitle: string,
suggestionText: string,
timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
@ -407,6 +420,22 @@ export class Editor {
perform();
}
private async scrollAndSearchSuggestion(editorTabTitle: string, suggestionLocator: By, timeout: number = 10000) {
await this.driverHelper.getDriver().wait(async () => {
const loadingLocator: By = this.getSuggestionLineXpathLocator('Loading');
await this.waitSuggestionContainer();
await this.driverHelper.waitDisappearance(loadingLocator);
await this.driverHelper.wait(1000);
if (await this.driverHelper.isVisible(suggestionLocator)) {
return true;
}
await this.performKeyCombination(editorTabTitle, Key.ARROW_DOWN);
}, timeout);
}
private getTabWithUnsavedStatus(tabTitle: string): By {
return By.xpath(`//div[text()='${tabTitle}']/parent::li[contains(@class, 'theia-mod-dirty')]`);
}

View File

@ -26,6 +26,41 @@ export class ProjectTree {
@inject(CLASSES.Ide) private readonly ide: Ide,
@inject(CLASSES.Editor) private readonly editor: Editor) { }
async clickCollapseAllButton() {
Logger.debug('ProjectTree.clickCollapseAllButton');
const collapseAllButtonLocator: By = By.css('div.theia-sidepanel-toolbar div.collapse-all');
await this.driverHelper.waitAndClick(collapseAllButtonLocator);
}
async waitTreeCollapsed(projectName: string, rootSubItem: string) {
Logger.debug(`ProjectTree.waitTreeCollapsed project: "${projectName}", subitem: "${rootSubItem}"`);
const rootSubitemLocator: By = By.css(this.getTreeItemCssLocator(`${projectName}/${rootSubItem}`));
await this.driverHelper.waitDisappearanceWithTimeout(rootSubitemLocator);
}
async collapseProjectTree(projectName: string, rootSubItem: string) {
Logger.debug(`ProjectTree.collapseProjectTree project: "${projectName}", subitem: "${rootSubItem}"`);
await this.clickCollapseAllButton();
await this.waitTreeCollapsed(projectName, rootSubItem);
}
async waitAssociatedWorkspaceProjectTreeCollapsed(projectName: string, expandedRootItem: string) {
Logger.debug(`ProjectTree.waitTreeCollapsed project name: "${projectName}", expanded root item: "${expandedRootItem}"`);
// const rootSubitemLocator: By = By.css(this.getTreeItemCssLocator(`${projectName}/${expandedRootItem}`));
await this.waitItemCollapsed(`${projectName}/${expandedRootItem}`);
}
async collapseAssociatedWorkspaceProjectTree(projectName: string, rootSubItem: string) {
Logger.debug(`ProjectTree.collapseProjectTree project: "${projectName}", subitem: "${rootSubItem}"`);
await this.clickCollapseAllButton();
await this.waitTreeCollapsed(projectName, rootSubItem);
}
async openProjectTreeContainer(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
Logger.debug('ProjectTree.openProjectTreeContainer');

View File

@ -95,7 +95,7 @@ suite('Java Vert.x test', async () => {
await editor.waitTabFocused(tabTitle);
await editor.moveCursorToLineAndChar(tabTitle, 19, 11);
await editor.pressControlSpaceCombination(tabTitle);
await editor.waitSuggestion(tabTitle, 'cancelTimer(long arg0) : boolean');
await editor.waitSuggestionWithScrolling(tabTitle, 'cancelTimer(long arg0) : boolean');
});
test('Error highlighting', async () => {
@ -109,7 +109,7 @@ suite('Java Vert.x test', async () => {
await editor.moveCursorToLineAndChar(tabTitle, 18, 15);
await editor.pressControlSpaceCombination(tabTitle);
await editor.waitSuggestionContainer();
await editor.waitSuggestion(tabTitle, 'Vertx - io.vertx.core');
await editor.waitSuggestionWithScrolling(tabTitle, 'Vertx - io.vertx.core');
});
test('Codenavigation', async () => {

View File

@ -79,7 +79,7 @@ suite('E2E', async () => {
await editor.waitTabFocused(tabTitle);
await editor.moveCursorToLineAndChar(tabTitle, 6, 20);
await editor.pressControlSpaceCombination(tabTitle);
await editor.waitSuggestion(tabTitle, 'append(CharSequence csq, int start, int end) : PrintStream');
await editor.waitSuggestionWithScrolling(tabTitle, 'append(CharSequence csq, int start, int end) : PrintStream');
});
});

View File

@ -116,7 +116,7 @@ suite('Language server validation', async () => {
test('Suggestion', async () => {
await editor.moveCursorToLineAndChar(javaFileName, 32, 27);
await editor.pressControlSpaceCombination(javaFileName);
await editor.waitSuggestion(javaFileName, 'run(Class<?> primarySource, String... args) : ConfigurableApplicationContext', 120000);
await editor.waitSuggestionWithScrolling(javaFileName, 'run(Class<?> primarySource, String... args) : ConfigurableApplicationContext', 120000);
});
@ -148,8 +148,8 @@ suite('Validation of workspace build and run', async () => {
test('Build application', async () => {
await runTask('build-file-output');
//workaround for issue: https://github.com/eclipse/che/issues/14771
// workaround for issue: https://github.com/eclipse/che/issues/14771
// await projectTree.expandPathAndOpenFileInAssociatedWorkspace(projectName, 'build-output.txt');
await projectTree.expandPathAndOpenFileInAssociatedWorkspace(projectName, 'result-build-output.txt', 220000);
await editor.waitText('result-build-output.txt', '[INFO] BUILD SUCCESS');
@ -193,10 +193,11 @@ suite('Display source code changes in the running application', async () => {
test('Build application with changes', async () => {
await runTask('build');
await projectTree.collapseAssociatedWorkspaceProjectTree(projectName + '/src', 'main');
await projectTree.expandPathAndOpenFileInAssociatedWorkspace(projectName, 'result-build.txt', 300000);
await editor.waitText('result-build.txt', '[INFO] BUILD SUCCESS');
//workaround for issue: https://github.com/eclipse/che/issues/14771
// workaround for issue: https://github.com/eclipse/che/issues/14771
/*await projectTree.expandPathAndOpenFileInAssociatedWorkspace(projectName, 'build.txt');
await editor.waitEditorAvailable('build.txt');