Commit a15df3b0 authored by Tatiana Buldina's avatar Tatiana Buldina Committed by Commit Bot

[ChromeDriver] Fix ClickScrollingTests on Mac

Update ScrollElementRegionIntoViewHelper() to look for
kElementClickIntercepted instead of kUnknownError.
Reason was in https://crrev.com/634697 which changed
VerifyElementClickable() function to return
kElementClickIntercepted instead of kUnknownError.

Bug: chromedriver:2856
Change-Id: Ic2eee972663df9163e6fa6c56adcca1512e14efc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1797706Reviewed-by: default avatarJohn Chen <johnchen@chromium.org>
Commit-Queue: Tatiana Buldina <buldina@chromium.org>
Cr-Commit-Position: refs/heads/master@{#695775}
parent 7073eb61
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "chrome/test/chromedriver/chrome/js.h" #include "chrome/test/chromedriver/chrome/js.h"
#include "chrome/test/chromedriver/chrome/status.h" #include "chrome/test/chromedriver/chrome/status.h"
#include "chrome/test/chromedriver/chrome/web_view.h" #include "chrome/test/chromedriver/chrome/web_view.h"
#include "chrome/test/chromedriver/net/timeout.h"
#include "chrome/test/chromedriver/session.h" #include "chrome/test/chromedriver/session.h"
#include "third_party/webdriver/atoms.h" #include "third_party/webdriver/atoms.h"
...@@ -157,8 +158,7 @@ Status ScrollElementRegionIntoViewHelper( ...@@ -157,8 +158,7 @@ Status ScrollElementRegionIntoViewHelper(
middle.Offset(region.Width() / 2, region.Height() / 2); middle.Offset(region.Width() / 2, region.Height() / 2);
status = VerifyElementClickable( status = VerifyElementClickable(
frame, web_view, clickable_element_id, middle); frame, web_view, clickable_element_id, middle);
if (status.code() == kUnknownError && if (status.code() == kElementClickIntercepted) {
status.message().find("is not clickable") != std::string::npos) {
// Clicking at the target location isn't reaching the target element. // Clicking at the target location isn't reaching the target element.
// One possible cause is a scroll event handler has shifted the element. // One possible cause is a scroll event handler has shifted the element.
// Try again to get the updated location of the target element. // Try again to get the updated location of the target element.
...@@ -174,8 +174,15 @@ Status ScrollElementRegionIntoViewHelper( ...@@ -174,8 +174,15 @@ Status ScrollElementRegionIntoViewHelper(
} }
middle = tmp_location; middle = tmp_location;
middle.Offset(region.Width() / 2, region.Height() / 2); middle.Offset(region.Width() / 2, region.Height() / 2);
status = Timeout response_timeout(base::TimeDelta::FromSeconds(1));
VerifyElementClickable(frame, web_view, clickable_element_id, middle); do {
status =
VerifyElementClickable(frame, web_view, clickable_element_id, middle);
if (status.code() == kElementClickIntercepted)
base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(50));
else
break;
} while (!response_timeout.IsExpired());
} }
if (status.IsError()) if (status.IsError())
return status; return status;
......
...@@ -48,10 +48,6 @@ _OS_NEGATIVE_FILTER['mac'] = [ ...@@ -48,10 +48,6 @@ _OS_NEGATIVE_FILTER['mac'] = [
# Test 'WindowTest.testSetsTheSizeOfTheCurrentWindowFromIframe' passes while it is run # Test 'WindowTest.testSetsTheSizeOfTheCurrentWindowFromIframe' passes while it is run
# standalone and fails in a test suit run # standalone and fails in a test suit run
'WindowTest.testSetsTheSizeOfTheCurrentWindowFromIframe', 'WindowTest.testSetsTheSizeOfTheCurrentWindowFromIframe',
# https://bugs.chromium.org/p/chromedriver/issues/detail?id=2856
'ClickScrollingTest.testShouldBeAbleToClickElementThatIsOutOfViewInANestedFrameThatIsOutOfView',
'ClickScrollingTest.testShouldBeAbleToClickElementThatIsOutOfViewInANestedFrame',
] ]
_OS_NEGATIVE_FILTER['android:chrome'] = [ _OS_NEGATIVE_FILTER['android:chrome'] = [
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment