def test_purchase_app(self): APP_NAME = 'Test Zippy With Me' PIN = '1234' username = self.testvars['marketplace']['username'] password = self.testvars['marketplace']['password'] if self.apps.is_app_installed(APP_NAME): self.apps.uninstall(APP_NAME) marketplace = Marketplace(self.marionette, self.MARKETPLACE_DEV_NAME) marketplace.launch() marketplace.login(username, password) marketplace.set_region('United States') details_page = marketplace.navigate_to_app(APP_NAME) payment = details_page.tap_purchase_button() payment.create_pin(PIN) payment.wait_for_buy_app_section_displayed() self.assertIn(APP_NAME, payment.app_name) payment.tap_buy_button() # 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' % APP_NAME, marketplace.install_notification_message) marketplace.switch_to_marketplace_frame() self.assertEqual('Launch', details_page.install_button_text)
def test_marketplace_login_from_app_details_page(self): account = self.create_firefox_account() marketplace = Marketplace(self.marionette, self.MARKETPLACE_DEV_NAME) home_page = marketplace.launch() app_name = home_page.first_free_app['name'] details_page = home_page.navigate_to_app(app_name) ff_accounts = details_page.tap_write_review(logged_in=False) ff_accounts.login(account.email, account.password) # switch back to Marketplace marketplace.switch_to_marketplace_frame() details_page.wait_for_login_success_notification() current_time = str(time.time()).split('.')[0] rating = random.randint(1, 5) body = 'This is a test %s' % current_time review_page = AddReview(self.marionette) details_page = review_page.write_a_review(rating, body) details_page.wait_for_review_posted_notification() # Check if review was added correctly self.assertEqual(details_page.first_review_rating, rating) self.assertEqual(details_page.first_review_body, body)
def test_login_marketplace(self): # https://moztrap.mozilla.org/manage/case/4134/ marketplace = Marketplace(self.marionette, self.MARKETPLACE_DEV_NAME) home_page = marketplace.launch() account = self.create_firefox_account() home_page.login(account.email, account.password) # switch back to Marketplace marketplace.switch_to_marketplace_frame() # wait for the expected notification, and for user to be signed in home_page.wait_for_login_success_notification() settings = home_page.show_menu().tap_settings() settings.wait_for_sign_out_button() # Verify that user is logged in self.assertEqual(account.email, settings.email) # Sign out, which should return to the Marketplace home screen settings.tap_sign_out() # Verify that user is signed out settings.wait_for_sign_in_displayed()
def test_purchase_app(self): pin = '1234' account = self.create_firefox_account() marketplace = Marketplace(self.marionette, self.MARKETPLACE_DEV_NAME) home_page = marketplace.launch() home_page.login(account.email, account.password) search_results_page = self.tap_install_button_of_first_paid_app() payment = Payment(self.marionette) payment.create_pin(pin) payment.wait_for_buy_app_section_displayed() self.assertIn(self.app_name, payment.app_name) payment.tap_buy_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, search_results_page.install_notification_message) marketplace.switch_to_marketplace_frame() app = search_results_page.search_results[0] self.assertEqual('Open app', app.install_button_text)
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))
def test_purchase_app(self): APP_NAME = 'Test Zippy With Me' username = self.testvars['marketplace']['username'] password = self.testvars['marketplace']['password'] if self.apps.is_app_installed(APP_NAME): self.apps.uninstall(APP_NAME) marketplace = Marketplace(self.marionette, self.MARKETPLACE_DEV_NAME) marketplace.launch() marketplace.set_region('United States') details_page = marketplace.navigate_to_app(APP_NAME) ff_accounts = details_page.tap_purchase_button(is_logged_in=False) ff_accounts.login(username, password) # Switch back to the Marketplace frame and wait for the install button to update marketplace.switch_to_marketplace_frame() Wait(marionette=self.marionette, ignored_exceptions=StaleElementException)\ .until(lambda m: details_page.install_button_text == 'Purchasing')