示例#1
0
    def test_browser_bookmark(self):
        search = Search(self.marionette)
        search.launch()

        browser = search.go_to_url(self.test_url)
        browser.tap_menu_button()
        bookmark = browser.tap_add_to_home()

        bookmark.type_bookmark_title(self.bookmark_title)
        bookmark.tap_add_bookmark_to_home_screen_dialog_button()

        # Switch to Home Screen to look for bookmark
        self.device.touch_home_button()

        homescreen = Homescreen(self.marionette)
        homescreen.wait_for_app_icon_present(self.bookmark_title)
        self._bookmark_added = homescreen.is_app_installed(self.bookmark_title)

        self.assertTrue(self._bookmark_added, 'The bookmark %s was not found to be installed on the home screen.' % self.bookmark_title)

        # Delete the bookmark
        homescreen.activate_edit_mode()
        homescreen.bookmark(self.bookmark_title).tap_delete_app().tap_confirm(bookmark=True)

        homescreen.wait_to_be_displayed()
        self.apps.switch_to_displayed_app()
        homescreen.wait_for_bookmark_icon_not_present(self.bookmark_title)

        # Check that the bookmark icon is no longer displayed on the homescreen
        self._bookmark_added = homescreen.is_app_installed(self.bookmark_title)
        self.assertFalse(self._bookmark_added, 'The bookmark %s was not successfully removed from homescreen.' % self.bookmark_title)
示例#2
0
    def setUp(self):
        GaiaTestCase.setUp(self)
        self.connect_to_local_area_network()

        self.homescreen = Homescreen(self.marionette)
        self.apps.switch_to_displayed_app()

        self.test_data = {
            'name':
            'packagedapp1',
            'url':
            self.marionette.absolute_url('webapps/packaged1/manifest.webapp'),
            'title':
            'Packaged app1'
        }

        # Install app
        self.marionette.execute_script(
            'navigator.mozApps.installPackage("%s")' % self.test_data['url'])

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

        # Wait for the notification to disappear
        system = System(self.marionette)
        system.wait_for_system_banner_displayed()
        system.wait_for_system_banner_not_displayed()

        self.apps.switch_to_displayed_app()
        self.homescreen.wait_for_app_icon_present(self.test_data['name'])
    def test_rocketbar_add_collection(self):
        homescreen = Homescreen(self.marionette)
        self.apps.switch_to_displayed_app()

        contextmenu = homescreen.open_context_menu()
        collection_activity = contextmenu.tap_add_collection()

        collection_list = collection_activity.collection_name_list
        # Choose the second option to avoid 'Custom'
        collection = collection_list[1]

        collection_activity.select(collection)
        self.wait_for_condition(
            lambda m: self.apps.displayed_app.name == homescreen.name)
        self.apps.switch_to_displayed_app()

        self.assertTrue(homescreen.is_app_installed(collection),
                        "Collection '%s' not found on Homescreen" % collection)

        collection = homescreen.tap_collection(collection)

        app = collection.applications[0]
        app_name = app.name
        app.long_tap_to_install()
        add_link = app.tap_save_to_home_screen()
        add_link.tap_add_bookmark_to_home_screen_dialog_button()

        # Switch to Home Screen to look for app
        self.device.touch_home_button()

        self.assertTrue(
            homescreen.is_app_installed(app_name),
            'The app %s was not found to be installed on the home screen.' %
            app_name)
示例#4
0
    def test_search_and_install_app(self):
        marketplace = Marketplace(self.marionette, self.MARKETPLACE_DEV_NAME)
        marketplace.launch()

        self.app_name = marketplace.popular_apps[0].name
        app_author = marketplace.popular_apps[0].author
        results = marketplace.search(self.app_name)

        self.assertGreater(len(results.search_results), 0, 'No results found.')

        first_result = results.search_results[0]

        self.assertEquals(first_result.name, self.app_name, 'First app has the wrong name.')
        self.assertEquals(first_result.author, app_author, 'First app has the wrong author.')

        # Find and click the install button to the install the web app
        self.assertEquals(first_result.install_button_text, 'Free', 'Incorrect button label.')

        first_result.tap_install_button()
        self.confirm_installation()
        self.APP_INSTALLED = True

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

        self.assertTrue(homescreen.is_app_installed(self.app_name))
示例#5
0
    def test_homescreen_change_wallpaper_from_gallery(self):
        """
        https://moztrap.mozilla.org/manage/case/1902/
        """

        homescreen = Homescreen(self.marionette)
        self.apps.switch_to_displayed_app()

        default_wallpaper_settings = self.data_layer.get_setting('wallpaper.image')
        contextmenu = homescreen.open_context_menu()
        activities = contextmenu.tap_change_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)
