예제 #1
0
 def tap_export_to_sim(self):
     export_to_sim = Wait(self.marionette).until(
         expected.element_present(*self._export_to_sim_button_locator))
     Wait(self.marionette).until(expected.element_displayed(export_to_sim))
     export_to_sim.tap()
     select_contacts = self.marionette.find_element(*self._select_contacts_locator)
     Wait(self.marionette).until(lambda m: select_contacts.location['y'] == 0)
예제 #2
0
파일: settings.py 프로젝트: bebef1987/gaia
 def tap_done(self):
     done_button = Wait(self.marionette).until(
         expected.element_present(*self._done_button_locator))
     Wait(self.marionette).until(expected.element_displayed(done_button))
     done_button.tap()
     # Switch back to Cost Control app frame
     self.apps.switch_to_displayed_app()
예제 #3
0
 def enable_passcode_lock(self):
     # This wait would be in __init__ but lockscreen could be disabled meaning init would timeout
     element = Wait(self.marionette).until(expected.element_present(*self._passcode_enable_locator))
     Wait(self.marionette).until(expected.element_displayed(element))
     element.tap()
     section = self.marionette.find_element(*self._screen_lock_passcode_section_locator)
     Wait(self.marionette).until(lambda m: section.location['x'] == 0)
예제 #4
0
    def tap_share_button(self):
        share_button = Wait(self.marionette).until(expected.element_present(*self._share_thumbnail_locator))
        Wait(self.marionette).until(expected.element_displayed(share_button))
        share_button.tap()
        from gaiatest.apps.system.regions.activities import Activities

        return Activities(self.marionette)
예제 #5
0
파일: keypad.py 프로젝트: AxelRoyer/gaia
 def tap_call_button(self, switch_to_call_screen=True):
     element = Wait(self.marionette).until(
         expected.element_present(*self._call_bar_locator))
     Wait(self.marionette).until(expected.element_enabled(element))
     element.tap()
     if switch_to_call_screen:
         return CallScreen(self.marionette)
예제 #6
0
파일: browser.py 프로젝트: bebef1987/gaia
 def tap_share_to_messages(self):
     element = Wait(self.marionette).until(
         expected.element_present(*self._share_to_messages_button_locator))
     Wait(self.marionette).until(expected.element_displayed(element))
     element.tap()
     from gaiatest.apps.messages.regions.new_message import NewMessage
     return NewMessage(self.marionette)
예제 #7
0
 def tap_keyboard_language_key(self):
     self.switch_to_keyboard()
     key = Wait(self.marionette).until(
         expected.element_present(*self._language_key_locator))
     Wait(self.marionette).until(expected.element_displayed(key))
     key.tap()
     self.apps.switch_to_displayed_app()
예제 #8
0
 def tap_done(self):
     done = Wait(self.marionette).until(expected.element_present(*self._done_locator))
     Wait(self.marionette).until(expected.element_displayed(done))
     done.tap()
     view = self.marionette.find_element(*self._alarm_view_locator)
     Wait(self.marionette).until(lambda m: view.location['x'] == view.size['width'])
     return Clock(self.marionette)
예제 #9
0
 def tap_first_predictive_word(self):
     self.switch_to_keyboard()
     key = Wait(self.marionette).until(
         expected.element_present(*self._predicted_word_locator))
     Wait(self.marionette).until(expected.element_displayed(key))
     key.tap()
     self.apps.switch_to_displayed_app()
예제 #10
0
 def select_sim(self, sim):
     locators = [self._menuItem_carrier_sim1_locator,
                 self._menuItem_carrier_sim2_locator]
     element = Wait(self.marionette).until(
         expected.element_present(*locators[sim]))
     Wait(self.marionette).until(expected.element_dispayed(element))
     element.tap()
예제 #11
0
 def tap_done(self):
     done = Wait(self.marionette, timeout=60).until(
         expected.element_present(*self._done_locator))
     Wait(self.marionette).until(expected.element_displayed(done))
     done.tap()
     #Switch back to the settings app
     self.apps.switch_to_displayed_app()
