Commit 46947736 authored by Tricia Crichton's avatar Tricia Crichton Committed by Commit Bot

[ChromeDriver] Change window and element size in tests

Alter the element and window size to reduce flakiness of tests caused by
scrolling.

Bug: 1038366
Change-Id: I448ffd291a55d596f2a832021645061fde168931
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1984533Reviewed-by: default avatarJohn Chen <johnchen@chromium.org>
Commit-Queue: John Chen <johnchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#728030}
parent db8cf80a
......@@ -7,7 +7,7 @@
background: blue;
width: 300px;
height: 300px;
top: 300px;
top: 150px;
left: 100px;
}
......@@ -30,7 +30,7 @@ function testElementParentCenterLocation() {
var parent = document.getElementById('parent');
var location = getElementLocation(parent, true);
var x = 100 + 0.5 * 300;
var y = 300 + 0.5 * 300;
var y = 150 + 0.5 * 300;
assertEquals(Math.floor(x), Math.floor(location.x));
assertEquals(Math.floor(y), Math.floor(location.y));
}
......@@ -39,7 +39,7 @@ function testElementChildCenterLocation() {
var child = document.getElementById('child');
var location = getElementLocation(child, true);
var x = 150 + 0.5 * 200;
var y = 360 + 0.5 * 100;
var y = 210 + 0.5 * 100;
assertEquals(Math.floor(x), Math.floor(location.x));
assertEquals(Math.floor(y), Math.floor(location.y));
}
......@@ -48,7 +48,7 @@ function testElementParentTopLeftLocation() {
var parent = document.getElementById('parent');
var location = getElementLocation(parent, false);
var x = 100;
var y = 300;
var y = 150;
assertEquals(Math.floor(x), Math.floor(location.x));
assertEquals(Math.floor(y), Math.floor(location.y));
}
......@@ -57,7 +57,7 @@ function testElementChildCenterTopLeftLocation() {
var child = document.getElementById('child');
var location = getElementLocation(child, false);
var x = 150;
var y = 360;
var y = 210;
assertEquals(Math.floor(x), Math.floor(location.x));
assertEquals(Math.floor(y), Math.floor(location.y));
}
......@@ -66,7 +66,7 @@ function testElementChildCenterTopLeftLocation() {
<body>
<h2>position: absolute;</h2>
<p>The Parent element has position: absolute.</p>
<div id="parent">Parent: position: absolute, top: 300px, left: 100px.
<div id="parent">Parent: position: absolute, top: 150px, left: 100px.
<div id="child">Child: position: absolute, top: 60px, left: 50px.</div>
</div>
</body>
......
......@@ -80,8 +80,6 @@ _NEGATIVE_FILTER = [
'ChromeDriverPageLoadTimeoutTest.testRefreshWithPageLoadTimeout',
# testFocus is failing
'JavaScriptTests.testFocus',
# https://bugs.chromium.org/p/chromium/issues/detail?id=1038366
'JavaScriptTests.testAllJS',
]
......@@ -237,6 +235,8 @@ _ANDROID_NEGATIVE_FILTER['chrome'] = (
'ChromeDriverTest.testPushAndNotificationsPermissions',
'ChromeDriverTest.testSensorPermissions',
'ChromeDriverTest.testSettingPermissionDoesNotAffectOthers',
# Android does not allow changing window size
'JavaScriptTests.*',
]
)
_ANDROID_NEGATIVE_FILTER['chrome_stable'] = (
......@@ -4212,6 +4212,7 @@ class JavaScriptTests(ChromeDriverBaseTestWithWebServer):
def setUp(self):
self._driver = self.CreateDriver()
self.js_root = os.path.dirname(os.path.realpath(__file__)) + '/../js/'
self._driver.SetWindowRect(1000, 1000, 0, 0)
def checkTestResult(self):
def getStatus():
......
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