From ed2fd1cfc0a2d707e06bb94364a1ea97d7c524aa Mon Sep 17 00:00:00 2001 From: Dmytro Nochevnov Date: Wed, 17 Feb 2021 23:28:34 +0200 Subject: [PATCH] Work around error highlighting and run application failures in Happy path tests (#19068) Signed-off-by: Dmytro Nochevnov Co-authored-by: Radim Hopp --- tests/.infra/crw-ci/pr-check/k8s/Jenkinsfile | 18 +++++++++------ tests/e2e/TimeoutConstants.ts | 12 +++++----- .../happy-path/happy-path-workspace.yaml | 10 ++++----- tests/e2e/pageobjects/ide/DebugView.ts | 19 +++++++++++----- tests/e2e/pageobjects/ide/Ide.ts | 1 - .../tests/e2e_happy_path/HappyPath.spec.ts | 22 ++++++++----------- 6 files changed, 45 insertions(+), 37 deletions(-) diff --git a/tests/.infra/crw-ci/pr-check/k8s/Jenkinsfile b/tests/.infra/crw-ci/pr-check/k8s/Jenkinsfile index 9bcad952b9..d1c84243dd 100644 --- a/tests/.infra/crw-ci/pr-check/k8s/Jenkinsfile +++ b/tests/.infra/crw-ci/pr-check/k8s/Jenkinsfile @@ -242,9 +242,6 @@ pipeline { eval \$(minikube docker-env) docker login -u maxura -p ${maxura_docker_password} - docker pull mariolet/petclinic:d2831f9b - docker pull centos/postgresql-96-centos7:9.6 - docker pull centos/mysql-57-centos7 docker pull ${cheImageRepo}:${mutableCheImageTag} docker pull docker.io/traefik:v2.2.8 """ @@ -372,6 +369,7 @@ EOL""" -e TS_SELENIUM_PASSWORD="admin" \\ -e TEST_SUITE="${e2eTestToRun}" ${e2eTestParameters} \\ -e NODE_TLS_REJECT_UNAUTHORIZED=0 \\ + -e TS_SELENIUM_LOG_LEVEL="TRACE" \\ -v ${WORKSPACE}/tests/e2e:/tmp/e2e:Z \\ quay.io/eclipse/che-e2e:${cheE2eImageTag} """ @@ -398,6 +396,7 @@ EOL""" mkdir -p $LOGS_AND_CONFIGS/kubectl kubectl --namespace=eclipse-che get events > $LOGS_AND_CONFIGS/kubectl/events.txt || true kubectl --namespace=eclipse-che get events -o json > $LOGS_AND_CONFIGS/kubectl/events.json || true + kubectl get pods -A >$LOGS_AND_CONFIGS/kubectl/pods.txt || true mkdir -p $LOGS_AND_CONFIGS/che-config @@ -416,13 +415,18 @@ EOL""" for pod in \$PODS ; do \ kubectl logs --namespace=eclipse-che "\${pod}" --namespace=eclipse-che > $LOGS_AND_CONFIGS/che-logs/"\${pod}".pod.log || true; \ done + kubectl describe pod --namespace=eclipse-che \$WS_POD > $LOGS_AND_CONFIGS/che-config/eclipse-che-pod-description.txt || true mkdir -p $LOGS_AND_CONFIGS/workspace-logs - export WS_POD=\$(kubectl get pod --namespace=eclipse-che | grep ".workspace-" | awk '{print \$1}') - for c in \$(kubectl get pod --namespace=eclipse-che \$WS_POD -o jsonpath="{.spec.containers[*].name}") ; do \\ - kubectl logs \$(kubectl get pod --namespace=eclipse-che | grep ".workspace-" | awk '{print \$1}') "\${c}" --namespace=eclipse-che > $LOGS_AND_CONFIGS/workspace-logs/"\${c}".container.log || true; \\ + WORKSPACE_NAMESPACE_NAME=admin-che + export WS_POD=\$(kubectl get pod --namespace=\$WORKSPACE_NAMESPACE_NAME | grep ".workspace-" | awk '{print \$1}') + for c in \$(kubectl get pod --namespace=\$WORKSPACE_NAMESPACE_NAME \$WS_POD -o jsonpath="{.spec.containers[*].name}") ; do + CONTAINER_LOGS_DIR=$LOGS_AND_CONFIGS/workspace-logs/"\${c}" + mkdir \$CONTAINER_LOGS_DIR + kubectl logs \$WS_POD "\${c}" --namespace=\$WORKSPACE_NAMESPACE_NAME > \${CONTAINER_LOGS_DIR}.container.log || true; + kubectl cp \$WORKSPACE_NAMESPACE_NAME/\$WS_POD:/workspace_logs \$CONTAINER_LOGS_DIR -c "\${c}" || true; done - kubectl describe pod --namespace=eclipse-che \$WS_POD > $LOGS_AND_CONFIGS/che-config/workspace-pod-description.txt || true + kubectl describe pod --namespace=\$WORKSPACE_NAMESPACE_NAME \$WS_POD > $LOGS_AND_CONFIGS/che-config/workspace-pod-description.txt || true mkdir -p $LOGS_AND_CONFIGS/docker docker image ls > $LOGS_AND_CONFIGS/docker/images.txt || true diff --git a/tests/e2e/TimeoutConstants.ts b/tests/e2e/TimeoutConstants.ts index 3f07421c4f..fd4dcc8de0 100644 --- a/tests/e2e/TimeoutConstants.ts +++ b/tests/e2e/TimeoutConstants.ts @@ -65,14 +65,14 @@ export const TimeoutConstants = { TS_SELENIUM_LANGUAGE_SERVER_START_TIMEOUT: Number(process.env.TS_SELENIUM_LANGUAGE_SERVER_START_TIMEOUT) || 180_000, /** - * Timeout for suggestion invoking, "30 000" by default. + * Timeout for suggestion invoking, "60 000" by default. */ - TS_SUGGESTION_TIMEOUT: Number(process.env.TS_OPEN_PROJECT_TREE_TIMEOUT) || 30_000, + TS_SUGGESTION_TIMEOUT: Number(process.env.TS_OPEN_PROJECT_TREE_TIMEOUT) || 60_000, /** - * Timeout for error highlighting presence, "10 000" by default + * Timeout for error highlighting presence, "90 000" by default */ - TS_ERROR_HIGHLIGHTING_TIMEOUT: Number(process.env.TS_OPEN_PROJECT_TREE_TIMEOUT) || 20_000, + TS_ERROR_HIGHLIGHTING_TIMEOUT: Number(process.env.TS_OPEN_PROJECT_TREE_TIMEOUT) || 90_000, // -------------------------------------------- PROJECT TREE -------------------------------------------- @@ -128,9 +128,9 @@ export const TimeoutConstants = { TS_NOTIFICATION_CENTER_TIMEOUT: Number(process.env.TS_OPEN_PROJECT_TREE_TIMEOUT) || 10_000, /** - * Timeout for debugger to connect, "30 000" by default + * Timeout for debugger to connect, "60 000" by default */ - TS_DEBUGGER_CONNECTION_TIMEOUT: Number(process.env.TS_DEBUGGER_CONNECTION_TIMEOUT) || 30_000, + TS_DEBUGGER_CONNECTION_TIMEOUT: Number(process.env.TS_DEBUGGER_CONNECTION_TIMEOUT) || 60_000, /** * Timeout for context menu manipulation, "10 000" by default diff --git a/tests/e2e/files/happy-path/happy-path-workspace.yaml b/tests/e2e/files/happy-path/happy-path-workspace.yaml index 2aa940e9b5..e032993b15 100644 --- a/tests/e2e/files/happy-path/happy-path-workspace.yaml +++ b/tests/e2e/files/happy-path/happy-path-workspace.yaml @@ -45,30 +45,30 @@ commands: actions: - type: exec component: maven-container - command: mvn clean package | tee build.txt && tail -n 40 /projects/petclinic/build.txt | grep 'BUILD SUCCESS' > /projects/petclinic/result-build.txt + command: mvn clean package | tee /workspace_logs/build.log && tail -n 40 /workspace_logs/build.log | grep 'BUILD SUCCESS' > /projects/petclinic/result-build.txt workdir: /projects/petclinic - name: build-file-output actions: - type: exec component: maven-container - command: cd /projects/petclinic && mvn package | tee build-output.txt && tail -n 40 /projects/petclinic/build-output.txt | grep 'BUILD SUCCESS' > /projects/petclinic/result-build-output.txt + command: cd /projects/petclinic && mvn package | tee /workspace_logs/build-output.log && tail -n 40 /workspace_logs/build-output.log | grep 'BUILD SUCCESS' > /projects/petclinic/result-build-output.txt - name: run actions: - type: exec component: maven-container - command: java -jar spring-petclinic-2.4.2.jar --spring.profiles.active=mysql + command: java -jar spring-petclinic-2.4.2.jar --spring.profiles.active=mysql | tee /workspace_logs/run.log workdir: /projects/petclinic/target - name: run-with-changes actions: - type: exec component: maven-container - command: java -jar spring-petclinic-2.4.2.jar --spring.profiles.active=mysql + command: java -jar spring-petclinic-2.4.2.jar --spring.profiles.active=mysql | tee /workspace_logs/run-with-changes.log workdir: /projects/petclinic/target - name: run-debug actions: - type: exec component: maven-container - command: java -jar -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 spring-petclinic-2.4.2.jar --spring.profiles.active=mysql + command: java -jar -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 spring-petclinic-2.4.2.jar --spring.profiles.active=mysql | tee /workspace_logs/run-debug.log workdir: /projects/petclinic/target - name: Debug remote java application actions: diff --git a/tests/e2e/pageobjects/ide/DebugView.ts b/tests/e2e/pageobjects/ide/DebugView.ts index da31ec2a34..0b8f15b160 100644 --- a/tests/e2e/pageobjects/ide/DebugView.ts +++ b/tests/e2e/pageobjects/ide/DebugView.ts @@ -9,8 +9,9 @@ **********************************************************************/ import { inject, injectable } from 'inversify'; import { CLASSES } from '../../inversify.types'; +import { TestConstants } from '../../TestConstants'; import { DriverHelper } from '../../utils/DriverHelper'; -import { By, Key, WebElement } from 'selenium-webdriver'; +import { By, Key, WebElement, error } from 'selenium-webdriver'; import { Ide } from './Ide'; import { Logger } from '../../utils/Logger'; import { TimeoutConstants } from '../../TimeoutConstants'; @@ -55,11 +56,19 @@ export class DebugView { const threadsTreeLocator = `//div[contains(@class, 'theia-debug-thread')]`; - const threadElements: WebElement[] = await this.driverHelper.waitAllPresence(By.xpath(threadsTreeLocator)); - if (threadElements.length > 1) { - return true; + try { + const threadElements: WebElement[] = await this.driverHelper.waitAllPresence(By.xpath(threadsTreeLocator)); + if (threadElements.length > 1) { + return true; + } + + } catch (err) { + if (!(err instanceof error.TimeoutError)) { + throw err; + } + + return await this.driverHelper.wait(TestConstants.TS_SELENIUM_DEFAULT_POLLING); } - return false; }, timeout); } diff --git a/tests/e2e/pageobjects/ide/Ide.ts b/tests/e2e/pageobjects/ide/Ide.ts index d2a1f9daf3..112deed521 100644 --- a/tests/e2e/pageobjects/ide/Ide.ts +++ b/tests/e2e/pageobjects/ide/Ide.ts @@ -114,7 +114,6 @@ export class Ide { async waitNotificationAndOpenLink(notificationText: string, timeout: number) { Logger.debug(`Ide.waitNotificationAndOpenLink "${notificationText}"`); await this.waitNotification(notificationText, timeout); - await this.waitApllicationIsReady(await this.getApplicationUrlFromNotification(notificationText), timeout); await this.waitNotificationAndClickOnButton(notificationText, 'Open Link', timeout); } diff --git a/tests/e2e/tests/e2e_happy_path/HappyPath.spec.ts b/tests/e2e/tests/e2e_happy_path/HappyPath.spec.ts index 964639c911..371b1ad7dd 100644 --- a/tests/e2e/tests/e2e_happy_path/HappyPath.spec.ts +++ b/tests/e2e/tests/e2e_happy_path/HappyPath.spec.ts @@ -115,22 +115,22 @@ suite('Language server validation', async () => { }); test('Error highlighting', async () => { - const textForErrorDisplaying: string = '$#%@#'; - + await driverHelper.getDriver().sleep(TimeoutConstants.TS_SUGGESTION_TIMEOUT); // workaround https://github.com/eclipse/che/issues/19004 + + const textForErrorDisplaying: string = '$'; await editor.type(javaFileName, textForErrorDisplaying, 30); try { - await editor.waitErrorInLine(30, TimeoutConstants.TS_ERROR_HIGHLIGHTING_TIMEOUT * 3); + await editor.waitErrorInLine(30, TimeoutConstants.TS_ERROR_HIGHLIGHTING_TIMEOUT); } catch (err) { - Logger.debug('Workaround for the https://github.com/eclipse/che/issues/18974 issue.'); - await (await driverHelper.getDriver()).navigate().refresh(); - + Logger.debug('Workaround for the https://github.com/eclipse/che/issues/18974.'); + await driverHelper.reloadPage(); await ide.waitAndSwitchToIdeFrame(); - await editor.selectTab(javaFileName); - await editor.waitErrorInLine(30, TimeoutConstants.TS_ERROR_HIGHLIGHTING_TIMEOUT * 3); + await ide.waitIde(); + await editor.waitErrorInLine(30, TimeoutConstants.TS_ERROR_HIGHLIGHTING_TIMEOUT * 2); } - await editor.performKeyCombination(javaFileName, Key.chord(Key.BACK_SPACE, Key.BACK_SPACE, Key.BACK_SPACE, Key.BACK_SPACE, Key.BACK_SPACE)); + await editor.performKeyCombination(javaFileName, Key.chord(Key.BACK_SPACE)); await editor.waitErrorInLineDisappearance(30); }); @@ -170,10 +170,6 @@ suite('Validation of workspace build and run', async () => { test('Build application', async () => { let buildTaskName: string = 'build-file-output'; await topMenu.runTask('build-file-output'); - - // workaround for issue: https://github.com/eclipse/che/issues/14771 - - // await projectTree.expandPathAndOpenFileInAssociatedWorkspace(projectName, 'build-output.txt'); await terminal.waitIconSuccess(buildTaskName, 250_000); });