예제 #12
0
파일: app.py 프로젝트: AutomatedTester/gaia
 def tap_settings(self):
     settings = Wait(self.marionette).until(
         expected.element_present(*self._settings_button_locator))
     Wait(self.marionette).until(expected.element_displayed(settings))
     settings.tap()
     from gaiatest.apps.cost_control.regions.settings import Settings
     return Settings(self.marionette)
예제 #13
0
파일: wifi.py 프로젝트: William-Hsu/gaia
    def connect_to_network(self, network_info):

        # Wait for the networks to be found
        this_network_locator = ('xpath', "//li/a/span[text()='%s']" % network_info['ssid'])
        this_network = Wait(self.marionette).until(expected.element_present(*this_network_locator))
        this_network.tap()

        if network_info.get('keyManagement'):
            password = network_info.get('psk') or network_info.get('wep')
            if not password:
                raise Exception('No psk or wep key found in testvars for secured wifi network.')

            screen_width = int(self.marionette.execute_script('return window.innerWidth'))
            ok_button = self.marionette.find_element(*self._password_ok_button_locator)
            Wait(self.marionette).until(lambda m: (ok_button.location['x'] + ok_button.size['width']) == screen_width)
            password_input = self.marionette.find_element(*self._password_input_locator)
            Wait(self.marionette).until(expected.element_displayed(password_input))
            password_input.send_keys(password)
            ok_button.tap()

        connected_message = self.marionette.find_element(*self._connected_message_locator)
        self.marionette.execute_script("arguments[0].scrollIntoView(false);", [connected_message])
        timeout = max(self.marionette.timeout and self.marionette.timeout / 1000, 60)
        Wait(self.marionette, timeout, ignored_exceptions=StaleElementException).until(
            lambda m: m.find_element(*self._connected_message_locator).text == "Connected")
예제 #14
0
 def tap_export_contacts(self):
     export_contacts = Wait(self.marionette).until(
         expected.element_present(*self._export_contacts_locator))
     Wait(self.marionette).until(expected.element_displayed(export_contacts))
     export_contacts.tap()
     import_settings = self.marionette.find_element(*self._import_settings_locator)
     Wait(self.marionette).until(lambda m: import_settings.location['x'] == 0)
예제 #15
0
 def tap_delete_contacts(self):
     delete_contacts = Wait(self.marionette).until(
         expected.element_present(*self._delete_contacts_locator))
     Wait(self.marionette).until(expected.element_displayed(delete_contacts))
     delete_contacts.tap()
     select_contacts = self.marionette.find_element(*self._select_contacts_locator)
     Wait(self.marionette).until(lambda m: select_contacts.location['y'] == 0)
예제 #16
0
 def go_back(self):
     element = Wait(self.marionette).until(expected.element_present(*self._header_locator))
     Wait(self.marionette).until(expected.element_displayed(element))
     # TODO: replace this hard coded value with tap on the back button, after Bug 1061698 is fixed
     element.tap(x=10)
     Wait(self.marionette).until(lambda m: m.execute_script(
         "return window.wrappedJSObject.Settings && window.wrappedJSObject.Settings._currentPanel === '#root'"))
예제 #17
0
 def tap_import_from_gmail(self):
     import_from_gmail = Wait(self.marionette).until(
         expected.element_present(*self._import_from_gmail_button_locator))
     Wait(self.marionette).until(expected.element_displayed(import_from_gmail))
     import_from_gmail.tap()
     from gaiatest.apps.contacts.regions.gmail import GmailLogin
     return GmailLogin(self.marionette)
예제 #18
0
파일: settings.py 프로젝트: 6a68/gaia
 def reset_mobile_usage(self):
     self.marionette.find_element(*self._reset_button_locator).tap()
     reset_mobile_usage = Wait(self.marionette).until(
         expected.element_present(*self._reset_mobile_usage_button_locator))
     Wait(self.marionette).until(expected.element_displayed(reset_mobile_usage))
     reset_dialog = self.marionette.find_element(*self._reset_dialog_locator)
     reset_mobile_usage.tap()
     Wait(self.marionette).until(expected.element_not_displayed(reset_dialog))
