Пример #1
0
    def post_idle_wifi_browser_run_test(self, url, test_name, permissionFlag = False):

        lock_screen = LockScreen(self.marionette)
        homescreen = lock_screen.unlock()

        self.data_layer.disable_wifi() # make sure it starts out disabled
        self.data_layer.connect_to_wifi()
        print "Connected to wifi"

        self.apps.switch_to_displayed_app()
        self.go_to_url(homescreen, url)
        print "Opened URL"
        if permissionFlag:
            time.sleep(2)
            print "Looking for Permission Dialog"
            permission = PermissionDialog(self.marionette)
            permission.wait_for_permission_dialog_displayed()
            print "Pressing Share Button"
            permission.tap_to_confirm_permission()

        print "Waiting 30 seconds for URL to load"
        time.sleep(30)
        self.device.touch_home_button()
        #homescreen.wait_to_be_displayed()
        self.data_layer.disable_wifi()
        print "Disabled wifi"
        self.device.turn_screen_off()
        print ""
        print "Running Test (", test_name, ")"
        self.runPowerTest(test_name, "Browser", "browser")
Пример #2
0
    def test_play_video(self):
        """Confirm video playback

        https://moztrap.mozilla.org/manage/case/6073/
        Note: this test case does not reflect the entire test steps of above test case.
        """
        search = Search(self.marionette)
        search.launch()
        browser = search.go_to_url(self.video_URL)
        browser.wait_for_page_to_load(180)
        browser.switch_to_content()
        player = HTML5Player(self.marionette)
        player.wait_for_video_loaded()
        play_time = 20.0
        self.wait_for_condition(
            lambda m: player.current_timestamp == play_time,
            timeout=30,
            message='Video did not reach the end')
        self.take_screenshot()

        # Tap UI buttons. player must be reinstantiated each time after screenshot is called, because it loses context
        HTML5Player(self.marionette).tap_mute()
        self.take_screenshot()
        HTML5Player(self.marionette).invoke_controls()  # after tapping mute, the control view disappears
        HTML5Player(self.marionette).tap_unmute()
        self.take_screenshot()
        HTML5Player(self.marionette).tap_full_screen()
        permission = PermissionDialog(self.marionette)
        self.marionette.switch_to_default_content()
        permission.wait_for_permission_dialog_displayed()
        permission.tap_to_confirm_permission()

        browser.switch_to_content()
        Wait(self.marionette).until(lambda m: HTML5Player(self.marionette).is_fullscreen)
        self.take_screenshot()

        # Temporary workaround until below methods are fixed (Bug 1163747)
        # player = HTML5Player(self.marionette)
        # player.show_controls()
        # Wait(self.marionette).until(lambda m: player.controls_visible)
        self.marionette.find_element(*self._video_screen_locator).tap()
        self.take_screenshot()

        # exit from fullscreen view
        player = HTML5Player(self.marionette)
        player.tap_full_screen()
        if player.is_fullscreen:    # control view has disappeared,
                                    # and above tap only brought up control view
            player.tap_full_screen()
        Wait(self.marionette).until(lambda m: not player.is_fullscreen)
        self.take_screenshot()
