tor-browser

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

test_chrome_element_rect.py (1179B)


      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 TestElementSizeChrome(ChromeHandlerMixin, WindowManagerMixin, MarionetteTestCase):
     18    def setUp(self):
     19        super(TestElementSizeChrome, 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        self.close_all_windows()
     28        super(TestElementSizeChrome, self).tearDown()
     29 
     30    def test_payload(self):
     31        rect = self.marionette.find_element(By.ID, "textInput").rect
     32        self.assertTrue(rect["x"] > 0)
     33        self.assertTrue(rect["y"] > 0)
     34        self.assertTrue(rect["width"] > 0)
     35        self.assertTrue(rect["height"] > 0)