Пример #1
0
    def select(self, match_string):
        # This needs to be duplicated from base.py for a few reasons:
        # 1. When we return from the frame we don't return to the Settings app in its initial state,
        #    so the wait for in its launch method times out
        # 2. We need to use in instead of == on the match text because of the directional strings

        # have to go back to top level to get the B2G select box wrapper
        self.marionette.switch_to_frame()

        options = Wait(self.marionette).until(expected.elements_present(
            By.CSS_SELECTOR, '.value-selector-container li'))
        close = self.marionette.find_element(By.CSS_SELECTOR, 'button.value-option-confirm')

        # loop options until we find the match
        for li in options:
            if match_string in li.text:
                self.marionette.execute_script('arguments[0].scrollIntoView(false);', [li])
                li.tap()
                break
        else:
            raise Exception("Element '%s' could not be found in select wrapper" % match_string)

        close.tap()
        Wait(self.marionette).until(expected.element_not_displayed(close))

        # TODO we should find something suitable to wait for, but this goes too
        # fast against desktop builds causing intermittent failures
        time.sleep(0.2)

        # now back to app
        self.apps.switch_to_displayed_app()
Пример #2
0
 def media(self):
     self.marionette.switch_to_frame(self.marionette.find_element(*self._active_view_locator))
     elements = Wait(self.marionette).until(
         expected.elements_present(*self._list_item_locator))
     Wait(self.marionette).until(expected.element_displayed(elements[0]))
     self.apps.switch_to_displayed_app()
     return [Media(self.marionette, element, self._active_view_locator) for element in elements]
Пример #3
0
    def select(self, match_string):
        # This needs to be duplicated from base.py for a few reasons:
        # 1. When we return from the frame we don't return to the Settings app in its initial state,
        #    so the wait for in its launch method times out
        # 2. We need to use in instead of == on the match text because of the directional strings

        # have to go back to top level to get the B2G select box wrapper
        self.marionette.switch_to_frame()

        options = Wait(self.marionette).until(
            expected.elements_present(By.CSS_SELECTOR,
                                      '.value-selector-container li'))
        close = self.marionette.find_element(By.CSS_SELECTOR,
                                             'button.value-option-confirm')

        # loop options until we find the match
        for li in options:
            if match_string in li.text:
                li.tap()
                break
        else:
            raise Exception(
                "Element '%s' could not be found in select wrapper" %
                match_string)

        close.tap()
        Wait(self.marionette).until(expected.element_not_displayed(close))

        # TODO we should find something suitable to wait for, but this goes too
        # fast against desktop builds causing intermittent failures
        time.sleep(0.2)

        # now back to app
        self.apps.switch_to_displayed_app()
Пример #4
0
 def __init__(self, marionette):
     Base.__init__(self, marionette)
     Wait(self.marionette).until(
         lambda m: self.apps.displayed_app.name == self.name)
     self.apps.switch_to_displayed_app()
     Wait(self.marionette).until(
         expected.elements_present(*self._apps_locator))
Пример #5
0
    def select(self, match_string):
        # This needs to be duplicated from base.py because when we return from the frame
        # we don't return to the Settings app in its initial state,
        # so the wait for in its launch method times out

        # have to go back to top level to get the B2G select box wrapper
        self.marionette.switch_to_frame()

        Wait(self.marionette).until(
            expected.elements_present(
                By.CSS_SELECTOR, '.value-selector-container li'))

        options = self.marionette.find_elements(By.CSS_SELECTOR, '.value-selector-container li')
        close = self.marionette.find_element(By.CSS_SELECTOR, 'button.value-option-confirm')

        # loop options until we find the match
        for li in options:
            if match_string == li.text:
                li.tap()
                break
        else:
            raise Exception("Element '%s' could not be found in select wrapper" % match_string)

        close.tap()
        Wait(self.marionette).until(expected.element_not_displayed(close))

        # TODO we should find something suitable to wait for, but this goes too
        # fast against desktop builds causing intermittent failures
        time.sleep(0.2)

        # now back to app
        self.apps.switch_to_displayed_app()