예제 #19
0
    def tap_login(self):
        login = Wait(self.marionette, timeout=60).until(expected.element_present(*self._login_locator))
        Wait(self.marionette).until(expected.element_displayed(login))
        login.tap()
        # After tapping, we are getting into the Firefox Accounts login page
        from gaiatest.apps.system.regions.fxaccounts import FirefoxAccount

        return FirefoxAccount(self.marionette)
예제 #20
0
 def tap_send(self, timeout=120):
     send = Wait(self.marionette).until(
         expected.element_present(*self._send_message_button_locator))
     Wait(self.marionette).until(expected.element_enabled(send))
     send.tap()
     self.wait_for_element_not_present(*self._message_sending_locator, timeout=timeout)
     from gaiatest.apps.messages.regions.message_thread import MessageThread
     return MessageThread(self.marionette)
예제 #21
0
 def tap_edit(self):
     edit = Wait(self.marionette).until(expected.element_present(
         *self._edit_contact_button_locator))
     Wait(self.marionette).until(expected.element_displayed(edit))
     edit.tap()
     Wait(self.marionette).until(expected.element_not_displayed(edit))
     from gaiatest.apps.contacts.regions.contact_form import EditContact
     return EditContact(self.marionette)
예제 #22
0
파일: message_thread.py 프로젝트: 6a68/gaia
 def tap_call(self):
     call = Wait(self.marionette).until(expected.element_present(*self._call_button_locator))
     Wait(self.marionette).until(expected.element_displayed(call))
     call.tap()
     from gaiatest.apps.phone.regions.keypad import Keypad
     keypad = Keypad(self.marionette)
     keypad.wait_for_phone_number_ready()
     return keypad
예제 #23
0
    def tap_change_wallpaper(self):
        change_wallpaper = Wait(self.marionette).until(
            expected.element_present(*self._change_wallpaper_button_locator))
        Wait(self.marionette).until(expected.element_displayed(change_wallpaper))
        change_wallpaper.tap()

        from gaiatest.apps.system.regions.activities import Activities
        return Activities(self.marionette)
예제 #24
0
    def tap_add_collection(self):
        add_collection = Wait(self.marionette).until(
            expected.element_present(*self._add_collection_button_locator))
        Wait(self.marionette).until(expected.element_displayed(add_collection))
        add_collection.tap()

        from gaiatest.apps.homescreen.regions.collections_activity import CollectionsActivity
        return CollectionsActivity(self.marionette)
예제 #25
0
 def tap_confirm(self):
     # TODO add a good wait here when Bug 1008961 is resolved
     time.sleep(1)
     self.marionette.switch_to_frame()
     confirm = Wait(self.marionette).until(expected.element_present(
         *self._confirm_install_button_locator))
     Wait(self.marionette).until(expected.element_displayed(confirm))
     confirm.tap()
예제 #26
0
    def tap_delete_confirmation_button(self):
        confirm = Wait(self.marionette).until(
            expected.element_present(*self._call_log_delete_confirmation_locator))
        Wait(self.marionette).until(expected.element_displayed(confirm))
        confirm.tap()

        Wait(self.marionette, ignored_exceptions=StaleElementException).until(
            lambda m: len(self.call_list) == 0)
예제 #27
0
파일: ftu_step1.py 프로젝트: 6a68/gaia
 def tap_next(self):
     # TODO Remove the sleep when Bug 1013249 is fixed
     time.sleep(2)
     next = Wait(self.marionette).until(
         expected.element_present(*self._next_button_locator))
     Wait(self.marionette).until(expected.element_displayed(next))
     next.tap()
     return FTUStep2(self.marionette)