示例#6
0
    def setUp(self):
        GaiaTestCase.setUp(self)
        self.connect_to_local_area_network()

        # Turn off geolocation prompt for smart collections
        self.apps.set_permission('Smart Collections', 'geolocation', 'deny')

        self.homescreen = Homescreen(self.marionette)
        self.apps.switch_to_displayed_app()

        self.test_data = {
            'name':
            'Mozilla QA WebRT Tester',
            'url':
            self.marionette.absolute_url('webapps/mozqa.com/manifest.webapp'),
            'title':
            'Directory listing for /'
        }

        # Install app
        self.marionette.execute_script('navigator.mozApps.install("%s")' %
                                       self.test_data['url'])

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

        # Wait for the notification to disappear
        system = System(self.marionette)
        system.wait_for_system_banner_displayed()
        system.wait_for_system_banner_not_displayed()

        self.apps.switch_to_displayed_app()
        self.homescreen.wait_for_app_icon_present(self.test_data['name'])
    def setUp(self):
        GaiaTestCase.setUp(self)
        self.connect_to_local_area_network()

        # Turn off geolocation prompt for smart collections
        self.apps.set_permission('Smart Collections', 'geolocation', 'deny')

        self.homescreen = Homescreen(self.marionette)
        self.apps.switch_to_displayed_app()

        self.test_data = {
            'name':
            'packagedapp1',
            'url':
            self.marionette.absolute_url('webapps/packaged1/manifest.webapp'),
            'title':
            'Packaged app1'
        }

        # Install app so we can delete it
        self.marionette.execute_script(
            'navigator.mozApps.installPackage("%s")' % self.test_data['url'])

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

        self.apps.switch_to_displayed_app()
        self.homescreen.wait_for_app_icon_present(self.test_data['name'])
示例#8
0
    def setUp(self):
        GaiaTestCase.setUp(self)
        self.connect_to_network()

        # Turn off geolocation prompt for smart collections
        self.apps.set_permission('Smart Collections', 'geolocation', 'deny')

        self.homescreen = Homescreen(self.marionette)
        self.apps.switch_to_displayed_app()

        if not self.apps.is_app_installed(self.APP_NAME):

            # Install app
            self.marionette.execute_script('navigator.mozApps.install("%s")' %
                                           self.MANIFEST)

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

            # Wait for the notification to disappear
            system = System(self.marionette)
            system.wait_for_system_banner_displayed()
            system.wait_for_system_banner_not_displayed()

        self.apps.switch_to_displayed_app()
        self.homescreen.wait_for_app_icon_present(self.APP_NAME)
    def test_only_one_header_displayed(self):
        """ https://bugzilla.mozilla.org/show_bug.cgi?id=1116087 """

        self.email.setup_IMAP_email(self.environment.email['imap'],
                                    self.environment.email['smtp'])
        self.email.wait_for_emails_to_sync()
        self.assertGreater(len(self.email.mails), 0)

        email_header_list = self.marionette.find_elements(*self.email.emails_list_header_locator)
        self.assertEqual(len(email_header_list), 1, 'Should have only 1 list-header')

        self.device.hold_home_button()
        cards_view = CardsView(self.marionette)
        cards_view.wait_for_cards_view()
        cards_view.cards[0].wait_for_centered()
        cards_view.cards[0].close()

        self.assertEqual(len(cards_view.cards), 0, 'Should have no cards left to display')
        Homescreen(self.marionette).wait_to_be_displayed()

        self.email.launch()
        self.email.wait_for_emails_to_sync()
        self.assertGreater(len(self.email.mails), 0)

        email_header_list = self.marionette.find_elements(*self.email.emails_list_header_locator)
        self.assertEqual(len(email_header_list), 1, 'Should have only 1 list-header')