Пример #6
0
 def __init__(self, marionette):
     Base.__init__(self, marionette)
     Wait(self.marionette).until(
         lambda m: self.apps.displayed_app.name == self.name)
     self.apps.switch_to_displayed_app()
     # See Bug 1162112, Marionette Wait() polling without interval might be interfering network load
     Wait(self.marionette, timeout=30,
          interval=5).until(expected.elements_present(*self._apps_locator))
Пример #7
0
 def wait_for_languages_to_load(self):
     Wait(self.marionette).until(
         expected.elements_present(*self._language_options_locator))
Пример #8
0
    def tap_sub_song(self, order):
        sub_tiles = Wait(self.marionette).until(
            expected.elements_present(*self._sub_tile_locator))

        sub_tiles[order].tap()
        return PlayerView(self.marionette)
Пример #9
0
 def __init__(self, marionette):
     Base.__init__(self, marionette)
     self.wait_to_be_displayed()
     self.apps.switch_to_displayed_app()
     # See Bug 1162112, Marionette Wait() polling without interval might be interfering network load
     Wait(self.marionette, timeout=30, interval=5).until(expected.elements_present(*self._apps_locator))
Пример #10
0
 def test_elements_present_not_present(self):
     r = expected.elements_present(no_such_elements)(self.marionette)
     self.assertEqual(r, [])
def test_view_catalogue(client):
    go_home(client)
    link = client.find_element('id', 'catalogue__call-to-action')
    link.click()
    Wait(client, timeout=timeout).until(expected.elements_present('id', 'react-bundle-search'))
Пример #12
0
 def test_elements_present_locator(self):
     self.marionette.navigate(static_elements)
     els = expected.elements_present(By.TAG_NAME, "p")(self.marionette)
     self.assertEqual(len(els), 2)
Пример #13
0
def test_view_catalogue(client):
    go_home(client)
    link = client.find_element('id', 'catalogue__call-to-action')
    link.click()
    Wait(client, timeout=timeout).until(
        expected.elements_present('id', 'react-bundle-search'))
Пример #14
0
 def media(self):
     elements = Wait(self.marionette).until(
         expected.elements_present(*self._list_item_locator))
     Wait(self.marionette).until(expected.element_displayed(elements[0]))
     return [Media(self.marionette, element) for element in elements]
Пример #15
0
 def media(self):
     elements = Wait(self.marionette).until(
         expected.elements_present(*self._list_item_locator))
     Wait(self.marionette).until(expected.element_displayed(elements[0]))
     return [Media(self.marionette, element) for element in elements]
Пример #16
0
    def tap_sub_song(self, order):
        sub_tiles = Wait(self.marionette).until(expected.elements_present(*self._sub_tile_locator))

        sub_tiles[order].tap()
        return PlayerView(self.marionette)
Пример #17
0
 def wait_for_languages_to_load(self):
     Wait(self.marionette).until(expected.elements_present(*self._language_options_locator))
Пример #18
0
 def test_elements_present_func(self):
     self.marionette.navigate(static_elements)
     els = expected.elements_present(ps)(self.marionette)
     self.assertEqual(len(els), 2)
Пример #19
0
def test_view_briefs(client):
    go_home(client)
    link = client.find_element('id', 'opportunities__call-to-action')
    link.click()
    Wait(client, timeout=timeout).until(
        expected.elements_present('class name', 'brief-result'))
def test_view_briefs(client):
    go_home(client)
    link = client.find_element('id', 'opportunities__call-to-action')
    link.click()
    Wait(client, timeout=timeout).until(expected.elements_present('class name', 'opportunities-page'))
Пример #21
0
 def test_elements_present_not_present(self):
     r = expected.elements_present(no_such_elements)(self.marionette)
     self.assertEqual(r, [])
Пример #22
0
 def test_elements_present_func(self):
     self.marionette.navigate(static_elements)
     els = expected.elements_present(ps)(self.marionette)
     self.assertEqual(len(els), 2)
Пример #23
0
 def test_elements_present_locator(self):
     self.marionette.navigate(static_elements)
     els = expected.elements_present(By.TAG_NAME, "p")(self.marionette)
     self.assertEqual(len(els), 2)
Пример #24
0
 def __init__(self, marionette):
     Base.__init__(self, marionette)
     Wait(self.marionette).until(lambda m: self.apps.displayed_app.name == self.name)
     self.apps.switch_to_displayed_app()
     Wait(self.marionette).until(expected.elements_present(*self._apps_locator))