Commit 88cbe356 authored by Elly Fong-Jones's avatar Elly Fong-Jones Committed by Commit Bot

mac: fix for chromedriver screenshot test

This test flakily fails on Mac, like in this run:
https://ci.chromium.org/p/chromium/builders/ci/Mac10.14%20Tests/2044

The flakes are caused by the scrollbar sometimes showing or not showing; see the
root cause analysis given on the linked bug. Using "overflow: hidden" on the
body will prevent the scrollbar from ever showing.

Bug: 1005670
Change-Id: Icb7ac47e6c0acd53b7733693282a493e3ab0e09f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2033366Reviewed-by: default avatarJohn Chen <johnchen@chromium.org>
Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#737422}
parent 815680e0
......@@ -2167,17 +2167,8 @@ class ChromeDriverTest(ChromeDriverBaseTestWithWebServer):
self._driver.Load(self.GetHttpUrlForFile(
'/chromedriver/page_with_redbox.html'))
analysisResult = 'FAIL'
i = 0
redElement = self._driver.FindElement('css selector', '#box')
# In some cases (particularly on Mac),
# scrollbars are displayed briefly after scrolling,
# causing failures in verifying the screenshot.
# Retries until the scrollbars disappear.
while analysisResult != 'PASS' and i < 3:
analysisResult = self.takeScreenshotAndVerifyCorrect(redElement)
i += 1
if analysisResult != 'PASS':
time.sleep(0.5)
analysisResult = self.takeScreenshotAndVerifyCorrect(redElement)
self.assertEquals('PASS', analysisResult)
def testTakeElementScreenshotInIframe(self):
......@@ -2186,17 +2177,8 @@ class ChromeDriverTest(ChromeDriverBaseTestWithWebServer):
frame = self._driver.FindElement('css selector', '#frm')
self._driver.SwitchToFrame(frame)
analysisResult = 'FAIL'
i = 0
redElement = self._driver.FindElement('css selector', '#box')
# In some cases (particularly on Mac),
# scrollbars are displayed briefly after scrolling,
# causing failures in verifying the screenshot.
# Retries until the scrollbars disappear.
while analysisResult != 'PASS' and i < 3:
analysisResult = self.takeScreenshotAndVerifyCorrect(redElement)
i += 1
if analysisResult != 'PASS':
time.sleep(0.5)
analysisResult = self.takeScreenshotAndVerifyCorrect(redElement)
self.assertEquals('PASS', analysisResult)
def testTakeLargeElementScreenshot(self):
......
<!DOCTYPE html>
<html>
<body>
<body style="overflow: hidden">
<iframe id="frm" width="300" height="200" style="position: absolute; top: 2500px; left: 2500px; border: 20px solid red; padding: 20px; margin: 20px" src="page_with_redbox.html">
</iframe>
</body>
......
<!DOCTYPE html>
<html>
<body>
<body style="overflow: hidden">
<div id='box' style='width: 120px; height: 20px; background-color: red; position: absolute; left: 2000px; top: 3000px; border: 20px solid red; padding: 20px; margin: 20px'></div>
</body>
</html>
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