示例#10
0
    def horizontal_launch_by_touch(self,
                                   name,
                                   switch_to_frame=True,
                                   url=None,
                                   launch_timeout=None):
        '''
        This function is deprecated because homescreen was changed to vertical
        '''
        homescreen = Homescreen(self.marionette)
        self.marionette.switch_to_frame()
        hs = self.marionette.find_element('css selector', '#homescreen iframe')
        self.marionette.switch_to_frame(hs)
        homescreen.go_to_next_page()

        icon = self.marionette.find_element(
            'css selector',
            'li[aria-label="' + name + '"]:not([data-type="collection"])')

        while not icon.is_displayed() and homescreen.homescreen_has_more_pages:
            homescreen.go_to_next_page()

        get_current_page = "var pageHelper = window.wrappedJSObject.GridManager.pageHelper;return pageHelper.getCurrentPageNumber() > 0;"
        while not icon.is_displayed() and self.marionette.execute_script(
                get_current_page):
            self.marionette.execute_script(
                'window.wrappedJSObject.GridManager.goToPreviousPage()')
            self.wait_for_condition(
                lambda m: m.find_element('tag name', 'body').get_attribute(
                    'data-transitioning') != 'true')
        icon.tap()

        self.marionette.switch_to_frame()
示例#11
0
    def test_apps_are_present(self):
        EXPECTED_APPS = (
            self._get_manifest_url_by_app_name('Phone') + '/dialer',
            self._get_manifest_url_by_app_name('Messages'),
            self._get_manifest_url_by_app_name('Contacts') + '/contacts',
            self._get_manifest_url_by_app_name('Email'),
            self._get_manifest_url_by_app_name('Camera'),
            self._get_manifest_url_by_app_name('Gallery'),
            self._get_manifest_url_by_app_name('Music'),
            self._get_manifest_url_by_app_name('VideoPlayer'),
            self._get_manifest_url_by_app_name('Marketplace'),
            self._get_manifest_url_by_app_name('Calendar'),
            self._get_manifest_url_by_app_name('Clock'),
            self._get_manifest_url_by_app_name('Settings'),
            self._get_manifest_url_by_app_name('FmRadio'),
            'https://marketplace.firefox.com/app/8d979279-a142-4fee-993b-8e7797b221a5/manifest.webapp',  # BuddyUp
            self._get_manifest_url_by_app_name('BugzillaLite'),
            'https://m.facebook.com/openwebapp/manifest.webapp',  # Facebook
            'https://mobile.twitter.com/cache/twitter.webapp',  # Twitter
            'https://marketplace.firefox.com/app/dcdaeefc-26f4-4af6-ad22-82eb93beadcd/manifest.webapp',  # Notes
            'https://marketplace.firefox.com/app/9f96ce77-5b2d-42ca-a0d9-10a933dd84c4/manifest.webapp',  # Calculator
        )

        homescreen = Homescreen(self.marionette)
        self.apps.switch_to_displayed_app()
        for expected_app in EXPECTED_APPS:
            homescreen.wait_for_app_icon_present(expected_app)
示例#12
0
    def setUp(self):
        GaiaTestCase.setUp(self)
        self.connect_to_local_area_network()

        self.homescreen = Homescreen(self.marionette)
        self.apps.switch_to_displayed_app()

        self.test_data = {
            'name':
            'Mozilla QA WebRT Tester',
            'url':
            self.marionette.absolute_url('webapps/mozqa.com/manifest.webapp')
        }
        self.logger.info('Test data: %s' % self.test_data)

        # Install app
        self.marionette.execute_script('navigator.mozApps.install("%s")' %
                                       self.test_data['url'])

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

        # Wait for the notification to disappear
        system = System(self.marionette)
        system.wait_for_system_banner_displayed()
        system.wait_for_system_banner_not_displayed()

        self.apps.switch_to_displayed_app()
        self.homescreen.wait_for_app_icon_present(self.test_data['name'])
    def test_browser_bookmark(self):
        # https://github.com/mozilla/gaia-ui-tests/issues/452
        browser = Browser(self.marionette)
        browser.launch()

        browser.go_to_url('http://mozqa.com/data/firefox/layout/mozilla.html')

        browser.tap_bookmark_button()
        browser.tap_add_bookmark_to_home_screen_choice_button()
        browser.type_bookmark_title(self.bookmark_title)
        browser.dismiss_keyboard()
        browser.tap_add_bookmark_to_home_screen_dialog_button()

        # Switch to Home Screen to look for bookmark
        homescreen = Homescreen(self.marionette)
        self.marionette.execute_script(
            "window.wrappedJSObject.dispatchEvent(new Event('home'));")
        homescreen.switch_to_homescreen_frame()

        self._bookmark_added = homescreen.is_app_installed(self.bookmark_title)

        self.assertTrue(
            self._bookmark_added,
            'The bookmark %s was not found to be installed on the home screen.'
            % self.bookmark_title)
    def test_installing_everything_me_app(self):
        # https://github.com/mozilla/gaia-ui-tests/issues/67

        homescreen = Homescreen(self.marionette)
        homescreen.switch_to_homescreen_frame()

        self.assertGreater(homescreen.collections_count, 0)
        collection = homescreen.tap_collection('Social')
        collection.wait_for_collection_screen_visible()

        app = collection.applications[0]
        app_name = app.name
        app.long_tap_to_install()
        app.tap_save_to_home_screen()

        notification_message = collection.notification_message
        self.assertEqual(notification_message,
                         '%s added to Home Screen' % app_name)

        homescreen = collection.tap_exit()

        # return to home screen
        self.marionette.execute_script(
            "window.wrappedJSObject.dispatchEvent(new Event('home'));")
        homescreen.switch_to_homescreen_frame()

        self.assertTrue(
            homescreen.is_app_installed(app_name),
            'The app %s was not found to be installed on the home screen.' %
            app_name)
    def test_search_and_install_app(self):

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

        marketplace.search(self.app_search)
        # Make sure All apps is chosen as search filter
        results = marketplace.filter_search_all_apps()
        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)
