示例#1
0
    def test_enable_cell_data_via_settings_app(self):
        """
        https://moztrap.mozilla.org/manage/case/1373/
        """

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

        self.assertNotEqual(cell_and_data_settings.carrier_name, '')

        # enable cell data
        self.assertFalse(cell_and_data_settings.is_data_toggle_checked)
        cell_data_prompt = cell_and_data_settings.enable_data()

        self.assertTrue(cell_and_data_settings.is_data_toggle_checked)
        # Even though the data toggle checkbox is already checked,
        # cell data should not be enabled until we turn it on via the prompt
        self.assertFalse(self.data_layer.get_setting('ril.data.enabled'),
            "Cell data was enabled before responding to the prompt")

        cell_data_prompt.turn_on()

        # verify that cell data is now enabled and connected
        self.assertTrue(self.data_layer.is_cell_data_enabled, "Cell data was not enabled via Settings app")
        Wait(self.marionette).until(lambda m: self.data_layer.is_cell_data_connected,
            message="Cell data was not connected via Settings app")
示例#2
0
    def test_music_share_ringtone(self):
        """
        https://moztrap.mozilla.org/manage/case/2683/
        """

        music_app = Music(self.marionette)
        music_app.launch()
        music_app.wait_for_music_tiles_displayed()

        # switch to songs view, and play the first one on the list
        list_view = music_app.tap_songs_tab()
        songs = list_view.media
        self.assertGreater(len(songs), 0, 'The ogg file could not be found')
        player_view = songs[0].tap_first_song()

        # wait until the player view is shown, then tap the share button
        play_time = time.strptime('00:01', '%M:%S')
        Wait(self.marionette).until(lambda m: player_view.player_elapsed_time >= play_time)
        activities = player_view.tap_share_button()
        ringtone = activities.share_to_ringtones()
        ringtone.tap_save()

        system = System(self.marionette)
        self.marionette.switch_to_frame()
        system.wait_for_notification_toaster_displayed(message="Ringtone set as default.")
        system.wait_for_notification_toaster_not_displayed()

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

        # desktop b2g doesn't have this option visible, see bug 1130538
        if sound.ring_tone_selector_visible:
            self.assertEqual(sound.current_ring_tone, 'MUS_0001')
示例#3
0
    def test_settings_change_wallpaper_from_gallery(self):
        """
        https://moztrap.mozilla.org/manage/case/1902/
        """
        self.apps.switch_to_displayed_app()
        default_wallpaper_settings = self.data_layer.get_setting(
            'wallpaper.image')

        # open settings app and choose to change wallpaper, instead of opening context menu
        settings = Settings(self.marionette)
        settings.launch()
        homescreen_page = settings.open_homescreen()
        activities = homescreen_page.pick_wallpaper()

        # select gallery
        gallery = activities.tap_gallery()

        # go through the crop process
        gallery.wait_for_thumbnails_to_load()
        gallery.thumbnails[0].tap()

        from gaiatest.apps.gallery.regions.crop_view import CropView
        crop_view = CropView(self.marionette)

        # can't actually crop the element
        crop_view.tap_crop_done()

        # check that the wallpaper has changed
        new_wallpaper_settings = self.data_layer.get_setting('wallpaper.image')
        self.assertNotEqual(default_wallpaper_settings, new_wallpaper_settings)
    def test_change_manager_default_sim(self, default_sim_value, default_sim_option):
        """
        https://moztrap.mozilla.org/manage/case/10590/
        """

        # Initialize to the other SIM so the confirmation window will show when selecting data
        other_sim = 1 if default_sim_value == 0 else 0
        self.data_layer.set_setting('ril.telephony.defaultServiceId', other_sim)
        self.data_layer.set_setting('ril.sms.defaultServiceId', other_sim)
        self.data_layer.set_setting('ril.data.defaultServiceId', other_sim)

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

        sim_manager_settings.select_outgoing_calls(default_sim_option)
        sim_manager_settings.select_outgoing_messages(default_sim_option)
        sim_manager_settings.select_data(default_sim_option)

        self.assertEqual(default_sim_option, sim_manager_settings.sim_for_outgoing_calls)
        self.assertEqual(default_sim_option, sim_manager_settings.sim_for_outgoing_messages)
        self.assertEqual(default_sim_option, sim_manager_settings.sim_for_data)

        self.assertEqual(self.data_layer.get_setting('ril.telephony.defaultServiceId'), default_sim_value)
        self.assertEqual(self.data_layer.get_setting('ril.sms.defaultServiceId'), default_sim_value)
        self.assertEqual(self.data_layer.get_setting('ril.data.defaultServiceId'), default_sim_value)
    def test_enable_do_not_track_via_settings_app(self):
        """Enable do not track via the Settings app"""

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

        # turned off by default
        self.wait_for_condition(
            lambda m: not do_not_track_settings.is_do_not_track_enabled
        )

        # turn on
        do_not_track_settings.enable_do_not_track()

        # should be on
        self.assertTrue(self.data_layer.get_setting('privacy.donottrackheader.enabled'),
                        'Do Not Track was not enabled via Settings app')

        # turn back off
        do_not_track_settings.disable_do_not_track()

        # should be off
        self.assertFalse(self.data_layer.get_setting('privacy.donottrackheader.enabled'),
                         'Do Not Track was not disabled via Settings app')
    def test_browser_clear_history(self):
        """
        https://moztrap.mozilla.org/manage/cases/?filter-id=3582
        """
        search = Search(self.marionette)
        search.launch()
        browser = search.go_to_url(self.test_url)
        browser.switch_to_content()
        Wait(self.marionette).until(lambda m: m.title == 'Mozilla')

        self.device.touch_home_button()

        search.launch()
        search.wait_for_history_to_load(number_of_items=1)
        self.assertGreater(search.history_items_count, 0)

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

        browsing_privacy.tap_clear_browsing_history()
        browsing_privacy.tap_clear()

        self.device.touch_home_button()
        search.launch()
        search.wait_for_history_to_load(number_of_items=0)
        self.assertEqual(0, search.history_items_count)
    def test_change_keyboard_language_settings(self):
        settings = Settings(self.marionette)
        settings.launch()
        keyboard_settings = settings.open_keyboard_settings()

        # Tap 'add more keyboards' button
        add_more_keyboards = keyboard_settings.tap_add_more_keyboards()

        # Select keyboard language, then click back to make it "stick"
        add_more_keyboards.select_language(u'Espa\u00F1ol')
        add_more_keyboards.go_back()

        keyboard_settings.wait_for_built_in_keyboard(u'Espa\u00F1ol')

        # launch the Contacts app to verify the keyboard layout
        contacts_app = Contacts(self.marionette)
        contacts_app.launch()
        new_contact_form = contacts_app.tap_new_contact()
        new_contact_form.type_given_name('')

        # Switch to keyboard frame and switch language
        new_contact_form.keyboard.switch_to_keyboard()
        new_contact_form.keyboard.tap_keyboard_language_key()
        new_contact_form.keyboard.switch_to_keyboard()
        special_key = self.marionette.find_element(*self._special_key_locator).text

        # Checking if exists the special key - "ñ"
        self.assertEqual(special_key, self._expected_key)
