Exemplo n.º 1
0
 def wait_for_condition(self, method, timeout=None, message=None):
     Wait(self.marionette, timeout).until(method, message=message)
Exemplo n.º 2
0
 def header_text(self):
     header = Wait(self.marionette).until(
         expected.element_present(*self._message_header_locator))
     Wait(self.marionette).until(expected.element_displayed(header))
     return header.text
Exemplo n.º 3
0
 def _assert_n_errors(self, n):
     Wait(self.marionette).until(lambda _: (len(
         self._get_error_lines_including_ignored_errors()) == n))
     self.assertEqual(0, len(self._get_error_lines()))
Exemplo n.º 4
0
 def wait_for_element_exists(self, by, locator, timeout=None):
     Wait(self.marionette, timeout,
          ignored_exceptions=[NoSuchElementException, StaleElementException]) \
         .until(lambda m: m.find_element(by, locator))
     return self.marionette.find_element(by, locator)
Exemplo n.º 5
0
 def wait_for_history_to_load(self, number_of_items=1):
     Wait(self.marionette).until(lambda m: len(
         m.find_elements(*self._history_item_locator)) == number_of_items)
    def test_dv_cert(self):
        with self.marionette.using_context('content'):
            self.marionette.navigate(self.url)

        # The lock icon should be shown
        self.assertIn(
            'identity-secure',
            self.locationbar.connection_icon.value_of_css_property(
                'list-style-image'))

        self.assertEqual(
            self.locationbar.identity_box.get_attribute('className'),
            'verifiedDomain')

        # Open the identity popup
        self.locationbar.open_identity_popup()

        # Check the identity popup doorhanger
        self.assertEqual(
            self.identity_popup.element.get_attribute('connection'), 'secure')

        cert = self.browser.tabbar.selected_tab.certificate

        # The shown host equals to the certificate
        self.assertEqual(
            self.identity_popup.view.main.host.get_attribute('textContent'),
            cert['commonName'])

        # Only the secure label is visible in the main view
        secure_label = self.identity_popup.view.main.secure_connection_label
        self.assertNotEqual(secure_label.value_of_css_property('display'),
                            'none')

        insecure_label = self.identity_popup.view.main.insecure_connection_label
        self.assertEqual(insecure_label.value_of_css_property('display'),
                         'none')

        self.identity_popup.view.main.expander.click()
        Wait(self.marionette).until(
            lambda _: self.identity_popup.view.security.selected)

        # Only the secure label is visible in the security view
        secure_label = self.identity_popup.view.security.secure_connection_label
        self.assertNotEqual(secure_label.value_of_css_property('display'),
                            'none')

        insecure_label = self.identity_popup.view.security.insecure_connection_label
        self.assertEqual(insecure_label.value_of_css_property('display'),
                         'none')

        verifier_label = self.browser.get_property(
            'identity.identified.verifier')
        self.assertEqual(
            self.identity_popup.view.security.verifier.get_attribute(
                'textContent'),
            verifier_label.replace("%S", cert['issuerOrganization']))

        def opener(mn):
            self.identity_popup.view.security.more_info_button.click()

        page_info_window = self.browser.open_page_info_window(opener)
        deck = page_info_window.deck

        self.assertEqual(deck.selected_panel, deck.security)

        self.assertEqual(deck.security.domain.get_attribute('value'),
                         cert['commonName'])

        self.assertEqual(deck.security.owner.get_attribute('value'),
                         page_info_window.get_property('securityNoOwner'))

        self.assertEqual(deck.security.verifier.get_attribute('value'),
                         cert['issuerOrganization'])
    def test_settings_app(self):

        settings = Settings(self.marionette)
        settings.launch()

        ################### Sound ######################
        sound_page = settings.open_sound()
        self.take_screenshot('sound')
        GaiaImageCompareTestCase.scroll(
            self.marionette,
            'down',
            sound_page.screen_element.size['height'],
            screen=sound_page.screen_element)
        self.take_screenshot('sound')
        ringtone_page = sound_page.tap_ring_tone_selector()
        self.take_screenshot('sound-ringtones')
        for i in range(0, 5):
            GaiaImageCompareTestCase.scroll(
                self.marionette,
                'down',
                ringtone_page.screen_element.size['height'],
                screen=ringtone_page.screen_element)
            self.take_screenshot('sound-ringtones')

        ringtone_page.tap_exit()
        Wait(self.marionette).until(
            lambda m: sound_page.ring_tone_selector_visible)

        alerts_page = sound_page.tap_alerts_selector()
        self.take_screenshot('sound-alerts')
        for i in range(0, 5):
            GaiaImageCompareTestCase.scroll(
                self.marionette,
                'down',
                alerts_page.screen_element.size['height'],
                screen=alerts_page.screen_element)
            self.take_screenshot('sound-alerts')
        alerts_page.tap_exit()
        Wait(self.marionette).until(
            lambda m: sound_page.ring_tone_selector_visible)

        manage_page = sound_page.tap_manage_tones_selector()
        self.take_screenshot('sound-manage_tones')
        for i in range(0, 5):
            GaiaImageCompareTestCase.scroll(
                self.marionette,
                'down',
                manage_page.screen_element.size['height'],
                screen=manage_page.screen_element)
            self.take_screenshot('sound-manage_tones')

        manage_page.ring_tones[1].select_option()
        self.take_screenshot('sound-manage_tones-share')
        manage_page.cancel_share()
        manage_page.tap_exit()
        Wait(self.marionette).until(
            lambda m: sound_page.ring_tone_selector_visible)
        settings.return_to_prev_menu(settings.screen_element,
                                     sound_page.screen_element)

        #################### Display ######################
        display_page = settings.open_display()
        self.take_screenshot('display')
        display_page.tap_timeout_selector()
        self.take_screenshot('display-timeout_values', top_frame=True)
        display_page.tap_timeout_confirmation()
        settings.return_to_prev_menu(settings.screen_element,
                                     display_page.screen_element)

        #################### Homescreen ######################
        homescreen_page = settings.open_homescreen()
        self.take_screenshot('homescreen')

        homescreen_page.pick_wallpaper()
        self.take_screenshot('wallpaper')
        homescreen_page.cancel_pick_wallpaper()

        homescreen_page.select_change_icon_layout()
        self.take_screenshot('layout', top_frame=True)
        homescreen_page.confirm_icon_layout()

        homescreen_page.open_change_home_screen()
        self.take_screenshot('homescreen-change_homescreen')
        homescreen_page.open_get_more_home_screen()
        self.take_screenshot('homescreen-get_more_homescreen', top_frame=True)
        homescreen_page.cancel_get_more_home_screen()
        settings.return_to_prev_menu(
            homescreen_page.screen_element,
            homescreen_page.change_homescreen_screen_element)
        settings.return_to_prev_menu(settings.screen_element,
                                     homescreen_page.screen_element)

        ################### Search ######################
        search_page = settings.open_search()
        self.take_screenshot('search')
        search_page.open_select_search_engine()
        self.take_screenshot('search-engine_list')
        search_page.close_select_search_engine()
        settings.return_to_prev_menu(settings.screen_element,
                                     search_page.screen_element)

        ################## Navigation ######################
        nav_page = settings.open_navigation()
        self.take_screenshot('navigation')
        settings.return_to_prev_menu(settings.screen_element,
                                     nav_page.screen_element)

        ################# Notifications ######################
        notif_page = settings.open_notification()
        self.take_screenshot('notification')
        settings.return_to_prev_menu(settings.screen_element,
                                     notif_page.screen_element)

        ################ Date and Time ######################
        # Only the main page and Time Format selection is checked
        date_time_page = settings.open_date_and_time()
        self.take_screenshot('date_and_time')
        GaiaImageCompareTestCase.scroll(
            self.marionette,
            'down',
            date_time_page.screen_element.size['height'],
            screen=date_time_page.screen_element)
        self.take_screenshot('date_and_time')
        date_time_page.disable_default_format()
        date_time_page.open_time_format()
        self.take_screenshot('date_and_time-time_format', top_frame=True)
        date_time_page.close_time_format()
        settings.return_to_prev_menu(settings.screen_element,
                                     date_time_page.screen_element)

        ############### Language ######################
        # 'Get more languages' menu cannot be opened due to css bug
        language_page = settings.open_language()
        self.take_screenshot('language')
        language_page.open_select_language()
        self.take_screenshot('language-select', top_frame=True)
        language_page.close_select_language()
        settings.return_to_prev_menu(settings.screen_element,
                                     language_page.screen_element)

        # This involves app switching, and often would cause whitescreen issue under 319MB memory config
        # Please run in 512 or 1024 MB mode to avoid this issue
        ############### Keyboards ######################
        keyboard_page = settings.open_keyboard()
        self.take_screenshot('keyboard')
        builtin_page = keyboard_page.tap_built_in_keyboards()
        self.take_screenshot('keyboard-built_in')
        builtin_page.tap_user_dictionary()
        self.take_screenshot('keyboard-user-dict')
        builtin_page.tap_user_dict_exit()
        builtin_page.tap_exit()
        keyboard_page.wait_until_page_ready()
        morekb_page = keyboard_page.tap_add_more_keyboards()
        self.take_screenshot('keyboard-more_kb')
        settings.return_to_prev_menu(keyboard_page.screen_element,
                                     morekb_page.screen_element)
        settings.return_to_prev_menu(settings.screen_element,
                                     keyboard_page.screen_element)

        ############## Themes ######################
        themes_page = settings.open_themes()
        self.take_screenshot('themes')
        settings.return_to_prev_menu(settings.screen_element,
                                     themes_page.screen_element)

        ############# Addons ######################
        addons_page = settings.open_addons()
        self.take_screenshot('addons')

        addons_page.tap_item(0)
        self.take_screenshot('addons-addon_enabled')
        addons_page.toggle_addon_status()  # addons are enabled by default
        Wait(self.marionette).until(lambda m: not addons_page.is_addon_enabled)
        self.take_screenshot('addons-addon_disabled')
        addons_page.toggle_addon_status()  # revert to original state
        settings.return_to_prev_menu(addons_page.screen_element,
                                     addons_page.details_screen_element)

        addons_page.tap_item(1)
        self.take_screenshot('addons-nouse_addon')
        settings.return_to_prev_menu(addons_page.screen_element,
                                     addons_page.details_screen_element)

        addons_page.tap_item(2)
        self.take_screenshot('addons-obsolete_addon')
        settings.return_to_prev_menu(addons_page.screen_element,
                                     addons_page.details_screen_element)
Exemplo n.º 8
0
    def test_settings_app(self):
        settings = Settings(self.marionette)
        settings.launch()

        # opening each subpage in Settings menu.
        # some subpages have their own subpages, and they need to be opened as well.
        #################### Wi-Fi and its subpages ######################
        wifi_page = settings.open_wifi()
        Wait(
            self.marionette).until(lambda m: wifi_page.is_wifi_enabled is True)

        self.take_screenshot('wifi-enabled')
        wifi_page.tap_connect_with_wps()
        self.take_screenshot('wifi-wps')
        settings.return_to_prev_menu(wifi_page.screen_element,
                                     wifi_page.wps_screen_element)
        self.marionette.execute_script('arguments[0].scrollIntoView(false);',
                                       [wifi_page.manage_network_button])
        wifi_page.tap_manage_networks()
        wifi_page.tap_join_hidden_network()
        wifi_page.tap_security_selector()
        self.take_screenshot('wifi-securityType', top_frame=True)
        wifi_page.tap_security_ok()
        self.take_screenshot('wifi-joinHidden')
        settings.return_to_prev_menu(
            wifi_page.manage_network_screen_element,
            wifi_page.join_hidden_network_screen_element)
        self.take_screenshot('wifi-manageNetwork')
        settings.return_to_prev_menu(wifi_page.screen_element,
                                     wifi_page.manage_network_screen_element)
        wifi_page.tap_manage_certs()
        wifi_page.tap_import_certs()
        self.take_screenshot('wifi-importCert')
        settings.return_to_prev_menu(wifi_page.manage_certs_screen_element,
                                     wifi_page.select_certs_screen_element)
        self.take_screenshot('wifi-manageCert')
        settings.return_to_prev_menu(wifi_page.screen_element,
                                     wifi_page.manage_certs_screen_element)
        wifi_page.disable_wifi()
        self.take_screenshot('wifi-disabled')
        settings.return_to_prev_menu(settings.screen_element,
                                     wifi_page.screen_element)

        #################### Sim manager and its subpages ######################
        sim_page = settings.open_sim_manager()
        self.take_screenshot('sim_manager')
        GaiaImageCompareTestCase.scroll(self.marionette,
                                        'down',
                                        sim_page.screen_element.size['height'],
                                        screen=sim_page.screen_element)
        self.take_screenshot('sim_manager')
        sim_page.tap_sim_security()
        sim_page.enable_sim_pin()
        self.take_screenshot('sim_manager-pin_page')
        settings.return_to_prev_menu(sim_page.security_screen_element,
                                     sim_page.sim_pin_screen_element)
        self.take_screenshot('sim_manager-security')
        settings.return_to_prev_menu(sim_page.screen_element,
                                     sim_page.security_screen_element)
        settings.return_to_prev_menu(settings.screen_element,
                                     sim_page.screen_element)

        ################### Call Settings and its subpages ######################
        cs_page = settings.open_call()
        self.take_screenshot('cs-selectSIM')
        cs_page.tap_sim_1()
        self.take_screenshot('callsettings')
        cs_page.tap_voicemail()
        self.take_screenshot('voicemail')
        settings.return_to_prev_menu(cs_page.cs_screen_element,
                                     cs_page.vm_screen_element)

        cs_page.tap_caller_id_selection()
        self.take_screenshot('callerID', top_frame=True)
        cs_page.confirm_caller_id_selection()

        cs_page.tap_fixed_dialing()
        self.take_screenshot('fixeddialing')
        cs_page.tap_auth_numbers()
        self.take_screenshot('authNumbers')
        settings.return_to_prev_menu(cs_page.fixed_dialing_screen_element,
                                     cs_page.auth_screen_element)
        cs_page.enable_fixed_dialing()
        self.take_screenshot('enableFDN')
        settings.return_to_prev_menu(
            cs_page.fixed_dialing_screen_element,
            cs_page.fixed_dialing_simpin_screen_element)
        settings.return_to_prev_menu(cs_page.cs_screen_element,
                                     cs_page.fixed_dialing_screen_element)

        cs_page.tap_call_forwarding()
        self.take_screenshot('callforward_init')
        cs_page.wait_until_call_forwarding_info_received()
        self.take_screenshot('callforward')
        cs_page.tap_always_forward()
        self.take_screenshot('alwaysFwd')
        settings.return_to_prev_menu(
            cs_page.call_forwarding_screen_element,
            cs_page.call_forwarding_always_screen_element)
        cs_page.tap_forward_when_busy()
        self.take_screenshot('busyFwd')
        settings.return_to_prev_menu(
            cs_page.call_forwarding_screen_element,
            cs_page.call_forwarding_busy_screen_element)
        cs_page.tap_forward_unanswered()
        self.take_screenshot('unansweredFwd')
        settings.return_to_prev_menu(
            cs_page.call_forwarding_screen_element,
            cs_page.call_forwarding_unans_screen_element)
        cs_page.tap_forward_unreachable()
        self.take_screenshot('unreachFwd')
        settings.return_to_prev_menu(
            cs_page.call_forwarding_screen_element,
            cs_page.call_forwarding_unreach_screen_element)
        settings.return_to_prev_menu(cs_page.cs_screen_element,
                                     cs_page.call_forwarding_screen_element)

        cs_page.tap_call_barring()

        self.take_screenshot('callBarring-init')
        cs_page.wait_until_call_barring_info_received(
        )  # this sometimes happens in less than a second,
        # making it difficult to obtain init view
        self.take_screenshot('callBarring')
        GaiaImageCompareTestCase.scroll(
            self.marionette,
            'down',
            cs_page.call_barring_screen_element.size['height'],
            screen=cs_page.call_barring_screen_element)
        self.take_screenshot('callBarring')
        cs_page.tap_change_passcode()
        self.take_screenshot('callBarring-passcode')
        settings.return_to_prev_menu(
            cs_page.call_barring_screen_element,
            cs_page.call_barring_passcode_screen_element)
        cs_page.tap_call_barring_all()
        self.take_screenshot('callBarring-passcode2')
        cs_page.tap_call_barring_all_cancel()
        settings.return_to_prev_menu(cs_page.cs_screen_element,
                                     cs_page.call_barring_screen_element)
        settings.return_to_prev_menu(cs_page.screen_element,
                                     cs_page.cs_screen_element)
        settings.return_to_prev_menu(settings.screen_element,
                                     cs_page.screen_element)

        ################## Messaging Settings and its subpages ######################
        messaging_page = settings.open_message()
        self.take_screenshot('message')
        GaiaImageCompareTestCase.scroll(
            self.marionette,
            'down',
            messaging_page.screen_element.size['height'],
            screen=messaging_page.screen_element)
        self.take_screenshot('message')
        messaging_page.tap_auto_retrieve_selector()
        self.take_screenshot('message-autoretrieve_options', top_frame=True)
        messaging_page.close_retrieve_dialog()
        messaging_page.select_sim_1()
        self.take_screenshot('message-sim_1')
        settings.return_to_prev_menu(messaging_page.screen_element,
                                     messaging_page.settings_screen_element)
        settings.return_to_prev_menu(settings.screen_element,
                                     messaging_page.screen_element)

        ################### Cellular & Data and its subpages ######################
        cell_data_page = settings.open_cell_and_data()
        self.take_screenshot('cell_and_data')
        cell_data_page.enable_data()
        self.take_screenshot('data_enable_prompt')
        cell_data_page.data_prompt.turn_on()
        Wait(self.marionette).until(
            lambda m: cell_data_page.is_data_toggle_checked is True)
        cell_data_page.enable_roaming()
        self.take_screenshot('roaming_enable_prompt')
        cell_data_page.data_prompt.turn_on()
        Wait(self.marionette).until(
            lambda m: cell_data_page.is_roaming_toggle_checked is True)
        self.take_screenshot('cell_and_data_enabled')
        sim_settings_page = cell_data_page.tap_sim_1_setting()
        self.take_screenshot('sim_1_setting')
        sim_settings_page.tap_network_operator()
        self.take_screenshot('network_op')
        sim_settings_page.tap_network_type()
        self.take_screenshot('cell_network_type', top_frame=True)
        sim_settings_page.confirm_network_type()
        settings.return_to_prev_menu(
            sim_settings_page.screen_element,
            sim_settings_page.network_op_screen_element)
        sim_settings_page.tap_apn_settings()
        self.take_screenshot('apn_settings')
        sim_settings_page.tap_reset_to_default()
        self.take_screenshot('apn_setting_reset')
        sim_settings_page.tap_cancel_reset()
        sim_settings_page.tap_data_settings()
        self.take_screenshot(
            'apn_list')  # all other settings show the same dialog
        sim_settings_page.tap_add_new_apn()
        self.take_screenshot('apn_editor')
        for i in range(0, 2):
            GaiaImageCompareTestCase.scroll(
                self.marionette,
                'down',
                sim_settings_page.apn_editor_screen_element.size['height'],
                screen=sim_settings_page.apn_editor_screen_element)
            self.take_screenshot('apn_editor')
        sim_settings_page.select_authentication()
        self.take_screenshot('apn_authentication', top_frame=True)
        sim_settings_page.confirm_apn_selection()
        sim_settings_page.select_protocol()
        self.take_screenshot('apn_protocol', top_frame=True)
        sim_settings_page.confirm_apn_selection()
        sim_settings_page.select_roaming_protocol()
        self.take_screenshot('apn_roaming', top_frame=True)
        sim_settings_page.confirm_apn_selection()

        settings.return_to_prev_menu(
            sim_settings_page.data_settings_screen_element,
            sim_settings_page.apn_editor_screen_element)
        settings.return_to_prev_menu(
            sim_settings_page.apn_settings_screen_element,
            sim_settings_page.data_settings_screen_element)
        settings.return_to_prev_menu(
            sim_settings_page.screen_element,
            sim_settings_page.apn_settings_screen_element)
        settings.return_to_prev_menu(cell_data_page.screen_element,
                                     sim_settings_page.screen_element)
        settings.return_to_prev_menu(settings.screen_element,
                                     cell_data_page.screen_element)

        ################# Bluetooth and its subpages ######################
        bluetooth_page = settings.open_bluetooth()
        self.take_screenshot('bluetooth-disabled')
        bluetooth_page.refresh_root_element(
        )  # frame is switched, need to refresh the root
        bluetooth_page.enable_bluetooth()
        self.take_screenshot('bluetooth-enabled')
        bluetooth_page.refresh_root_element()
        bluetooth_page.tap_rename_my_device()
        self.take_screenshot('bluetooth-renameDevice')
        bluetooth_page.refresh_root_element()
        bluetooth_page.tap_update_device_name_ok()
        bluetooth_page.disable_bluetooth()
        settings.return_to_prev_menu(settings.screen_element,
                                     bluetooth_page.screen_element)

        ##################### Internet sharing and its subpages ######################
        internet_settings_page = settings.open_internet_sharing()
        self.take_screenshot('internet_sharing')
        internet_settings_page.enable_hotspot()
        self.take_screenshot('internet_sharing-hotspot_enabled')
        hotspot_page = internet_settings_page.tap_hotspot_settings()
        self.take_screenshot('internet_sharing-hotspot')
        hotspot_page.tap_security_settings()
        self.take_screenshot('internet_sharing-hotspot-security',
                             top_frame=True)
        hotspot_page.confirm_security_settings()
        settings.return_to_prev_menu(internet_settings_page.screen_element,
                                     hotspot_page.screen_element)
        settings.return_to_prev_menu(settings.screen_element,
                                     internet_settings_page.screen_element)