示例#16
0
 def test_spark_apps_are_present(self):
     homescreen = Homescreen(self.marionette)
     self.apps.switch_to_displayed_app()
     for expected_app in ('Customizer', 'Hackerplace', 'Studio', 'Sharing',
                          'Webmaker', 'Bugzilla Lite', 'Facebook',
                          'Twitter', 'RunWhatsApp (Preview)', 'BuddyUp',
                          'Notes', 'Calculator', 'SWOOOP', 'Firesea IRC'):
         homescreen.wait_for_app_icon_present(expected_app)
示例#17
0
    def setUp(self):
        GaiaTestCase.setUp(self)

        # Wait for homescreen to fully load
        homescreen = Homescreen(self.marionette)
        homescreen.launch()
        homescreen.wait_for_homescreen_to_load()
        self.marionette.switch_to_frame()
示例#18
0
    def test_everythingme_add_collection(self):

        homescreen = Homescreen(self.marionette)
        homescreen.switch_to_homescreen_frame()
        contextmenu = homescreen.open_context_menu()
        contextmenu.tap_add_collection()
        homescreen.select('Autos')
        self.assertTrue(homescreen.is_app_installed('Autos'),
                        "App %s not found on Homescreen" % 'Autos')
示例#19
0
    def setUp(self):
        GaiaTestCase.setUp(self)

        if self.apps.is_app_installed(self.APP_NAME):
            self.apps.uninstall(self.APP_NAME)

        self.connect_to_network()

        self.homescreen = Homescreen(self.marionette)
示例#20
0
 def type_passcode(self, passcode):
     for digit in passcode:
         button_locator = (self._numeric_button_locator[0],
                           self._numeric_button_locator[1] % digit)
         # Workaround for bug 1203269 where the Marionette tap() method somehow enters
         # 2 digits in the passcode pad
         Actions(self.marionette).press(
             self.marionette.find_element(*button_locator)).wait(
                 time=0.5).release().perform()
     return Homescreen(self.marionette)
示例#21
0
 def launch_by_touch(self, app):
     # Parameter: GaiaApp
     Homescreen(self.marionette).launch()
     icon = self.marionette.find_element(By.CSS_SELECTOR, 'gaia-app-icon[data-identifier="' + app.manifest_url + '"]')
     self.marionette.execute_script("arguments[0].scrollIntoView(false);", [icon])
     # Sleep because homescreen protect touch event when scrolling
     time.sleep(1)
     icon.tap()
     time.sleep(3)
     self.apps.switch_to_displayed_app()
示例#22
0
    def test_unlock_to_homescreen(self):
        """
        https://moztrap.mozilla.org/manage/case/6784/
        """

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

        from gaiatest.apps.homescreen.app import Homescreen
        Homescreen(self.marionette).wait_to_be_displayed()
