def test_reviews_section(self, mozwebqa): """https://moztrap.mozilla.org/runtests/run/243/env/112/ - Verify details page for an app - Reviews section""" home_page = Home(mozwebqa) home_page.go_to_homepage() # click first app and load its Details Page search_term = self._take_first_popular_app_name(mozwebqa) details_page = home_page.search_and_click_on_app(search_term) # This takes the number of reviews on the details page and based on that number it treats 3 different scenarios: # when the app has reviews, when it has 1 review and when the app isn't rated. if details_page.is_app_rated: if details_page.reviews_count >= 2: if len(details_page.reviews) == 2: for review in details_page.reviews: Assert.true(review.is_visible) elif details_page.reviews_count == 1: Assert.true(details_page.reviews[0].is_visible) else: Assert.equal(details_page.app_not_rated_text, 'App not yet rated') Assert.true(details_page.is_write_a_review_button_visible) for support_button in details_page.support_buttons_list: Assert.true(details_page.is_element_visible(*support_button))
def test_that_after_writing_a_review_clicking_back_goes_to_app_page(self, mozwebqa): """Logged out, click "Write a Review" on an app page, sign in, submit a review, click Back, test that the current page is the app page. """ mock_review = MockReview() home_page = Home(mozwebqa) home_page.go_to_homepage() # Search for an app and go to it's details page. search_term = self._take_first_app_name(mozwebqa) details_page = home_page.search_and_click_on_app(search_term) Assert.true(details_page.is_product_details_visible) # Write a review. review_box = details_page.click_write_review() acct = self.create_new_user(mozwebqa) details_page.login(acct) 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() reviews_page.header.click_back() Assert.true(details_page.is_product_details_visible) Assert.equal(search_term, details_page.title)
def test_details_page_for_an_app(self, mozwebqa): """https://moztrap.mozilla.org/runtests/run/243/env/112/ - Verify details page for an app""" home_page = Home(mozwebqa) home_page.go_to_homepage() search_term = self._take_first_popular_app_name(mozwebqa) details_page = home_page.search_and_click_on_app(search_term) details_page.click_more_button() # The verifications required by the testcase Assert.true(details_page.header.is_back_button_visible) Assert.true(search_term in details_page.title) Assert.true(details_page.is_author_visible) Assert.true(details_page.is_app_icon_present) Assert.true(details_page.is_rating_visible) Assert.true(details_page.is_product_details_visible) Assert.true(details_page.is_description_visible)