Exemplo n.º 9
0
    def test_ftu_skip_tour(self):
        """
        https://moztrap.mozilla.org/manage/case/6119/
        """
        ssid = self.testvars['wifi']['ssid']
        psk = self.testvars['wifi'].get('psk')
        keymanagement = self.testvars['wifi'].get('keyManagement')
        share_data_default = True
        geolocation_default = True

        # Assume a SIM is present if we assigned a phone number
        # Don't trust internal API for this, since it's an external condition
        has_a_sim = bool(self.environment.phone_numbers)

        self.wait_for_condition(lambda m: self.ftu.languages_list > 0,
                                message="No languages listed on screen")

        # select en-US due to the condition of this test is only for en-US
        self.ftu.tap_language("en-US")

        # If a SIM is present, the cell data screen comes up
        if has_a_sim:
            self.ftu.tap_next_to_cell_data_section()
            # Tap enable data if connection is also present. You might have
            # a SIM, but without a valid connection.
            if self.device.has_mobile_connection:
                self.ftu.enable_data()
                self.wait_for_condition(
                    lambda m: self.data_layer.is_cell_data_connected,
                    message='Cell data was not connected by FTU app')

        # Tap next
        self.ftu.tap_next_to_wifi_section()
        self.ftu.wait_for_networks_available()
        self.ftu.connect_to_wifi(ssid, psk, keymanagement)
        Wait(self.marionette,
             timeout=60,
             ignored_exceptions=StaleElementException).until(
                 lambda m: 'connected' in m.find_element(
                     By.CSS_SELECTOR, '#networks-list li[data-ssid="%s"] aside'
                     % self.testvars['wifi']['ssid']).get_attribute('class'))

        self.assertTrue(
            self.data_layer.is_wifi_connected(self.testvars['wifi']),
            "WiFi was not connected via FTU app")

        self.apps.switch_to_displayed_app()

        # Set timezone if there's no connection
        if not self.device.has_mobile_connection:
            self.ftu.tap_next_to_timezone_section()
            # UTC-05:00 America/New York is the default info if no network is detected
            self.assertEqual(self.ftu.timezone_title,
                             "UTC-05:00 America/New York")
            self.ftu.set_timezone_continent("Asia")
            self.ftu.set_timezone_city("Almaty")
            self.assertEqual(self.ftu.timezone_title, "UTC+06:00 Asia/Almaty")

        # Verify Geolocation section appears
        self.ftu.tap_next_to_geolocation_section()

        # Verify the "geolocation" option matches expected initial state
        # There's a very small lag on this after the dialog appears.
        Wait(self.marionette).until(
            lambda m: self.ftu.is_geolocation_enabled == geolocation_default,
            message="Geolocation state should match initial internal state")

        # Verify that internal state matches UI state
        self.assertEqual(
            self.data_layer.get_setting('geolocation.enabled'),
            self.ftu.is_geolocation_enabled,
            msg='Geolocation internal state should match UI state')

        # Toggle geolocation and verify that it also toggled internal state
        self.ftu.toggle_geolocation()
        self.assertEqual(
            self.data_layer.get_setting('geolocation.enabled'),
            not geolocation_default,
            msg='Geolocation internal state should be changed by UI')
        self.ftu.tap_next_to_import_contacts_section()

        # If there's a SIM, try importing from it
        if has_a_sim:
            # You can do this as many times as you like without db conflict
            self.ftu.tap_import_from_sim()
            self.ftu.wait_for_contacts_imported()
            self.assertEqual(self.ftu.count_imported_contacts,
                             len(self.data_layer.all_contacts))

            # all_contacts switches to top frame; Marionette needs to be switched back to ftu
            self.apps.switch_to_displayed_app()

        self.ftu.tap_next_to_firefox_accounts_section()
        self.ftu.tap_next_to_welcome_browser_section()

        # Verify the "Share Data" option matches expected initial state
        # There's a very small lag on this after the dialog appears.
        Wait(self.marionette).until(
            lambda m: self.ftu.is_share_data_enabled == share_data_default,
            message="Send Data UI state should match initial internal state")

        # Verify that internal state matches UI state
        self.assertEqual(
            self.data_layer.get_setting('debug.performance_data.shared'),
            self.ftu.is_share_data_enabled,
            msg='Send Data internal state should match UI state')

        # Toggle "Share Data" and verify that it also toggled internal state
        self.ftu.toggle_share_data()
        self.assertEqual(
            self.data_layer.get_setting('debug.performance_data.shared'),
            not share_data_default,
            msg='Send Data internal state should be changed by UI')

        self.ftu.tap_next_to_privacy_browser_section()

        # Enter a dummy email address and check it set inside the os
        # TODO assert that this is preserved in the system somewhere. Currently it is not used
        self.ftu.enter_email_address("*****@*****.**")
        self.ftu.tap_next_to_finish_section()

        # Skip the tour
        self.ftu.tap_skip_tour()

        # Switch back to top level now that FTU app is gone
        self.wait_for_condition(
            lambda m: self.apps.displayed_app.name == Homescreen.name)
