Bug 1434904 - Remove dependency to testSize.html in test_elementsize.py r=ato
authorMike Yusko <freshjelly12@yahoo.com>
Sat, 17 Feb 2018 14:16:49 +0200
changeset 404391 022b0205b80ef91d441838a2d2b55d6cafd5465c
parent 404390 1f5f5fe0abea007f339aa361970fd75ab0b84589
child 404392 e1ac6bfbb020275f1b1994e0ce11db0fb7599c2a
push id100000
push userncsoregi@mozilla.com
push dateMon, 19 Feb 2018 16:46:49 +0000
treeherdermozilla-inbound@176fb0d46b64 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersato
bugs1434904
milestone60.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1434904 - Remove dependency to testSize.html in test_elementsize.py r=ato MozReview-Commit-ID: EOteIE2ArhI
testing/marionette/harness/marionette_harness/tests/unit/test_elementsize.py
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_elementsize.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_elementsize.py
@@ -1,19 +1,35 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from __future__ import absolute_import
 
+import urllib
+
 from marionette_driver.by import By
 
 from marionette_harness import MarionetteTestCase
 
 
+TEST_SIZE = """
+    <?xml version="1.0"?>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+  <head>
+    <title>Test page for element size</title>
+  </head>
+  <body>
+    <p>Let's get the size of <a href='#' id='linkId'>some really cool link</a></p>
+  </body>
+</html>
+"""
+
+def inline(doc):
+    return "data:text/html;charset=utf-8,{}".format(urllib.quote(doc))
+
 class TestElementSize(MarionetteTestCase):
     def testShouldReturnTheSizeOfALink(self):
-        test_html = self.marionette.absolute_url("testSize.html")
-        self.marionette.navigate(test_html)
+        self.marionette.navigate(inline(TEST_SIZE))
         shrinko = self.marionette.find_element(By.ID, 'linkId')
         size = shrinko.rect
         self.assertTrue(size['width'] > 0)
         self.assertTrue(size['height'] > 0)