def test_that_purchases_an_app_without_pre_auth_and_requests_a_refund(self, mozwebqa): """Litmus 58166""" user = MockUser() home_page = Home(mozwebqa) home_page.go_to_homepage() home_page.create_new_user(user) home_page.login(user) Assert.true(home_page.is_the_current_page) search_page = home_page.header.search(self._app_name) Assert.true(search_page.is_the_current_page) Assert.not_equal("FREE", search_page.results[0].price) details_page = search_page.results[0].click_name() Assert.true(details_page.is_app_available_for_purchase) pre_aproval_region = details_page.click_purchase() paypal_frame = pre_aproval_region.click_one_time_payment() paypal_popup = paypal_frame.login_to_paypal() Assert.true(paypal_popup.is_user_logged_into_paypal) try: # From this point on we have payed for the app so we have to request a refund paypal_popup.click_pay() paypal_popup.close_paypal_popup() Assert.true(details_page.is_app_installing) except Exception as exception: Assert.fail(exception) finally: self.request_refund_procedure(mozwebqa, self._app_name)
def test_that_checks_the_addition_of_a_review(self, mozwebqa): # Step 1 - Login into Marketplace user = MockUser() home_page = Home(mozwebqa) home_page.go_to_homepage() home_page.create_new_user(user) home_page.login(user) Assert.true(home_page.is_the_current_page) # Step 2 - Search for the test app and go to its details page search_page = home_page.header.search(self.test_app) details_page = search_page.results[0].click_name() Assert.true(details_page.is_the_current_page) Assert.true(details_page.is_submit_review_link_visible) Assert.equal(details_page.submit_review_link, "Submit a Review") # Step 3 - Write a review body = 'Automatic app review by Selenium tests %s' % datetime.now() rating = random.randint(1, 5) add_review_page = details_page.click_submit_review() review_page = add_review_page.write_a_review(rating, body) # Step 4 - Check review Assert.true(review_page.is_success_message_visible) Assert.equal(review_page.success_message, "Your review was successfully added!") review = review_page.reviews[0] Assert.equal(review.rating, rating) Assert.equal(review.author, user.name) Assert.equal(review.text, body)
def test_that_checks_the_deletion_of_a_review(self, mozwebqa): """ https://moztrap.mozilla.org/manage/case/648/ """ # Step 1 - Login into Marketplace user = MockUser() home_page = Home(mozwebqa) home_page.go_to_homepage() home_page.create_new_user(user) home_page.login(user) Assert.true(home_page.is_the_current_page) # Step 2 - Search for the test app and go to its details page search_page = home_page.header.search(self.test_app) details_page = search_page.results[0].click_name() Assert.true(details_page.is_the_current_page) Assert.true(details_page.is_submit_review_link_visible) # Step 3 - Write a review body = 'Automatic app review by Selenium tests %s' % datetime.now() rating = random.randint(1, 5) add_review_page = details_page.click_submit_review() reviews_page = add_review_page.write_a_review(rating, body) # Step 4 - Check review Assert.true(reviews_page.is_success_message_visible) # Step 5 - Delete review review = reviews_page.reviews[0] review.delete() Assert.true(reviews_page.is_success_message_visible) Assert.equal(reviews_page.success_message, "Your review was successfully deleted!") Assert.false(review.is_review_visible)
def test_create_new_user(self, mozwebqa): user = MockUser() home_page = Home(mozwebqa) home_page.go_to_homepage() home_page.create_new_user(user) home_page.login(user) Assert.true(home_page.is_the_current_page) Assert.true(home_page.footer.is_user_logged_in)
def _login_to_consumer_pages(self, mozwebqa, user=None): """login to consumer pages using the provided user if the user is not provided a new one will be created""" home_page = Home(mozwebqa) home_page.go_to_homepage() if user is None: user = MockUser() home_page.create_new_user(user) home_page.login(user) return home_page, user
def _login_to_consumer_pages(self, mozwebqa, user=None): """login to consumer pages using the provided user if the user is not provided a new one will be created""" from pages.desktop.consumer_pages.home import Home home_page = Home(mozwebqa) home_page.go_to_homepage() if user == None: from mocks.mock_user import MockUser user = MockUser() home_page.create_new_user(user) home_page.login(user) return home_page, user
def test_editing_user_profile(self, mozwebqa): """Test for https://www.pivotaltracker.com/story/show/33709085""" user = MockUser() home_page = Home(mozwebqa) home_page.go_to_homepage() home_page.create_new_user(user) home_page.login(user) profile_page = home_page.footer.click_account_settings() _username = user['email'].split('@')[0] #Initial check Assert.equal(profile_page.browser_id_email, user['email']) Assert.equal(profile_page.username, _username) Assert.equal(profile_page.display_name, _username) #Data to submit. Username and Bio should be unique name = 'Napoleon' username = _username[::-1] location = 'Saint Helena' occupation = 'Emperor of the French' homepage = 'https://mozilla.org/' bio = 'Unique bio for %s' % _username profile_page.edit_display_name(name) profile_page.edit_username(username) profile_page.edit_location(location) profile_page.edit_occupation(occupation) profile_page.edit_homepage(homepage) profile_page.edit_bio(bio) profile_page.check_email_me_checkbox() profile_page.save_changes() Assert.equal(profile_page.notification_text, 'Profile Updated') Assert.equal(profile_page.display_name, name) Assert.equal(profile_page.username, username) Assert.equal(profile_page.location, location) Assert.equal(profile_page.occupation, occupation) Assert.equal(profile_page.homepage, homepage) Assert.equal(profile_page.bio, bio) Assert.false(profile_page.is_email_me_checked)