added changes for bug 1434907 draft
authorpaarthurnax@live.ca
Fri, 09 Mar 2018 23:12:38 -0500
changeset 765741 a042f04d18e32f437d8c3b585f7cd88bb99837b6
parent 717422 05fed903f40f05fd923ba2137696ecc1fa0bafe6
push id102159
push userbmo:paarthurnax@live.ca
push dateSat, 10 Mar 2018 04:26:01 +0000
bugs1434907
milestone59.0a1
added changes for bug 1434907 MozReview-Commit-ID: 4AhmMe5V7ix
testing/marionette/harness/marionette_harness/tests/unit/test_click.py
testing/marionette/harness/marionette_harness/tests/unit/test_mouse_action.py
testing/marionette/harness/marionette_harness/tests/unit/test_visibility.py
testing/marionette/harness/marionette_harness/www/hidden.html
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_click.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_click.py
@@ -99,17 +99,17 @@ class TestLegacyClick(MarionetteTestCase
     def test_click_number_link(self):
         test_html = self.marionette.absolute_url("clicks.html")
         self.marionette.navigate(test_html)
         self.marionette.find_element(By.LINK_TEXT, "333333").click()
         self.marionette.find_element(By.ID, "testDiv")
         self.assertEqual(self.marionette.title, "Marionette Test")
 
     def test_clicking_an_element_that_is_not_displayed_raises(self):
-        test_html = self.marionette.absolute_url("hidden.html")
+        test_html = inline("<div id='parent' hidden> <div id='child'>My parent is hidden so you can't see me</div></div>")
         self.marionette.navigate(test_html)
 
         with self.assertRaises(errors.ElementNotInteractableException):
             self.marionette.find_element(By.ID, "child").click()
 
     def test_clicking_on_a_multiline_link(self):
         test_html = self.marionette.absolute_url("clicks.html")
         self.marionette.navigate(test_html)
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_mouse_action.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_mouse_action.py
@@ -29,18 +29,20 @@ class TestMouseAction(MarionetteTestCase
         self.marionette.navigate(test_html)
         link = self.marionette.find_element(By.ID, "mozLink")
         self.action.click(link).perform()
         self.assertEqual("Clicked", self.marionette.execute_script(
             "return document.getElementById('mozLink').innerHTML"))
 
     def test_clicking_element_out_of_view_succeeds(self):
         # The action based click doesn"t check for visibility.
-        test_html = self.marionette.absolute_url("hidden.html")
-        self.marionette.navigate(test_html)
+        self.marionette.navigate(inline("""
+        <div id='parent' hidden>
+            <div id='child'>My parent is hidden so you can't see me</div>
+        </div>"""))
         el = self.marionette.find_element(By.ID, "child")
         self.action.click(el).perform()
 
     def test_double_click_action(self):
         self.marionette.navigate(inline("""
           <div contenteditable>zyxw</div><input type="text"/>
         """))
 
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_visibility.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_visibility.py
@@ -1,16 +1,20 @@
 # 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/.
 
+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 TestVisibility(MarionetteTestCase):
 
     def testShouldAllowTheUserToTellIfAnElementIsDisplayedOrNot(self):
         test_html = self.marionette.absolute_url("visibility.html")
         self.marionette.navigate(test_html)
 
         self.assertTrue(self.marionette.find_element(By.ID, "displayed").is_displayed())
@@ -84,24 +88,25 @@ class TestVisibility(MarionetteTestCase)
 
     def testShouldSayElementIsInvisibleWhenOverflowXIsHiddenAndOutOfViewport(self):
         test_html = self.marionette.absolute_url("bug814037.html")
         self.marionette.navigate(test_html)
         overflow_x = self.marionette.find_element(By.ID, "assertMe2")
         self.assertFalse(overflow_x.is_displayed())
 
     def testShouldShowElementNotVisibleWithHiddenAttribute(self):
-        test_html = self.marionette.absolute_url("hidden.html")
-        self.marionette.navigate(test_html)
+        self.marionette.navigate(inline("""<div id='singleHidden' hidden>This will not be visible</div>"""))
         singleHidden = self.marionette.find_element(By.ID, 'singleHidden')
         self.assertFalse(singleHidden.is_displayed())
 
     def testShouldShowElementNotVisibleWhenParentElementHasHiddenAttribute(self):
-        test_html = self.marionette.absolute_url("hidden.html")
-        self.marionette.navigate(test_html)
+        self.marionette.navigate(inline("""
+        <div id='parent' hidden>
+            <div id='child'>My parent is hidden so you can't see me</div>
+        </div>"""))
         child = self.marionette.find_element(By.ID, 'child')
         self.assertFalse(child.is_displayed())
 
     def testShouldClickOnELementPartiallyOffLeft(self):
         test_html = self.marionette.absolute_url("element_left.html")
         self.marionette.navigate(test_html)
         self.marionette.find_element(By.CSS_SELECTOR, '.element').click()
 
deleted file mode 100644
--- a/testing/marionette/harness/marionette_harness/www/hidden.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<!DOCTYPE html>
-<div id='singleHidden' hidden>This will not be visible</div>
-<div id='parent' hidden>
-  <div id='child'>My parent is hidden so you can't see me</div>
-</div>
\ No newline at end of file