test_chrome_checkbox.py (1241B)
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 TestSelectedChrome(ChromeHandlerMixin, WindowManagerMixin, MarionetteTestCase): 18 def setUp(self): 19 super(TestSelectedChrome, self).setUp() 20 21 self.marionette.set_context("chrome") 22 23 new_window = self.open_chrome_window(self.chrome_base_url + "test.xhtml") 24 self.marionette.switch_to_window(new_window) 25 26 def tearDown(self): 27 try: 28 self.close_all_windows() 29 finally: 30 super(TestSelectedChrome, self).tearDown() 31 32 def test_selected(self): 33 box = self.marionette.find_element(By.ID, "testBox") 34 self.assertFalse(box.is_selected()) 35 self.assertFalse( 36 self.marionette.execute_script("arguments[0].checked = true;", [box]) 37 ) 38 self.assertTrue(box.is_selected())