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 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 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('xpath', "//li[@class='icon']//span[text()='%s']" % self.app_name))
def test_search_and_install_app(self): marketplace = Marketplace(self.marionette, self.MARKETPLACE_DEV_NAME) marketplace.launch() 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_add_review(self): marketplace = Marketplace(self.marionette, 'Marketplace dev') marketplace.launch() # Sign in settings = marketplace.tap_settings() persona = settings.tap_sign_in() persona.login(self.user.email, self.user.password) self.marionette.switch_to_frame() marketplace.launch() settings.wait_for_sign_out_button() # Search and select app results = marketplace.search('SoundCloud') self.assertGreater(len(results.search_results), 0, 'No results found.') details_page = results.search_results[0].tap_app() # Setting your default values for review current_time = str(time.time()).split('.')[0] rating = random.randint(1, 5) body = 'This is a test %s' % current_time # Adding the review review_box = details_page.tap_write_review() review_box.write_a_review(rating, body) marketplace.wait_for_notification_message_displayed() # Check if review was added correctly self.assertEqual(marketplace.notification_message, "Your review was posted") self.assertEqual(details_page.first_review_rating, rating) self.assertEqual(details_page.first_review_body, body)
def test_add_review(self): marketplace = Marketplace(self.marionette, 'Marketplace dev') marketplace.launch() # Sign in settings = marketplace.tap_settings() persona = settings.tap_sign_in() persona.login(self.user.email, self.user.password) self.marionette.switch_to_frame() marketplace.launch() settings.wait_for_sign_out_button() # Search and select app results = marketplace.search('SoundCloud') self.assertGreater(len(results.search_results), 0, 'No results found.') details_page = results.search_results[0].tap_app() # Setting your default values for review current_time = str(time.time()).split('.')[0] rating = random.randint(1, 5) body = 'This is a test %s' % current_time # Adding the review review_box = details_page.tap_write_review() review_box.write_a_review(rating, body) marketplace.wait_for_notification_message_displayed() # Check if review was added correctly self.assertEqual(marketplace.notification_message, "Your review was posted") self.assertEqual(details_page.first_review_rating, rating) self.assertEqual(details_page.first_review_body, body)
def test_search_and_install_app(self): marketplace = Marketplace(self.marionette, self.MARKETPLACE_DEV_NAME) marketplace.launch() 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_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 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('xpath', "//li[@class='icon']//span[text()='%s']" % self.app_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_search_paid_app(self): marketplace = Marketplace(self.marionette, 'Marketplace Dev') marketplace.launch() results = marketplace.search('') self.assertGreater(len(results.search_results), 0, 'No results found.') filter = results.tap_filter() filter.by_price('paid') results = filter.tap_apply() self.assertGreater(len(results.search_results), 0, 'No results found.') for result in results.search_results: self.assertTrue(re.match('^\$\d+\.\d{2}', result.price), "App %s it's not a paid app." % result.name)
def test_install_and_execute_bing_map(self): marketplace = Marketplace(self.marionette) marketplace.launch() results = marketplace.search(self.app_search) first_result = results.search_results[0] first_result.tap_install_button() confirm_install = ConfirmInstall(self.marionette) confirm_install.tap_confirm() results = marketplace.get_current_displayed_result() first_result = results.search_results[0] first_result.tap_open_app_button(self.app_title, self._map_locator) self.take_screenshot(prewait=self.draw_wait_time) self.marionette.find_element(*self._zoom_in_locator).tap() self.take_screenshot(prewait=self.draw_wait_time) self.marionette.find_element(*self._zoom_in_locator).tap() self.take_screenshot(prewait=self.draw_wait_time) self.marionette.find_element(*self._zoom_in_locator).tap() self.take_screenshot(prewait=self.draw_wait_time) # move around GaiaImageCompareTestCase.scroll(self.marionette, 'right', 100, locator=self._map_locator) self.take_screenshot(prewait=self.draw_wait_time) GaiaImageCompareTestCase.scroll(self.marionette, 'down', 100, locator=self._map_locator) self.take_screenshot(prewait=self.draw_wait_time) # zoom out self.marionette.find_element(*self._zoom_out_locator).tap() self.take_screenshot(prewait=self.draw_wait_time) self.marionette.find_element(*self._zoom_out_locator).tap() self.take_screenshot(prewait=self.draw_wait_time) self.marionette.find_element(*self._zoom_out_locator).tap() self.take_screenshot(prewait=self.draw_wait_time)
def test_install_and_execute_bing_map(self): marketplace = Marketplace(self.marionette) marketplace.launch() results = marketplace.search(self.app_search) first_result = results.search_results[0] first_result.tap_install_button() confirm_install = ConfirmInstall(self.marionette) confirm_install.tap_confirm() results = marketplace.get_current_displayed_result() first_result = results.search_results[0] first_result.tap_open_app_button(self._map_locator) self.take_screenshot(prewait=self.draw_wait_time) self.marionette.find_element(*self._zoom_in_locator).tap() self.take_screenshot(prewait=self.draw_wait_time) self.marionette.find_element(*self._zoom_in_locator).tap() self.take_screenshot(prewait=self.draw_wait_time) self.marionette.find_element(*self._zoom_in_locator).tap() self.take_screenshot(prewait=self.draw_wait_time) # move around GaiaImageCompareTestCase.scroll(self.marionette, 'right', 100, locator=self._map_locator) self.take_screenshot(prewait=self.draw_wait_time) GaiaImageCompareTestCase.scroll(self.marionette, 'down', 100, locator=self._map_locator) self.take_screenshot(prewait=self.draw_wait_time) # zoom out self.marionette.find_element(*self._zoom_out_locator).tap() self.take_screenshot(prewait=self.draw_wait_time) self.marionette.find_element(*self._zoom_out_locator).tap() self.take_screenshot(prewait=self.draw_wait_time) self.marionette.find_element(*self._zoom_out_locator).tap() self.take_screenshot(prewait=self.draw_wait_time)
def test_install_and_execute_bing_map(self): marketplace = Marketplace(self.marionette) marketplace.launch() results = marketplace.search(self.app_search) 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) bingmap = self.marionette.find_element(*self._map_locator) Wait(self.marionette).until(lambda m: bingmap.is_displayed()) time.sleep(self.draw_wait_time) self.take_screenshot() # once the map is completely loaded, use the UI to render different views # zoom in self.marionette.find_element(*self._zoom_in_locator).tap() time.sleep(self.draw_wait_time) self.take_screenshot() self.marionette.find_element(*self._zoom_in_locator).tap() time.sleep(self.draw_wait_time) self.take_screenshot() self.marionette.find_element(*self._zoom_in_locator).tap() time.sleep(self.draw_wait_time) self.take_screenshot() # move around GaiaImageCompareTestCase.scroll(self.marionette, 'right', 100, locator=self._map_locator) time.sleep(self.draw_wait_time) self.take_screenshot() GaiaImageCompareTestCase.scroll(self.marionette, 'down', 100, locator=self._map_locator) time.sleep(self.draw_wait_time) self.take_screenshot() # zoom out self.marionette.find_element(*self._zoom_out_locator).tap() time.sleep(self.draw_wait_time) self.take_screenshot() self.marionette.find_element(*self._zoom_out_locator).tap() time.sleep(self.draw_wait_time) self.take_screenshot() self.marionette.find_element(*self._zoom_out_locator).tap() time.sleep(self.draw_wait_time) self.take_screenshot()
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() @contextmanager def pushd(newdir): wd = os.getcwd()
def test_install_and_execute_bing_map(self): marketplace = Marketplace(self.marionette) marketplace.launch() results = marketplace.search(self.app_search) 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) bingmap = self.marionette.find_element(*self._map_locator) Wait(self.marionette).until(lambda m: bingmap.is_displayed()) time.sleep(self.draw_wait_time) self.take_screenshot() # once the map is completely loaded, use the UI to render different views # zoom in self.marionette.find_element(*self._zoom_in_locator).tap() time.sleep(self.draw_wait_time) self.take_screenshot() self.marionette.find_element(*self._zoom_in_locator).tap() time.sleep(self.draw_wait_time) self.take_screenshot() self.marionette.find_element(*self._zoom_in_locator).tap() time.sleep(self.draw_wait_time) self.take_screenshot() # move around self.scroll(self._map_locator, 'right', 100) time.sleep(self.draw_wait_time) self.take_screenshot() self.scroll(self._map_locator, 'down', 100) time.sleep(self.draw_wait_time) self.take_screenshot() # zoom out self.marionette.find_element(*self._zoom_out_locator).tap() time.sleep(self.draw_wait_time) self.take_screenshot() self.marionette.find_element(*self._zoom_out_locator).tap() time.sleep(self.draw_wait_time) self.take_screenshot() self.marionette.find_element(*self._zoom_out_locator).tap() time.sleep(self.draw_wait_time) self.take_screenshot()
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') marketplace.wait_for_element_displayed(*_install_button_locator) mc.find_element(*_install_button_locator).tap() mc.switch_to_frame() confirm_installation()