Bug 1434909 - Remove dependency to rectangles.html in test_position.py
MozReview-Commit-ID: 75uJNm4ESOp
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_position.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_position.py
@@ -1,21 +1,47 @@
# 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
+def inline(doc):
+ return "data:text/html;charset=utf-8,{}".format(urllib.quote(doc))
+
class TestPosition(MarionetteTestCase):
-
def test_should_get_element_position_back(self):
- test_url = self.marionette.absolute_url('rectangles.html')
- self.marionette.navigate(test_url)
+ doc = """
+ <head>
+ <title>Rectangles</title>
+ <style>
+ div {
+ position: absolute;
+ margin: 0;
+ border: 0;
+ padding: 0;
+ }
+ #r {
+ background-color: red;
+ left: 11px;
+ top: 10px;
+ width: 48.666666667px;
+ height: 49.333333333px;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="r">r</div>
+ </body>
+ """
+ self.marionette.navigate(inline(doc))
- r2 = self.marionette.find_element(By.ID, "r2")
+ r2 = self.marionette.find_element(By.ID, "r")
location = r2.rect
self.assertEqual(11, location['x'])
self.assertEqual(10, location['y'])
deleted file mode 100644
--- a/testing/marionette/harness/marionette_harness/www/rectangles.html
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0"?>
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <title>Rectangles</title>
- <style type="text/css">
- div {
- position: absolute;
- margin: 0;
- border: 0;
- padding: 0;
- }
- #r1 {
- background-color: blue;
- left: 10px;
- top: 10px;
- width: 100px;
- height: 50px;
- }
- #r2 {
- background-color: red;
- left: 11px;
- top: 10px;
- width: 48.666666667px;
- height: 49.333333333px;
- }
- #r3 {
- background-color: yellow;
- left: 60px;
- top: 10px;
- width: 50px;
- height: 25px;
- }
- </style>
-</head>
- <body>
- <div id="r1">r1</div>
- <div id="r2">r2</div>
- <div id="r3">r3</div>
- </body>
-</html>