Пример #3
0
    def test_camera_geolocation_prompt(self):

        camera = Camera(self.marionette)
        camera.launch()

        permission = PermissionDialog(self.marionette)
        self.marionette.switch_to_default_content()
        permission.wait_for_permission_dialog_displayed()

        self.assertEqual(permission.permission_dialog_message,
                         '%s would like to know your location.' % camera.name)

        permission.tap_to_confirm_permission()

        current_permission = self.apps.get_permission('Camera', 'geolocation')
        self.assertEqual(current_permission, 'allow')
    def test_geolocation_prompt(self):
        uiTestsPrivileged = UiTestsPivileged(self.marionette)
        uiTestsPrivileged.launch()

        geolocation = uiTestsPrivileged.tap_geolocation_option()
        geolocation.switch_to_frame()
        geolocation.tap_find_location_button()

        permission = PermissionDialog(self.marionette)
        self.marionette.switch_to_default_content()
        permission.wait_for_permission_dialog_displayed()

        self.assertEqual(permission.permission_dialog_message,
                         u'UI tests - Privileged App would like to know your location.')

        permission.tap_to_confirm_permission()

        current_permission = self.apps.get_permission('UI tests - Privileged App', 'geolocation')
        self.assertEqual(current_permission, 'allow')
    def test_video_capture_prompt(self):
        uiTestsPrivileged = UiTestsPivileged(self.marionette)
        uiTestsPrivileged.launch()

        user_media = uiTestsPrivileged.tap_get_user_media_option()
        user_media.switch_to_frame()
        user_media.tap_video1_button()

        permission = PermissionDialog(self.marionette)
        self.marionette.switch_to_default_content()
        permission.wait_for_permission_dialog_displayed()

        self.assertEqual(permission.permission_dialog_message,
                         u'Would you like to share your camera with UI tests - Privileged App?')

        permission.tap_to_confirm_permission()

        current_permission = self.apps.get_permission('UI tests - Privileged App', 'video-capture')
        self.assertEqual(current_permission, 'prompt')
    def test_geolocation_prompt(self):

        self.app = self.apps.launch("Geoloc")

        # Quick fix to resolve intermittency - TODO remove this with bug 952292
        time.sleep(2)
        self.marionette.find_element(*self._geoloc_start_button_locator).tap()

        permission = PermissionDialog(self.marionette)
        self.marionette.switch_to_default_content()
        permission.wait_for_permission_dialog_displayed()

        self.assertEqual(permission.permission_dialog_message, "Geoloc would like to know your location.")

        system_app = permission.tap_to_confirm_permission()

        current_permission = self.apps.get_permission("Geoloc", "geolocation")
        self.assertEqual(current_permission, "allow")
        system_app.wait_for_geolocation_icon_displayed()
Пример #7
0
    def test_geolocation_prompt(self):

        self.app = self.apps.launch('Geoloc')

        # Quick fix to resolve intermittency - TODO remove this with bug 952292
        time.sleep(2)
        self.marionette.find_element(*self._geoloc_start_button_locator).tap()

        permission = PermissionDialog(self.marionette)
        self.marionette.switch_to_default_content()
        permission.wait_for_permission_dialog_displayed()

        self.assertEqual(permission.permission_dialog_message,
                         'Geoloc would like to know your location.')

        system_app = permission.tap_to_confirm_permission()

        current_permission = self.apps.get_permission('Geoloc', 'geolocation')
        self.assertEqual(current_permission, 'allow')
        self.assertTrue(system_app.geolocation_icon_displayed)
Пример #8
0
    def test_geolocation_prompt(self):

        self.app = self.apps.launch('Geoloc')

        element = Wait(self.marionette).until(
            expected.element_present(*self._geoloc_start_button_locator))
        Wait(self.marionette).until(expected.element_displayed(element))
        element.tap()

        permission = PermissionDialog(self.marionette)
        self.marionette.switch_to_default_content()
        permission.wait_for_permission_dialog_displayed()

        self.assertEqual(permission.permission_dialog_message,
                         'Geoloc would like to know your location.')

        system_app = permission.tap_to_confirm_permission()

        current_permission = self.apps.get_permission('Geoloc', 'geolocation')
        self.assertEqual(current_permission, 'allow')
        system_app.status_bar.wait_for_geolocation_icon_displayed()
Пример #9
0
    def test_contact_prompt(self):
        uiTestsPrivileged = UiTestsPivileged(self.marionette)
        uiTestsPrivileged.launch()

        contacts = uiTestsPrivileged.tap_contacts_option()
        contacts.switch_to_frame()
        contacts.tap_insert_fake_contacts()

        permission = PermissionDialog(self.marionette)
        self.marionette.switch_to_default_content()
        permission.wait_for_permission_dialog_displayed()

        self.assertEqual(permission.permission_dialog_message,
                         u'UI tests - Privileged App would like to access your contact list.')

        permission.tap_to_confirm_permission()

        read_permission = self.apps.get_permission('UI tests - Privileged App', 'contacts-read')
        self.assertEqual(read_permission, 'allow')

        create_permission = self.apps.get_permission('UI tests - Privileged App', 'contacts-create')
        self.assertEqual(create_permission, 'allow')

        write_permission = self.apps.get_permission('UI tests - Privileged App', 'contacts-write')
        self.assertEqual(write_permission, 'allow')
    def test_get_music_prompt(self):
        uiTestsPrivileged = UiTestsPivileged(self.marionette)
        uiTestsPrivileged.launch()

        deviceStorage = uiTestsPrivileged.tap_device_storage_option()
        deviceStorage.switch_to_frame()
        deviceStorage.tap_get_music_button_locator()

        permission = PermissionDialog(self.marionette)
        self.marionette.switch_to_default_content()
        permission.wait_for_permission_dialog_displayed()

        self.assertEqual(
            permission.permission_dialog_message,
            u'UI tests - Privileged App would like to access your music.')

        permission.tap_to_confirm_permission()

        read_permission = self.apps.get_permission(
            'UI tests - Privileged App', 'device-storage:music-read')
        self.assertEqual(read_permission, 'allow')

        write_permission = self.apps.get_permission(
            'UI tests - Privileged App', 'device-storage:music-write')
        self.assertEqual(write_permission, 'allow')
