Skip to content
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

FTR: fix WebDriver Actions calls #44605

Merged

Conversation

dmlemeshko
Copy link
Member

@dmlemeshko dmlemeshko commented Sep 2, 2019

Summary

I noticed that the same functions work different while called on browser and webElementWrapper, e.g. browser.moveMouseTo vs element.moveMouseTo. Running some of them in Firefox causes exceptions.

This PR contains the following changes:

  • moveMouseTo, clickMouseButton, doubleClick can be executed on WebElementWrapper instance directly
  • browser service should be used to do the same operation using screen coordinates (pointer)
  • make sure all the Webdriver Actions API related calls work properly in both Chrome (non-w3c, w3c) and Firefox (w3c)
  • @LeeDr I noticed that dragging Histogram bars on Discover page in Firefox returns the exact same result we got on Chrome with w3c turned on: probably the main reason behind it, is that now offset is calculated from element center box (per W3C spec) and before it was the top left corner

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

For maintainers

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@@ -25,7 +25,6 @@ export default function ({ getService, getPageObjects }) {
const PageObjects = getPageObjects(['dashboard']);

describe('dashboard grid', function () {
this.tags(['skipFirefox']);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now this test is passing in Firefox as well

@@ -160,7 +160,7 @@ export default function ({ getService, getPageObjects }) {

const newDurationHours = await PageObjects.timePicker.getTimeDurationInHours();
expect(Math.round(newDurationHours)).to.be(3);
const rowData = await PageObjects.discover.getDocTableIndex(1);
const rowData = await PageObjects.discover.getDocTableField(1);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case of failure, we were getting a long string with all fields. To simplify analysis getDocTableField returns the date only.

offset ? { x: offset.x, y: offset.y } : { x: 0, y: 0 };

if (from.location instanceof WebElementWrapper === false) {
throw new Error('Dragging point should be WebElementWrapper instance');
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid confusing while getting this error. InvalidArgumentError: invalid argument: at least an element or offset should be set │ (Session info: chrome=76.0.3809.132) │ (Driver info: chromedriver=76.0.3809.68 (420c9498db8ce8fcd190a954d51297672c1515d5-refs/branch-heads/3809@{#864}),platform=Mac OS X 10.14.6 x86_64)

In non-w3c start point should be provided as WebElement

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@dmlemeshko dmlemeshko marked this pull request as ready for review September 2, 2019 18:34
@dmlemeshko dmlemeshko added release_note:skip Skip the PR/issue when compiling release notes v7.5.0 v8.0.0 v7.3.2 v7.4.0 labels Sep 2, 2019
Copy link
Contributor

@spalger spalger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@elasticmachine
Copy link
Contributor

💔 Build Failed

@LeeDr
Copy link
Contributor

LeeDr commented Sep 4, 2019

Running --grep 'discover test'
on Chrome browser first. Several test failures;

         └- × fail: "discover app discover test query should modify the time range when the histogram is brushed"
         │      Error: expected 'Sep 20, 2015 @ 02:53:24.492' to contain 'Sep 20, 2015 @ 02:56:02.323'

24 passing (8.0m)
1 failing

I changed my display scaling from 175% to 100% thinking this could fix the issue but it failed again with a different time;

         └- × fail: "discover app discover test query should modify the time range when the histogram is brushed"
         │      Error: expected 'Sep 20, 2015 @ 02:55:18.954' to contain 'Sep 20, 2015 @ 02:56:02.323'

This test is actually failing for me on master (on Windows, running Chrome headless) :-(

         └- × fail: "discover app discover test query should modify the time range when the histogram is brushed"
         │      Error: expected 'Sep 20, 2015 @ 02:53:24.492' to contain 'Sep 20, 2015 @ 02:56:02.323'

I could try this PR (and master) on Ubuntu and make another update here.

@LeeDr
Copy link
Contributor

LeeDr commented Sep 4, 2019

Ran the brush test on Ubuntu 18 on Chrome and it still failed;

         └- ✖ fail: "discover app discover test query should modify the time range when the histogram is brushed"
         │       Error: expected 'Sep 20, 2015 @ 02:54:25.048\n@message:34.197.178.155 - - [2015-09-20T02:54:25.048Z] "GET /uploads/daniel-bursch.jpg HTTP/1.1" 200 2609 "-" "Mozilla/4.0 (compatible; MSIE 6.

@LeeDr
Copy link
Contributor

LeeDr commented Sep 4, 2019

That brush test passed for me locally on Ubuntu when I ran it TEST_BROWSER_HEADLESS=1

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@dmlemeshko
Copy link
Member Author

@LeeDr Since brushing test fails on Windows with master code, I think we need to address the issue in separate PR. Probably it will require additional work on window scaling size, that you already started some time ago.

I checked the code again, and I do not make any specific changes to dragNdrop in Chrome, but splitting logic to make it easy to read and support.

Copy link
Contributor

@LeeDr LeeDr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dmlemeshko dmlemeshko merged commit 3a158b9 into elastic:master Sep 6, 2019
dmlemeshko added a commit to dmlemeshko/kibana that referenced this pull request Sep 6, 2019
* [services/web_element_wrapper] add actions API methods

* fixes

* [services/browser] fix dragAnDrop to work in both w3c/non-w3c modes

* small review changes

* dragAndDrop: add default values for offset
dmlemeshko added a commit that referenced this pull request Sep 6, 2019
* [services/web_element_wrapper] add actions API methods

* fixes

* [services/browser] fix dragAnDrop to work in both w3c/non-w3c modes

* small review changes

* dragAndDrop: add default values for offset
jloleysens added a commit to jloleysens/kibana that referenced this pull request Sep 6, 2019
…ete-for-distance_feature

* 'master' of github.com:elastic/kibana: (89 commits)
  Replace TSVB timeseries charts with elastic-charts (elastic#33558)
  [TSVB][Top N aggregation] Unable to deal with negative values (elastic#43581)
  [alerting] Adds Action Type configuration support and whitelisting (elastic#44483)
  FTR: fix WebDriver Actions calls (elastic#44605)
  [Code] add NodeRepositoriesService to watch new repositories on local node (elastic#44677)
  [skip-ci][Maps] Improve Maps intro page (elastic#44721)
  [Maps] Update titles and descriptions for data sources (elastic#44833)
  Types + Extract Integration Util (elastic#44433)
  Downgrade log level from info to debug for cases when we cannot handle authentication attempt. (elastic#44933)
  [Reporting] Remove Chome stdout/stderr observables, Add Browser Logger observable (elastic#44359)
  Update Jest script to output coverage (elastic#44447)
  [ftr] support --kibana-install-dir flag (elastic#44552)
  [WATCHER] Allow user to set a threshold value of 0 (elastic#44810)
  Remove injectI18n in dashboard plugin. (elastic#44580)
  [Graph] Save modal (elastic#44261)
  Use external script for the OIDC Implicit flow handler page. (elastic#44866)
  disable router prefixing with pluginId (elastic#44855)
  [SIEM] Fix bug on url + inspect functionality on hosts/hostDetails page (elastic#44671)
  [ML] File data viz limiting uploaded doc chunk size (elastic#44768)
  [code] Append go env variable 'GOCACHE' to go lsp spawn command. (elastic#44864)
  ...
jloleysens added a commit to jloleysens/kibana that referenced this pull request Sep 6, 2019
…plate

* 'master' of github.com:elastic/kibana: (91 commits)
  [APM] Make number of x ticks responsive to the plot width (elastic#44870)
  [ML] Single metric viewer: Fix top nav refresh behaviour. (elastic#44860)
  Replace TSVB timeseries charts with elastic-charts (elastic#33558)
  [TSVB][Top N aggregation] Unable to deal with negative values (elastic#43581)
  [alerting] Adds Action Type configuration support and whitelisting (elastic#44483)
  FTR: fix WebDriver Actions calls (elastic#44605)
  [Code] add NodeRepositoriesService to watch new repositories on local node (elastic#44677)
  [skip-ci][Maps] Improve Maps intro page (elastic#44721)
  [Maps] Update titles and descriptions for data sources (elastic#44833)
  Types + Extract Integration Util (elastic#44433)
  Downgrade log level from info to debug for cases when we cannot handle authentication attempt. (elastic#44933)
  [Reporting] Remove Chome stdout/stderr observables, Add Browser Logger observable (elastic#44359)
  Update Jest script to output coverage (elastic#44447)
  [ftr] support --kibana-install-dir flag (elastic#44552)
  [WATCHER] Allow user to set a threshold value of 0 (elastic#44810)
  Remove injectI18n in dashboard plugin. (elastic#44580)
  [Graph] Save modal (elastic#44261)
  Use external script for the OIDC Implicit flow handler page. (elastic#44866)
  disable router prefixing with pluginId (elastic#44855)
  [SIEM] Fix bug on url + inspect functionality on hosts/hostDetails page (elastic#44671)
  ...
dmlemeshko added a commit to dmlemeshko/kibana that referenced this pull request Sep 6, 2019
* [services/web_element_wrapper] add actions API methods

* fixes

* [services/browser] fix dragAnDrop to work in both w3c/non-w3c modes

* small review changes

* dragAndDrop: add default values for offset
dmlemeshko added a commit that referenced this pull request Sep 6, 2019
* [services/web_element_wrapper] add actions API methods

* fixes

* [services/browser] fix dragAnDrop to work in both w3c/non-w3c modes

* small review changes

* dragAndDrop: add default values for offset
dmlemeshko added a commit to dmlemeshko/kibana that referenced this pull request Sep 9, 2019
* [services/web_element_wrapper] add actions API methods

* fixes

* [services/browser] fix dragAnDrop to work in both w3c/non-w3c modes

* small review changes

* dragAndDrop: add default values for offset
dmlemeshko added a commit that referenced this pull request Sep 9, 2019
* [services/web_element_wrapper] add actions API methods

* fixes

* [services/browser] fix dragAnDrop to work in both w3c/non-w3c modes

* small review changes

* dragAndDrop: add default values for offset
@dmlemeshko dmlemeshko deleted the ftr/fix-webdriver-actions-calls branch January 31, 2022 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes v7.3.2 v7.4.0 v7.5.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants