def test_search_and_install_app(self): marketplace = Marketplace(self.marionette) marketplace.launch() # Switch to marketplace iframe marketplace.switch_to_marketplace_frame() results = marketplace.search(self.APP_NAME) # validate the first result is the official lanyrd mobile app 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, self.APP_DEVELOPER, '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 self.marionette.switch_to_frame() homescreen_frame = self.marionette.find_element(*self._homescreen_iframe_locator) self.marionette.switch_to_frame(homescreen_frame) self.assertTrue(self.marionette.find_element(*self._app_icon_locator))
def test_marketplace_without_connectivity(self): marketplace = Marketplace(self.marionette) marketplace.launch() # Switch to marketplace iframe marketplace.switch_to_marketplace_frame() self.assertEqual(marketplace.error_title_text, self.expected_error_title) self.assertEqual(marketplace.error_message_text, self.expected_error_message)
def test_marketplace_without_connectivity(self): marketplace = Marketplace(self.marionette) marketplace.launch() # Switch to marketplace iframe marketplace.switch_to_marketplace_frame() self.assertEqual(marketplace.error_title_text, self.expected_error_title) self.assertEqual(marketplace.error_message_text, self.expected_error_message)
browser.switch_to_content() browser.wait_for_element_not_displayed(*_loading_fragment_locator) marketplace = Marketplace(mc, marketplace_app) if not args.browser: try: marketplace.launch() except AssertionError: e = ('Marketplace Dev app is not installed. Install it using ' 'install_mkt --dev or use --browser to install apps ' 'from the browser directly.') args.error(e) if args.prod: marketplace.switch_to_marketplace_frame() try: marketplace.wait_for_element_displayed(*_search_locator) results = marketplace.search(args.app) except NoSuchElementException, exc: print '** %s: %s' % (exc.__class__.__name__, exc) args.error(no_internet_error) try: results.search_results[0].tap_install_button() except IndexError: args.error('Error: App not found.') confirm_installation()
browser.switch_to_content() browser.wait_for_element_not_displayed(*_loading_fragment_locator) marketplace = Marketplace(mc, marketplace_app) if not args.browser: try: marketplace.launch() except AssertionError: e = ('Marketplace Dev app is not installed. Install it using ' 'install_mkt --dev or use --browser to install apps ' 'from the browser directly.') args.error(e) if args.prod: marketplace.switch_to_marketplace_frame() if not args.app_url: try: marketplace.wait_for_element_displayed(*_search_locator) results = marketplace.search(args.app) except NoSuchElementException, exc: print '** %s: %s' % (exc.__class__.__name__, exc) args.error(no_internet_error) try: results.search_results[0].tap_install_button() except IndexError: args.error('Error: App not found.') else: _install_button_locator = ('css selector', '.button.product.install')