tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_chrome_click.py (1218B)


      1 # This Source Code Form is subject to the terms of the Mozilla Public
      2 # License, v. 2.0. If a copy of the MPL was not distributed with this
      3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
      4 
      5 import os
      6 import sys
      7 
      8 from marionette_driver.by import By
      9 from marionette_harness import MarionetteTestCase, WindowManagerMixin
     10 
     11 # add this directory to the path
     12 sys.path.append(os.path.dirname(__file__))
     13 
     14 from chrome_handler_mixin import ChromeHandlerMixin
     15 
     16 
     17 class TestClickChrome(ChromeHandlerMixin, WindowManagerMixin, MarionetteTestCase):
     18    def setUp(self):
     19        super(TestClickChrome, self).setUp()
     20 
     21        self.marionette.set_context("chrome")
     22 
     23    def tearDown(self):
     24        self.close_all_windows()
     25 
     26        super(TestClickChrome, self).tearDown()
     27 
     28    def test_click(self):
     29        win = self.open_chrome_window(self.chrome_base_url + "test.xhtml")
     30        self.marionette.switch_to_window(win)
     31 
     32        def checked():
     33            return self.marionette.execute_script(
     34                "return arguments[0].checked", script_args=[box]
     35            )
     36 
     37        box = self.marionette.find_element(By.ID, "testBox")
     38        self.assertFalse(checked())
     39        box.click()
     40        self.assertTrue(checked())