示例#8
0
    def test_toggle_bluetooth_settings(self):
        """Toggle Bluetooth via Settings - Networks & Connectivity

        https://moztrap.mozilla.org/manage/case/6071/
        """
        device_name = str(time.time())

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

        self.assertFalse(self.data_layer.bluetooth_is_enabled)
        self.assertFalse(self.data_layer.get_setting("bluetooth.visible"))

        bluetooth_settings = settings.open_bluetooth_settings()
        bluetooth_settings.enable_bluetooth()

        self.assertTrue(self.data_layer.bluetooth_is_enabled)

        bluetooth_settings.tap_rename_my_device()
        bluetooth_settings.type_phone_name(device_name)
        bluetooth_settings.tap_update_device_name_ok()

        self.assertEquals(bluetooth_settings.device_name, device_name)

        bluetooth_settings.enable_visible_to_all()

        self.assertTrue(self.data_layer.get_setting("bluetooth.visible"))
        self.assertTrue(self.data_layer.bluetooth_is_discoverable)
        self.assertEquals(self.data_layer.bluetooth_name, device_name)
示例#9
0
    def test_that_device_info_is_populated(self):
        settings = Settings(self.marionette)
        settings.launch()
        device_info = settings.open_device_info()

        # devices without sim cards have no phone number
        if self.environment.phone_numbers:
            self.assertNotEqual(device_info.phone_number, '')
            self.assertIsNotNone(device_info.phone_number)
        else:
            self.assertEqual(device_info.phone_number, '')

        for item in ('model', 'software'):
            self.assertNotEqual(getattr(device_info, item), '')

        more_info = device_info.tap_more_info()
        for item in ('os_version', 'hardware_revision', 'mac_address', 'iccid',
                     'platform_version', 'build_id', 'build_number',
                     'update_channel', 'git_commit_timestamp',
                     'git_commit_hash'):
            self.assertNotEqual(getattr(more_info, item), '',
                                '{} does not have any value'.format(item))

        i = 1
        for expected_imei in self.environment.imei_numbers:
            self.assertEqual(getattr(more_info, 'imei{}'.format(i)),
                             expected_imei)
            i += 1
    def test_settings_change_wallpaper_from_gallery(self):
        """
        https://moztrap.mozilla.org/manage/case/1902/
        """
        self.apps.switch_to_displayed_app()
        default_wallpaper_settings = self.data_layer.get_setting('wallpaper.image')

        # open settings app and choose to change wallpaper, instead of opening context menu
        settings = Settings(self.marionette)
        settings.launch()
        homescreen_page = settings.open_homescreen()
        activities = homescreen_page.pick_wallpaper()

        # select gallery
        gallery = activities.tap_gallery()

        # go through the crop process
        gallery.wait_for_thumbnails_to_load()
        gallery.thumbnails[0].tap()

        from gaiatest.apps.gallery.regions.crop_view import CropView
        crop_view = CropView(self.marionette)

        # can't actually crop the element
        crop_view.tap_crop_done()

        # check that the wallpaper has changed
        new_wallpaper_settings = self.data_layer.get_setting('wallpaper.image')
        self.assertNotEqual(default_wallpaper_settings, new_wallpaper_settings)
示例#11
0
    def test_enable_do_not_track_via_settings_app(self):
        """Enable do not track via the Settings app"""

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

        # turn to "disallow tracking"
        do_not_track_settings.tap_disallow_tracking()

        # should be enabled
        self.assertEqual(self.data_layer.get_setting('privacy.donottrackheader.enabled'), True)
        # should be 1
        self.assertEqual(self.data_layer.get_setting('privacy.donottrackheader.value'), '1')

        # turn to "allow tracking"
        do_not_track_settings.tap_allow_tracking()

        # should be enabled
        self.assertEqual(self.data_layer.get_setting('privacy.donottrackheader.enabled'), True)
        # should be 0
        self.assertEqual(self.data_layer.get_setting('privacy.donottrackheader.value'), '0')

        # turn back to "no pref"
        do_not_track_settings.tap_do_not_have_pref_on_tracking()

        # should be disabled
        self.assertEqual(self.data_layer.get_setting('privacy.donottrackheader.enabled'), False)
        # should be back to "no pref"
        self.assertEqual(self.data_layer.get_setting('privacy.donottrackheader.value'), '-1')
示例#12
0
    def test_enable_do_not_track_via_settings_app(self):
        """Enable do not track via the Settings app"""

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

        # turn to "disallow tracking"
        do_not_track_settings.tap_disallow_tracking()
        Wait(self.marionette).until(lambda m: self.data_layer.get_int_pref(
            'privacy.donottrackheader.value') == 1)
        Wait(self.marionette).until(lambda m: self.data_layer.get_bool_pref(
            'privacy.donottrackheader.enabled'))
        self.apps.switch_to_displayed_app()

        # turn to "allow tracking"
        do_not_track_settings.tap_allow_tracking()
        Wait(self.marionette).until(lambda m: self.data_layer.get_int_pref(
            'privacy.donottrackheader.value') == 0)
        self.assertEqual(
            self.data_layer.get_bool_pref('privacy.donottrackheader.enabled'),
            True)
        self.apps.switch_to_displayed_app()

        # turn back to "no pref"
        do_not_track_settings.tap_do_not_have_pref_on_tracking()
        Wait(self.marionette).until(lambda m: self.data_layer.get_int_pref(
            'privacy.donottrackheader.value') == -1)
        Wait(
            self.marionette).until(lambda m: not self.data_layer.get_bool_pref(
                'privacy.donottrackheader.enabled'))
示例#13
0
 def tap_offline_settings_button(self):
     self.marionette.find_element(
         *self._search_results_offline_settings_locator).tap()
     from gaiatest.apps.settings.app import Settings
     settings = Settings(self.marionette)
     settings.switch_to_settings_app()
     return settings
    def test_power_save_mode(self):
        settings = Settings(self.marionette)
        settings.launch()

        # Tap on Battery menu item.
        battery_settings = settings.open_battery_settings()
        battery_settings.toggle_power_save_mode()

        # TODO Wait for everything to switch off
        time.sleep(5)

        # Wait for Cell Data to be disabled.
        self.wait_for_condition(lambda m: not self.data_layer.is_cell_data_connected)

        # Check if Wi-Fi is disabled.
        self.assertFalse(self.data_layer.is_wifi_connected(self.testvars['wifi']))

        # Check if Cell Data is disabled.
        self.assertFalse(self.data_layer.get_setting('ril.data.enabled'))

        # Check if GPS is disabled.
        self.assertFalse(self.data_layer.get_setting('geolocation.enabled'),)

        # Check if Bluetooth is diabled.
        self.assertFalse(self.data_layer.get_setting('bluetooth.enabled'))
