Remove IE support in functional tests (#71285)

* [ftr] remove ie support

* remove ie integration tests config
This commit is contained in:
Dmitry Lemeshko 2020-07-09 22:12:52 +02:00 committed by GitHub
parent f7b5144e1d
commit 633968e053
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 39 additions and 322 deletions

View file

@ -148,7 +148,7 @@ export const schema = Joi.object()
browser: Joi.object()
.keys({
type: Joi.string().valid('chrome', 'firefox', 'ie', 'msedge').default('chrome'),
type: Joi.string().valid('chrome', 'firefox', 'msedge').default('chrome'),
logPollingMs: Joi.number().default(100),
acceptInsecureCerts: Joi.boolean().default(false),

View file

@ -26,21 +26,11 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['common', 'header', 'home', 'timePicker']);
const appsMenu = getService('appsMenu');
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
describe('Kibana browser back navigation should work', function describeIndexTests() {
before(async () => {
await esArchiver.loadIfNeeded('discover');
await esArchiver.loadIfNeeded('logstash_functional');
if (browser.isInternetExplorer) {
await kibanaServer.uiSettings.replace({ 'state:storeInSessionStorage': false });
}
});
after(async () => {
if (browser.isInternetExplorer) {
await kibanaServer.uiSettings.replace({ 'state:storeInSessionStorage': true });
}
});
it('detect navigate back issues', async () => {

View file

@ -1,52 +0,0 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
export default async function ({ readConfigFile }) {
const defaultConfig = await readConfigFile(require.resolve('./config'));
return {
...defaultConfig.getAll(),
browser: {
type: 'ie',
},
junit: {
reportName: 'Internet Explorer UI Functional Tests',
},
uiSettings: {
defaults: {
'accessibility:disableAnimations': true,
'dateFormat:tz': 'UTC',
'state:storeInSessionStorage': true,
'notifications:lifetime:info': 10000,
},
},
kbnTestServer: {
...defaultConfig.get('kbnTestServer'),
serverArgs: [
...defaultConfig.get('kbnTestServer.serverArgs'),
'--csp.strict=false',
'--telemetry.optIn=false',
],
},
};
}

View file

@ -98,13 +98,6 @@ export function TimePickerProvider({ getService, getPageObjects }: FtrProviderCo
const input = await testSubjects.find(dataTestSubj);
await input.clearValue();
await input.type(value);
} else if (browser.isInternetExplorer) {
const input = await testSubjects.find(dataTestSubj);
const currentValue = await input.getAttribute('value');
await input.type(browser.keys.ARROW_RIGHT.repeat(currentValue.length));
await input.type(browser.keys.BACK_SPACE.repeat(currentValue.length));
await input.type(value);
await input.click();
} else {
await testSubjects.setValue(dataTestSubj, value);
}

View file

@ -34,8 +34,6 @@ export async function BrowserProvider({ getService }: FtrProviderContext) {
const log = getService('log');
const { driver, browserType } = await getService('__webdriver__').init();
const isW3CEnabled = (driver as any).executor_.w3c === true;
return new (class BrowserService {
/**
* Keyboard events
@ -53,19 +51,12 @@ export async function BrowserProvider({ getService }: FtrProviderContext) {
public readonly isFirefox: boolean = browserType === Browsers.Firefox;
public readonly isInternetExplorer: boolean = browserType === Browsers.InternetExplorer;
/**
* Is WebDriver instance W3C compatible
*/
isW3CEnabled = isW3CEnabled;
/**
* Returns instance of Actions API based on driver w3c flag
* https://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/lib/webdriver_exports_WebDriver.html#actions
*/
public getActions() {
return this.isW3CEnabled ? driver.actions() : driver.actions({ bridge: true });
return driver.actions();
}
/**
@ -164,12 +155,7 @@ export async function BrowserProvider({ getService }: FtrProviderContext) {
*/
public async getCurrentUrl() {
// strip _t=Date query param when url is read
let current: string;
if (this.isInternetExplorer) {
current = await driver.executeScript('return window.document.location.href');
} else {
current = await driver.getCurrentUrl();
}
const current = await driver.getCurrentUrl();
const currentWithoutTime = modifyUrl(current, (parsed) => {
delete (parsed.query as any)._t;
return void 0;
@ -214,15 +200,8 @@ export async function BrowserProvider({ getService }: FtrProviderContext) {
* @return {Promise<void>}
*/
public async moveMouseTo(point: { x: number; y: number }): Promise<void> {
if (this.isW3CEnabled) {
await this.getActions().move({ x: 0, y: 0 }).perform();
await this.getActions().move({ x: point.x, y: point.y, origin: Origin.POINTER }).perform();
} else {
await this.getActions()
.pause(this.getActions().mouse)
.move({ x: point.x, y: point.y, origin: Origin.POINTER })
.perform();
}
await this.getActions().move({ x: 0, y: 0 }).perform();
await this.getActions().move({ x: point.x, y: point.y, origin: Origin.POINTER }).perform();
}
/**
@ -237,44 +216,20 @@ export async function BrowserProvider({ getService }: FtrProviderContext) {
from: { offset?: { x: any; y: any }; location: any },
to: { offset?: { x: any; y: any }; location: any }
) {
if (this.isW3CEnabled) {
// The offset should be specified in pixels relative to the center of the element's bounding box
const getW3CPoint = (data: any) => {
if (!data.offset) {
data.offset = {};
}
return data.location instanceof WebElementWrapper
? { x: data.offset.x || 0, y: data.offset.y || 0, origin: data.location._webElement }
: { x: data.location.x, y: data.location.y, origin: Origin.POINTER };
};
const startPoint = getW3CPoint(from);
const endPoint = getW3CPoint(to);
await this.getActions().move({ x: 0, y: 0 }).perform();
return await this.getActions().move(startPoint).press().move(endPoint).release().perform();
} else {
// The offset should be specified in pixels relative to the top-left corner of the element's bounding box
const getOffset: any = (offset: { x: number; y: number }) =>
offset ? { x: offset.x || 0, y: offset.y || 0 } : { x: 0, y: 0 };
if (from.location instanceof WebElementWrapper === false) {
throw new Error('Dragging point should be WebElementWrapper instance');
} else if (typeof to.location.x === 'number') {
return await this.getActions()
.move({ origin: from.location._webElement })
.press()
.move({ x: to.location.x, y: to.location.y, origin: Origin.POINTER })
.release()
.perform();
} else {
return await new LegacyActionSequence(driver)
.mouseMove(from.location._webElement, getOffset(from.offset))
.mouseDown()
.mouseMove(to.location._webElement, getOffset(to.offset))
.mouseUp()
.perform();
// The offset should be specified in pixels relative to the center of the element's bounding box
const getW3CPoint = (data: any) => {
if (!data.offset) {
data.offset = {};
}
}
return data.location instanceof WebElementWrapper
? { x: data.offset.x || 0, y: data.offset.y || 0, origin: data.location._webElement }
: { x: data.location.x, y: data.location.y, origin: Origin.POINTER };
};
const startPoint = getW3CPoint(from);
const endPoint = getW3CPoint(to);
await this.getActions().move({ x: 0, y: 0 }).perform();
return await this.getActions().move(startPoint).press().move(endPoint).release().perform();
}
/**
@ -341,19 +296,11 @@ export async function BrowserProvider({ getService }: FtrProviderContext) {
* @return {Promise<void>}
*/
public async clickMouseButton(point: { x: number; y: number }) {
if (this.isW3CEnabled) {
await this.getActions().move({ x: 0, y: 0 }).perform();
await this.getActions()
.move({ x: point.x, y: point.y, origin: Origin.POINTER })
.click()
.perform();
} else {
await this.getActions()
.pause(this.getActions().mouse)
.move({ x: point.x, y: point.y, origin: Origin.POINTER })
.click()
.perform();
}
await this.getActions().move({ x: 0, y: 0 }).perform();
await this.getActions()
.move({ x: point.x, y: point.y, origin: Origin.POINTER })
.click()
.perform();
}
/**

View file

@ -47,7 +47,6 @@ const RETRY_CLICK_RETRY_ON_ERRORS = [
export class WebElementWrapper {
private By = By;
private Keys = Key;
public isW3CEnabled: boolean = (this.driver as any).executor_.w3c === true;
public isChromium: boolean = [Browsers.Chrome, Browsers.ChromiumEdge].includes(this.browserType);
public static create(
@ -141,7 +140,7 @@ export class WebElementWrapper {
}
private getActions() {
return this.isW3CEnabled ? this.driver.actions() : this.driver.actions({ bridge: true });
return this.driver.actions();
}
/**
@ -233,9 +232,6 @@ export class WebElementWrapper {
* @default { withJS: false }
*/
async clearValue(options: ClearOptions = { withJS: false }) {
if (this.browserType === Browsers.InternetExplorer) {
return this.clearValueWithKeyboard();
}
await this.retryCall(async function clearValue(wrapper) {
if (wrapper.isChromium || options.withJS) {
// https://bugs.chromium.org/p/chromedriver/issues/detail?id=2702
@ -252,16 +248,6 @@ export class WebElementWrapper {
* @default { charByChar: false }
*/
async clearValueWithKeyboard(options: TypeOptions = { charByChar: false }) {
if (this.browserType === Browsers.InternetExplorer) {
const value = await this.getAttribute('value');
// For IE testing, the text field gets clicked in the middle so
// first go HOME and then DELETE all chars
await this.pressKeys(this.Keys.HOME);
for (let i = 0; i <= value.length; i++) {
await this.pressKeys(this.Keys.DELETE);
}
return;
}
if (options.charByChar === true) {
const value = await this.getAttribute('value');
for (let i = 0; i <= value.length; i++) {
@ -429,19 +415,11 @@ export class WebElementWrapper {
public async moveMouseTo(options = { xOffset: 0, yOffset: 0 }) {
await this.retryCall(async function moveMouseTo(wrapper) {
await wrapper.scrollIntoViewIfNecessary();
if (wrapper.isW3CEnabled) {
await wrapper.getActions().move({ x: 0, y: 0 }).perform();
await wrapper
.getActions()
.move({ x: options.xOffset, y: options.yOffset, origin: wrapper._webElement })
.perform();
} else {
await wrapper
.getActions()
.pause(wrapper.getActions().mouse)
.move({ x: options.xOffset, y: options.yOffset, origin: wrapper._webElement })
.perform();
}
await wrapper.getActions().move({ x: 0, y: 0 }).perform();
await wrapper
.getActions()
.move({ x: options.xOffset, y: options.yOffset, origin: wrapper._webElement })
.perform();
});
}
@ -456,21 +434,12 @@ export class WebElementWrapper {
public async clickMouseButton(options = { xOffset: 0, yOffset: 0 }) {
await this.retryCall(async function clickMouseButton(wrapper) {
await wrapper.scrollIntoViewIfNecessary();
if (wrapper.isW3CEnabled) {
await wrapper.getActions().move({ x: 0, y: 0 }).perform();
await wrapper
.getActions()
.move({ x: options.xOffset, y: options.yOffset, origin: wrapper._webElement })
.click()
.perform();
} else {
await wrapper
.getActions()
.pause(wrapper.getActions().mouse)
.move({ x: options.xOffset, y: options.yOffset, origin: wrapper._webElement })
.click()
.perform();
}
await wrapper.getActions().move({ x: 0, y: 0 }).perform();
await wrapper
.getActions()
.move({ x: options.xOffset, y: options.yOffset, origin: wrapper._webElement })
.click()
.perform();
});
}

View file

@ -20,6 +20,5 @@
export enum Browsers {
Chrome = 'chrome',
Firefox = 'firefox',
InternetExplorer = 'ie',
ChromiumEdge = 'msedge',
}

View file

@ -64,15 +64,12 @@ export async function RemoteProvider({ getService }: FtrProviderContext) {
};
const { driver, consoleLog$ } = await initWebDriver(log, browserType, lifecycle, browserConfig);
const isW3CEnabled = (driver as any).executor_.w3c;
const caps = await driver.getCapabilities();
const browserVersion = caps.get(isW3CEnabled ? 'browserVersion' : 'version');
log.info(
`Remote initialized: ${caps.get(
'browserName'
)} ${browserVersion}, w3c compliance=${isW3CEnabled}, collectingCoverage=${collectCoverage}`
`Remote initialized: ${caps.get('browserName')} ${caps.get(
'browserVersion'
)}, collectingCoverage=${collectCoverage}`
);
if ([Browsers.Chrome, Browsers.ChromiumEdge].includes(browserType)) {

View file

@ -17,7 +17,7 @@
* under the License.
*/
import { delimiter, resolve } from 'path';
import { resolve } from 'path';
import Fs from 'fs';
import * as Rx from 'rxjs';
@ -279,40 +279,6 @@ async function attemptToCreateCommand(
};
}
case 'ie': {
// https://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/ie_exports_Options.html
const driverPath = require.resolve('iedriver/lib/iedriver');
process.env.PATH = driverPath + delimiter + process.env.PATH;
const ieCapabilities = Capabilities.ie();
ieCapabilities.set('se:ieOptions', {
'ie.ensureCleanSession': true,
ignoreProtectedModeSettings: true,
ignoreZoomSetting: false, // requires us to have 100% zoom level
nativeEvents: true, // need this for values to stick but it requires 100% scaling and window focus
requireWindowFocus: true,
logLevel: 'TRACE',
});
let session;
if (remoteSessionUrl) {
session = await new Builder()
.forBrowser(browserType)
.withCapabilities(ieCapabilities)
.usingServer(remoteSessionUrl)
.build();
} else {
session = await new Builder()
.forBrowser(browserType)
.withCapabilities(ieCapabilities)
.build();
}
return {
session,
consoleLog$: Rx.EMPTY,
};
}
default:
throw new Error(`${browserType} is not supported yet`);
}

View file

@ -1,74 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
export default async function ({ readConfigFile }) {
const defaultConfig = await readConfigFile(require.resolve('./config'));
return {
...defaultConfig.getAll(),
//csp.strict: false
// testFiles: [
// require.resolve(__dirname, './apps/advanced_settings'),
// require.resolve(__dirname, './apps/canvas'),
// require.resolve(__dirname, './apps/graph'),
// require.resolve(__dirname, './apps/monitoring'),
// require.resolve(__dirname, './apps/watcher'),
// require.resolve(__dirname, './apps/dashboard'),
// require.resolve(__dirname, './apps/dashboard_mode'),
// require.resolve(__dirname, './apps/discover'),
// require.resolve(__dirname, './apps/security'),
// require.resolve(__dirname, './apps/spaces'),
// require.resolve(__dirname, './apps/lens'),
// require.resolve(__dirname, './apps/logstash'),
// require.resolve(__dirname, './apps/grok_debugger'),
// require.resolve(__dirname, './apps/infra'),
// require.resolve(__dirname, './apps/ml'),
// require.resolve(__dirname, './apps/rollup_job'),
// require.resolve(__dirname, './apps/maps'),
// require.resolve(__dirname, './apps/status_page'),
// require.resolve(__dirname, './apps/timelion'),
// require.resolve(__dirname, './apps/upgrade_assistant'),
// require.resolve(__dirname, './apps/visualize'),
// require.resolve(__dirname, './apps/uptime'),
// require.resolve(__dirname, './apps/saved_objects_management'),
// require.resolve(__dirname, './apps/dev_tools'),
// require.resolve(__dirname, './apps/apm'),
// require.resolve(__dirname, './apps/index_patterns'),
// require.resolve(__dirname, './apps/index_management'),
// require.resolve(__dirname, './apps/index_lifecycle_management'),
// require.resolve(__dirname, './apps/snapshot_restore'),
// require.resolve(__dirname, './apps/cross_cluster_replication'),
// require.resolve(__dirname, './apps/remote_clusters'),
// // This license_management file must be last because it is destructive.
// require.resolve(__dirname, './apps/license_management'),
// ],
browser: {
type: 'ie',
},
junit: {
reportName: 'Internet Explorer UI Functional X-Pack Tests',
},
uiSettings: {
defaults: {
'accessibility:disableAnimations': true,
'dateFormat:tz': 'UTC',
'state:storeInSessionStorage': true,
},
},
kbnTestServer: {
...defaultConfig.get('kbnTestServer'),
serverArgs: [
...defaultConfig.get('kbnTestServer.serverArgs'),
'--csp.strict=false',
'--telemetry.optIn=false',
],
},
};
}

View file

@ -1,18 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
export default async ({ readConfigFile }) => {
const baseConfigs = await readConfigFile(
require.resolve('./config.stack_functional_integration_base.js')
);
return {
...baseConfigs.getAll(),
browser: {
type: 'ie',
},
security: { disableTestUser: true },
};
};