Пример #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)
    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)
        homescreen.wait_to_be_displayed()
        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)
    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)
        homescreen.wait_to_be_displayed()
        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
class TestDeleteApp(GaiaTestCase):
    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 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'])

    def test_delete_app(self):
        """https://moztrap.mozilla.org/manage/case/6117/"""
        # Verify that the app is installed i.e. the app icon is visible on one of the homescreen pages
        self.assertTrue(
            self.homescreen.is_app_installed(self.test_data['name']),
            'App %s not found on homescreen' % self.test_data['name'])

        # Activate edit mode
        self.homescreen.activate_edit_mode()

        # Tap on the (x) to start delete process and tap on the confirm delete button
        self.homescreen.installed_app(
            self.test_data['name']).tap_delete_app().tap_confirm()

        self.homescreen.wait_to_be_displayed()
        self.apps.switch_to_displayed_app()
        self.homescreen.tap_edit_done()
        self.homescreen.wait_for_app_icon_not_present(self.test_data['name'])

        # Check that the app is no longer available
        with self.assertRaises(AssertionError):
            self.apps.launch(self.test_data['name'])

    def tearDown(self):
        self.apps.uninstall(self.test_data['name'])

        GaiaTestCase.tearDown(self)
Пример #5
0
class TestDeleteApp(GaiaTestCase):

    regular_app = {
        'name': 'Mozilla QA WebRT Tester',
        'partial_url': 'webapps/mozqa.com/manifest.webapp'
    }
    packaged_app = {
        'name': 'packagedapp1',
        'partial_url': 'webapps/packaged1/manifest.webapp',
        'title': 'Packaged app1'
    }

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

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

    def parameterized_set_up(self, app_to_delete, install_method):
        self.app_to_delete = app_to_delete
        self.app_to_delete['url'] = self.marionette.absolute_url(
            self.app_to_delete['partial_url'])

        self.marionette.execute_script('navigator.mozApps.{}("{}")'.format(
            install_method, self.app_to_delete['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.app_to_delete['url'])

    @parameterized('regular_app', regular_app, 'install')
    @parameterized('packaged_app', packaged_app, 'installPackage')
    def test_delete(self, app_to_delete, install_method):
        # We can't pass parameters to the setUp(). Bug # to be filed
        self.parameterized_set_up(app_to_delete, install_method)

        self.homescreen.delete_app(self.app_to_delete['url']).tap_confirm()
        self.homescreen.wait_to_be_displayed()
        self.apps.switch_to_displayed_app()
        self.homescreen.wait_for_app_icon_not_present(
            self.app_to_delete['url'])

        # Check that the app is no longer available
        with self.assertRaises(AssertionError):
            self.apps.launch(self.app_to_delete['url'])

    def tearDown(self):
        self.apps.uninstall(self.app_to_delete['url'])
        GaiaTestCase.tearDown(self)
class TestDeleteApp(GaiaTestCase):

    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 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'])

    def test_delete_app(self):
        """https://moztrap.mozilla.org/manage/case/6117/"""
        # Verify that the app is installed i.e. the app icon is visible on one of the homescreen pages
        self.assertTrue(
            self.homescreen.is_app_installed(self.test_data['name']),
            'App %s not found on homescreen' % self.test_data['name'])

        # Activate edit mode
        self.homescreen.activate_edit_mode()

        # Tap on the (x) to start delete process and tap on the confirm delete button
        self.homescreen.installed_app(self.test_data['name']).tap_delete_app().tap_confirm()

        self.homescreen.wait_to_be_displayed()
        self.apps.switch_to_displayed_app()
        self.homescreen.tap_edit_done()
        self.homescreen.wait_for_app_icon_not_present(self.test_data['name'])

        # Check that the app is no longer available
        with self.assertRaises(AssertionError):
            self.apps.launch(self.test_data['name'])

    def tearDown(self):
        self.apps.uninstall(self.test_data['name'])

        GaiaTestCase.tearDown(self)
Пример #7
0
class TestDeleteApp(GaiaTestCase):

    regular_app = {
        'name': 'Mozilla QA WebRT Tester',
        'partial_url': 'webapps/mozqa.com/manifest.webapp'
    }
    packaged_app = {
        'name': 'packagedapp1',
        'partial_url': 'webapps/packaged1/manifest.webapp',
        'title': 'Packaged app1'
    }

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

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

    def parameterized_set_up(self, app_to_delete, install_method):
        self.app_to_delete = app_to_delete
        self.app_to_delete['url'] = self.marionette.absolute_url(self.app_to_delete['partial_url'])

        self.marionette.execute_script('navigator.mozApps.{}("{}")'.format(install_method, self.app_to_delete['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.app_to_delete['url'])

    @parameterized('regular_app', regular_app, 'install')
    @parameterized('packaged_app', packaged_app, 'installPackage')
    def test_delete(self, app_to_delete, install_method):
        # We can't pass parameters to the setUp(). Bug # to be filed
        self.parameterized_set_up(app_to_delete, install_method)

        self.homescreen.delete_app(self.app_to_delete['url']).tap_confirm()
        self.homescreen.wait_to_be_displayed()
        self.apps.switch_to_displayed_app()
        self.homescreen.wait_for_app_icon_not_present(self.app_to_delete['url'])

        # Check that the app is no longer available
        with self.assertRaises(AssertionError):
            self.apps.launch(self.app_to_delete['url'])

    def tearDown(self):
        self.apps.uninstall(self.app_to_delete['url'])
        GaiaTestCase.tearDown(self)
Пример #8
0
    def touch_home_button(self):
        from gaiatest.apps.homescreen.app import Homescreen
        homescreen = Homescreen(self.marionette)
        apps = GaiaApps(self.marionette)
        if homescreen.is_displayed == False:
            # touching home button will return to homescreen
            self._dispatch_home_button_event()
            homescreen.wait_to_be_displayed()
            apps.switch_to_displayed_app()
        else:
            self._dispatch_home_button_event()
            apps.switch_to_displayed_app()

            # touching home button inside homescreen will scroll it to the top
            Wait(self.marionette).until(lambda m: homescreen.is_at_topmost_position)
Пример #9
0
 def touch_home_button(self):
     from gaiatest.apps.homescreen.app import Homescreen
     homescreen = Homescreen(self.marionette)
     apps = GaiaApps(self.marionette)
     if homescreen.is_displayed == False:
         # touching home button will return to homescreen
         self._dispatch_home_button_event()
         homescreen.wait_to_be_displayed()
         apps.switch_to_displayed_app()
     else:
         apps.switch_to_displayed_app()
         mode = self.marionette.find_element(By.TAG_NAME, 'body').get_attribute('class')
         self._dispatch_home_button_event()
         apps.switch_to_displayed_app()
         if 'edit-mode' in mode:
             # touching home button will exit edit mode
             Wait(self.marionette).until(lambda m: m.find_element(
                 By.TAG_NAME, 'body').get_attribute('class') != mode)
         else:
             # touching home button inside homescreen will scroll it to the top
             Wait(self.marionette).until(lambda m: m.execute_script(
                 "return window.wrappedJSObject.scrollY") == 0)