Skip to content

Commit

Permalink
[7.7] Revert FTR: add chromium-based Edge browser support (#61684) (#…
Browse files Browse the repository at this point in the history
…63063) (#63485)

* Revert "FTR: add chromium-based Edge browser support (#61684) (#63068)"

This reverts commit e8caa06.

* update lock file
  • Loading branch information
dmlemeshko authored Apr 15, 2020
1 parent fd94761 commit f081ced
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 413 deletions.
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@
"@types/recompose": "^0.30.6",
"@types/redux-actions": "^2.6.1",
"@types/request": "^2.48.2",
"@types/selenium-webdriver": "4.0.9",
"@types/selenium-webdriver": "^4.0.5",
"@types/semver": "^5.5.0",
"@types/sinon": "^7.0.13",
"@types/strip-ansi": "^3.0.0",
Expand Down Expand Up @@ -454,7 +454,6 @@
"load-grunt-config": "^3.0.1",
"mocha": "^7.1.1",
"mock-http-server": "1.3.0",
"ms-chromium-edge-driver": "^0.2.0",
"multistream": "^2.1.1",
"murmurhash3js": "3.0.1",
"mutation-observer": "^1.0.3",
Expand All @@ -473,7 +472,7 @@
"react-textarea-autosize": "^7.1.2",
"regenerate": "^1.4.0",
"sass-lint": "^1.12.1",
"selenium-webdriver": "^4.0.0-alpha.7",
"selenium-webdriver": "^4.0.0-alpha.5",
"simple-git": "1.116.0",
"simplebar-react": "^2.1.0",
"sinon": "^7.4.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export const schema = Joi.object()
browser: Joi.object()
.keys({
type: Joi.string()
.valid('chrome', 'firefox', 'ie', 'msedge')
.valid('chrome', 'firefox', 'ie')
.default('chrome'),

logPollingMs: Joi.number().default(100),
Expand Down
34 changes: 0 additions & 34 deletions test/functional/config.edge.js

This file was deleted.

4 changes: 1 addition & 3 deletions test/functional/services/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ export async function BrowserProvider({ getService }: FtrProviderContext) {
*/
public readonly browserType: string = browserType;

public readonly isChromium: boolean = [Browsers.Chrome, Browsers.ChromiumEdge].includes(
browserType
);
public readonly isChrome: boolean = browserType === Browsers.Chrome;

public readonly isFirefox: boolean = browserType === Browsers.Firefox;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ export class WebElementWrapper {
private driver: WebDriver = this.webDriver.driver;
private Keys = Key;
public isW3CEnabled: boolean = (this.webDriver.driver as any).executor_.w3c === true;
public isChromium: boolean = [Browsers.Chrome, Browsers.ChromiumEdge].includes(this.browserType);

public static create(
webElement: WebElement | WebElementWrapper,
Expand All @@ -64,7 +63,7 @@ export class WebElementWrapper {
timeout: number,
fixedHeaderHeight: number,
logger: ToolingLog,
browserType: Browsers
browserType: string
): WebElementWrapper {
if (webElement instanceof WebElementWrapper) {
return webElement;
Expand All @@ -88,7 +87,7 @@ export class WebElementWrapper {
private timeout: number,
private fixedHeaderHeight: number,
private logger: ToolingLog,
private browserType: Browsers
private browserType: string
) {}

private async _findWithCustomTimeout(
Expand Down Expand Up @@ -244,7 +243,7 @@ export class WebElementWrapper {
return this.clearValueWithKeyboard();
}
await this.retryCall(async function clearValue(wrapper) {
if (wrapper.isChromium || options.withJS) {
if (wrapper.browserType === Browsers.Chrome || options.withJS) {
// https://bugs.chromium.org/p/chromedriver/issues/detail?id=2702
await wrapper.driver.executeScript(`arguments[0].value=''`, wrapper._webElement);
} else {
Expand Down Expand Up @@ -276,7 +275,7 @@ export class WebElementWrapper {
await delay(100);
}
} else {
if (this.isChromium) {
if (this.browserType === Browsers.Chrome) {
// https://bugs.chromium.org/p/chromedriver/issues/detail?id=30
await this.retryCall(async function clearValueWithKeyboard(wrapper) {
await wrapper.driver.executeScript(`arguments[0].select();`, wrapper._webElement);
Expand Down
1 change: 0 additions & 1 deletion test/functional/services/remote/browsers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,4 @@ export enum Browsers {
Chrome = 'chrome',
Firefox = 'firefox',
InternetExplorer = 'ie',
ChromiumEdge = 'msedge',
}
15 changes: 4 additions & 11 deletions test/functional/services/remote/remote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,16 @@ export async function RemoteProvider({ getService }: FtrProviderContext) {
lifecycle,
config.get('browser.logPollingMs')
);

const isW3CEnabled = (driver as any).executor_.w3c;

const caps = await driver.getCapabilities();
const browserVersion = caps.get(
isW3CEnabled || browserType === Browsers.ChromiumEdge ? 'browserVersion' : 'version'
);
const browserVersion = caps.get(isW3CEnabled ? 'browserVersion' : 'version');

log.info(
`Remote initialized: ${caps.get(
'browserName'
)} ${browserVersion}, w3c compliance=${isW3CEnabled}`
);
log.info(`Remote initialized: ${caps.get('browserName')} ${browserVersion}`);

if ([Browsers.Chrome, Browsers.ChromiumEdge].includes(browserType)) {
if (browserType === Browsers.Chrome) {
log.info(
`${browserType}driver version: ${caps.get(browserType)[`${browserType}driverVersion`]}`
`Chromedriver version: ${caps.get('chrome').chromedriverVersion}, w3c=${isW3CEnabled}`
);
}

Expand Down
45 changes: 1 addition & 44 deletions test/functional/services/remote/webdriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,10 @@ import firefox from 'selenium-webdriver/firefox';
// @ts-ignore types not available
import ie from 'selenium-webdriver/ie';
// @ts-ignore internal modules are not typed
import edge from 'selenium-webdriver/edge';
import { installDriver } from 'ms-chromium-edge-driver';
// @ts-ignore internal modules are not typed
import { Executor } from 'selenium-webdriver/lib/http';
// @ts-ignore internal modules are not typed
import { getLogger } from 'selenium-webdriver/lib/logging';

import { pollForLogEntry$ } from './poll_for_log_entry';
import { createStdoutSocket } from './create_stdout_stream';
import { preventParallelCalls } from './prevent_parallel_calls';
Expand Down Expand Up @@ -67,7 +65,6 @@ Executor.prototype.execute = preventParallelCalls(
);

let attemptCounter = 0;
let edgePaths: { driverPath: string | undefined; browserPath: string | undefined };
async function attemptToCreateCommand(
log: ToolingLog,
browserType: Browsers,
Expand All @@ -79,41 +76,6 @@ async function attemptToCreateCommand(

const buildDriverInstance = async () => {
switch (browserType) {
case 'msedge': {
if (edgePaths && edgePaths.browserPath && edgePaths.driverPath) {
const edgeOptions = new edge.Options();
if (headlessBrowser === '1') {
// @ts-ignore internal modules are not typed
edgeOptions.headless();
}
// @ts-ignore internal modules are not typed
edgeOptions.setEdgeChromium(true);
// @ts-ignore internal modules are not typed
edgeOptions.setBinaryPath(edgePaths.browserPath);
const session = await new Builder()
.forBrowser('MicrosoftEdge')
.setEdgeOptions(edgeOptions)
.setEdgeService(new edge.ServiceBuilder(edgePaths.driverPath))
.build();
return {
session,
consoleLog$: pollForLogEntry$(session, logging.Type.BROWSER, logPollingMs).pipe(
takeUntil(lifecycle.cleanup.after$),
map(({ message, level: { name: level } }) => ({
message: message.replace(/\\n/g, '\n'),
level,
}))
),
};
} else {
throw new Error(
`Chromium Edge session requires browser or driver path to be defined: ${JSON.stringify(
edgePaths
)}`
);
}
}

case 'chrome': {
const chromeCapabilities = Capabilities.chrome();
const chromeOptions = [
Expand Down Expand Up @@ -300,11 +262,6 @@ export async function initWebDriver(
log.verbose(entry.message);
});

// download Edge driver only in case of usage
if (browserType === Browsers.ChromiumEdge) {
edgePaths = await installDriver();
}

return await Promise.race([
(async () => {
await delay(2 * MINUTE);
Expand Down
21 changes: 0 additions & 21 deletions x-pack/test/functional/config.edge.js

This file was deleted.

Loading

0 comments on commit f081ced

Please sign in to comment.