Exemplo n.º 10
0
 def wait_for_search_popup_visible(self):
     Wait(self.marionette).until(
         expected.element_displayed(*self._search_popup_locator))
Exemplo n.º 11
0
    def test_install_and_execute_bing_map(self):

        marketplace = Marketplace(self.marionette)
        marketplace.launch()

        results = marketplace.search(self.app_search)
        first_result = results.search_results[0]
        app_name = first_result.get_app_name()
        first_result.tap_install_button()

        # Confirm the installation and wait for the app icon to be present
        confirm_install = ConfirmInstall(self.marionette)
        confirm_install.tap_confirm()

        self.assertEqual(self.apps.displayed_app.name, 'Marketplace')

        self.device.touch_home_button()

        # Check that the icon of the app is on the homescreen
        homescreen = Homescreen(self.marionette)
        homescreen.wait_for_app_icon_present(app_name)

        installed_app = homescreen.installed_app(app_name)
        installed_app.tap_icon()

        Wait(self.marionette).until(lambda m: m.title == self.app_title)
        bingmap = self.marionette.find_element(*self._map_locator)
        Wait(self.marionette).until(lambda m: bingmap.is_displayed())
        time.sleep(self.draw_wait_time)
        self.take_screenshot()

        # once the map is completely loaded, use the UI to render different views
        # zoom in
        self.marionette.find_element(*self._zoom_in_locator).tap()
        time.sleep(self.draw_wait_time)
        self.take_screenshot()
        self.marionette.find_element(*self._zoom_in_locator).tap()
        time.sleep(self.draw_wait_time)
        self.take_screenshot()
        self.marionette.find_element(*self._zoom_in_locator).tap()
        time.sleep(self.draw_wait_time)
        self.take_screenshot()

        # move around
        self.scroll(self._map_locator, 'right', 100)
        time.sleep(self.draw_wait_time)
        self.take_screenshot()
        self.scroll(self._map_locator, 'down', 100)
        time.sleep(self.draw_wait_time)
        self.take_screenshot()

        # zoom out
        self.marionette.find_element(*self._zoom_out_locator).tap()
        time.sleep(self.draw_wait_time)
        self.take_screenshot()
        self.marionette.find_element(*self._zoom_out_locator).tap()
        time.sleep(self.draw_wait_time)
        self.take_screenshot()
        self.marionette.find_element(*self._zoom_out_locator).tap()
        time.sleep(self.draw_wait_time)
        self.take_screenshot()