示例#15
0
    def test_search_and_install_app(self):

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

        marketplace.install_addon(self.addon_url)

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

        for addon in addons_page.items:
            if addon.name == self.addon_name_to_install:
                addon_details = addon.tap()
                break
        else:
            self.fail('{} was not found in {}'.format(self.addon_name_to_install, addons_page.items))

        self.assertTrue(addon_details.is_enabled)
        self.assertEquals(addon_details.description, "Adds a 'M' to the status bar")
        self.assertEquals(self.apps.is_app_installed(addon_details.affected_apps)['name'], 'System')

        status_bar_addon = StatusBarAddon(self.marionette)
        self.assertEquals(status_bar_addon.instances, 1)
        self.assertTrue(status_bar_addon.is_displayed)
        self.assertEquals(status_bar_addon.text, 'M')
示例#16
0
    def test_toggle_bluetooth_settings(self):
        """Toggle Bluetooth via Settings - Networks & Connectivity

        https://moztrap.mozilla.org/manage/case/6071/
        """
        device_name = str(time.time())

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

        self.assertFalse(self.data_layer.bluetooth_is_enabled)
        self.assertFalse(self.data_layer.get_setting('bluetooth.visible'))

        bluetooth_settings = settings.open_bluetooth_settings()
        bluetooth_settings.enable_bluetooth()

        self.assertTrue(self.data_layer.bluetooth_is_enabled)

        bluetooth_settings.tap_rename_my_device()
        bluetooth_settings.type_phone_name(device_name)
        bluetooth_settings.tap_update_device_name_ok()

        self.assertEquals(bluetooth_settings.device_name, device_name)

        bluetooth_settings.enable_visible_to_all()

        self.assertTrue(self.data_layer.get_setting('bluetooth.visible'))
        self.assertTrue(self.data_layer.bluetooth_is_discoverable)
        self.assertEquals(self.data_layer.bluetooth_name, device_name)
示例#17
0
    def test_change_keyboard_language_settings(self):
        settings = Settings(self.marionette)
        settings.launch()
        keyboard_settings = settings.open_keyboard_settings()

        # Tap on active keyboard link
        select_keyboard = keyboard_settings.tap_selected_keyboards()

        # Tap 'add more keyboards' button
        add_more_keyboards = select_keyboard.tap_add_more_keyboards()

        # Select keyboard language, then click back to make it "stick"
        add_more_keyboards.select_language(u'Espa\u00F1ol')
        add_more_keyboards.go_back()

        # launch the Contacts app to verify the keyboard layout
        contacts_app = Contacts(self.marionette)
        contacts_app.launch()
        new_contact_form = contacts_app.tap_new_contact()
        new_contact_form.type_given_name('')
        self.wait_for_condition(
            lambda m: new_contact_form.keyboard.is_displayed())

        # Switch to keyboard frame and switch language
        new_contact_form.keyboard.tap_keyboard_language_key()
        new_contact_form.keyboard.switch_to_keyboard()
        special_key = self.marionette.find_element(
            *self._special_key_locator).text

        # Checking if exists the special key - "ñ"
        self.assertEqual(special_key, self._expected_key)
示例#18
0
    def test_settings_battery_power_save_mode(self):
        """
        https://moztrap.mozilla.org/manage/case/1406/
        """

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

        # Asserting as a integer because this is how it's defined in the default value file.
        self.assertEqual(self.data_layer.get_setting('powersave.threshold'), -1)
        self.assertEqual(self.data_layer.get_setting('powersave.enabled'), False)


        battery_settings.tap_turn_on_auto()
        battery_settings.select('5% battery left')
        self.assertEqual(self.data_layer.get_setting('powersave.threshold'), '0.05')
        self.assertEqual(self.data_layer.get_setting('powersave.enabled'), False)

        battery_settings.tap_turn_on_auto()
        battery_settings.select('15% battery left')
        self.assertEqual(self.data_layer.get_setting('powersave.threshold'), '0.15')
        self.assertEqual(self.data_layer.get_setting('powersave.enabled'), False)

        battery_settings.tap_turn_on_auto()
        battery_settings.select('25% battery left')
        self.assertEqual(self.data_layer.get_setting('powersave.threshold'), '0.25')
        self.assertEqual(self.data_layer.get_setting('powersave.enabled'), False)

        battery_settings.tap_turn_on_auto()
        battery_settings.select('Never')
        self.assertEqual(self.data_layer.get_setting('powersave.threshold'), '-1')
        self.assertEqual(self.data_layer.get_setting('powersave.enabled'), False)
示例#19
0
    def test_enable_do_not_track_via_settings_app(self):
        """Enable do not track via the Settings app"""

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

        # turned off by default
        self.wait_for_condition(
            lambda m: not do_not_track_settings.is_do_not_track_enabled)

        # turn on
        do_not_track_settings.enable_do_not_track()

        # should be on
        self.assertTrue(
            self.data_layer.get_setting('privacy.donottrackheader.enabled'),
            'Do Not Track was not enabled via Settings app')

        # turn back off
        do_not_track_settings.disable_do_not_track()

        # should be off
        self.assertFalse(
            self.data_layer.get_setting('privacy.donottrackheader.enabled'),
            'Do Not Track was not disabled via Settings app')
    def test_change_keyboard_language_settings(self):
        settings = Settings(self.marionette)
        settings.launch()
        keyboard_settings = settings.open_keyboard_settings()

        # Tap on active keyboard link
        select_keyboard = keyboard_settings.tap_active_keyboard()

        # Tap 'add more keyboards' button
        add_more_keyboards = select_keyboard.tap_add_more_keyboards()

        # Select keyboard language
        add_more_keyboards.select_language('Spanish')

        # launch the Contacts app to verify the keyboard layout
        contacts_app = Contacts(self.marionette)
        contacts_app.launch()
        new_contact_form = contacts_app.tap_new_contact()
        new_contact_form.type_given_name('')

        # Switch to keyboard frame and switch language
        new_contact_form.keyboard.switch_to_keyboard()
        new_contact_form.keyboard.tap_keyboard_language_key()
        self.wait_for_element_displayed(*self._special_key_locator)
        special_key = self.marionette.find_element(
            *self._special_key_locator).text

        # Checking if exists the special key - "ñ"
        self.assertEqual(special_key, self._expected_key)
    def test_change_language_settings_rtl(self):
        lang_name = self.marionette.execute_script(
            """
            var  = window.wrappedJSObject.navigator.mozL10n.;
            return ['ar-x-psbidi'].translate('Packaged Bidi');
        """
        )
        header = self.marionette.execute_script(
            """
            var  = window.wrappedJSObject.navigator.mozL10n.;
            return ['ar-x-psbidi'].translate('Settings');
        """
        )

        self.data_layer.set_setting("devtools.pseudolocalization.enabled", True)
        settings = Settings(self.marionette)
        settings.launch()

        language_settings = settings.open_language()
        language_settings.select_language(lang_name)

        self.wait_for_condition(lambda m: language_settings.current_language == "ar-x-psbidi")
        language_settings.go_back()

        # Verify that language has changed
        self.wait_for_condition(lambda m: settings.header_text == header)
        self.assertEqual(self.data_layer.get_setting("language.current"), "ar-x-psbidi")
    def test_change_keyboard_language_settings(self):
        settings = Settings(self.marionette)
        settings.launch()
        keyboard_settings = settings.open_keyboard_settings()

        # Tap on active keyboard link
        select_keyboard = keyboard_settings.tap_active_keyboard()

        # Tap 'add more keyboards' button
        add_more_keyboards = select_keyboard.tap_add_more_keyboards()

        # Select keyboard language
        add_more_keyboards.select_language('Spanish')

        # launch the Contacts app to verify the keyboard layout
        contacts_app = Contacts(self.marionette)
        contacts_app.launch()
        new_contact_form = contacts_app.tap_new_contact()
        new_contact_form.type_given_name('')

        # Switch to keyboard frame and switch language
        new_contact_form.keyboard.switch_to_keyboard()
        new_contact_form.keyboard.tap_keyboard_language_key()
        self.wait_for_element_displayed(*self._special_key_locator)
        special_key = self.marionette.find_element(*self._special_key_locator).text

        # Checking if exists the special key - "ñ"
        self.assertEqual(special_key, self._expected_key)
