Skip to content

Commit

Permalink
Replace Leadfoot with WebDriver API (#26477)
Browse files Browse the repository at this point in the history
* [services/browser] switch to webdriver API

* [services/find] switch to webdriver API

* [services/remote] update to use webdriver service

* rename WebDriver service

* [services/remote] remove browser_driver_api

* [services/find] update to use WebDriver element wrapper

* [services/web_element_wrapper] use wrapped elements

* [services/find] use element wrapped moveMouseTo function

* [services/find] fix webdriver service init, add missing functions

* add missing functions for Leadfoot Element API

* [services/web_element_wrapper] add search by tag name

* tune WebDriver API calls to match Leadfoot

* Fixed implementation of moveMouseTo that is causing el.getClientRect error.

* fix references to WebElementWrapper

* [services/find] fix findElement call on webElementWrapper object

* fix issues in find and test_subject services

* [web_element_wrapper] add search by partial link text

* [services/find] adjust wrapper functions with Leadfoot API to support tests

* fix dragAnDrop & filer on elements displayed

* [visualise_page] improve searching of bucket element

* [discover_page] wait for visualisation loaded + dragAndDrop

* [service/find] fix exists, add pressKey for element

* fixes for visualize tests

* [services/browser] update dragAnddrop

* Made change to test to use move() code path in drag and drop.

* tune page objects for chart tests

* fix discover & xpack tests

* [page_objects/upgrade_assistant] fix locator

* [page_objects/discover_page] retry on brushHistogram to fix staleElementException

* update dragAndDrop, retry on getHeaders

* retry on getTextTag

* [services/screenshots] fix webdriver image take

* skip histogram brushed test & remove --bail

* use legacyAction for dragAndDrop with offset

* add missing await

* page objects update

* increase mocha timeout to 5 min

* use data-rendering-count to track visualization loading completion

* adjust waitForVisualizationRenderingCompleted

* [page_objects/visualize_page] add waiting for visualization

* fixes for xpack functional tests

* improve logging in find & testSubjects

* [services/find] fix wrapped element usage

* [page_objects/visual_builder_page] use BACK_SPACE key, supported by WebDriver

* page objects fix

* [services/test_subjects] add async/await

* [visualize/_tile_map] add missing await in tests

* fix tile_map tests for webdriver

* replace bluebird.prop with async/await

* try to wait for rendering in openLegendOptionColors

* additional logs in find.allByCssSelector

* [services/find] fix implicit wait  handling

* fix mapping in getRowsFromTable

* add timeouts and waitForVisualisation in failed tests

* [services/test_subjects] set default timeout to FIND_TIME

* [services/test_subjects] replace bluebird.filter with for loop

* replace retry.try with waitForVisualisation

* add 'visualize' PO import

* [services/web_element_wrapper] add scrollIntoView support

* fixing kibana-intake

* fixes after merging master

* Switching browser temporarily to firefox to get a CI run on FF.

* set chrome back to default browser

* print logs for some WebElementWrapper functions

* fix _wrap function

* update NOTICE.txt

* Fixed some firefox config to get the browser working. Consolidated some of the calls to build out the driver.

* Cleaning driver instance creation

* Added network throttling option for chrome.

* fix implicit wait setting

* uncomment bail

* adjust waiting for timepicker popup

* [services/inspector] process table in sequence

* Added conditional for TEST_THROTTLE_NETWORK option along with updating the speed and comments.

* add cheerio checks

* [services/apps_menu] get links quicker via innerHtml

* install webdriver dependency via yarn

* [services/combo_box] wrap getComboBoxSelectedOptions with retry

* remove leadfoot

* [testSubjects] remove unnecessary method

* [ftr/browser] explicitly export specific keys, keep `BACKSPACE` name

* Revert "[ftr/browser] explicitly export specific keys, keep `BACKSPACE` name"

This reverts commit 779335f.

* [ftr/filterBar] allow finding filters even if they're off the page

* [webdriver] write verbose logs

* [webdriver] shim executor to run all commands in series

Best we can tell WebDriver locks up sometimes when we send too many
commands at once, sometimes... It causes random lockups where we never
receive another response from WedDriver and we don't want to live with
that risk, so for now I've shimmed the Executor class in WebDiver to
queue all calls to Executor#send() if there is already a call in
progress.

* [webdriver] add comment about why we're shimming

* [webdriver] fix queue, actually put things there and take things off

* run all functional four times per build

* [webdriver] extract preventParallelCalls to test it

* Revert "run all functional four times per build"

This reverts commit f91996d.
  • Loading branch information
dmlemeshko authored Feb 16, 2019
1 parent 1138673 commit 0bd3b4f
Show file tree
Hide file tree
Showing 31 changed files with 1,076 additions and 1,022 deletions.
4 changes: 1 addition & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,7 @@ module.exports = {
* Files that run in the browser with only node-level transpilation
*/
{
files: [
'test/functional/services/lib/leadfoot_element_wrapper/scroll_into_view_if_necessary.js',
],
files: ['test/functional/services/lib/web_element_wrapper/scroll_into_view_if_necessary.js'],
rules: {
'prefer-object-spread/prefer-object-spread': 'off',
'no-var': 'off',
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@
"@types/eslint": "^4.16.2",
"@types/execa": "^0.9.0",
"@types/fetch-mock": "7.2.1",
"@types/json5": "^0.0.30",
"@types/getopts": "^2.0.0",
"@types/glob": "^5.0.35",
"@types/globby": "^8.0.0",
Expand All @@ -287,6 +286,7 @@
"@types/joi": "^13.4.2",
"@types/jquery": "^3.3.6",
"@types/js-yaml": "^3.11.1",
"@types/json5": "^0.0.30",
"@types/listr": "^0.13.0",
"@types/lodash": "^3.10.1",
"@types/minimatch": "^2.0.29",
Expand Down Expand Up @@ -373,7 +373,6 @@
"karma-junit-reporter": "1.2.0",
"karma-mocha": "1.3.0",
"karma-safari-launcher": "1.0.0",
"leadfoot": "1.7.5",
"license-checker": "^16.0.0",
"listr": "^0.14.1",
"load-grunt-config": "0.19.2",
Expand All @@ -393,6 +392,7 @@
"proxyquire": "1.7.11",
"regenerate": "^1.4.0",
"sass-lint": "^1.12.1",
"selenium-webdriver": "^4.0.0-alpha.1",
"simple-git": "1.37.0",
"sinon": "^5.0.7",
"strip-ansi": "^3.0.1",
Expand Down
1 change: 1 addition & 0 deletions src/dev/jest/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export default {
'<rootDir>/src/setup_node_env',
'<rootDir>/packages',
'<rootDir>/src/test_utils',
'<rootDir>/test/functional/services/remote',
],
collectCoverageFrom: [
'packages/kbn-ui-framework/src/components/**/*.js',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export class ProviderCollection {
instance = createAsyncInstance(type, name, instance);
}

if (name !== '__leadfoot__' && name !== 'log' && name !== 'config' && instance && typeof instance === 'object') {
if (name !== '__webdriver__' && name !== 'log' && name !== 'config' && instance && typeof instance === 'object') {
instance = createVerboseInstance(
this._log,
type === 'PageObject' ? `PageObjects.${name}` : name,
Expand Down
5 changes: 2 additions & 3 deletions test/functional/apps/dashboard/_dashboard_grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,9 @@ export default function ({ getService, getPageObjects }) {
const lastVisTitle = 'Rendering Test: datatable';
const panelTitleBeforeMove = await dashboardPanelActions.getPanelHeading(lastVisTitle);
const position1 = await panelTitleBeforeMove.getPosition();

await browser.dragAndDrop(
{ element: panelTitleBeforeMove },
{ element: null, xOffset: -20, yOffset: -450 }
{ location: panelTitleBeforeMove },
{ location: { x: -20, y: -450 } }
);

const panelTitleAfterMove = await dashboardPanelActions.getPanelHeading(lastVisTitle);
Expand Down
2 changes: 1 addition & 1 deletion test/functional/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export default async function ({ readConfigFile }) {
esArchiver: commonConfig.get('services.esArchiver'),
kibanaServer: commonConfig.get('services.kibanaServer'),
retry: commonConfig.get('services.retry'),
__leadfoot__: RemoteProvider,
__webdriver__: RemoteProvider,
filterBar: FilterBarProvider,
queryBar: QueryBarProvider,
find: FindProvider,
Expand Down
4 changes: 2 additions & 2 deletions test/functional/page_objects/discover_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ export function DiscoverPageProvider({ getService, getPageObjects }) {
async brushHistogram(from, to) {
const bars = await find.allByCssSelector('.series.histogram rect');
await browser.dragAndDrop(
{ element: bars[from], xOffset: 0, yOffset: -5 },
{ element: bars[to], xOffset: 0, yOffset: -5 }
{ location: bars[from], offset: { x: 0, y: -5 } },
{ location: bars[to], offset: { x: 0, y: -5 } }
);
}

Expand Down
14 changes: 14 additions & 0 deletions test/functional/page_objects/time_picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ export function TimePickerPageProvider({ getService, getPageObjects }) {
return dateString.substring(0, 23);
}

async getTimePickerPanel() {
return await find.byCssSelector('div.euiPopover__panel-isOpen');
}

async waitPanelIsGone(panelElement) {
await find.waitForElementStale(panelElement);
}

/**
* @param {String} fromTime YYYY-MM-DD HH:mm:ss.SSS
* @param {String} fromTime YYYY-MM-DD HH:mm:ss.SSS
Expand All @@ -49,11 +57,14 @@ export function TimePickerPageProvider({ getService, getPageObjects }) {

// set to time
await testSubjects.click('superDatePickerendDatePopoverButton');
let panel = await this.getTimePickerPanel();
await testSubjects.click('superDatePickerAbsoluteTab');
await testSubjects.setValue('superDatePickerAbsoluteDateInput', toTime);

// set from time
await testSubjects.click('superDatePickerstartDatePopoverButton');
await this.waitPanelIsGone(panel);
panel = await this.getTimePickerPanel();
await testSubjects.click('superDatePickerAbsoluteTab');
await testSubjects.setValue('superDatePickerAbsoluteDateInput', fromTime);

Expand All @@ -68,6 +79,7 @@ export function TimePickerPageProvider({ getService, getPageObjects }) {
await testSubjects.click('querySubmitButton');
}

await this.waitPanelIsGone(panel);
await PageObjects.header.awaitGlobalLoadingIndicatorHidden();
}

Expand Down Expand Up @@ -145,11 +157,13 @@ export function TimePickerPageProvider({ getService, getPageObjects }) {

// get to time
await testSubjects.click('superDatePickerendDatePopoverButton');
const panel = await this.getTimePickerPanel();
await testSubjects.click('superDatePickerAbsoluteTab');
const end = await testSubjects.getAttribute('superDatePickerAbsoluteDateInput', 'value');

// get from time
await testSubjects.click('superDatePickerstartDatePopoverButton');
await this.waitPanelIsGone(panel);
await testSubjects.click('superDatePickerAbsoluteTab');
const start = await testSubjects.getAttribute('superDatePickerAbsoluteDateInput', 'value');

Expand Down
2 changes: 1 addition & 1 deletion test/functional/page_objects/visual_builder_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export function VisualBuilderPageProvider({ getService, getPageObjects }) {
await input.pressKeys([browser.keys.CONTROL, 'a']); // Select all for everything else
}
await input.pressKeys(browser.keys.NULL); // Release modifier keys
await input.pressKeys(browser.keys.BACKSPACE); // Delete all content
await input.pressKeys(browser.keys.BACK_SPACE); // Delete all content
await input.type(markdown);
await PageObjects.visualize.waitForRenderingCount(prevRenderingCount + 1);
}
Expand Down
Loading

0 comments on commit 0bd3b4f

Please sign in to comment.