Exemplo n.º 12
0
 def __init__(self, marionette):
     Base.__init__(self, marionette)
     form = self.marionette.find_element(*self._form_locator)
     Wait(self.marionette).until(lambda m: form.location['y'] == 0)
Exemplo n.º 13
0
 def wait_for_phone_number_ready(self):
     # entering dialer and expecting a phone number there is javascript that
     # sets the phone value and enables this button
     add_contact = self.marionette.find_element(
         *self._add_new_contact_button_locator)
     Wait(self.marionette).until(expected.element_enabled(add_contact))
Exemplo n.º 14
0
 def wait_to_not_be_displayed(self):
     Wait(self.marionette).until(lambda m: self.apps.displayed_app.manifest_url != self.manifest_url)
Exemplo n.º 15
0
 def wait_for_cards_view_not_displayed(self):
     Wait(self.marionette).until(
         expected.element_not_displayed(self.root_element))
Exemplo n.º 16
0
 def wait_for_enable_switch_to_be_turned_on(self):
     Wait(self.marionette, timeout=60).until(
         expected.element_displayed(*self._checkbox_locator))
     Wait(self.marionette).until(lambda m: GaiaBinaryControl(
         m, self._checkbox_locator).is_checked is True)
Exemplo n.º 17
0
 def test_verify_phone_not_bricked(self):
     Wait(self.marionette).until(
         lambda m: self.apps.displayed_app.name == Homescreen.name)