示例#23
0
 def test_get_set_bool_pref_from_within_an_app(self):
     from gaiatest.apps.settings.app import Settings
     settings = Settings(self.marionette)
     settings.launch()
     self.data_layer.set_bool_pref('gaiauitest.pref.enabled', True)
     test_pref = self.data_layer.get_bool_pref('gaiauitest.pref.enabled')
     self.assertEquals(test_pref, True)
示例#24
0
    def test_change_language_settings_rtl(self):
        lang_name = self.marionette.execute_script("""
            var  = window.wrappedJSObject.navigator.mozL10n.;
            return ['ar-x-psbidi'].translate('Packaged Bidi');
        """)
        header = self.marionette.execute_script("""
            var  = window.wrappedJSObject.navigator.mozL10n.;
            return ['ar-x-psbidi'].translate('Settings');
        """)

        self.data_layer.set_setting('devtools.pseudolocalization.enabled',
                                    True)
        settings = Settings(self.marionette)
        settings.launch()

        language_settings = settings.open_language()
        language_settings.select_language(lang_name)

        self.wait_for_condition(
            lambda m: language_settings.current_language == 'ar-x-psbidi')
        language_settings.go_back()

        # Verify that language has changed
        self.wait_for_condition(lambda m: settings.header_text == header)
        self.assertEqual(self.data_layer.get_setting('language.current'),
                         'ar-x-psbidi')
    def test_that_device_info_is_populated(self):
        settings = Settings(self.marionette)
        settings.launch()
        device_info = settings.open_device_info()

        # devices without sim cards have no phone number
        if self.environment.phone_numbers:
            self.assertNotEqual(device_info.phone_number, '')
            self.assertIsNotNone(device_info.phone_number)
        else:
            self.assertEqual(device_info.phone_number, '')

        for item in ('model', 'software'):
            self.assertNotEqual(getattr(device_info, item), '')

        more_info = device_info.tap_more_info()
        for item in ('os_version', 'hardware_revision', 'mac_address',
                     'iccid', 'platform_version', 'build_id', 'build_number',
                     'update_channel', 'git_commit_timestamp', 'git_commit_hash'):
            self.assertNotEqual(getattr(more_info, item), '', '{} does not have any value'.format(item))

        i = 1
        for expected_imei in self.environment.imei_numbers:
            self.assertEqual(getattr(more_info, 'imei{}'.format(i)), expected_imei)
            i += 1
示例#26
0
    def test_that_device_info_is_populated(self):
        settings = Settings(self.marionette)
        settings.launch()
        device_info = settings.open_device_info_settings()

        # devices without sim cards have no phone number
        if self.environment.phone_numbers:
            self.assertTrue(len(device_info.phone_number) > 0)
            self.assertIsNotNone(device_info.phone_number)
        else:
            self.assertEqual(device_info.phone_number, "")

        # verify fields on the main page
        for item in ("model", "software"):
            self.assertTrue(len(getattr(device_info, item)) > 0)

        # open more info panel and check that fields are populated
        more_info = device_info.tap_more_info()
        for item in (
            "os_version",
            "hardware_revision",
            "mac_address",
            "imei1",
            "imei2",
            "iccid",
            "platform_version",
            "build_id",
            "build_number",
            "update_channel",
            "git_commit_timestamp",
            "git_commit_hash",
        ):
            self.assertTrue(len(getattr(more_info, item)) > 0)
        self.assertEqual(more_info.imei1, self.environment.imei_numbers[0])
        self.assertEqual(more_info.imei2, self.environment.imei_numbers[1])
示例#27
0
    def launch_app(self):
        settings = Settings(self.device.marionette)
        settings.launch()
        settings_container = self.device.marionette.find_element(
            By.CSS_SELECTOR, '#root > div')
        header = self.device.marionette.find_element(By.CSS_SELECTOR,
                                                     '#root > header')
        settings_location = settings_container.location
        settings_swipe_padding = 16

        scroll_x1 = settings_location[
            'x'] + settings_container.size['width'] / 2
        scroll_y1 = settings_location['y'] + (
            settings_container.size['height'] - settings_swipe_padding)
        scroll_y2 = settings_location['y'] + (header.size['height'] +
                                              settings_swipe_padding)

        self.cmds = []
        for i in range(5):
            self.cmds.append(
                ['drag', scroll_x1, scroll_y1, scroll_x1, scroll_y2, 100, 10])
            self.cmds.append(['sleep', 0.5])
            self.cmds.append(
                ['drag', scroll_x1, scroll_y2, scroll_x1, scroll_y1, 100, 10])
            self.cmds.append(['sleep', 0.5])