예제 #28
0
 def tap_songs_tab(self):
     element = Wait(self.marionette).until(
         expected.element_present(*self._songs_tab_locator))
     Wait(self.marionette).until(expected.element_displayed(element))
     element.tap()
     if self.marionette.find_element(*self._top_bannder_locator).text != 'Songs':
         return Mtbf_ListView(self.marionette)
     else:
         return Mtbf_ListView(self.marionette, bolScrollingCheck=False)
예제 #29
0
 def tap_sync_friends(self):
     element = Wait(self.marionette).until(
         expected.element_present(*self._sync_friends_locator))
     Wait(self.marionette).until(expected.element_displayed(element))
     element.tap()
     Wait(self.marionette).until(
         lambda m: m.find_element(*self._sync_friends_locator).location['x'] == 0)
     from gaiatest.apps.system.regions.facebook import FacebookLogin
     return FacebookLogin(self.marionette)
예제 #30
0
 def tap_stop_alarm(self):
     stop_alarm_button = Wait(self.marionette).until(
         expected.element_present(*self._stop_button_locator))
     Wait(self.marionette).until(expected.element_displayed(stop_alarm_button))
     try:
         stop_alarm_button.tap()
     except FrameSendFailureError:
         # The frame may close for Marionette but that's expected so we can continue - Bug 1065933
         pass
예제 #31
0
파일: battery.py 프로젝트: philsmd/gaia
 def tap_turn_on_auto(self):
     power_save_turn_on_auto = Wait(self.marionette).until(
         expected.element_present(*self._power_save_turn_on_auto_locator))
     power_save_turn_on_auto.tap()
예제 #32
0
 def tap_account_prefs_next(self):
     next = Wait(self.marionette, timeout=120).until(
         expected.element_present(*self._account_prefs_next_locator))
     Wait(self.marionette, timeout=120).until(
         expected.element_displayed(next))
     next.tap()
예제 #33
0
 def enable_data(self):
     checkbox = Wait(self.marionette).until(
         expected.element_present(*self._enable_data_checkbox_locator))
     Wait(self.marionette).until(expected.element_displayed(checkbox))
     checkbox.tap()
예제 #34
0
 def tap_clear(self):
     clear_button = Wait(self.marionette).until(
         expected.element_present(*self._clear_button_locator))
     Wait(self.marionette).until(expected.element_displayed(clear_button))
     clear_button.tap()
예제 #35
0
 def set_timezone_city(self, city):
     element = Wait(self.marionette).until(
         expected.element_present(*self._timezone_city_locator))
     Wait(self.marionette).until(expected.element_displayed(element))
     element.tap()
     self.select(city)
예제 #36
0
파일: app.py 프로젝트: orivier/gaia
 def tap_settings(self):
     settings = Wait(self.marionette).until(
         expected.element_present(*self._settings_locator))
     Wait(self.marionette).until(expected.element_displayed(settings))
     settings.tap()
예제 #37
0
 def confirm_usb_storage(self):
     element = Wait(self.marionette).until(
         expected.element_present(
             *self._usb_storage_confirm_button_locator))
     Wait(self.marionette).until(expected.element_displayed(element))
     element.tap()
예제 #38
0
 def delete_file(self):
     self.tap_options()
     self.marionette.find_element(*self._delete_button_locator).tap()
     element = Wait(self.marionette).until(expected.element_present(*self._confirm_delete_button))
     Wait(self.marionette).until(expected.element_displayed(element))
     element.tap()
예제 #39
0
 def tap_message(self):
     message = Wait(self.marionette).until(
         expected.element_present(*self._message_field_locator))
     Wait(self.marionette).until(expected.element_displayed(message))
     message.tap()
예제 #40
0
 def tap_back(self):
     back = Wait(self.marionette).until(
         expected.element_present(*self._tour_back_button_locator))
     Wait(self.marionette).until(expected.element_displayed(back))
     back.tap()
예제 #41
0
 def tap_link_contact(self):
     facebook_link_button = Wait(self.marionette).until(expected.element_present(*self._facebook_link_locator))
     Wait(self.marionette).until(expected.element_displayed(facebook_link_button))
     facebook_link_button.tap()
     from gaiatest.apps.system.regions.facebook import FacebookLogin
     return FacebookLogin(self.marionette)