Exemplo n.º 18
0
 def __init__(self, marionette):
     Base.__init__(self, marionette)
     element = self.marionette.find_element(*self._page_locator)
     Wait(self.marionette).until(
         lambda m: 'current' in element.get_attribute('class'))
Exemplo n.º 19
0
    def check_get_me_out_of_here_button(self, unsafe_page):
        button = self.marionette.find_element(By.ID, "getMeOutButton")
        button.click()

        Wait(self.marionette, timeout=self.marionette.timeout.page_load).until(
            lambda mn: self.browser.default_homepage in mn.get_url())
    def test_insecure_website(self):
        with self.marionette.using_context('content'):
            self.marionette.navigate(self.urls[2])

        Wait(self.marionette).until(lambda _: (self.identity_box.get_property(
            'className') == 'unknownIdentity'))
Exemplo n.º 21
0
 def wait_for_subelement_displayed(self, parent, by, locator, timeout=None):
     Wait(self.marionette, timeout,
          ignored_exceptions=[NoSuchElementException, StaleElementException])\
         .until(lambda m: parent.find_element(by, locator).is_displayed())
     return parent.find_element(by, locator)
Exemplo n.º 22
0
    def test_launch_manifest(self):
        browser_manifest_url = 'app://search.gaiamobile.org/manifest.webapp'

        app = self.apps.launch('Browser', manifest_url=browser_manifest_url)
        self.assertTrue(app.frame)
        Wait(self.marionette).until(lambda m: 'search' in m.get_url())