示例#28
0
    def test_enable_cell_data_via_settings_app(self):
        """
        https://moztrap.mozilla.org/manage/case/1373/
        """

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

        # verify that a carrier is displayed
        self.assertTrue(len(cell_and_data_settings.carrier_name) > 0)

        # enable cell data
        self.assertFalse(cell_and_data_settings.is_data_toggle_checked)
        cell_data_prompt = cell_and_data_settings.enable_data()

        # deal with prompt that sometimes appears (on first setting)
        if cell_data_prompt.is_displayed:
            # Cell data should not be enabled until we turn it on via the prompt
            self.assertFalse(cell_and_data_settings.is_data_toggle_checked)
            self.assertFalse(self.data_layer.get_setting('ril.data.enabled'), "Cell data was enabled before responding to the prompt")
            cell_data_prompt.turn_on()

        # Wait for cell data to be turned on
        self.wait_for_condition(lambda m: cell_and_data_settings.is_data_toggle_checked)

        # verify that cell data is now enabled and connected
        self.assertTrue(self.data_layer.is_cell_data_enabled, "Cell data was not enabled via Settings app")
        self.wait_for_condition(
            lambda m: self.data_layer.is_cell_data_connected,
            message='Cell data was not connected via Settings app')
    def test_browser_clear_history(self):
        """
        https://moztrap.mozilla.org/manage/cases/?filter-id=3582
        """
        search = Search(self.marionette)
        search.launch()
        browser = search.go_to_url(self.test_url)
        browser.switch_to_content()
        Wait(self.marionette, timeout=30).until(lambda m: m.title == 'Mozilla')

        self.apps.kill(search.app)
        self.device.touch_home_button()

        search.launch()
        Wait(self.marionette).until(
            lambda m: len(m.find_elements(*search._history_item_locator)) > 0)
        self.assertGreater(search.history_items_count, 0)

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

        browsing_privacy.tap_clear_browsing_history()
        browsing_privacy.tap_clear()

        self.settings.return_to_prev_menu(self.settings.screen_element)

        self.device.touch_home_button()
        search.launch()
        search.wait_for_history_to_load(number_of_items=0)
        self.assertEqual(0, search.history_items_count)
    def test_cell_data_for_two_sims(self):
        """
        https://moztrap.mozilla.org/manage/case/1373/
        We only test with 1 SIM in the device
        """

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

        # Open cell data settings
        cell_and_data_settings = settings.open_cell_and_data_settings()

        # verify that a carrier is displayed
        self.assertTrue(len(cell_and_data_settings.carrier_name) > 0)

        cell_data_prompt = cell_and_data_settings.enable_data()

        # deal with prompt that sometimes appears (on first setting)
        if cell_data_prompt.is_displayed:
            # Cell data should not be enabled until we turn it on via the prompt
            self.assertFalse(self.data_layer.get_setting('ril.data.enabled'), "Cell data was enabled before responding to the prompt")
            cell_data_prompt.turn_on()

        # Wait for cell data to be turned on
        self.wait_for_condition(lambda m: cell_and_data_settings.is_data_toggle_checked)

        # verify that cell data is now enabled and connected
        self.assertTrue(self.data_layer.is_cell_data_enabled, "Cell data was not enabled via Settings app")
        self.wait_for_condition(
            lambda m: self.data_layer.is_cell_data_connected,
            message='Cell data was not connected via Settings app')
示例#31
0
    def test_change_language_settings(self):
        lang_name = self.marionette.execute_script(
            """
            var qps = window.wrappedJSObject.navigator.mozL10n.qps;
            return qps['qps-ploc'].name;
        """
        )
        header = self.marionette.execute_script(
            """
            var qps = window.wrappedJSObject.navigator.mozL10n.qps;
            return qps['qps-ploc'].translate('Settings');
        """
        )

        self.data_layer.set_setting("devtools.qps.enabled", True)
        settings = Settings(self.marionette)
        settings.launch()

        language_settings = settings.open_language_settings()
        language_settings.select_language(lang_name)
        self.wait_for_condition(lambda m: language_settings.current_language == "qps-ploc")
        language_settings.go_back()

        # Verify that language has changed
        self.wait_for_condition(lambda m: settings.header_text == header)
        self.assertEqual(self.data_layer.get_setting("language.current"), "qps-ploc")
示例#32
0
    def test_search_and_install_app(self):

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

        results = marketplace.install_addon(self.addon_name_to_install)

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

        for addon in addons_page.items:
            if addon.name == self.addon_name_to_install:
                addon_details = addon.tap()
                break
        else:
            self.fail('{} was not found in {}'.format(self.addon_name_to_install, addons_page.items))

        self.assertTrue(addon_details.is_enabled)
        self.assertEquals(addon_details.description, "Adds a 'M' to the status bar")
        self.assertEquals(self.apps.is_app_installed(addon_details.affected_apps)['name'], 'System')

        status_bar_addon = StatusBarAddon(self.marionette)
        self.assertEquals(status_bar_addon.instances, 1)
        self.assertTrue(status_bar_addon.is_displayed)
        self.assertEquals(status_bar_addon.text, 'M')
示例#33
0
    def test_change_keyboard_language_settings(self):
        settings = Settings(self.marionette)
        settings.launch()
        keyboard_settings = settings.open_keyboard_settings()

        # Select keyboard language
        keyboard_settings.select_language('spanish')

        # launch the Contacts app to verify the keyboard layout
        contacts_app = Contacts(self.marionette)
        contacts_app.launch()
        new_contact_form = contacts_app.tap_new_contact()
        new_contact_form.type_given_name('')

        # Switch to keyboard frame and switch language
        self.keyboard.switch_keyboard_language("es")
        keybframe = self.marionette.find_element(
            *self._select_keyb_frame_locator)
        self.marionette.switch_to_frame(keybframe, focus=False)
        self.wait_for_element_displayed(*self._special_key_locator)
        special_key = self.marionette.find_element(
            *self._special_key_locator).text

        # Checking if exists the special key - "ñ"
        self.assertEqual(special_key, self._expected_key)
示例#34
0
    def test_that_device_info_is_populated(self):
        settings = Settings(self.marionette)
        settings.launch()
        device_info = settings.open_device_info()

        # devices without sim cards have no phone number
        if self.environment.phone_numbers:
            self.assertTrue(len(device_info.phone_number) > 0)
            self.assertIsNotNone(device_info.phone_number)
        else:
            self.assertEqual(device_info.phone_number, '')

        # verify fields on the main page
        for item in ('model', 'software'):
            self.assertTrue(len(getattr(device_info, item)) > 0)

        # open more info panel and check that fields are populated
        more_info = device_info.tap_more_info()
        for item in ('os_version', 'hardware_revision', 'mac_address', 'imei1',
                     'imei2', 'iccid', 'platform_version', 'build_id',
                     'build_number', 'update_channel', 'git_commit_timestamp',
                     'git_commit_hash'):
            self.assertTrue(len(getattr(more_info, item)) > 0)
        self.assertEqual(more_info.imei1, self.environment.imei_numbers[0])
        self.assertEqual(more_info.imei2, self.environment.imei_numbers[1])
示例#35
0
class TestCaptionsAccessibility(GaiaTestCase):

    def setUp(self):
        GaiaTestCase.setUp(self)

        # Make accessibility settings visible
        self.data_layer.set_setting('accessibility.screenreader-show-settings', True)
        self.data_layer.set_setting('accessibility.screenreader-captions', False)

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

    def test_a11y_captions(self):
        accessibility_settings = self.settings.a11y_open_accessibility_settings()
        screenreader_settings = accessibility_settings.a11y_open_screenreader_settings()

        # Captions should be invisible when screen reader is disabled
        self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
            *screenreader_settings._screen_reader_captions_locator)))

        # Turn on screen reader
        self.data_layer.set_setting('accessibility.screenreader', True)

        # Captions should be visible when screen reader is on
        self.assertTrue(self.accessibility.is_visible(self.marionette.find_element(
            *screenreader_settings._screen_reader_captions_locator)))

        # Turn on color filters
        screenreader_settings.a11y_toggle_captions()

        # Captions settings should be set
        self.wait_for_condition(
            lambda m: self.data_layer.get_setting('accessibility.screenreader-captions'))
    def test_browser_clear_history(self):
        """
        https://moztrap.mozilla.org/manage/cases/?filter-id=3582
        """
        search = Search(self.marionette)
        search.launch()
        browser = search.go_to_url(self.test_url)
        browser.switch_to_content()
        Wait(self.marionette, timeout=30).until(lambda m: m.title == 'Mozilla')

        self.apps.kill(search.app)
        self.device.touch_home_button()

        search.launch()
        search.wait_for_history_to_load(number_of_items=1)
        self.assertGreater(search.history_items_count, 0)

        # This shouldn't be necessary, remove these 2 lines once bug 1216933 is fixed
        self.apps.kill(search.app)
        self.device.touch_home_button()

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

        confirm_dialog = browsing_privacy.clear_browsing_history()
        confirm_dialog.confirm_clear()

        self.device.touch_home_button()
        search.launch()
        search.wait_for_history_to_load(number_of_items=0)
        self.assertEqual(0, search.history_items_count)
