class TestHomescreenLayout(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.homescreen = Homescreen(self.marionette) self.apps.switch_to_displayed_app() def test_homescreen_column_layout(self): """ https://moztrap.mozilla.org/manage/case/13710/ """ self.homescreen.wait_for_number_of_apps(1) initial_number_of_columns = self.homescreen.number_of_columns self.assertEqual(3, initial_number_of_columns) settings = Settings(self.marionette) settings.launch() homescreen_settings = settings.open_homescreen() homescreen_settings.change_icon_layout('Four Columns') self.device.touch_home_button() Wait(self.marionette).until(lambda m: initial_number_of_columns != self.homescreen.number_of_columns) self.assertEqual(4, self.homescreen.number_of_columns) settings.launch() # in 319MB setting, the settings app gets killed sometimes, # in which case homescreen needs to be opened again if settings.current_view == 'root': homescreen_settings = settings.open_homescreen() homescreen_settings.change_icon_layout('Four Columns') self.device.touch_home_button() self.assertEqual(4, self.homescreen.number_of_columns)
class TestMoveApp(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.homescreen = Homescreen(self.marionette) self.apps.switch_to_displayed_app() def test_move_app_position(self): """ https://moztrap.mozilla.org/manage/case/1317/ """ self.homescreen.wait_for_number_of_apps(1) first_app_before_move = self.homescreen.visible_apps[0].name # Assert that we are not in edit mode. self.assertFalse(self.homescreen.is_edit_mode_active, "Edit mode should not be active") # Move first app to position 3 (index 2) self.homescreen.move_app_to_position(0, 2) # Assert that we are in edit mode. self.assertTrue(self.homescreen.is_edit_mode_active, "Edit mode should be active") # Exit edit mode self.device.touch_home_button() self.assertFalse(self.homescreen.is_edit_mode_active, "Edit mode should not be active") # Check the app order and that the app on position 12 is the right one first_app_after_move = self.homescreen.visible_apps[0].name self.assertNotEqual(first_app_before_move, first_app_after_move) self.assertEqual(first_app_before_move, self.homescreen.visible_apps[2].name)
class TestHomescreenLayout(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.homescreen = Homescreen(self.marionette) self.apps.switch_to_displayed_app() def test_homescreen_column_layout(self): """ https://moztrap.mozilla.org/manage/case/13710/ """ self.homescreen.wait_for_number_of_apps(1) initial_number_of_columns = self.homescreen.number_of_columns self.assertEqual(3, initial_number_of_columns) settings = Settings(self.marionette) settings.launch() homescreen_settings = settings.open_homescreen() homescreen_settings.select_icon_layout('Four Columns') self.device.touch_home_button() Wait(self.marionette).until(lambda m: initial_number_of_columns != self.homescreen.number_of_columns) self.assertEqual(4, self.homescreen.number_of_columns) settings.launch() # No need to open homescreen setting again # because it remembers where it left off homescreen_settings.select_icon_layout('Four Columns') self.device.touch_home_button() self.assertEqual(4, self.homescreen.number_of_columns)
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'])
class TestMoveApp(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.homescreen = Homescreen(self.marionette) self.apps.switch_to_displayed_app() def test_move_app_position(self): """Verify the user can move an application around on the homescreen. https://moztrap.mozilla.org/manage/case/1317/ """ self.homescreen.wait_for_number_of_apps(1) first_app_before_move = self.homescreen.visible_apps[0].name # Assert that we are not in edit mode. self.assertFalse(self.homescreen.is_edit_mode_active, "Edit mode should not be active") # Move first app to position 3 (index 2) self.homescreen.move_app_to_position(0, 2) # Assert that we are in edit mode. self.assertTrue(self.homescreen.is_edit_mode_active, "Edit mode should be active") # Exit edit mode self.device.touch_home_button() self.assertFalse(self.homescreen.is_edit_mode_active, "Edit mode should not be active") # Check the app order and that the app on position 12 is the right one first_app_after_move = self.homescreen.visible_apps[0].name self.assertNotEqual(first_app_before_move, first_app_after_move) self.assertEqual(first_app_before_move, self.homescreen.visible_apps[2].name)
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))
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)
def test_everythingme_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.switch_to_add_bookmark_frame() 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)
class TestHomescreenLayout(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.homescreen = Homescreen(self.marionette) self.apps.switch_to_displayed_app() def test_homescreen_column_layout(self): """ https://moztrap.mozilla.org/manage/case/13710/ """ self.homescreen.wait_for_number_of_apps(1) self.assertEqual(3, self.homescreen.number_of_columns) settings = Settings(self.marionette) settings.launch() homescreen_settings = settings.open_homescreen_settings() homescreen_settings.select_icon_layout('Four Columns') self.device.touch_home_button() self.assertEqual(4, self.homescreen.number_of_columns) settings.launch() # No need to open homescreen setting again # because it remembers where it left off homescreen_settings.select_icon_layout('Four Columns') self.device.touch_home_button() self.assertEqual(4, self.homescreen.number_of_columns)
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)
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 # Press Home button self.marionette.execute_script("window.wrappedJSObject.dispatchEvent(new Event('home'));") # Check that the icon of the app is on the homescreen homescreen = Homescreen(self.marionette) self.apps.switch_to_displayed_app() self.assertTrue(homescreen.is_app_installed(self.app_name))
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()
class TestLaunchApp(GaiaTestCase): _header_locator = (By.CSS_SELECTOR, 'h1') def setUp(self): GaiaTestCase.setUp(self) self.connect_to_network() self.homescreen = Homescreen(self.marionette) # Install app self.marionette.execute_script( 'navigator.mozApps.install("%s")' % MANIFEST) # Confirm the installation and wait for the app icon to be present confirm_install = ConfirmInstall(self.marionette) confirm_install.tap_confirm() self.wait_for_condition(lambda m: self.apps.displayed_app.name == self.homescreen.name) self.apps.switch_to_displayed_app() self.homescreen.wait_for_app_icon_present(APP_NAME) def test_launch_app(self): # Verify that the app icon is visible on one of the homescreen pages self.assertTrue(self.homescreen.is_app_installed(APP_NAME), "App %s not found on Homescreen" % APP_NAME) # Click icon and wait for h1 element displayed self.homescreen.installed_app(APP_NAME).tap_icon() self.wait_for_element_displayed(*self._header_locator, timeout=20) self.assertEqual(self.marionette.find_element(*self._header_locator).text, TITLE) def tearDown(self): self.apps.uninstall(APP_NAME) GaiaTestCase.tearDown(self)
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'])
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_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)
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_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)
class TestMoveApp(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.homescreen = Homescreen(self.marionette) self.apps.switch_to_displayed_app() def test_move_app_position(self): """Verify the user can move an application around on the homescreen. https://moztrap.mozilla.org/manage/case/1317/ """ first_app_before_move = self.homescreen.visible_apps[0].name # Activate edit mode self.assertFalse(self.homescreen.is_edit_mode_active, "Edit mode should not be active") self.homescreen.activate_edit_mode() self.assertTrue(self.homescreen.is_edit_mode_active, "Edit mode should be active") # Move first app to position 12 self.homescreen.move_app_to_position(0, 3) # Exit edit mode self.device.touch_home_button() self.assertFalse(self.homescreen.is_edit_mode_active, "Edit mode should not be active") # Check the app order and that the app on position 12 is the right one first_app_after_move = self.homescreen.visible_apps[0].name self.assertNotEqual(first_app_before_move, first_app_after_move) self.assertEqual(first_app_before_move, self.homescreen.visible_apps[3].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': '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 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)
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() marketplace.wait_for_notification_message_not_displayed() 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))
class TestHomescreenLayout(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.homescreen = Homescreen(self.marionette) self.apps.switch_to_displayed_app() def test_homescreen_column_layout(self): """ https://moztrap.mozilla.org/manage/case/13710/ """ self.homescreen.wait_for_number_of_apps(1) initial_number_of_columns = self.homescreen.number_of_columns self.assertEqual(3, initial_number_of_columns) settings = Settings(self.marionette) settings.launch() homescreen_settings = settings.open_homescreen() homescreen_settings.change_icon_layout('Four Columns') self.device.touch_home_button() Wait(self.marionette).until(lambda m: initial_number_of_columns != self .homescreen.number_of_columns) self.assertEqual(4, self.homescreen.number_of_columns) settings.launch() # in 319MB setting, the settings app gets killed sometimes, # in which case homescreen needs to be opened again if settings.current_view == 'root': homescreen_settings = settings.open_homescreen() homescreen_settings.change_icon_layout('Four Columns') self.device.touch_home_button() self.assertEqual(4, self.homescreen.number_of_columns)
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()
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)
def test_everythingme_add_collection(self): collection = 'Weather' homescreen = Homescreen(self.marionette) self.apps.switch_to_displayed_app() 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)
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 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()
class home(object): def __init__(self, parent): self.parent = parent self.marionette = parent.marionette self.homescreen = Homescreen(self.marionette) def goHome(self): """ Return to the home screen. """ # (Sometimes the home button needs to be tapped twice, i.e. if you're # in a results screen of EME.) self.touchHomeButton() self.touchHomeButton() self.parent.apps.kill_all() self.parent.iframe.switchToFrame(*DOM.Home.frame_locator, quit_on_error=False) time.sleep(1) def holdHomeButton(self): """Hold Home button pressed to show active applications. """ self.parent.parent.device.hold_home_button() def putHomeInEditMode(self): """Activate Edit Mode by holding an app pressed and then releasing. """ self.homescreen.activate_edit_mode() def scrollHomescreenLeft(self): """ Scroll to previous page (left). Should change this to use marionette.flick() when it works. """ self.marionette.execute_script( 'window.wrappedJSObject.GridManager.goToPreviousPage()') def scrollHomescreenRight(self): """ Scroll to next page (right). Should change this to use marionette.flick() when it works. """ self.marionette.execute_script( 'window.wrappedJSObject.GridManager.goToNextPage()') def touchHomeButton(self): """Touch Home button. """ self.parent.parent.device.touch_home_button()
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_packaged_app_from_search_panel(self): homescreen = Homescreen(self.marionette) self.apps.switch_to_displayed_app() search_panel = homescreen.tap_search_bar() search_panel.wait_for_everything_me_loaded() search_panel.type_into_search_box(self.app_name) results = search_panel.installed_apps self.assertEqual(results[0].name, self.app_name) results[0].tap() self.assertEqual(self.apps.displayed_app.name.lower(), self.app_name.lower())
class home(object): def __init__(self, parent): self.parent = parent self.marionette = parent.marionette self.homescreen = Homescreen(self.marionette) def goHome(self): """ Return to the home screen. """ # (Sometimes the home button needs to be tapped twice, i.e. if you're # in a results screen of EME.) self.touchHomeButton() self.touchHomeButton() self.parent.apps.kill_all() self.parent.iframe.switchToFrame(*DOM.Home.frame_locator, quit_on_error=False) time.sleep(1) def holdHomeButton(self): """Hold Home button pressed to show active applications. """ self.parent.parent.device.hold_home_button() def putHomeInEditMode(self): """Activate Edit Mode by holding an app pressed and then releasing. """ self.homescreen.activate_edit_mode() def scrollHomescreenLeft(self): """ Scroll to previous page (left). Should change this to use marionette.flick() when it works. """ self.marionette.execute_script('window.wrappedJSObject.GridManager.goToPreviousPage()') def scrollHomescreenRight(self): """ Scroll to next page (right). Should change this to use marionette.flick() when it works. """ self.marionette.execute_script('window.wrappedJSObject.GridManager.goToNextPage()') def touchHomeButton(self): """Touch Home button. """ self.parent.parent.device.touch_home_button()
class TestLaunchApp(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', 'manifest': self.marionette.absolute_url('webapps/packaged1/manifest.webapp'), 'title': 'Packaged app1' } # Install app self.marionette.execute_script( 'navigator.mozApps.installPackage("%s")' % self.test_data['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.test_data['manifest']) def test_launch_app(self): """https://moztrap.mozilla.org/manage/case/6116/""" # Verify that the app icon is visible on one of the homescreen pages self.assertTrue( self.homescreen.is_app_installed(self.test_data['manifest']), 'App %s not found on homescreen' % self.test_data['manifest']) # Click icon and wait for h1 element displayed self.homescreen.installed_app(self.test_data['manifest']).tap_icon() Wait(self.marionette).until( lambda m: m.title == self.test_data['title']) def tearDown(self): self.apps.uninstall(self.test_data['name']) GaiaTestCase.tearDown(self)
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)
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())
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': 'Mozilla QA WebRT Tester', 'url': self.marionette.absolute_url('webapps/mozqa.com/manifest.webapp') } # Install app so we can delete it 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() self.apps.switch_to_displayed_app() self.homescreen.wait_for_app_icon_present(self.test_data['name']) def test_delete_app(self): # 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.wait_for_condition( lambda m: self.apps.displayed_app.name == self.homescreen.name) self.wait_for_condition( lambda m: not self.homescreen.is_edit_mode_active) self.apps.switch_to_displayed_app() 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)
class testDragDrop(GaiaImageCompareTestCase): _homescreen_locator = (By.CLASS_NAME, 'theme-media') def setUp(self): GaiaImageCompareTestCase.setUp(self) self.homescreen = Homescreen(self.marionette) self.apps.switch_to_displayed_app() def test_drag_drop(self): self.homescreen.wait_for_number_of_apps(1) # Assert that we are not in edit mode. self.assertFalse(self.homescreen.is_edit_mode_active, "Edit mode should not be active") # Move first app to position 3 (index 2) and to position 4 self.homescreen.move_app_to_position(0, 2) self.take_screenshot() self.homescreen.move_app_to_position(2, 3) self.take_screenshot() self.homescreen.move_app_to_position(5, 4) self.take_screenshot() # Assert that we are in edit mode. self.assertTrue(self.homescreen.is_edit_mode_active, "Edit mode should be active") # Exit edit mode self.device.touch_home_button() self.assertFalse(self.homescreen.is_edit_mode_active, "Edit mode should not be active")
class TestMoveApp(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.homescreen = Homescreen(self.marionette) self.apps.switch_to_displayed_app() def test_move_app_position(self): """ Verify the user can move an application around on the homescreen. https://moztrap.mozilla.org/manage/case/1317/ """ # Go to app page self.homescreen.go_to_next_page() first_app_before_move = self.homescreen.visible_apps[0].name # Activate edit mode self.assertFalse(self.homescreen.is_edit_mode_active, "Edit mode should not be active") self.homescreen.activate_edit_mode() self.assertTrue(self.homescreen.is_edit_mode_active, "Edit mode should be active") # Move first app to position 12 self.homescreen.move_app_to_position(0, 12) # Exit edit mode self.homescreen.touch_home_button() self.assertFalse(self.homescreen.is_edit_mode_active, "Edit mode should not be active") # Check the app order and that the app on position 12 is the right one first_app_after_move = self.homescreen.visible_apps[0].name self.assertNotEqual(first_app_before_move, first_app_after_move) self.assertEqual(first_app_before_move, self.homescreen.visible_apps[12].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)
class testDragDrop(GaiaImageCompareTestCase): _homescreen_locator = (By.CLASS_NAME, "theme-media") def setUp(self): GaiaImageCompareTestCase.setUp(self) self.homescreen = Homescreen(self.marionette) self.apps.switch_to_displayed_app() def test_drag_drop(self): self.take_screenshot() self.homescreen.wait_for_number_of_apps(1) # Assert that we are not in edit mode. self.assertFalse(self.homescreen.is_edit_mode_active, "Edit mode should not be active") # Move first app to position 3 (index 2) and to position 4 self.homescreen.move_app_to_position(0, 2) self.take_screenshot() self.homescreen.move_app_to_position(2, 3) self.take_screenshot() self.homescreen.move_app_to_position(5, 4) self.take_screenshot() # Assert that we are in edit mode. self.assertTrue(self.homescreen.is_edit_mode_active, "Edit mode should be active") # Exit edit mode self.device.touch_home_button() self.assertFalse(self.homescreen.is_edit_mode_active, "Edit mode should not be active")
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)
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)
class TestLaunchApp(GaiaTestCase): 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() self.test_data = { 'name': 'Mozilla QA WebRT Tester', 'url': 'http://mozqa.com/data/webapps/mozqa.com/manifest.webapp', 'title': 'Index of /data' } if self.device.is_desktop_b2g or self.data_layer.is_wifi_connected(): self.test_data['url'] = self.marionette.absolute_url( 'webapps/mozqa.com/manifest.webapp') self.test_data['title'] = 'Directory listing for /' if not self.apps.is_app_installed(self.test_data['name']): # 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_launch_app(self): # Verify that 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']) # Click icon and wait for h1 element displayed self.homescreen.installed_app(self.test_data['name']).tap_icon() Wait(self.marionette).until( lambda m: m.title == self.test_data['title'])
def test_launch_everything_me_app(self): app_name = 'Twitter' homescreen = Homescreen(self.marionette) self.apps.switch_to_displayed_app() search_panel = homescreen.tap_search_bar() search_panel.wait_for_everything_me_loaded() search_panel.type_into_search_box(app_name) search_panel.wait_for_everything_me_results_to_load() self.assertGreater(len(search_panel.results), 0) search_panel.results[0].tap() self.assertIn(app_name, self.marionette.title)
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) homescreen.switch_to_homescreen_frame() search_panel = homescreen.tap_search_bar() search_panel.wait_for_everything_me_loaded() search_panel.type_into_search_box(test_string) search_panel.wait_for_everything_me_results_to_load() self.assertGreater(len(search_panel.results), 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)
class TestDeleteApp(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) # 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': 'http://mozqa.com/data/webapps/mozqa.com/manifest.webapp'} if not self.apps.is_app_installed(self.test_data['name']): self.connect_to_network() if self.device.is_desktop_b2g or self.data_layer.is_wifi_connected(): self.test_data['url'] = self.marionette.absolute_url( 'webapps/mozqa.com/manifest.webapp') # Install app so we can delete it 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() self.apps.switch_to_displayed_app() self.homescreen.wait_for_app_icon_present(self.test_data['name']) def test_delete_app(self): # 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.wait_for_condition(lambda m: self.apps.displayed_app.name == self.homescreen.name) self.apps.switch_to_displayed_app() 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 test_search_and_install_app(self): marketplace = Marketplace(self.marionette, self.MARKETPLACE_DEV_NAME) home_page = marketplace.launch() # Find a free app to install app = home_page.first_free_app self.app_name = app["name"] if self.apps.is_app_installed(self.app_name): raise Exception("The app %s is already installed." % self.app_name) marketplace.switch_to_marketplace_frame() results_page = home_page.search(self.app_name) results = results_page.search_results self.assertGreater(len(results), 0, "No results found.") first_result = 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. Found %s but expected %s." % (first_result.author, app["author"]), ) # Find and click the install button to the install the web app self.assertEquals(first_result.install_button_text, "Install for free", "Incorrect button label.") first_result.tap_install_button() self.wait_for_downloads_to_finish() # Confirm the installation and wait for the app icon to be present confirm_install = ConfirmInstall(self.marionette) confirm_install.tap_confirm() self.assertEqual("%s installed" % self.app_name, results_page.install_notification_message) # Press Home button self.device.touch_home_button() # Check that the icon of the app is on the homescreen homescreen = Homescreen(self.marionette) self.apps.switch_to_displayed_app() self.assertTrue(homescreen.is_app_installed(self.app_name))
class TestDeleteApp(GaiaTestCase): 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']) 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.wait_for_condition( lambda m: self.apps.displayed_app.name == self.homescreen.name) self.apps.switch_to_displayed_app() 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 run(self): # kill any open apps (e.g. "firstrun") self.device.killApps() from gaiatest.apps.homescreen.app import Homescreen homescreen = Homescreen(self.device.marionette) self.device.gaiaApps.switch_to_displayed_app() # switch to homescreen appicon = None try: # look for the application icon in the dock first self.log('Looking for app icon in dock') appicon = self.device.marionette.find_element( By.CSS_SELECTOR, '#footer .icon[aria-label="%s"]' % self.appname) except NoSuchElementException: # skip the everything.me page self.device.marionette.execute_async_script( 'window.wrappedJSObject.GridManager.goToPage(1, ' 'marionetteScriptFinished);') for i in range(1, homescreen.homescreen_get_total_pages_number): current_page = self.device.marionette.find_element( By.CSS_SELECTOR, '#icongrid .page:not([aria-hidden=true])') try: self.log('Looking for app icon on page %s' % (i + 1)) appicon = current_page.find_element( By.CSS_SELECTOR, '.icon[aria-label="%s"]' % self.appname) break except NoSuchElementException: if homescreen.homescreen_has_more_pages: homescreen.go_to_next_page() else: raise Exception("Cannot find icon for app with name " "'%s'" % self.appname) tap_x = appicon.location['x'] + (appicon.size['width'] / 2) tap_y = appicon.location['y'] + (appicon.size['height'] / 2) self.start_capture() self.execute_actions([['tap', tap_x, tap_y]], test_finished_after_actions=False) self.log("Waiting %s seconds for app to finish starting" % self.capture_timeout) time.sleep(self.capture_timeout) self.test_finished() self.end_capture()