Пример #11
0
    def post_idle_wifi_browser_run_test(self,
                                        url,
                                        test_name,
                                        permissionFlag=False):

        lock_screen = LockScreen(self.marionette)
        homescreen = lock_screen.unlock()

        self.data_layer.disable_wifi()  # make sure it starts out disabled
        self.data_layer.connect_to_wifi()
        print "Connected to wifi"

        self.apps.switch_to_displayed_app()
        self.go_to_url(homescreen, url)
        print "Opened URL"
        if permissionFlag:
            time.sleep(2)
            print "Looking for Permission Dialog"
            permission = PermissionDialog(self.marionette)
            permission.wait_for_permission_dialog_displayed()
            print "Pressing Share Button"
            permission.tap_to_confirm_permission()

        print "Waiting 30 seconds for URL to load"
        time.sleep(30)
        self.device.touch_home_button()
        #homescreen.wait_to_be_displayed()
        self.data_layer.disable_wifi()
        print "Disabled wifi"
        self.device.turn_screen_off()
        print ""
        print "Running Test (", test_name, ")"
        self.runPowerTest(test_name, "Browser", "browser")
    def test_get_music_prompt(self):
        uiTestsPrivileged = UiTestsPivileged(self.marionette)
        uiTestsPrivileged.launch()

        deviceStorage = uiTestsPrivileged.tap_device_storage_option()
        deviceStorage.switch_to_frame()
        deviceStorage.tap_get_music_button_locator()

        permission = PermissionDialog(self.marionette)
        self.marionette.switch_to_default_content()
        permission.wait_for_permission_dialog_displayed()

        self.assertEqual(permission.permission_dialog_message,
                         u'UI tests - Privileged App would like to access your music.')

        permission.tap_to_confirm_permission()

        read_permission = self.apps.get_permission('UI tests - Privileged App', 'device-storage:music-read')
        self.assertEqual(read_permission, 'allow')

        write_permission = self.apps.get_permission('UI tests - Privileged App', 'device-storage:music-write')
        self.assertEqual(write_permission, 'allow')
    def test_get_sdcard_prompt(self):
        uiTestsPrivileged = UiTestsPivileged(self.marionette)
        uiTestsPrivileged.launch()

        deviceStorage = uiTestsPrivileged.tap_device_storage_option()
        deviceStorage.switch_to_frame()
        deviceStorage.tap_get_sdcard_button_locator()

        permission = PermissionDialog(self.marionette)
        self.marionette.switch_to_default_content()
        permission.wait_for_permission_dialog_displayed()

        self.assertEqual(
            permission.permission_dialog_message, u"UI tests - Privileged App would like to access your memory card."
        )

        permission.tap_to_confirm_permission()

        read_permission = self.apps.get_permission("UI tests - Privileged App", "device-storage:sdcard-read")
        self.assertEqual(read_permission, "allow")

        write_permission = self.apps.get_permission("UI tests - Privileged App", "device-storage:sdcard-write")
        self.assertEqual(write_permission, "allow")
