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))
def test_marketplace_purchase_app_on_dev_with_mocked_bango(self): marketplace = Marketplace(self.marionette, 'Marketplace Dev') marketplace.launch() # Tap settings and sign in in Marketplace settings = marketplace.tap_settings() persona = settings.tap_sign_in() # login with PersonaTestUser account persona.login(self.user.email, self.user.password) # switch back to Marketplace self.marionette.switch_to_frame() marketplace.launch() # wait for the page to refresh and the sign out button to be visible settings.wait_for_sign_out_button() # Well I dunno, it just needs this time.sleep(3) settings.select_region("Spain") time.sleep(3) settings.tap_save_changes() marketplace.wait_for_notification_message_not_displayed() # search for a paid app and tap on the price search = marketplace.search(self._APP_NAME) bango = search.search_results[0].tap_purchase_button() # pay app bango.create_pin('1234') # make fake payment bango.make_fake_payment() self.marionette.switch_to_frame() # At gaia System level, complete the installation prompt self._confirm_installation() # Switch into homescreen frame homescreen_frame = self.marionette.find_element(*self._homescreen_iframe_locator) self.marionette.switch_to_frame(homescreen_frame) # Not overly concerned about it being visible, only present self.assertTrue(self.is_element_present(*self._app_icon_locator))
class TestMarketplaceLogin(GaiaTestCase): MARKETPLACE_DEV_NAME = 'Marketplace Dev' def setUp(self): GaiaTestCase.setUp(self) self.connect_to_network() self.install_marketplace() self.user = PersonaTestUser().create_user(verified=True, env={"browserid": "firefoxos.persona.org", "verifier": "marketplace-dev.allizom.org"}) self.marketplace = Marketplace(self.marionette, self.MARKETPLACE_DEV_NAME) self.marketplace.launch() def test_login_marketplace(self): # https://moztrap.mozilla.org/manage/case/4134/ self.marketplace.wait_for_setting_displayed() settings = self.marketplace.tap_settings() persona = settings.tap_sign_in() persona.login(self.user.email, self.user.password) # switch back to Marketplace self.marionette.switch_to_frame() self.marketplace.launch() # wait for signed-in notification at the bottom of the screen to clear self.marketplace.wait_for_notification_message_not_displayed() # Verify that user is logged in self.assertEqual(self.user.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()