def test_that_checks_the_addition_of_a_review(self, mozwebqa, new_user): mock_review = MockReview() home_page = Home(mozwebqa) home_page.go_to_homepage() home_page.more_menu.click_sign_in() home_page.login(new_user['email'], new_user['password']) details_page = home_page.go_to_first_free_app_page() assert details_page.is_product_details_visible # Write a review review_box = details_page.click_write_review() review_box.write_a_review(mock_review['rating'], mock_review['body']) assert 'Your review was successfully posted. Thanks!' == details_page.notification_message details_page.wait_notification_box_not_visible() # Go to the reviews page reviews_page = details_page.click_view_reviews() # Check review review = reviews_page.reviews[0] assert mock_review['rating'] == review.rating assert review.author in new_user['email'] assert mock_review['body'] in review.text
def test_that_checks_the_deletion_of_a_review(self, mozwebqa): """ https://moztrap.mozilla.org/manage/case/648/ """ # Step 1 - Login into Marketplace mock_review = MockReview() home_page = Home(mozwebqa) home_page.go_to_homepage() home_page.login() 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_write_review_button_visible) # Step 3 - Write a review add_review_box = details_page.click_write_review() details_page = add_review_box.write_a_review(mock_review['rating'], mock_review['body']) # Step 4 - Check review Assert.true(details_page.is_success_message_visible) # Step 5 - Go to reviews page reviews_page = details_page.click_reviews_button() # Step 6 - Delete review reviews = reviews_page.reviews[0] reviews.delete() Assert.true(reviews_page.is_success_message_visible) Assert.equal(reviews_page.success_message, "Your review was deleted") Assert.false(reviews.is_review_visible)
def test_that_checks_the_editing_of_a_review(self, mozwebqa): self._reviews_setup(mozwebqa) home_page = Home(mozwebqa) home_page.go_to_homepage() # Login into Marketplace home_page.login(user="******") Assert.true(home_page.is_the_current_page) # Search for the test app and go to its details page search_page = home_page.header.search(self.app_name) details_page = search_page.results[0].click_name() Assert.true(details_page.is_the_current_page) Assert.true(details_page.is_edit_review_button_visible) Assert.equal(details_page.edit_review_button, "Edit Your Review") # Write a review edit_review = details_page.click_edit_review() mock_review = MockReview() details_page = edit_review.write_a_review(mock_review['rating'], mock_review['body']) # Check notification details_page.wait_notification_box_visible() Assert.equal(details_page.notification_message, "Review updated successfully") details_page.wait_notification_box_not_visible() # Go to reviews page and verify reviews = details_page.click_reviews_button() Assert.equal(reviews.logged_in_users_review.text, mock_review['body']) Assert.equal(reviews.logged_in_users_review.rating, mock_review['rating']) # Clean up self.mk_api.delete_app_review(self.review_id)
def test_that_checks_the_addition_of_a_review(self, mozwebqa): new_user = PersonaTestUser().create_user() mock_review = MockReview() home_page = Home(mozwebqa) home_page.go_to_homepage() # Create new user and login. settings_page = home_page.header.click_settings() settings_page.login(user=new_user) # Search for an app and go to it's details page. home_page.go_to_homepage() search_page = home_page.search_for(self.app_name) details_page = search_page.results[0].click_app() Assert.true(details_page.is_product_details_visible) # Write a review. details_page.click_write_review() add_review_box = AddReview(mozwebqa) details_page = add_review_box.write_a_review(mock_review['rating'], mock_review['body']) details_page.wait_for_ajax_on_page_finish() Assert.true(details_page.is_success_message_visible, "Review not added: %s" % details_page.success_message) Assert.equal(details_page.success_message, "Your review was posted") # Go to the reviews page reviews_page = details_page.click_view_reviews() # Check review review = reviews_page.reviews[0] Assert.equal(review.rating, mock_review['rating']) Assert.contains(review.author, new_user['email']) Assert.equal(review.text, mock_review['body'])
def test_that_checks_the_addition_of_a_review(self, mozwebqa): mock_review = MockReview() home_page = Home(mozwebqa) home_page.go_to_homepage() app_name = self._take_first_app_name(mozwebqa) # Login settings_page = home_page.header.click_settings() settings_page.click_sign_in() acct = self.create_new_user(mozwebqa) settings_page.login(acct) settings_page.wait_for_user_email_visible() # Search for an app and go to it's details page. search_page = home_page.search_for(app_name) details_page = search_page.results[0].click_app() Assert.true(details_page.is_product_details_visible) # Write a review details_page.refresh_page() review_box = details_page.click_write_review() self.review_id = review_box.write_a_review(mock_review['rating'], mock_review['body']).review_id Assert.equal(details_page.notification_message, "Your review was successfully posted. Thanks!") details_page.wait_notification_box_not_visible() # Go to the reviews page reviews_page = details_page.click_view_reviews() # Check review review = reviews_page.reviews[0] Assert.equal(review.rating, mock_review['rating']) Assert.contains(review.author, acct.email) Assert.contains(review.text, mock_review['body'])
def test_that_checks_the_editing_of_a_review(self, mozwebqa, new_user): # Create the review to be edited app_name = self._create_review(mozwebqa, new_user) home_page = Home(mozwebqa) home_page.go_to_homepage() details_page = home_page.header.search_and_click_on_app(app_name) Assert.true(details_page.is_the_current_page) details_page.wait_for_review_button_visible() Assert.equal(details_page.review_button_text, "Edit your review") # Edit the review edit_review = details_page.click_review_button(edit_review=True) mock_review = MockReview() details_page = edit_review.write_a_review(mock_review['rating'], mock_review['body']) # Go to reviews page and verify reviews_page = details_page.click_all_reviews_button() review = reviews_page.get_review_for_user(new_user['name']) Assert.equal(review.text, mock_review['body']) Assert.equal(review.rating, mock_review['rating'])