示例#37
0
class TestSliderVisibilityAccessibility(GaiaTestCase):
    def setUp(self):
        GaiaTestCase.setUp(self)

        # make accessibility settings visible
        self.data_layer.set_setting('accessibility.show-settings', True)

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

    def test_a11y_slider_visibility(self):
        accessibility_settings = self.settings.a11y_open_accessibility_settings(
        )

        # Both rate and volume sliders should be visible
        self.assertTrue(
            self.is_element_displayed(
                *accessibility_settings._screen_reader_volume_slider_locator))
        self.assertTrue(
            self.accessibility.is_visible(
                self.marionette.find_element(
                    *accessibility_settings.
                    _screen_reader_volume_slider_locator)))
        self.assertTrue(
            self.is_element_displayed(
                *accessibility_settings._screen_reader_rate_slider_locator))
        self.assertTrue(
            self.accessibility.is_visible(
                self.marionette.find_element(
                    *accessibility_settings._screen_reader_rate_slider_locator)
            ))
示例#38
0
    def test_music_share_ringtone(self):
        """
        https://moztrap.mozilla.org/manage/case/2683/
        """

        music_app = Music(self.marionette)
        music_app.launch()
        music_app.wait_for_music_tiles_displayed()

        # switch to songs view, and play the first one on the list
        list_view = music_app.tap_songs_tab()
        songs = list_view.media
        self.assertGreater(len(songs), 0, 'The ogg file could not be found')
        player_view = songs[0].tap_first_song()

        # wait until the player view is shown, then tap the share button
        play_time = time.strptime('00:01', '%M:%S')
        Wait(self.marionette).until(lambda m: player_view.player_elapsed_time >= play_time)
        activities = player_view.tap_share_button()
        ringtone = activities.share_to_ringtones()
        ringtone.tap_save()

        system = System(self.marionette)
        self.marionette.switch_to_frame()
        system.wait_for_notification_toaster_displayed(message="Ringtone set as default.")
        system.wait_for_notification_toaster_not_displayed()

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

        # desktop b2g doesn't have this option visible, see bug 1130538
        if sound.ring_tone_selector_visible:
            self.assertEqual(sound.current_ring_tone, 'MUS_0001')
示例#39
0
    def test_browser_clear_history(self):
        """
        https://moztrap.mozilla.org/manage/cases/?filter-id=3582
        """
        search = Search(self.marionette)
        search.launch()
        browser = search.go_to_url(self.test_url)
        browser.switch_to_content()
        Wait(self.marionette).until(lambda m: m.title == 'Mozilla')

        self.device.touch_home_button()

        search.launch()
        search.wait_for_history_to_load(number_of_items=1)
        self.assertGreater(search.history_items_count, 0)

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

        browsing_privacy.tap_clear_browsing_history()
        browsing_privacy.tap_clear()

        self.device.touch_home_button()
        search.launch()
        search.wait_for_history_to_load(number_of_items=0)
        self.assertEqual(0, search.history_items_count)
示例#40
0
    def test_change_sim_manager_default(self):
        """https://moztrap.mozilla.org/manage/case/10590/"""
        
        # Check settings before change, all set to SIM 1
        self.assertEqual(self.data_layer.get_setting('ril.telephony.defaultServiceId'), 0)
        self.assertEqual(self.data_layer.get_setting('ril.sms.defaultServiceId'), 0)
        self.assertEqual(self.data_layer.get_setting('ril.data.defaultServiceId'), 0)
        
        # Launchs settings
        settings = Settings(self.marionette)
        settings.launch()

        # Open sim manager
        sim_manager_settings = settings.open_sim_manager_settings()

        # Change default sim for calls, outgoing messages and data
        # SIM index start with 0; '1' means 2nd SIM 
        # UI shows 'SIM 2' for sim in index 1
        sim_manager_settings.select_outgoing_calls(sim=2)
        sim_manager_settings.select_outgoing_messages(sim=2)
        sim_manager_settings.select_data(sim=2)

        # Verify UI settings has been changed
        # SIM index start with 0; '1' means 2nd SIM 
        self.assertEqual(u'1', sim_manager_settings.sim_for_outgoing_calls)
        self.assertEqual(u'1', sim_manager_settings.sim_for_outgoing_messages)
        self.assertEqual(u'1', sim_manager_settings.sim_for_data)

        # Verify settings after change, all set to SIM 2
        self.assertEqual(self.data_layer.get_setting('ril.telephony.defaultServiceId'), 1)
        self.assertEqual(self.data_layer.get_setting('ril.sms.defaultServiceId'), 1)
        self.assertEqual(self.data_layer.get_setting('ril.data.defaultServiceId'), 1)