Exemplo n.º 23
0
 def wait_for_element_enabled(self, element, timeout=10):
     Wait(self.marionette, timeout) \
         .until(lambda e: element.is_enabled(),
                message="Timed out waiting for element to be enabled")
Exemplo n.º 24
0
 def wait_for_centered(self):
     Wait(self.marionette).until(lambda m: self.is_centered)
Exemplo n.º 25
0
 def wait_for_received_messages(self, interval=5, timeout=300):
     Wait(self.marionette, timeout).until(
         expected.element_displayed(
             Wait(self.marionette, timeout).until(
                 expected.element_present(
                     *self._received_message_content_locator))))
Exemplo n.º 26
0
 def wait_for_no_card_displayed(self):
     Wait(self.marionette).until(lambda m: self.is_no_card_displayed)
Exemplo n.º 27
0
 def switch_to_frame(self):
     frame = Wait(self.marionette).until(
         expected.element_present(*self._frame_locator))
     Wait(self.marionette).until(expected.element_displayed(frame))
     self.marionette.switch_to_frame(frame)
Exemplo n.º 28
0
 def wait_for_cards_view(self):
     Wait(self.marionette).until(
         lambda m: self.root_element.get_attribute('class') == 'active')
Exemplo n.º 29
0
Arquivo: event.py Projeto: uniony/gaia
 def wait_for_panel_to_load(self):
     Wait(self.marionette).until(expected.element_displayed(
         Wait(self.marionette).until(expected.element_present(
             *self._event_title_input_locator))))
Exemplo n.º 30
0
 def wait_for_element_present(self, by, locator, timeout=None):
     return Wait(self.marionette, timeout, ignored_exceptions=NoSuchElementException).until(
         lambda m: m.find_element(by, locator))