コード例 #1
0
ファイル: settings_form.py プロジェクト: AutomatedTester/gaia
 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
ファイル: screen_lock.py プロジェクト: William-Hsu/gaia
 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
ファイル: alarm.py プロジェクト: AutomatedTester/gaia
 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
ファイル: cell_data.py プロジェクト: William-Hsu/gaia
 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
ファイル: fxaccounts.py プロジェクト: AutomatedTester/gaia
 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
ファイル: settings_form.py プロジェクト: AutomatedTester/gaia
 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
ファイル: settings_form.py プロジェクト: AutomatedTester/gaia
 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
ファイル: language.py プロジェクト: William-Hsu/gaia
 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
ファイル: settings_form.py プロジェクト: AutomatedTester/gaia
 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
ファイル: new_message.py プロジェクト: Wikiwide/gaia
 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
ファイル: contact_details.py プロジェクト: 6a68/gaia
 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
ファイル: context_menu.py プロジェクト: AutomatedTester/gaia
    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
ファイル: context_menu.py プロジェクト: AutomatedTester/gaia
    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
ファイル: confirm_install.py プロジェクト: 6a68/gaia
 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
ファイル: call_log.py プロジェクト: AutomatedTester/gaia
    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
ファイル: app.py プロジェクト: alison-shiue/MTBF-Driver
 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
ファイル: settings_form.py プロジェクト: AutomatedTester/gaia
 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
ファイル: alarm_alert.py プロジェクト: AutomatedTester/gaia
 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
ファイル: new_message.py プロジェクト: klambycom/gaia
 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
ファイル: edit_photo.py プロジェクト: romanbaumgaertner/gaia
 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'))