예제 #42
0
 def confirm_suggestion_notice(self):
     confirm = Wait(self.marionette).until(expected.element_present(
         *self._search_suggestion_ok_button_locator))
     Wait(self.marionette).until(expected.element_displayed(confirm))
     confirm.tap()
     Wait(self.marionette).until(expected.element_not_displayed(confirm))
예제 #43
0
class HTML5Player(PageRegion):
    """Represents HTML5 Player.

    Reference:
    http://www.w3.org/TR/2012/WD-html5-20121025/media-elements.html#media-element
    """

    _video_element_locator = (By.TAG_NAME, 'video')

    def __init__(self, marionette):
        Base.__init__(self, marionette)
        self.root_element = Wait(self.marionette).until(
            expected.element_present(*self._video_element_locator))
        Wait(self.marionette).until(
            expected.element_displayed(self.root_element))

    def wait_for_video_loaded(self):
        # Wait long enough to make sure enough of the video has been loaded
        Wait(self.marionette, timeout=60).until(
            lambda m: int(self.root_element.get_attribute('readyState')) == 4)

    @property
    def is_fullscreen(self):
        return self.marionette.execute_script(
            """return document.mozFullScreenElement ==
                                                 document.getElementsByTagName("video")[0]"""
        )

    @property
    def is_playing(self):
        return self.root_element.get_attribute('paused') != 'true'

    @property
    def is_muted(self):
        return self.root_element.get_attribute('muted') == 'true'

    @property
    def is_ended(self):
        return self.root_element.get_attribute('ended') == 'true'

    @property
    def controls_visible(self):
        return (int(self.get_location('playButton')[0]) > 0)

    def invoke_controls(self):
        Wait(self.marionette).until(lambda m: not self.controls_visible)
        self.root_element.tap()
        Wait(self.marionette).until(lambda m: self.controls_visible)

    def show_controls(self):
        Wait(self.marionette).until(lambda m: not self.controls_visible)
        self.marionette.execute_script("""
           var a = SpecialPowers.Cc["@mozilla.org/inspector/dom-utils;1"]
               .getService(SpecialPowers.Ci.inIDOMUtils)
               .getChildrenForNode(document.getElementsByTagName('video')[0], true);
           var x = a[1].ownerDocument.getAnonymousElementByAttribute(a[1],'class', 'controlBar');
           x.removeAttribute('hidden');
         """)
        Wait(self.marionette).until(lambda m: self.controls_visible)

    def get_location(self, class_name):
        return self.marionette.execute_script("""
           var a = SpecialPowers.Cc["@mozilla.org/inspector/dom-utils;1"]
               .getService(SpecialPowers.Ci.inIDOMUtils)
               .getChildrenForNode(document.getElementsByTagName('video')[0], true);
           var x1 = document.getElementsByTagName('video')[0].getBoundingClientRect().left;
           var x2 = a[1].ownerDocument
                        .getAnonymousElementByAttribute(a[1],'class', '%s')
                        .getBoundingClientRect().left;
           var y1 = document.getElementsByTagName('video')[0]
                            .getBoundingClientRect().top;
           var y2 = a[1].ownerDocument.getAnonymousElementByAttribute(a[1],'class', '%s')
                        .getBoundingClientRect().top;
           return (Math.floor(x2-x1) + ',' + Math.floor(y2-y1));
         """ % (class_name, class_name)).split(',')

    def tap_video_control(self, class_name):
        location = self.get_location(class_name)
        if location[0] <= 0 or location[1] <= 0:
            print 'x=%d, y=%d' % (location[0], location[1])
            self.assertTrue(False)
        self.root_element.tap(x=int(location[0]) + 5, y=int(location[1]) + 5)

    def tap_play(self):
        self.tap_video_control('playButton')
        Wait(self.marionette).until(lambda m: self.is_playing)
        # Tapping the play button makes the controls disappear, wait for that to happen
        Wait(self.marionette).until(lambda m: not self.controls_visible)

    def tap_pause(self):
        self.tap_video_control('playButton')
        Wait(self.marionette).until(lambda m: not self.is_playing)

    def tap_mute(self):
        self.tap_video_control('muteButton')
        Wait(self.marionette).until(lambda m: self.is_muted)

    def tap_unmute(self):
        self.tap_video_control('muteButton')
        Wait(self.marionette).until(lambda m: not self.is_muted)

    def tap_full_screen(self):
        self.tap_video_control('fullscreenButton')

    @property
    def current_timestamp(self):
        return float(self.root_element.get_attribute('currentTime'))
