diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /testing/marionette/harness/marionette_harness/tests/unit/test_visibility.py | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/marionette/harness/marionette_harness/tests/unit/test_visibility.py')
-rw-r--r-- | testing/marionette/harness/marionette_harness/tests/unit/test_visibility.py | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/testing/marionette/harness/marionette_harness/tests/unit/test_visibility.py b/testing/marionette/harness/marionette_harness/tests/unit/test_visibility.py new file mode 100644 index 000000000..750ecf20a --- /dev/null +++ b/testing/marionette/harness/marionette_harness/tests/unit/test_visibility.py @@ -0,0 +1,121 @@ +# 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 marionette_driver.by import By + +from marionette_harness import MarionetteTestCase + + +class TestVisibility(MarionetteTestCase): + + def testShouldAllowTheUserToTellIfAnElementIsDisplayedOrNot(self): + test_html = self.marionette.absolute_url("javascriptPage.html") + self.marionette.navigate(test_html) + + self.assertTrue(self.marionette.find_element(By.ID, "displayed").is_displayed()) + self.assertFalse(self.marionette.find_element(By.ID, "none").is_displayed()) + self.assertFalse(self.marionette.find_element(By.ID, + "suppressedParagraph").is_displayed()) + self.assertFalse(self.marionette.find_element(By.ID, "hidden").is_displayed()) + + def testVisibilityShouldTakeIntoAccountParentVisibility(self): + test_html = self.marionette.absolute_url("javascriptPage.html") + self.marionette.navigate(test_html) + + childDiv = self.marionette.find_element(By.ID, "hiddenchild") + hiddenLink = self.marionette.find_element(By.ID, "hiddenlink") + + self.assertFalse(childDiv.is_displayed()) + self.assertFalse(hiddenLink.is_displayed()) + + def testShouldCountElementsAsVisibleIfStylePropertyHasBeenSet(self): + test_html = self.marionette.absolute_url("javascriptPage.html") + self.marionette.navigate(test_html) + shown = self.marionette.find_element(By.ID, "visibleSubElement") + self.assertTrue(shown.is_displayed()) + + def testShouldModifyTheVisibilityOfAnElementDynamically(self): + test_html = self.marionette.absolute_url("javascriptPage.html") + self.marionette.navigate(test_html) + element = self.marionette.find_element(By.ID, "hideMe") + self.assertTrue(element.is_displayed()) + element.click() + self.assertFalse(element.is_displayed()) + + def testHiddenInputElementsAreNeverVisible(self): + test_html = self.marionette.absolute_url("javascriptPage.html") + self.marionette.navigate(test_html) + + shown = self.marionette.find_element(By.NAME, "hidden") + + self.assertFalse(shown.is_displayed()) + + def testShouldSayElementsWithNegativeTransformAreNotDisplayed(self): + test_html = self.marionette.absolute_url("cssTransform.html") + self.marionette.navigate(test_html) + + elementX = self.marionette.find_element(By.ID, 'parentX') + self.assertFalse(elementX.is_displayed()) + elementY = self.marionette.find_element(By.ID, 'parentY') + self.assertFalse(elementY.is_displayed()) + + def testShouldSayElementsWithParentWithNegativeTransformAreNotDisplayed(self): + test_html = self.marionette.absolute_url("cssTransform.html") + self.marionette.navigate(test_html) + + elementX = self.marionette.find_element(By.ID, 'childX') + self.assertFalse(elementX.is_displayed()) + elementY = self.marionette.find_element(By.ID, 'childY') + self.assertFalse(elementY.is_displayed()) + + def testShouldSayElementWithZeroTransformIsVisible(self): + test_html = self.marionette.absolute_url("cssTransform.html") + self.marionette.navigate(test_html) + + zero_tranform = self.marionette.find_element(By.ID, 'zero-tranform') + self.assertTrue(zero_tranform.is_displayed()) + + def testShouldSayElementIsVisibleWhenItHasNegativeTransformButElementisntInANegativeSpace(self): + test_html = self.marionette.absolute_url("cssTransform2.html") + self.marionette.navigate(test_html) + negative_percent__tranform = self.marionette.find_element(By.ID, 'negative-percentage-transformY') + self.assertTrue(negative_percent__tranform.is_displayed()) + + 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.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.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() + + def testShouldClickOnELementPartiallyOffRight(self): + test_html = self.marionette.absolute_url("element_right.html") + self.marionette.navigate(test_html) + self.marionette.find_element(By.CSS_SELECTOR, '.element').click() + + def testShouldClickOnELementPartiallyOffTop(self): + test_html = self.marionette.absolute_url("element_top.html") + self.marionette.navigate(test_html) + self.marionette.find_element(By.CSS_SELECTOR, '.element').click() + + def testShouldClickOnELementPartiallyOffBottom(self): + test_html = self.marionette.absolute_url("element_bottom.html") + self.marionette.navigate(test_html) + self.marionette.find_element(By.CSS_SELECTOR, '.element').click() |