Best Python code snippet using lemoncheesecake
test_typing.py
Source:test_typing.py  
1# This Source Code Form is subject to the terms of the Mozilla Public2# License, v. 2.0. If a copy of the MPL was not distributed with this3# file, You can obtain one at http://mozilla.org/MPL/2.0/.4import urllib5from marionette_driver.by import By6from marionette_driver.errors import ElementNotInteractableException7from marionette_driver.keys import Keys8from marionette_harness import MarionetteTestCase, skip, skip_if_mobile9def inline(doc):10    return "data:text/html;charset=utf-8,{}".format(urllib.quote(doc))11class TypingTestCase(MarionetteTestCase):12    def setUp(self):13        super(TypingTestCase, self).setUp()14        if self.marionette.session_capabilities["platformName"] == "darwin":15            self.mod_key = Keys.META16        else:17            self.mod_key = Keys.CONTROL18class TestTypingChrome(TypingTestCase):19    def setUp(self):20        super(TestTypingChrome, self).setUp()21        self.marionette.set_context("chrome")22    @skip_if_mobile("Interacting with chrome elements not available for Fennec")23    def test_cut_and_paste_shortcuts(self):24        with self.marionette.using_context("content"):25            test_html = self.marionette.absolute_url("javascriptPage.html")26            self.marionette.navigate(test_html)27            keyReporter = self.marionette.find_element(By.ID, "keyReporter")28            self.assertEqual("", keyReporter.get_property("value"))29            keyReporter.send_keys("zyxwvutsr")30            self.assertEqual("zyxwvutsr", keyReporter.get_property("value"))31            # select all and cut32            keyReporter.send_keys(self.mod_key, "a")33            keyReporter.send_keys(self.mod_key, "x")34            self.assertEqual("", keyReporter.get_property("value"))35        url_bar = self.marionette.find_element(By.ID, "urlbar")36        # Clear contents first37        url_bar.send_keys(self.mod_key, "a")38        url_bar.send_keys(Keys.BACK_SPACE)39        self.assertEqual("", url_bar.get_attribute("value"))40        url_bar.send_keys(self.mod_key, "v")41        self.assertEqual("zyxwvutsr", url_bar.get_property("value"))42class TestTypingContent(TypingTestCase):43    def testShouldFireKeyPressEvents(self):44        test_html = self.marionette.absolute_url("javascriptPage.html")45        self.marionette.navigate(test_html)46        keyReporter = self.marionette.find_element(By.ID, "keyReporter")47        keyReporter.send_keys("a")48        result = self.marionette.find_element(By.ID, "result")49        self.assertTrue("press:" in result.text)50    def testShouldFireKeyDownEvents(self):51        test_html = self.marionette.absolute_url("javascriptPage.html")52        self.marionette.navigate(test_html)53        keyReporter = self.marionette.find_element(By.ID, "keyReporter")54        keyReporter.send_keys("I")55        result = self.marionette.find_element(By.ID, "result")56        self.assertTrue("down" in result.text)57    def testShouldFireKeyUpEvents(self):58        test_html = self.marionette.absolute_url("javascriptPage.html")59        self.marionette.navigate(test_html)60        keyReporter = self.marionette.find_element(By.ID, "keyReporter")61        keyReporter.send_keys("a")62        result = self.marionette.find_element(By.ID, "result")63        self.assertTrue("up:" in result.text)64    def testShouldTypeLowerCaseLetters(self):65        test_html = self.marionette.absolute_url("javascriptPage.html")66        self.marionette.navigate(test_html)67        keyReporter = self.marionette.find_element(By.ID, "keyReporter")68        keyReporter.send_keys("abc def")69        self.assertEqual("abc def", keyReporter.get_property("value"))70    def testShouldBeAbleToTypeCapitalLetters(self):71        test_html = self.marionette.absolute_url("javascriptPage.html")72        self.marionette.navigate(test_html)73        keyReporter = self.marionette.find_element(By.ID, "keyReporter")74        keyReporter.send_keys("ABC DEF")75        self.assertEqual("ABC DEF", keyReporter.get_property("value"))76    def testCutAndPasteShortcuts(self):77        test_html = self.marionette.absolute_url("javascriptPage.html")78        self.marionette.navigate(test_html)79        keyReporter = self.marionette.find_element(By.ID, "keyReporter")80        self.assertEqual("", keyReporter.get_property("value"))81        keyReporter.send_keys("zyxwvutsr")82        self.assertEqual("zyxwvutsr", keyReporter.get_property("value"))83        # select all and cut84        keyReporter.send_keys(self.mod_key, "a")85        keyReporter.send_keys(self.mod_key, "x")86        self.assertEqual("", keyReporter.get_property("value"))87        keyReporter.send_keys(self.mod_key, "v")88        self.assertEqual("zyxwvutsr", keyReporter.get_property("value"))89    def testShouldBeAbleToTypeQuoteMarks(self):90        test_html = self.marionette.absolute_url("javascriptPage.html")91        self.marionette.navigate(test_html)92        keyReporter = self.marionette.find_element(By.ID, "keyReporter")93        keyReporter.send_keys("\"")94        self.assertEqual("\"", keyReporter.get_property("value"))95    def testShouldBeAbleToTypeTheAtCharacter(self):96        test_html = self.marionette.absolute_url("javascriptPage.html")97        self.marionette.navigate(test_html)98        keyReporter = self.marionette.find_element(By.ID, "keyReporter")99        keyReporter.send_keys("@")100        self.assertEqual("@", keyReporter.get_property("value"))101    def testShouldBeAbleToMixUpperAndLowerCaseLetters(self):102        test_html = self.marionette.absolute_url("javascriptPage.html")103        self.marionette.navigate(test_html)104        keyReporter = self.marionette.find_element(By.ID, "keyReporter")105        keyReporter.send_keys("me@eXample.com")106        self.assertEqual("me@eXample.com", keyReporter.get_property("value"))107    def testArrowKeysShouldNotBePrintable(self):108        test_html = self.marionette.absolute_url("javascriptPage.html")109        self.marionette.navigate(test_html)110        keyReporter = self.marionette.find_element(By.ID, "keyReporter")111        keyReporter.send_keys(Keys.ARROW_LEFT)112        self.assertEqual("", keyReporter.get_property("value"))113    def testWillSimulateAKeyUpWhenEnteringTextIntoInputElements(self):114        test_html = self.marionette.absolute_url("javascriptPage.html")115        self.marionette.navigate(test_html)116        element = self.marionette.find_element(By.ID, "keyUp")117        element.send_keys("I like cheese")118        result = self.marionette.find_element(By.ID, "result")119        self.assertEqual(result.text, "I like cheese")120    def testWillSimulateAKeyDownWhenEnteringTextIntoInputElements(self):121        test_html = self.marionette.absolute_url("javascriptPage.html")122        self.marionette.navigate(test_html)123        element = self.marionette.find_element(By.ID, "keyDown")124        element.send_keys("I like cheese")125        result = self.marionette.find_element(By.ID, "result")126        #  Because the key down gets the result before the input element is127        #  filled, we're a letter short here128        self.assertEqual(result.text, "I like chees")129    def testWillSimulateAKeyPressWhenEnteringTextIntoInputElements(self):130        test_html = self.marionette.absolute_url("javascriptPage.html")131        self.marionette.navigate(test_html)132        element = self.marionette.find_element(By.ID, "keyPress")133        element.send_keys("I like cheese")134        result = self.marionette.find_element(By.ID, "result")135        #  Because the key down gets the result before the input element is136        #  filled, we're a letter short here137        self.assertEqual(result.text, "I like chees")138    def testWillSimulateAKeyUpWhenEnteringTextIntoTextAreas(self):139        test_html = self.marionette.absolute_url("javascriptPage.html")140        self.marionette.navigate(test_html)141        element = self.marionette.find_element(By.ID, "keyUpArea")142        element.send_keys("I like cheese")143        result = self.marionette.find_element(By.ID, "result")144        self.assertEqual("I like cheese", result.text)145    def testWillSimulateAKeyDownWhenEnteringTextIntoTextAreas(self):146        test_html = self.marionette.absolute_url("javascriptPage.html")147        self.marionette.navigate(test_html)148        element = self.marionette.find_element(By.ID, "keyDownArea")149        element.send_keys("I like cheese")150        result = self.marionette.find_element(By.ID, "result")151        #  Because the key down gets the result before the input element is152        #  filled, we're a letter short here153        self.assertEqual(result.text, "I like chees")154    def testWillSimulateAKeyPressWhenEnteringTextIntoTextAreas(self):155        test_html = self.marionette.absolute_url("javascriptPage.html")156        self.marionette.navigate(test_html)157        element = self.marionette.find_element(By.ID, "keyPressArea")158        element.send_keys("I like cheese")159        result = self.marionette.find_element(By.ID, "result")160        #  Because the key down gets the result before the input element is161        #  filled, we're a letter short here162        self.assertEqual(result.text, "I like chees")163    @skip_if_mobile("Bug 1324752 - Arrow keys cannot be sent in Fennec")164    def testShouldReportKeyCodeOfArrowKeysUpDownEvents(self):165        test_html = self.marionette.absolute_url("javascriptPage.html")166        self.marionette.navigate(test_html)167        result = self.marionette.find_element(By.ID, "result")168        element = self.marionette.find_element(By.ID, "keyReporter")169        element.send_keys(Keys.ARROW_DOWN)170        self.assertIn("down: 40", result.text.strip())171        self.assertIn("up: 40", result.text.strip())172        element.send_keys(Keys.ARROW_UP)173        self.assertIn("down: 38", result.text.strip())174        self.assertIn("up: 38", result.text.strip())175        element.send_keys(Keys.ARROW_LEFT)176        self.assertIn("down: 37", result.text.strip())177        self.assertIn("up: 37", result.text.strip())178        element.send_keys(Keys.ARROW_RIGHT)179        self.assertIn("down: 39", result.text.strip())180        self.assertIn("up: 39", result.text.strip())181        #  And leave no rubbish/printable keys in the "keyReporter"182        self.assertEqual("", element.get_property("value"))183    @skip("Reenable in Bug 1068728")184    def testNumericShiftKeys(self):185        test_html = self.marionette.absolute_url("javascriptPage.html")186        self.marionette.navigate(test_html)187        result = self.marionette.find_element(By.ID, "result")188        element = self.marionette.find_element(By.ID, "keyReporter")189        numericShiftsEtc = "~!@#$%^&*()_+{}:i\"<>?|END~"190        element.send_keys(numericShiftsEtc)191        self.assertEqual(numericShiftsEtc, element.get_property("value"))192        self.assertIn(" up: 16", result.text.strip())193    def testLowerCaseAlphaKeys(self):194        test_html = self.marionette.absolute_url("javascriptPage.html")195        self.marionette.navigate(test_html)196        element = self.marionette.find_element(By.ID, "keyReporter")197        lowerAlphas = "abcdefghijklmnopqrstuvwxyz"198        element.send_keys(lowerAlphas)199        self.assertEqual(lowerAlphas, element.get_property("value"))200    @skip("Reenable in Bug 1068735")201    def testUppercaseAlphaKeys(self):202        test_html = self.marionette.absolute_url("javascriptPage.html")203        self.marionette.navigate(test_html)204        result = self.marionette.find_element(By.ID, "result")205        element = self.marionette.find_element(By.ID, "keyReporter")206        upperAlphas = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"207        element.send_keys(upperAlphas)208        self.assertEqual(upperAlphas, element.get_property("value"))209        self.assertIn(" up: 16", result.text.strip())210    @skip("Reenable in Bug 1068726")211    def testAllPrintableKeys(self):212        test_html = self.marionette.absolute_url("javascriptPage.html")213        self.marionette.navigate(test_html)214        result = self.marionette.find_element(By.ID, "result")215        element = self.marionette.find_element(By.ID, "keyReporter")216        allPrintable = "!\"#$%&'()*+,-./0123456789:<=>?@ ABCDEFGHIJKLMNOPQRSTUVWXYZ [\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"217        element.send_keys(allPrintable)218        self.assertTrue(allPrintable, element.get_property("value"))219        self.assertIn(" up: 16", result.text.strip())220    @skip("Reenable in Bug 1068733")221    def testSpecialSpaceKeys(self):222        test_html = self.marionette.absolute_url("javascriptPage.html")223        self.marionette.navigate(test_html)224        element = self.marionette.find_element(By.ID, "keyReporter")225        element.send_keys("abcd" + Keys.SPACE + "fgh" + Keys.SPACE + "ij")226        self.assertEqual("abcd fgh ij", element.get_property("value"))227    def testShouldTypeAnInteger(self):228        test_html = self.marionette.absolute_url("javascriptPage.html")229        self.marionette.navigate(test_html)230        element = self.marionette.find_element(By.ID, "keyReporter")231        element.send_keys(1234)232        self.assertEqual("1234", element.get_property("value"))233    def testShouldSendKeysToElementsWithoutTheValueAttribute(self):234        test_html = self.marionette.absolute_url("javascriptPage.html")235        self.marionette.navigate(test_html)236        # If we don't get an error below we are good237        self.marionette.find_element(By.TAG_NAME, "body").send_keys("foo")238    def test_not_interactable_if_hidden(self):239        test_html = self.marionette.absolute_url("javascriptPage.html")240        self.marionette.navigate(test_html)241        not_displayed = self.marionette.find_element(By.ID, "notDisplayed")242        self.assertRaises(ElementNotInteractableException, not_displayed.send_keys, "foo")243    def test_appends_to_input_text(self):244        self.marionette.navigate(inline("<input>"))245        el = self.marionette.find_element(By.TAG_NAME, "input")246        el.send_keys("foo")247        el.send_keys("bar")248        self.assertEqual("foobar", el.get_property("value"))249    def test_appends_to_textarea(self):250        self.marionette.navigate(inline("<textarea></textarea>"))251        textarea = self.marionette.find_element(By.TAG_NAME, "textarea")252        textarea.send_keys("foo")253        textarea.send_keys("bar")...test_text.py
Source:test_text.py  
1# This Source Code Form is subject to the terms of the Mozilla Public2# License, v. 2.0. If a copy of the MPL was not distributed with this3# file, You can obtain one at http://mozilla.org/MPL/2.0/.4from marionette_driver.by import By5from marionette_driver.keys import Keys6from marionette_harness import MarionetteTestCase, skip_if_mobile7class TestText(MarionetteTestCase):8    def test_getText(self):9        test_html = self.marionette.absolute_url("test.html")10        self.marionette.navigate(test_html)11        l = self.marionette.find_element(By.ID, "mozLink")12        self.assertEqual("Click me!", l.text)13    def test_clearText(self):14        test_html = self.marionette.absolute_url("test.html")15        self.marionette.navigate(test_html)16        l = self.marionette.find_element(By.NAME, "myInput")17        self.assertEqual("asdf", self.marionette.execute_script("return arguments[0].value;", [l]))18        l.clear()19        self.assertEqual("", self.marionette.execute_script("return arguments[0].value;", [l]))20    def test_sendKeys(self):21        test_html = self.marionette.absolute_url("test.html")22        self.marionette.navigate(test_html)23        l = self.marionette.find_element(By.NAME, "myInput")24        self.assertEqual("asdf", self.marionette.execute_script("return arguments[0].value;", [l]))25        # Set caret position to the middle of the input text.26        self.marionette.execute_script(27            """var el = arguments[0];28            el.selectionStart = el.selectionEnd = el.value.length / 2;""",29            script_args=[l])30        l.send_keys("o")31        self.assertEqual("asodf", self.marionette.execute_script("return arguments[0].value;", [l]))32    def test_send_keys_to_type_input(self):33        test_html = self.marionette.absolute_url("html5/test_html_inputs.html")34        self.marionette.navigate(test_html)35        num_input = self.marionette.find_element(By.ID, 'number')36        self.assertEqual("", self.marionette.execute_script("return arguments[0].value", [num_input]))37        num_input.send_keys("1234")38        self.assertEqual('1234', self.marionette.execute_script("return arguments[0].value", [num_input]))39    def test_should_fire_key_press_events(self):40        test_html = self.marionette.absolute_url("javascriptPage.html")41        self.marionette.navigate(test_html)42        key_reporter = self.marionette.find_element(By.ID, "keyReporter")43        key_reporter.send_keys("a")44        result = self.marionette.find_element(By.ID, "result")45        self.assertIn("press:", result.text)46    def test_should_fire_key_down_events(self):47        test_html = self.marionette.absolute_url("javascriptPage.html")48        self.marionette.navigate(test_html)49        key_reporter = self.marionette.find_element(By.ID, "keyReporter")50        key_reporter.send_keys("a")51        result = self.marionette.find_element(By.ID, "result")52        self.assertIn("down:", result.text)53    def test_should_fire_key_up_events(self):54        test_html = self.marionette.absolute_url("javascriptPage.html")55        self.marionette.navigate(test_html)56        key_reporter = self.marionette.find_element(By.ID, "keyReporter")57        key_reporter.send_keys("a")58        result = self.marionette.find_element(By.ID, "result")59        self.assertIn("up:", result.text)60    def test_should_type_lowercase_characters(self):61        test_html = self.marionette.absolute_url("javascriptPage.html")62        self.marionette.navigate(test_html)63        key_reporter = self.marionette.find_element(By.ID, "keyReporter")64        key_reporter.send_keys("abc def")65        self.assertEqual("abc def", key_reporter.get_property("value"))66    def test_should_type_uppercase_characters(self):67        test_html = self.marionette.absolute_url("javascriptPage.html")68        self.marionette.navigate(test_html)69        key_reporter = self.marionette.find_element(By.ID, "keyReporter")70        key_reporter.send_keys("ABC DEF")71        self.assertEqual("ABC DEF", key_reporter.get_property("value"))72    def test_should_type_a_quote_characters(self):73        test_html = self.marionette.absolute_url("javascriptPage.html")74        self.marionette.navigate(test_html)75        key_reporter = self.marionette.find_element(By.ID, "keyReporter")76        key_reporter.send_keys('"')77        self.assertEqual('"', key_reporter.get_property("value"))78    def test_should_type_an_at_character(self):79        test_html = self.marionette.absolute_url("javascriptPage.html")80        self.marionette.navigate(test_html)81        key_reporter = self.marionette.find_element(By.ID, "keyReporter")82        key_reporter.send_keys('@')83        self.assertEqual("@", key_reporter.get_property("value"))84    def test_should_type_a_mix_of_upper_and_lower_case_character(self):85        test_html = self.marionette.absolute_url("javascriptPage.html")86        self.marionette.navigate(test_html)87        key_reporter = self.marionette.find_element(By.ID, "keyReporter")88        key_reporter.send_keys("me@EXampLe.com")89        self.assertEqual("me@EXampLe.com", key_reporter.get_property("value"))90    def test_arrow_keys_are_not_printable(self):91        test_html = self.marionette.absolute_url("javascriptPage.html")92        self.marionette.navigate(test_html)93        key_reporter = self.marionette.find_element(By.ID, "keyReporter")94        key_reporter.send_keys(Keys.ARROW_LEFT)95        self.assertEqual("", key_reporter.get_property("value"))96    def test_will_simulate_a_key_up_when_entering_text_into_input_elements(self):97        test_html = self.marionette.absolute_url("javascriptPage.html")98        self.marionette.navigate(test_html)99        element = self.marionette.find_element(By.ID, "keyUp")100        element.send_keys("I like cheese")101        result = self.marionette.find_element(By.ID, "result")102        self.assertEqual(result.text, "I like cheese")103    def test_will_simulate_a_key_down_when_entering_text_into_input_elements(self):104        test_html = self.marionette.absolute_url("javascriptPage.html")105        self.marionette.navigate(test_html)106        element = self.marionette.find_element(By.ID, "keyDown")107        element.send_keys("I like cheese")108        result = self.marionette.find_element(By.ID, "result")109        # Because the key down gets the result before the input element is110        # filled, we're a letter short here111        self.assertEqual(result.text, "I like chees")112    def test_will_simulate_a_key_press_when_entering_text_into_input_elements(self):113        test_html = self.marionette.absolute_url("javascriptPage.html")114        self.marionette.navigate(test_html)115        element = self.marionette.find_element(By.ID, "keyPress")116        element.send_keys("I like cheese")117        result = self.marionette.find_element(By.ID, "result")118        # Because the key down gets the result before the input element is119        # filled, we're a letter short here120        self.assertEqual(result.text, "I like chees")121    def test_will_simulate_a_keyup_when_entering_text_into_textareas(self):122        test_html = self.marionette.absolute_url("javascriptPage.html")123        self.marionette.navigate(test_html)124        element = self.marionette.find_element(By.ID, "keyUpArea")125        element.send_keys("I like cheese")126        result = self.marionette.find_element(By.ID, "result")127        self.assertEqual(result.text, "I like cheese")128    def test_will_simulate_a_keydown_when_entering_text_into_textareas(self):129        test_html = self.marionette.absolute_url("javascriptPage.html")130        self.marionette.navigate(test_html)131        element = self.marionette.find_element(By.ID, "keyDownArea")132        element.send_keys("I like cheese")133        result = self.marionette.find_element(By.ID, "result")134        # Because the key down gets the result before the input element is135        # filled, we're a letter short here136        self.assertEqual(result.text, "I like chees")137    def test_will_simulate_a_keypress_when_entering_text_into_textareas(self):138        test_html = self.marionette.absolute_url("javascriptPage.html")139        self.marionette.navigate(test_html)140        element = self.marionette.find_element(By.ID, "keyPressArea")141        element.send_keys("I like cheese")142        result = self.marionette.find_element(By.ID, "result")143        # Because the key down gets the result before the input element is144        # filled, we're a letter short here145        self.assertEqual(result.text, "I like chees")146    @skip_if_mobile("Bug 1333069 - Assertion: 'down: 40' not found in u''")147    def test_should_report_key_code_of_arrow_keys_up_down_events(self):148        test_html = self.marionette.absolute_url("javascriptPage.html")149        self.marionette.navigate(test_html)150        result = self.marionette.find_element(By.ID, "result")151        element = self.marionette.find_element(By.ID, "keyReporter")152        element.send_keys(Keys.ARROW_DOWN)153        self.assertIn("down: 40", result.text.strip())154        self.assertIn("up: 40", result.text.strip())155        element.send_keys(Keys.ARROW_UP)156        self.assertIn("down: 38", result.text.strip())157        self.assertIn("up: 38", result.text.strip())158        element.send_keys(Keys.ARROW_LEFT)159        self.assertIn("down: 37", result.text.strip())160        self.assertIn("up: 37", result.text.strip())161        element.send_keys(Keys.ARROW_RIGHT)162        self.assertIn("down: 39", result.text.strip())163        self.assertIn("up: 39", result.text.strip())164        #  And leave no rubbish/printable keys in the "keyReporter"165        self.assertEqual("", element.get_property("value"))166    def testNumericNonShiftKeys(self):167        test_html = self.marionette.absolute_url("javascriptPage.html")168        self.marionette.navigate(test_html)169        element = self.marionette.find_element(By.ID, "keyReporter")170        numericLineCharsNonShifted = "`1234567890-=[]\\,.'/42"171        element.send_keys(numericLineCharsNonShifted)172        self.assertEqual(numericLineCharsNonShifted, element.get_property("value"))173    def testShouldTypeAnInteger(self):174        test_html = self.marionette.absolute_url("javascriptPage.html")175        self.marionette.navigate(test_html)176        element = self.marionette.find_element(By.ID, "keyReporter")177        element.send_keys(1234)...test_visibility.py
Source:test_visibility.py  
1# This Source Code Form is subject to the terms of the Mozilla Public2# License, v. 2.0. If a copy of the MPL was not distributed with this3# file, You can obtain one at http://mozilla.org/MPL/2.0/.4from marionette_driver.by import By5from marionette_harness import MarionetteTestCase6class TestVisibility(MarionetteTestCase):7    def testShouldAllowTheUserToTellIfAnElementIsDisplayedOrNot(self):8        test_html = self.marionette.absolute_url("javascriptPage.html")9        self.marionette.navigate(test_html)10        self.assertTrue(self.marionette.find_element(By.ID, "displayed").is_displayed())11        self.assertFalse(self.marionette.find_element(By.ID, "none").is_displayed())12        self.assertFalse(self.marionette.find_element(By.ID,13            "suppressedParagraph").is_displayed())14        self.assertFalse(self.marionette.find_element(By.ID, "hidden").is_displayed())15    def testVisibilityShouldTakeIntoAccountParentVisibility(self):16        test_html = self.marionette.absolute_url("javascriptPage.html")17        self.marionette.navigate(test_html)18        childDiv = self.marionette.find_element(By.ID, "hiddenchild")19        hiddenLink = self.marionette.find_element(By.ID, "hiddenlink")20        self.assertFalse(childDiv.is_displayed())21        self.assertFalse(hiddenLink.is_displayed())22    def testShouldCountElementsAsVisibleIfStylePropertyHasBeenSet(self):23        test_html = self.marionette.absolute_url("javascriptPage.html")24        self.marionette.navigate(test_html)25        shown = self.marionette.find_element(By.ID, "visibleSubElement")26        self.assertTrue(shown.is_displayed())27    def testShouldModifyTheVisibilityOfAnElementDynamically(self):28        test_html = self.marionette.absolute_url("javascriptPage.html")29        self.marionette.navigate(test_html)30        element = self.marionette.find_element(By.ID, "hideMe")31        self.assertTrue(element.is_displayed())32        element.click()33        self.assertFalse(element.is_displayed())34    def testHiddenInputElementsAreNeverVisible(self):35        test_html = self.marionette.absolute_url("javascriptPage.html")36        self.marionette.navigate(test_html)37        shown = self.marionette.find_element(By.NAME, "hidden")38        self.assertFalse(shown.is_displayed())39    def testShouldSayElementsWithNegativeTransformAreNotDisplayed(self):40        test_html = self.marionette.absolute_url("cssTransform.html")41        self.marionette.navigate(test_html)42        elementX = self.marionette.find_element(By.ID, 'parentX')43        self.assertFalse(elementX.is_displayed())44        elementY = self.marionette.find_element(By.ID, 'parentY')45        self.assertFalse(elementY.is_displayed())46    def testShouldSayElementsWithParentWithNegativeTransformAreNotDisplayed(self):47        test_html = self.marionette.absolute_url("cssTransform.html")48        self.marionette.navigate(test_html)49        elementX = self.marionette.find_element(By.ID, 'childX')50        self.assertFalse(elementX.is_displayed())51        elementY = self.marionette.find_element(By.ID, 'childY')52        self.assertFalse(elementY.is_displayed())53    def testShouldSayElementWithZeroTransformIsVisible(self):54        test_html = self.marionette.absolute_url("cssTransform.html")55        self.marionette.navigate(test_html)56        zero_tranform = self.marionette.find_element(By.ID, 'zero-tranform')57        self.assertTrue(zero_tranform.is_displayed())58    def testShouldSayElementIsVisibleWhenItHasNegativeTransformButElementisntInANegativeSpace(self):59        test_html = self.marionette.absolute_url("cssTransform2.html")60        self.marionette.navigate(test_html)61        negative_percent__tranform = self.marionette.find_element(By.ID, 'negative-percentage-transformY')62        self.assertTrue(negative_percent__tranform.is_displayed())63    def testShouldSayElementIsInvisibleWhenOverflowXIsHiddenAndOutOfViewport(self):64        test_html = self.marionette.absolute_url("bug814037.html")65        self.marionette.navigate(test_html)66        overflow_x = self.marionette.find_element(By.ID, "assertMe2")67        self.assertFalse(overflow_x.is_displayed())68    def testShouldShowElementNotVisibleWithHiddenAttribute(self):69        test_html = self.marionette.absolute_url("hidden.html")70        self.marionette.navigate(test_html)71        singleHidden = self.marionette.find_element(By.ID, 'singleHidden')72        self.assertFalse(singleHidden.is_displayed())73    def testShouldShowElementNotVisibleWhenParentElementHasHiddenAttribute(self):74        test_html = self.marionette.absolute_url("hidden.html")75        self.marionette.navigate(test_html)76        child = self.marionette.find_element(By.ID, 'child')77        self.assertFalse(child.is_displayed())78    def testShouldClickOnELementPartiallyOffLeft(self):79        test_html = self.marionette.absolute_url("element_left.html")80        self.marionette.navigate(test_html)81        self.marionette.find_element(By.CSS_SELECTOR, '.element').click()82    def testShouldClickOnELementPartiallyOffRight(self):83        test_html = self.marionette.absolute_url("element_right.html")84        self.marionette.navigate(test_html)85        self.marionette.find_element(By.CSS_SELECTOR, '.element').click()86    def testShouldClickOnELementPartiallyOffTop(self):87        test_html = self.marionette.absolute_url("element_top.html")88        self.marionette.navigate(test_html)89        self.marionette.find_element(By.CSS_SELECTOR, '.element').click()90    def testShouldClickOnELementPartiallyOffBottom(self):91        test_html = self.marionette.absolute_url("element_bottom.html")92        self.marionette.navigate(test_html)...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
