Bug 1434907 - [marionette] Remove dependency to hidden.html in unit tests. r=whimboo
authorAditya Khadse <akk5597@gmail.com>
Wed, 09 May 2018 14:28:48 +0530
changeset 417714 ac582f3509d43aea21251329dae9f314b4875681
parent 417713 dc707cbe6702161652c7acd8e29f5066f3b2e205
child 417715 d1785dd8656246b853acd18e11d9cd9c4c47b648
push id33977
push userncsoregi@mozilla.com
push dateThu, 10 May 2018 16:43:24 +0000
treeherdermozilla-central@17db33b6a124 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswhimboo
bugs1434907
milestone62.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 1434907 - [marionette] Remove dependency to hidden.html in unit tests. r=whimboo
testing/marionette/harness/marionette_harness/tests/unit/test_click.py
testing/marionette/harness/marionette_harness/tests/unit/test_legacy_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
@@ -102,21 +102,22 @@ 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")
-        self.marionette.navigate(test_html)
+        self.marionette.navigate(inline("""
+            <p hidden>foo</p>
+        """))
 
         with self.assertRaises(errors.ElementNotInteractableException):
-            self.marionette.find_element(By.ID, "child").click()
+            self.marionette.find_element(By.TAG_NAME, "p").click()
 
     def test_clicking_on_a_multiline_link(self):
         test_html = self.marionette.absolute_url("clicks.html")
         self.marionette.navigate(test_html)
         self.marionette.find_element(By.ID, "overflowLink").click()
         self.marionette.find_element(By.ID, "testDiv")
         self.assertEqual(self.marionette.title, "Marionette Test")
 
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_legacy_mouse_action.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_legacy_mouse_action.py
@@ -37,19 +37,20 @@ class TestLegacyMouseAction(BaseLegacyMo
         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)
-        el = self.marionette.find_element(By.ID, "child")
+        self.marionette.navigate(inline("""
+            <div style="position:relative;top:200vh;">foo</div>
+        """))
+        el = self.marionette.find_element(By.TAG_NAME, "div")
         self.action.click(el).perform()
 
     def test_double_click_action(self):
         self.marionette.navigate(inline("""
           <div contenteditable>zyxw</div><input type="text"/>
         """))
 
         el = self.marionette.find_element(By.CSS_SELECTOR, "div")
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_visibility.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_visibility.py
@@ -106,25 +106,29 @@ 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)
-        singleHidden = self.marionette.find_element(By.ID, 'singleHidden')
+        self.marionette.navigate(inline("""
+            <p hidden>foo</p>
+        """))
+        singleHidden = self.marionette.find_element(By.TAG_NAME, "p")
         self.assertFalse(singleHidden.is_displayed())
 
     def testShouldShowElementNotVisibleWhenParentElementHasHiddenAttribute(self):
-        test_html = self.marionette.absolute_url("hidden.html")
-        self.marionette.navigate(test_html)
-        child = self.marionette.find_element(By.ID, 'child')
+        self.marionette.navigate(inline("""
+            <div hidden>
+                <p>foo</p>
+            </div>
+        """))
+        child = self.marionette.find_element(By.TAG_NAME, "p")
         self.assertFalse(child.is_displayed())
 
     def testShouldClickOnELementPartiallyOffLeft(self):
         test_html = self.marionette.navigate(element_direction_doc("left"))
         self.marionette.find_element(By.CSS_SELECTOR, '.element').click()
 
     def testShouldClickOnELementPartiallyOffRight(self):
         test_html = self.marionette.navigate(element_direction_doc("right"))
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