-
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
[TS-SELENIUM] Cover the "Use Java IDE features and the inner loop" step from "Happy path" scenario #13615
Merged
Merged
[TS-SELENIUM] Cover the "Use Java IDE features and the inner loop" step from "Happy path" scenario #13615
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
9575e3c
Cover the 'Use Java IDE features and the inner loop' step from 'Happy…
Ohrimenko1988 59ad850
Changes for debug
Ohrimenko1988 ffa1310
Changes for debug
Ohrimenko1988 cca7303
Add ability to store browser logs after test fail
Ohrimenko1988 5408847
Changes for debug
Ohrimenko1988 749bec7
Changes for debug
Ohrimenko1988 7757982
Changes for debug
Ohrimenko1988 0fe673f
Changes for debug
Ohrimenko1988 ffe530e
Changes for debug
Ohrimenko1988 4e966b5
Changes for debug
Ohrimenko1988 fb7a683
Workaround for the 'https://github.com/eclipse/che/issues/13681' bug
Ohrimenko1988 9d95830
Cleanup test
Ohrimenko1988 dc35ae9
Do changes according to review
Ohrimenko1988 628c64b
Add yaml files which defined test workspace
Ohrimenko1988 796215e
Cleanup tests
Ohrimenko1988 fafb5b9
Merge branch 'master' of https://github.com/eclipse/che into selen-ha…
Ohrimenko1988 ad94922
Remove hardcoded waits
Ohrimenko1988 d44d716
Do changes according to review
Ohrimenko1988 31def9b
remove redundant dependencies
Ohrimenko1988 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,11 +10,14 @@ | |
import * as mocha from 'mocha'; | ||
import { IDriver } from './IDriver'; | ||
import { e2eContainer } from '../inversify.config'; | ||
import { TYPES } from '../inversify.types'; | ||
import { TYPES, CLASSES } from '../inversify.types'; | ||
import * as fs from 'fs'; | ||
import { TestConstants } from '../TestConstants'; | ||
import { logging } from 'selenium-webdriver'; | ||
import { DriverHelper } from '../utils/DriverHelper'; | ||
|
||
const driver: IDriver = e2eContainer.get(TYPES.Driver); | ||
const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper); | ||
|
||
class CheReporter extends mocha.reporters.Spec { | ||
|
||
|
@@ -65,6 +68,8 @@ class CheReporter extends mocha.reporters.Spec { | |
const testReportDirPath: string = `${reportDirPath}/${testFullTitle}`; | ||
const screenshotFileName: string = `${testReportDirPath}/screenshot-${testTitle}.png`; | ||
const pageSourceFileName: string = `${testReportDirPath}/pagesource-${testTitle}.html`; | ||
const browserLogsFileName: string = `${testReportDirPath}/browserlogs-${testTitle}.txt`; | ||
|
||
|
||
// create reporter dir if not exist | ||
const reportDirExists: boolean = fs.existsSync(reportDirPath); | ||
|
@@ -91,8 +96,19 @@ class CheReporter extends mocha.reporters.Spec { | |
const pageSourceStream = fs.createWriteStream(pageSourceFileName); | ||
pageSourceStream.write(new Buffer(pageSource)); | ||
pageSourceStream.end(); | ||
}); | ||
|
||
// take browser console logs and write to 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. Nice addition. +1 ;-) |
||
const browserLogsEntries: logging.Entry[] = await driverHelper.getDriver().manage().logs().get('browser'); | ||
let browserLogs: string = ''; | ||
|
||
browserLogsEntries.forEach(log => { | ||
browserLogs += `\"${log.level}\" \"${log.type}\" \"${log.message}\"\n`; | ||
}); | ||
|
||
const browserLogsStream = fs.createWriteStream(browserLogsFileName); | ||
browserLogsStream.write(new Buffer(browserLogs)); | ||
browserLogsStream.end(); | ||
}); | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: mysql | ||
labels: | ||
app.kubernetes.io/name: mysql | ||
app.kubernetes.io/component: database | ||
app.kubernetes.io/part-of: petclinic | ||
spec: | ||
ports: | ||
- port: 3306 | ||
targetPort: 3306 | ||
selector: | ||
app.kubernetes.io/name: mysql | ||
app.kubernetes.io/component: database | ||
app.kubernetes.io/part-of: petclinic | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: db | ||
labels: | ||
app.kubernetes.io/name: mysql | ||
app.kubernetes.io/component: database | ||
app.kubernetes.io/part-of: petclinic | ||
spec: | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/name: mysql | ||
app.kubernetes.io/component: database | ||
app.kubernetes.io/part-of: petclinic | ||
replicas: 1 | ||
template: | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: mysql | ||
app.kubernetes.io/component: database | ||
app.kubernetes.io/part-of: petclinic | ||
spec: | ||
containers: | ||
- name: mysql | ||
image: centos/mysql-57-centos7 | ||
resources: | ||
requests: | ||
memory: 512Mi | ||
env: | ||
- name: MYSQL_USER | ||
value: petclinic | ||
- name: MYSQL_PASSWORD | ||
value: petclinic | ||
- name: MYSQL_ROOT_PASSWORD | ||
value: petclinic | ||
- name: MYSQL_DATABASE | ||
value: petclinic | ||
ports: | ||
- containerPort: 3306 | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: spring-boot-app | ||
labels: | ||
app.kubernetes.io/name: petclinic | ||
app.kubernetes.io/component: webapp | ||
app.kubernetes.io/part-of: petclinic | ||
spec: | ||
ports: | ||
- port: 8080 | ||
targetPort: 8080 | ||
selector: | ||
app.kubernetes.io/name: petclinic | ||
app.kubernetes.io/component: webapp | ||
app.kubernetes.io/part-of: petclinic | ||
--- | ||
apiVersion: apps/v1 # for k8s versions before 1.9.0 use apps/v1beta2 and before 1.8.0 use extensions/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
name: spring-boot-app | ||
labels: | ||
app.kubernetes.io/name: petclinic | ||
app.kubernetes.io/component: webapp | ||
app.kubernetes.io/part-of: petclinic | ||
spec: | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/name: petclinic | ||
app.kubernetes.io/component: webapp | ||
app.kubernetes.io/part-of: petclinic | ||
replicas: 1 | ||
template: | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: petclinic | ||
app.kubernetes.io/component: webapp | ||
app.kubernetes.io/part-of: petclinic | ||
spec: | ||
containers: | ||
- name: spring-boot | ||
image: mariolet/petclinic:d2831f9b | ||
resources: | ||
requests: | ||
memory: 1000Mi | ||
ports: | ||
- containerPort: 8080 | ||
--- | ||
apiVersion: extensions/v1beta1 | ||
kind: Ingress | ||
metadata: | ||
name: spring-boot-app | ||
labels: | ||
app: spring-petclinic | ||
tier: frontend | ||
annotations: | ||
kubernetes.io/ingress.class: "nginx" | ||
nginx.ingress.kubernetes.io/proxy-read-timeout: "3600" | ||
nginx.ingress.kubernetes.io/proxy-connect-timeout: "3600" | ||
nginx.ingress.kubernetes.io/ssl-redirect: "false" | ||
spec: | ||
rules: | ||
- host: 192.168.99.100.nip.io | ||
http: | ||
paths: | ||
- path: / | ||
backend: | ||
serviceName: spring-boot-app | ||
servicePort: 8080 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
--- | ||
apiVersion: 1.0.0 | ||
metadata: | ||
name: petclinic-dev-environment | ||
projects: | ||
- name: petclinic | ||
source: | ||
type: git | ||
location: 'https://github.com/spring-projects/spring-petclinic.git' | ||
components: | ||
- type: kubernetes | ||
alias: petclinic-web | ||
reference: https://raw.githubusercontent.com/eclipse/che/selen-happy-4/e2e/files/happy-path/containers-happy-path.yaml | ||
selector: | ||
app.kubernetes.io/component: webapp | ||
entrypoints: | ||
- containerName: spring-boot | ||
command: ["tail"] | ||
args: ["-f", "/dev/null"] | ||
- type: kubernetes | ||
alias: petclinic-db | ||
reference: https://raw.githubusercontent.com/eclipse/che/selen-happy-4/e2e/files/happy-path/containers-happy-path.yaml | ||
selector: | ||
app.kubernetes.io/component: database | ||
- type: dockerimage | ||
alias: maven-container | ||
image: bujhtr5555/maven-with-artifacts:latest | ||
command: ['sleep'] | ||
args: ['infinity'] | ||
env: | ||
- name: MAVEN_CONFIG | ||
value: /home/user/.m2 | ||
memoryLimit: 4Gi | ||
mountSources: true | ||
- type: cheEditor | ||
id: eclipse/che-theia/next | ||
- type: chePlugin | ||
id: redhat/java/latest | ||
- type: chePlugin | ||
id: redhat/vscode-yaml/latest | ||
commands: | ||
- name: build | ||
actions: | ||
- type: exec | ||
component: maven-container | ||
command: mvn clean package >> build.txt | ||
workdir: /projects/petclinic | ||
- name: build-file-output | ||
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' | ||
workdir: /projects/petclinic | ||
- name: run | ||
actions: | ||
- type: exec | ||
component: maven-container | ||
command: java -jar spring-petclinic-2.1.0.BUILD-SNAPSHOT.jar --spring.profiles.active=mysql | ||
workdir: /projects/petclinic/target | ||
- name: run-with-changes | ||
actions: | ||
- type: exec | ||
component: maven-container | ||
command: java -jar spring-petclinic-2.1.0.BUILD-SNAPSHOT.jar --spring.profiles.active=mysql | ||
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=1044 spring-petclinic-2.1.0.BUILD-SNAPSHOT.jar --spring.profiles.active=mysql | ||
workdir: /projects/petclinic/target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/********************************************************************* | ||
* Copyright (c) 2019 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 | ||
**********************************************************************/ | ||
import { inject, injectable } from 'inversify'; | ||
import { CLASSES } from '../../inversify.types'; | ||
import { DriverHelper } from '../../utils/DriverHelper'; | ||
import { By, Key } from 'selenium-webdriver'; | ||
import { Ide } from './Ide'; | ||
|
||
|
||
@injectable() | ||
export class DebugView { | ||
constructor(@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper, | ||
@inject(CLASSES.Ide) private readonly ide: Ide) { } | ||
|
||
async clickOnDebugConfigurationDropDown() { | ||
await this.driverHelper.waitAndClick(By.css('select.debug-configuration')); | ||
} | ||
|
||
async clickOnDebugConfigurationItem(itemText: string) { | ||
const configurationItemLocator: By = By.xpath(`//select[@class='debug-configuration']//option[text()=\'${itemText}\']`); | ||
|
||
await this.driverHelper.waitAndClick(configurationItemLocator); | ||
await this.ide.performKeyCombination(Key.ESCAPE); | ||
} | ||
|
||
async clickOnRunDebugButton() { | ||
const runDebugButtonLocator: By = By.xpath('//span[@title=\'Start Debugging\']'); | ||
|
||
await this.driverHelper.waitAndClick(runDebugButtonLocator); | ||
} | ||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Have we tried that without this timeout? (Just with default one?) I would prefer having default one and put this extended one just in case the default proves to be not sufficient.
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.
Without this variables each launch fails with "heap space" error
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 may have not been completely clear here... I was talking just about
CHE_INFRA_KUBERNETES_WORKSPACE__START__TIMEOUT__MIN
. This one is not affecting command execution (build inside workspace) in any way.