Пример #14
0
    def test_play_video(self):
        """Confirm video playback

        https://moztrap.mozilla.org/manage/case/6073/
        Note: this test case does not reflect the entire test steps of above test case.
        """
        search = Search(self.marionette)
        search.launch()
        browser = search.go_to_url(self.video_URL)
        browser.wait_for_page_to_load(180)
        browser.switch_to_content()
        player = HTML5Player(self.marionette)
        player.wait_for_video_loaded()
        play_time = 20.0
        self.wait_for_condition(
            lambda m: player.current_timestamp == play_time,
            timeout=30,
            message='Video did not reach the end')
        self.take_screenshot()

        # Tap UI buttons. player must be reinstantiated each time after screenshot is called, because it loses context
        HTML5Player(self.marionette).tap_mute()
        self.take_screenshot()
        HTML5Player(self.marionette).invoke_controls(
        )  # after tapping mute, the control view disappears
        HTML5Player(self.marionette).tap_unmute()
        self.take_screenshot()
        HTML5Player(self.marionette).tap_full_screen()
        permission = PermissionDialog(self.marionette)
        self.marionette.switch_to_default_content()
        permission.wait_for_permission_dialog_displayed()
        permission.tap_to_confirm_permission()

        browser.switch_to_content()
        Wait(self.marionette).until(
            lambda m: HTML5Player(self.marionette).is_fullscreen)
        self.take_screenshot()

        # Temporary workaround until below methods are fixed (Bug 1163747)
        # player = HTML5Player(self.marionette)
        # player.show_controls()
        # Wait(self.marionette).until(lambda m: player.controls_visible)
        self.marionette.find_element(*self._video_screen_locator).tap()
        self.take_screenshot()

        # exit from fullscreen view
        player = HTML5Player(self.marionette)
        player.tap_full_screen()
        if player.is_fullscreen:  # control view has disappeared,
            # and above tap only brought up control view
            player.tap_full_screen()
        Wait(self.marionette).until(lambda m: not player.is_fullscreen)
        self.take_screenshot()
Пример #15
0
    def test_geolocation_prompt(self):

        self.app = self.apps.launch('Geoloc')
        self.marionette.find_element(*self._geoloc_start_button_locator).tap()

        permission = PermissionDialog(self.marionette)
        self.marionette.switch_to_default_content()
        permission.wait_for_permission_dialog_displayed()

        self.assertEqual(permission.permission_dialog_message,
                         'Geoloc would like to know your location.')

        permission.tap_to_confirm_permission()

        current_permission = self.apps.get_permission('Geoloc', 'geolocation')
        self.assertEqual(current_permission, 'allow')
    def test_audio_capture_prompt(self):
        uiTestsPrivileged = UiTestsPivileged(self.marionette)
        uiTestsPrivileged.launch()

        user_media = uiTestsPrivileged.tap_get_user_media_option()
        user_media.switch_to_frame()
        user_media.tap_audio1_button()

        permission = PermissionDialog(self.marionette)
        self.marionette.switch_to_default_content()
        permission.wait_for_permission_dialog_displayed()

        self.assertEqual(permission.permission_dialog_message,
                         u'Would you like to share your microphone with UI tests - Privileged App?')

        permission.tap_to_confirm_permission()

        current_permission = self.apps.get_permission('UI tests - Privileged App', 'audio-capture')
        self.assertEqual(current_permission, 'allow')
    def test_geolocation_prompt(self):
        uiTestsPrivileged = UiTestsPivileged(self.marionette)
        uiTestsPrivileged.launch()

        geolocation = uiTestsPrivileged.tap_geolocation_option()
        geolocation.switch_to_frame()
        geolocation.tap_find_location_button()

        permission = PermissionDialog(self.marionette)
        self.marionette.switch_to_default_content()
        permission.wait_for_permission_dialog_displayed()

        self.assertEqual(
            permission.permission_dialog_message,
            u'UI tests - Privileged App would like to know your location.')

        permission.tap_to_confirm_permission()

        current_permission = self.apps.get_permission(
            'UI tests - Privileged App', 'geolocation')
        self.assertEqual(current_permission, 'allow')
