-
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
[TS-SELENIUM] Cover the "Use Java IDE features and the inner loop" step from "Happy path" scenario #13615
Changes from 10 commits
9575e3c
59ad850
ffa1310
cca7303
5408847
749bec7
7757982
0fe673f
ffe530e
4e966b5
fb7a683
9d95830
dc35ae9
628c64b
796215e
fafb5b9
ad94922
d44d716
31def9b
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 |
---|---|---|
|
@@ -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(); | ||
}); | ||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/********************************************************************* | ||
* 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}\']`); | ||
|
||
// for ensure that drop-down list has been opened | ||
await this.driverHelper.wait(2000); | ||
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. Couldn't these "hard" waits be replaced by some conditional waits? I think having "dumb" sleeps in test code is not a good practice. 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. In this case, it is not critical because it works properly even without this sleep. This is my overcautiousness for CI launches 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. I strongly believe any sleep like this should be either removed, or replaced by conditional wait. |
||
await this.driverHelper.waitAndClick(configurationItemLocator); | ||
|
||
// for ensure that item is selected | ||
await this.driverHelper.wait(1000); | ||
await this.ide.performKeyCombination(Key.ESCAPE); | ||
|
||
// for ensure that drop-down list has been closed | ||
await this.driverHelper.wait(2000); | ||
} | ||
|
||
async clickOnRunDebugButton() { | ||
const runDebugButtonLocator: By = By.xpath('//span[@title=\'Start Debugging\']'); | ||
|
||
await this.driverHelper.waitAndClick(runDebugButtonLocator); | ||
} | ||
|
||
} |
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.