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

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

Merged
merged 17 commits into from
Oct 16, 2019
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions dockerfiles/happy-path/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM quay.io/eclipse/che-java11-maven:nightly

USER root

RUN cd / && \
git clone https://github.com/spring-projects/spring-petclinic && \
cd /spring-petclinic && \
mvn clean package && \
mkdir -p /.m2 && \
cp -r /root/.m2/repository/* /.m2 && \
rm -rf spring-petclinic/ /root/.m2/repository/*

USER 10001
14 changes: 14 additions & 0 deletions dockerfiles/happy-path/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
# Copyright (c) 2017 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#

base_dir=$(cd "$(dirname "$0")"; pwd)
. "${base_dir}"/../build.include

init --name:happy-path "$@"
build
8 changes: 4 additions & 4 deletions e2e/files/happy-path/happy-path-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ projects:
- name: petclinic
source:
type: git
location: 'https://github.com/spring-projects/spring-petclinic.git'
location: "https://github.com/spring-projects/spring-petclinic.git"
components:
- type: kubernetes
alias: petclinic-web
Expand All @@ -25,8 +25,8 @@ components:
- type: dockerimage
alias: maven-container
image: bujhtr5555/maven-with-artifacts:latest
command: ['sleep']
args: ['infinity']
command: ["sleep"]
args: ["infinity"]
env:
- name: MAVEN_CONFIG
value: /home/user/.m2
Expand All @@ -47,7 +47,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'
command: "mkdir -p /projects/petclinic/?/.m2/repository && cp -r /.m2/* /projects/petclinic/?/.m2/repository && cd /projects/petclinic && mvn package >> build-output.txt"
workdir: /projects/petclinic
- name: run
actions:
Expand Down
40 changes: 34 additions & 6 deletions e2e/pageobjects/ide/Editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
public async waitSuggestion(editorTabTitle: string,
suggestionText: string,
timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {

Logger.debug(`Editor.waitSuggestion tabTitle: "${editorTabTitle}" suggestion: "${suggestionText}"`);

const suggestionLocator: By = this.getSuggestionLineXpathLocator(suggestionText);

await this.driverHelper.getDriver().wait(async () => {
await this.waitSuggestionContainer();
if (await this.driverHelper.isVisible(suggestionLocator)) {
try {
await this.driverHelper.waitVisibility(suggestionLocator, 5000);
return true;
}
} catch (err) {
if (!(err instanceof error.TimeoutError)) {
throw err;
}

await this.performKeyCombination(editorTabTitle, Key.ARROW_DOWN);
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) {

Expand Down Expand Up @@ -407,6 +420,21 @@ 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);

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')]`);
}
Expand Down
4 changes: 2 additions & 2 deletions e2e/tests/e2e/JavaVertx.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand All @@ -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 () => {
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 @@ -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');
});

});
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/e2e_happy_path/HappyPath.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});


Expand Down