Beispiel #1
0
 def test_long_press_fail(self):
     testAction = self.marionette.absolute_url("testAction.html")
     self.marionette.navigate(testAction)
     button = self.marionette.find_element(By.ID, "button1Copy")
     action = Actions(self.marionette)
     action.press(button).long_press(button, 5)
     self.assertRaises(MarionetteException, action.perform)
    def test_download_pdf(self):
        m = self.marionette

        m.set_search_timeout(1000)
        m.set_window_size(1024, 300)

        with m.using_context('content'):

            current_window = m.current_chrome_window_handle

            m.navigate(self.URL)
            download_button = m.find_element('id', 'download')
            action = Actions(m)
            action.click(download_button)
            action.wait(time=3)
            action.perform()

            closed_window = 0
            with m.using_context('chrome'):
                for window in m.chrome_window_handles:
                    if window != current_window:
                        m.switch_to_window(window)
                        info_msg = m.find_element('id', 'info.body')
                        self.assertRegexpMatches(
                            info_msg.text,
                            'Tails',
                            msg='Pop up window text does not include Tails')
                        m.close()
                        closed_window += 1
                m.switch_to_window(current_window)
            self.assertEqual(closed_window, 1, msg="no download pop up")
Beispiel #3
0
def open_page(client, post):
    while len(client.window_handles) == 1:
        # Fuzzy is required to enable the browser to lost the focus and a click that work
        # To use only if the website lags a lot and is full of js trash
        # removeOtherStrings = "window.scrollTo(0,(Math.floor(Math.random() * (document.documentElement.scrollHeight))))"
        # client.execute_script(removeOtherStrings)
        Actions(client).middle_click(post).perform()
        time.sleep(0.4)
Beispiel #4
0
    def signal_user_active(self):
        """Signal to the browser that the user is active.

        Normally when being driven by marionette the browser thinks the
        user is inactive the whole time because user activity is
        detected by looking at key and mouse events.

        This would be a problem for this test because user inactivity is
        used to schedule some GCs (in particular shrinking GCs), so it
        would make this unrepresentative of real use.

        Instead we manually cause some inconsequential activity (a press
        and release of the shift key) to make the browser think the user
        is active.  Then when we sleep to allow things to settle the
        browser will see the user as becoming inactive and trigger
        appropriate GCs, as would have happened in real use.
        """
        action = Actions(self.marionette)
        action.key_down(Keys.SHIFT)
        action.key_up(Keys.SHIFT)
        action.perform()
    def open_tab_in_background(self):
        with self.marionette.using_context("content"):
            link = self.marionette.find_element(By.ID, "new-tab")

            action = Actions(self.marionette)
            action.key_down(self.mod_key).click(link).perform()
 def __init__(self, marionette):
     self.marionette = marionette
     self.CHROME = 'chrome'
     self.CONTENT = 'content'
     self.set_context(self.CONTENT)
     self.action = Actions(marionette)