Пример #18
0
    def test_play_video(self):
        """Confirm video playback

        https://moztrap.mozilla.org/manage/case/6073/
        """
        search = Search(self.marionette)
        search.launch()
        browser = search.go_to_url(self.video_URL)
        browser.wait_for_page_to_load(180)
        browser.switch_to_content()

        player = HTML5Player(self.marionette)

        # Check that video is playing
        player.wait_for_video_loaded()
        self.assertTrue(player.is_video_playing())

        # Tap on the edge of the video to make the controls appear
        player.invoke_controls()
        # Pause playback
        player.tap_pause()
        stopped_at = player.current_timestamp
        self.assertFalse(player.is_video_playing())

        resumed_at = player.current_timestamp

        # Resume playback
        player.tap_play()

        # Ensure that video resumes to play
        # from the place where it was paused
        delay = resumed_at - stopped_at
        self.assertLessEqual(
            delay, self.acceptable_delay,
            'video resumed to play not from place where it was paused, paused at %.3f, resumed at %.3f'
            % (stopped_at, resumed_at))

        # Make sure the video is ready to play again
        player.wait_for_video_loaded()

        # This is disabled for now, because of bug 1100333
        # self.assertTrue(player.is_video_playing())

        # After tapping the play button, the controls disappear, make them appear again
        player.invoke_controls()

        # Tap mute button
        player.tap_mute()
        player.tap_unmute()

        player.tap_full_screen()
        permission = PermissionDialog(self.marionette)
        self.marionette.switch_to_default_content()
        permission.wait_for_permission_dialog_displayed()
        permission.tap_to_confirm_permission()

        # The interaction with the permission dialog makes us
        # loose connection to the player frame, so we need to reconnect
        browser.switch_to_content()
        player = HTML5Player(self.marionette)

        Wait(self.marionette).until(lambda m: player.is_fullscreen)

        # After tapping full screen, the controls disappear, make them appear again
        # Normally, we would use invoke_controls(), but this seems to cause intermittent failures
        # Bug 1111734 is filed to replace invoke_controls() to show_controls(), once it is possible
        Wait(self.marionette).until(lambda m: player.controls_visible is False)
        player.show_controls()
        Wait(self.marionette).until(lambda m: player.controls_visible)

        player.tap_full_screen()
        Wait(self.marionette).until(lambda m: player.is_fullscreen is False)
        Wait(self.marionette).until(lambda m: player.controls_visible is False)
    def test_play_video(self):
        """Confirm video playback

        https://moztrap.mozilla.org/manage/case/6073/
        """
        search = Search(self.marionette)
        search.launch()
        browser = search.go_to_url(self.video_URL)
        browser.wait_for_page_to_load(180)
        browser.switch_to_content()

        player = HTML5Player(self.marionette)

        # Check that video is playing
        player.wait_for_video_loaded()
        self.assertTrue(player.is_playing)

        # Tap on the edge of the video to make the controls appear
        player.invoke_controls()
        # Pause playback
        player.tap_pause()
        stopped_at = player.current_timestamp
        self.assertFalse(player.is_playing)

        resumed_at = player.current_timestamp

        # Resume playback
        player.tap_play()

        # Ensure that video resumes to play
        # from the place where it was paused
        delay = resumed_at - stopped_at
        self.assertLessEqual(delay, self.acceptable_delay,
                             'video resumed to play not from place where it was paused, paused at %.3f, resumed at %.3f' % (stopped_at, resumed_at))

        # Make sure the video is ready to play again
        player.wait_for_video_loaded()

        self.assertTrue(player.is_playing)

        # After tapping the play button, the controls disappear, make them appear again
        player.invoke_controls()

        # Tap mute button
        player.tap_mute()
        player.tap_unmute()

        player.tap_full_screen()
        permission = PermissionDialog(self.marionette)
        self.marionette.switch_to_default_content()
        permission.wait_for_permission_dialog_displayed()
        permission.tap_to_confirm_permission()

        # The interaction with the permission dialog makes us
        # loose connection to the player frame, so we need to reconnect
        browser.switch_to_content()
        player = HTML5Player(self.marionette)

        Wait(self.marionette).until(lambda m: player.is_fullscreen)

        # After tapping full screen, the controls disappear, make them appear again
        # Normally, we would use invoke_controls(), but this seems to cause intermittent failures
        # Bug 1111734 is filed to replace invoke_controls() to show_controls(), once it is possible
        Wait(self.marionette).until(lambda m: player.controls_visible is False)
        player.show_controls()
        Wait(self.marionette).until(lambda m: player.controls_visible)

        player.tap_full_screen()
        Wait(self.marionette).until(lambda m: player.is_fullscreen is False)
        Wait(self.marionette).until(lambda m: player.controls_visible is False)