示例#41
0
    def test_settings_root_items(self):
        # Launchs settings
        settings = Settings(self.marionette)
        settings.launch()

        # This will take longer, so let's just wait for this
        self.wait_for_condition(
            lambda s: 'Disabled' in settings.wifi_menu_item_description)

        self.assertEqual(settings.wifi_menu_item_description, 'Disabled')
        self.assertEqual(settings.usb_storage_menu_item_description,
                         'Disabled')
        self.assertEqual(settings.screen_lock_menu_item_description,
                         'Disabled')
        self.assertEqual(settings.bluetooth_menu_item_description,
                         'Turned off')

        self.assertTrue(
            lambda s: '%' in settings.battery_menu_item_description)
        self.assertTrue(lambda s: 'available' in settings.
                        application_storage_menu_item_description)
        self.assertTrue(lambda s: 'available' in settings.
                        media_storage_menu_item_description)
        self.assertTrue(
            lambda s: 'English' in settings.language_menu_item_description)
    def test_settings_battery_power_save_mode(self):
        """
        https://moztrap.mozilla.org/manage/case/1406/
        """

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

        # Asserting as a integer because this is how it's defined in the default value file.
        self.assertEqual(self.data_layer.get_setting('powersave.threshold'), -1)
        self.assertEqual(self.data_layer.get_setting('powersave.enabled'), False)


        battery_settings.tap_turn_on_auto()
        battery_settings.select('5% battery left')
        self.assertEqual(self.data_layer.get_setting('powersave.threshold'), '0.05')
        self.assertEqual(self.data_layer.get_setting('powersave.enabled'), False)

        battery_settings.tap_turn_on_auto()
        battery_settings.select('15% battery left')
        self.assertEqual(self.data_layer.get_setting('powersave.threshold'), '0.15')
        self.assertEqual(self.data_layer.get_setting('powersave.enabled'), False)

        battery_settings.tap_turn_on_auto()
        battery_settings.select('25% battery left')
        self.assertEqual(self.data_layer.get_setting('powersave.threshold'), '0.25')
        self.assertEqual(self.data_layer.get_setting('powersave.enabled'), False)

        battery_settings.tap_turn_on_auto()
        battery_settings.select('never')
        self.assertEqual(self.data_layer.get_setting('powersave.threshold'), '-1')
        self.assertEqual(self.data_layer.get_setting('powersave.enabled'), False)
    def test_toggle_airplane_mode(self):

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

        settings.wait_for_airplane_toggle_ready()

        # Switch on Airplane mode
        settings.toggle_airplane_mode()

        # wait for wifi to be disabled, this takes the longest when airplane mode is switched on
        self.wait_for_condition(
            lambda s: 'Disabled' in settings.wifi_menu_item_description)

        # wait for airplane mode icon is diaplayed on status bar
        self.marionette.switch_to_default_content()
        self.wait_for_condition(
            lambda m: System(m).is_airplane_mode_statusbar_displayed)

        # check Wifi is disabled
        self.assertFalse(
            self.data_layer.is_wifi_connected(self.testvars['wifi']),
            "WiFi was still connected after switching on Airplane mode")

        # check that Cell Data is disabled
        self.assertFalse(
            self.data_layer.get_setting('ril.data.enabled'),
            "Cell Data was still connected after switching on Airplane mode")

        # check GPS is disabled
        self.assertFalse(
            self.data_layer.get_setting('geolocation.enabled'),
            "GPS was still connected after switching on Airplane mode")

        # switch back to app frame
        self.apps.switch_to_displayed_app()

        # Switch off Airplane mode
        settings.toggle_airplane_mode()

        # Wait for wifi to be connected, because this takes the longest to connect after airplane mode is switched off
        self.wait_for_condition(lambda s: 'Connected to ' + self.testvars[
            'wifi']['ssid'] in settings.wifi_menu_item_description,
                                timeout=40)

        # check Wifi is enabled
        self.assertTrue(
            self.data_layer.is_wifi_connected(self.testvars['wifi']),
            "WiFi was not connected after switching off Airplane mode")

        # check that Cell Data is enabled
        self.assertTrue(
            self.data_layer.get_setting('ril.data.enabled'),
            "Cell data was not connected after switching off Airplane mode")

        # check GPS is enabled
        self.assertTrue(
            self.data_layer.get_setting('geolocation.enabled'),
            "GPS was not enabled after switching off Airplane mode")
示例#44
0
class TestLockScreen(GaiaTestCase):
    def setUp(self):
        GaiaTestCase.setUp(self)
        self.connect_to_local_area_network()

    def test_lockscreen_time_check(self):
        """
        https: // bugzilla.mozilla.org / show_bug.cgi?id = 1118054
        Due to the Bug 1133803, test requires active sim with data connection
        """

        self.settings = Settings(self.marionette)
        self.settings.launch()
        datetime_setting = self.settings.open_date_and_time_settings()
        old_time = datetime_setting.get_current_time_datetime

        # Auto time update is by default set to true, turn it off to make region change
        datetime_setting.toggle_automatic_time_update()
        self.assertFalse(datetime_setting.is_autotime_enabled,
                         'Autotime still enabled')

        # change the region.  since no one will be in Atlantic Ocean timezone, change in time
        # will be guaranteed.
        datetime_setting.set_region('Atlantic Ocean')

        # get the displayed time after the region change
        new_time = datetime_setting.get_current_time_datetime
        self.assertNotEqual(new_time, old_time)

        # lock screen and check time on the lockscreen
        self.marionette.switch_to_frame()
        self.device.lock()
        lock_screen = LockScreen(self.marionette)
        difference = lock_screen.time_in_datetime - new_time
        self.assertLessEqual(difference.seconds, 60)

        # configure to set the time automatically (this will revert the timezone change), then lock screen
        lock_screen.switch_to_frame()
        lock_screen.unlock()
        self.apps.switch_to_displayed_app()

        # Enable the auto time update, so the regions change back and date/time is reverted back
        datetime_setting.toggle_automatic_time_update()
        self.assertTrue(datetime_setting.is_autotime_enabled,
                        'Autotime still disabled')
        self.marionette.switch_to_frame()
        self.device.lock()

        # wait until device is off and turn back on to check that the time is changed
        Wait(self.marionette,
             timeout=20).until(lambda m: not self.device.is_screen_enabled)
        self.device.turn_screen_on()
        self.marionette.switch_to_frame()

        # Check it reverted to the correct time, and compare it with the previously shown time
        # Allow 4 minutes difference max
        difference = lock_screen.time_in_datetime - old_time

        self.assertLessEqual(difference.seconds, 240)
示例#45
0
    def setUp(self):
        GaiaTestCase.setUp(self)

        # make accessibility settings visible
        self.data_layer.set_setting('accessibility.show-settings', True)

        self.settings = Settings(self.marionette)
        self.settings.launch()
class TestLockScreen(GaiaTestCase):

    def setUp(self):
        GaiaTestCase.setUp(self)
        self.connect_to_local_area_network()

    def test_lockscreen_time_check(self):
        """
        https: // bugzilla.mozilla.org / show_bug.cgi?id = 1118054
        Due to the Bug 1133803, test requires active sim with data connection
        """

        self.settings = Settings(self.marionette)
        self.settings.launch()
        datetime_setting = self.settings.open_date_and_time()
        old_time = datetime_setting.get_current_time_datetime

        # Auto time update is by default set to true, turn it off to make region change
        datetime_setting.toggle_automatic_time_update()
        self.assertFalse(datetime_setting.is_autotime_enabled, 'Autotime still enabled')

        # change the region.  since no one will be in Atlantic Ocean timezone, change in time
        # will be guaranteed.
        datetime_setting.set_region('Atlantic Ocean')

        # get the displayed time after the region change
        new_time = datetime_setting.get_current_time_datetime
        self.assertNotEqual(new_time, old_time)

        # lock screen and check time on the lockscreen
        self.marionette.switch_to_frame()
        self.device.lock()
        lock_screen = LockScreen(self.marionette)
        difference = lock_screen.time_in_datetime - new_time
        self.assertLessEqual(difference.seconds, 60)

        # configure to set the time automatically (this will revert the timezone change), then lock screen
        lock_screen.switch_to_frame()
        lock_screen.unlock()
        self.apps.switch_to_displayed_app()

        # Enable the auto time update, so the regions change back and date/time is reverted back
        datetime_setting.toggle_automatic_time_update()
        self.assertTrue(datetime_setting.is_autotime_enabled, 'Autotime still disabled')
        self.marionette.switch_to_frame()
        self.device.lock()

        # wait until device is off and turn back on to check that the time is changed
        Wait(self.marionette, timeout=20).until(
            lambda m: not self.device.is_screen_enabled)
        self.device.turn_screen_on()
        self.marionette.switch_to_frame()

        # Check it reverted to the correct time, and compare it with the previously shown time
        # Allow 4 minutes difference max
        difference = lock_screen.time_in_datetime - old_time

        self.assertLessEqual(difference.seconds, 240)