예제 #44
0
 def tap_take_tour(self):
     take_tour = Wait(self.marionette).until(
         expected.element_present(*self._take_tour_button_locator))
     Wait(self.marionette).until(expected.element_enabled(take_tour))
     take_tour.tap()
예제 #45
0
 def tap_tour_next(self):
     next = Wait(self.marionette).until(
         expected.element_present(*self._tour_next_button_locator))
     Wait(self.marionette).until(expected.element_displayed(next))
     next.tap()
예제 #46
0
 def tap_confirm_delete(self):
     delete_button = Wait(self.marionette).until(expected.element_present(*self._confirm_delete_locator))
     Wait(self.marionette).until(expected.element_displayed(delete_button))
     delete_button.tap()
예제 #47
0
파일: app.py 프로젝트: orivier/gaia
 def tap_manual_setup(self):
     manual_setup = Wait(self.marionette).until(
         expected.element_present(*self._manual_setup_locator))
     Wait(self.marionette).until(expected.element_displayed(manual_setup))
     manual_setup.tap()
     return ManualSetupEmail(self.marionette)
예제 #48
0
 def tap_save_to_home_screen(self):
     element = Wait(self.marionette).until(expected.element_present(
         *self._modal_dialog_save_locator))
     Wait(self.marionette).until(expected.element_displayed(element))
     element.tap()
     return BookmarkMenu(self.marionette)
예제 #49
0
파일: app.py 프로젝트: orivier/gaia
 def tap_refresh(self):
     refresh = Wait(self.marionette).until(
         expected.element_present(*self._refresh_locator))
     Wait(self.marionette).until(expected.element_displayed(refresh))
     refresh.tap()
예제 #50
0
 def tap_edit_tool_apply_button(self):
     element = Wait(self.marionette).until(
         expected.element_present(*self._edit_tool_apply_button_locator))
     Wait(self.marionette).until(expected.element_displayed(element))
     element.tap()
예제 #51
0
파일: app.py 프로젝트: orivier/gaia
 def tap_search(self):
     search = Wait(self.marionette).until(
         expected.element_present(*self._search_locator))
     Wait(self.marionette).until(expected.element_displayed(search))
     search.tap()
예제 #52
0
파일: app.py 프로젝트: orivier/gaia
 def tap_edit(self):
     edit = Wait(self.marionette).until(
         expected.element_present(*self._edit_locator))
     Wait(self.marionette).until(expected.element_displayed(edit))
     edit.tap()
예제 #53
0
 def tap_approve_access(self):
     approve_access = Wait(self.marionette).until(
         expected.element_present(*self._approve_access_locator))
     Wait(self.marionette).until(expected.element_enabled(approve_access))
     approve_access.tap()
예제 #54
0
 def tap_artists_tab(self):
     element = Wait(self.marionette).until(
         expected.element_present(*self._artists_tab_locator))
     Wait(self.marionette).until(expected.element_displayed(element))
     element.tap()
     return ListView(self.marionette)
예제 #55
0
 def tap_portrait_crop(self):
     element = Wait(self.marionette).until(
         expected.element_present(*self._crop_portrait_locator))
     Wait(self.marionette).until(expected.element_displayed(element))
     element.tap()
     Wait(self.marionette).until(lambda m: 'selected' in element.get_attribute('class'))