示例#23
0
    def test_ftu_with_tour(self):
        """
        https://moztrap.mozilla.org/manage/case/6119/
        """

        # Go through the FTU setup as quickly as possible to get to the Tour section
        self.ftu.run_ftu_setup_with_default_values()

        # Take the tour
        self.ftu.tap_take_tour()

        # Walk through the tour
        self.assertEqual(
            self.ftu.step1_header_text,
            "Swipe up and down to browse your apps and bookmarks. Tap and hold an icon to delete, move, or edit it."
        )
        self.ftu.tap_tour_next()
        self.assertEqual(
            self.ftu.step2_header_text,
            "Tap to expand and collapse app groups. Drag an app into a new space to create a group."
        )
        self.ftu.tap_tour_next()
        self.assertEqual(
            self.ftu.step3_header_text,
            "Swipe down to access recent notifications, usage information and settings."
        )
        self.ftu.tap_tour_next()
        self.assertEqual(
            self.ftu.step4_header_text,
            "Drag from the left edge of your screen to return to recently used apps."
        )
        self.ftu.tap_tour_next()
        self.assertEqual(
            self.ftu.step5_header_text,
            "Tap on the search box anytime to start a search or go to a website."
        )

        # Try going back a step
        self.ftu.tap_back()
        self.assertEqual(
            self.ftu.step4_header_text,
            "Drag from the left edge of your screen to return to recently used apps."
        )
        self.ftu.tap_tour_next()
        self.assertEqual(
            self.ftu.step5_header_text,
            "Tap on the search box anytime to start a search or go to a website."
        )
        self.ftu.tap_tour_next()
        self.ftu.wait_for_finish_tutorial_section()
        self.ftu.tap_lets_go_button()

        # Switch back to top level now that FTU app is gone
        Homescreen(self.marionette).wait_to_be_displayed()
    def test_everythingme_add_collection(self):
        collection = 'Weather'
        homescreen = Homescreen(self.marionette)
        self.apps.switch_to_displayed_app()
        homescreen.wait_for_homescreen_to_load()

        contextmenu = homescreen.open_context_menu()
        contextmenu.tap_add_collection()
        homescreen.select(collection)
        self.assertTrue(homescreen.is_app_installed(collection),
                        "Collection '%s' not found on Homescreen" % collection)
示例#25
0
    def setUp(self):
        GaiaMtbfTestCase.setUp(self)
        self.connect_to_network()

        self.test_url = 'http://mozqa.com/data/firefox/layout/mozilla.html'

        curr_time = repr(time.time()).replace('.', '')
        self.bookmark_title = 'gaia%s' % curr_time[10:]

        self.homescreen = Homescreen(self.marionette)
        self.browser = Browser(self.marionette)
        self.browser.launch()
    def test_homescreen_status_bar_icons_visibility(self):
        self._assert_every_icon_is_present()
        self.apps.switch_to_displayed_app()
        homescreen = Homescreen(self.marionette)
        self.assertTrue(homescreen.is_at_topmost_position)

        # scroll last icon into homescreen view
        last_icon = len(homescreen.visible_apps) - 1
        homescreen.scroll_to_icon(icon_position=last_icon)

        self.assertFalse(homescreen.is_at_topmost_position)
        self._assert_every_icon_is_present()
    def test_launch_everything_me_search_accented(self):
        # Tests a search with accented characters.
        # Asserts that title and shortcut results are returned correctly

        test_string = u'Pétanque'
        homescreen = Homescreen(self.marionette)
        homescreen.launch()

        search_panel = homescreen.tap_search_bar()
        search_panel.type_into_search_box(test_string)
        search_panel.wait_for_everything_me_results_to_load()

        self.assertGreater(search_panel.everything_me_apps_count, 0)
    def test_launch_everything_me_search(self):
        # Tests a search with a common string.
        # Asserts that the title and shortcuts are listed

        test_string = u'skyfall'
        homescreen = Homescreen(self.marionette)
        homescreen.launch()

        search_panel = homescreen.tap_search_bar()
        search_panel.type_into_search_box(test_string)
        search_panel.wait_for_everything_me_results_to_load()

        self.assertGreater(search_panel.everything_me_apps_count, 0)
    def test_launch_everything_me_link(self):
        search_string = 'Facebook'
        homescreen = Homescreen(self.marionette)
        self.apps.switch_to_displayed_app()

        search_panel = homescreen.tap_search_bar()
        search_panel.type_into_search_box(search_string)

        search_panel.confirm_suggestion_notice()
        search_panel.wait_for_everything_me_results_to_load(1)

        search_panel.link_results[0].tap()

        self.assertIn(search_string.lower(), self.marionette.title.lower())
示例#30
0
    def test_launch_everything_me_search(self):
        # Tests a search with a common string.
        # Asserts that the title and shortcuts are listed

        test_string = u'News'
        homescreen = Homescreen(self.marionette)
        self.apps.switch_to_displayed_app()

        search_panel = homescreen.tap_search_bar()
        search_panel.type_into_search_box(test_string)

        search_panel.wait_for_everything_me_results_to_load(4)

        self.assertGreater(len(search_panel.link_results), 0)