class TestVolumeButtonsAccessibility(GaiaTestCase):
    def setUp(self):
        GaiaTestCase.setUp(self)

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

    def toggle_screen_reader(self):
        self.marionette.switch_to_frame()

        self.device.press_release_volume_up_then_down_n_times(3)
        time.sleep(3)
        self.device.press_release_volume_up_then_down_n_times(3)

        self.apps.switch_to_displayed_app()

    def test_a11y_volume_buttons(self):
        # Open accessibility settings panel
        accessibility_settings = self.settings.a11y_open_accessibility_settings()

        # Panel should not be visible by default
        self.assertFalse(self.data_layer.get_setting("accessibility.screenreader-show-settings"))
        self.assertFalse(
            self.is_element_displayed(*accessibility_settings._accessibility_screenreader_menu_item_locator)
        )
        self.assertTrue(
            self.accessibility.is_hidden(
                self.marionette.find_element(*accessibility_settings._accessibility_screenreader_menu_item_locator)
            )
        )

        self.toggle_screen_reader()

        # Panel should become visible after screen reader turned ON
        self.assertTrue(self.data_layer.get_setting("accessibility.screenreader-show-settings"))
        self.assertTrue(
            self.is_element_displayed(*accessibility_settings._accessibility_screenreader_menu_item_locator)
        )
        self.assertTrue(
            self.accessibility.is_visible(
                self.marionette.find_element(*accessibility_settings._accessibility_screenreader_menu_item_locator)
            )
        )

        self.toggle_screen_reader()

        # Panel should still be visible
        self.assertTrue(self.data_layer.get_setting("accessibility.screenreader-show-settings"))
        self.assertTrue(
            self.is_element_displayed(*accessibility_settings._accessibility_screenreader_menu_item_locator)
        )
        self.assertTrue(
            self.accessibility.is_visible(
                self.marionette.find_element(*accessibility_settings._accessibility_screenreader_menu_item_locator)
            )
        )
示例#48
0
    def test_connect_to_wifi_via_settings_app(self):
        settings = Settings(self.marionette)
        settings.launch()
        wifi_settings = settings.open_wifi_settings()

        wifi_settings.enable_wifi()
        wifi_settings.connect_to_network(self.testvars['wifi'])

        # verify that wifi is now on
        self.assertTrue(self.data_layer.is_wifi_connected(self.testvars['wifi']), "WiFi was not connected via Settings app")
示例#49
0
    def setUp(self):
        GaiaTestCase.setUp(self)

        # Turn off accessibility and captions
        self.data_layer.set_setting('accessibility.screenreader', False)
        self.data_layer.set_setting('accessibility.screenreader-captions',
                                    False)

        self.settings = Settings(self.marionette)
        self.settings.launch()
    def test_settings_app(self):

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

        self.take_screenshot('main')
        for i in range(0, 4):
            GaiaImageCompareTestCase.scroll(self.marionette, 'down',
                                            settings.screen_element.size['height'], screen = settings.screen_element)
            self.take_screenshot('main')
    def test_open_app_permissions(self):

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

        # Tap on the app to open permissions details
        app_permissions_details = app_permissions_settings.tap_app('Homescreen')

        # Verify the permission is listed
        self.assertTrue(app_permissions_details.is_geolocation_listed)
    def setUp(self):
        GaiaTestCase.setUp(self)

        # make accessibility settings visible
        self.data_layer.set_setting('accessibility.colors.enabled', False)
        self.data_layer.set_setting('accessibility.colors.invert', False)
        self.data_layer.set_setting('accessibility.colors.grayscale', False)
        self.data_layer.set_setting('accessibility.colors.contrast', 0.0)

        self.settings = Settings(self.marionette)
        self.settings.launch()
示例#53
0
    def test_change_wallpaper(self):
        # https://moztrap.mozilla.org/manage/case/3449/

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

        self._default_wallpaper_src = display_settings.wallpaper_preview_src

        display_settings.choose_wallpaper(3)

        self.assertNotEqual(display_settings.wallpaper_preview_src[0:24], self._default_wallpaper_src[0:24])
示例#54
0
    def test_set_passcode_by_settings(self):
        settings = Settings(self.marionette)
        settings.launch()
        phone_lock_settings = settings.open_phone_lock_settings()

        phone_lock_settings.enable_passcode_lock()
        phone_lock_settings.create_passcode(self._input_passcode)

        passcode_code = self.data_layer.get_setting('lockscreen.passcode-lock.code')
        passcode_enabled = self.data_layer.get_setting('lockscreen.passcode-lock.enabled')
        self.assertEqual(passcode_code, "".join(self._input_passcode), 'Passcode is "%s", not "%s"' % (passcode_code, "".join(self._input_passcode)))
        self.assertEqual(passcode_enabled, True, 'Passcode is not enabled.')
示例#55
0
class TestSliderVisibilityAccessibility(GaiaTestCase):
    def setUp(self):
        GaiaTestCase.setUp(self)

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

    def test_a11y_slider_visibility(self):
        accessibility_settings = self.settings.open_accessibility()
        screenreader_settings = accessibility_settings.a11y_open_screenreader_settings()

        # Rate and volume settings should be invisible when screen reader is disabled
        self.assertTrue(
            self.accessibility.is_hidden(
                self.marionette.find_element(*screenreader_settings._screen_reader_volume_slider_locator)
            )
        )
        self.assertTrue(
            self.accessibility.is_hidden(
                self.marionette.find_element(*screenreader_settings._screen_reader_rate_slider_locator)
            )
        )

        # Turn on screen reader
        self.data_layer.set_setting("accessibility.screenreader", True)

        # Both rate and volume sliders should be visible when screen reader is on
        self.wait_for_condition(
            lambda x: self.accessibility.is_visible(
                self.marionette.find_element(*screenreader_settings._screen_reader_volume_slider_locator)
            )
        )
        self.assertTrue(
            self.accessibility.is_visible(
                self.marionette.find_element(*screenreader_settings._screen_reader_rate_slider_locator)
            )
        )

        # Turn screen reader off again
        self.data_layer.set_setting("accessibility.screenreader", False)

        # Rate and volume settings should be invisible when screen reader is disabled
        self.wait_for_condition(
            lambda x: self.accessibility.is_hidden(
                self.marionette.find_element(*screenreader_settings._screen_reader_volume_slider_locator)
            )
        )
        self.assertTrue(
            self.accessibility.is_hidden(
                self.marionette.find_element(*screenreader_settings._screen_reader_rate_slider_locator)
            )
        )