def test_click_stats_grouped_ratings(selenium, base_url, variables): extension = variables['addon_with_stats'] selenium.get(f'{base_url}/addon/{extension}') addon = Detail(selenium, base_url).wait_for_page_to_load() # clicks on the grouped ratings number displayed left to a rating bar, # verifies that all reviews page opens and is filtered by the correct rating score addon.stats.bar_grouped_ratings[2].click() reviews = Reviews(selenium, base_url).wait_for_page_to_load() select = Select(reviews.filter_by_score) assert 'Show only three-star reviews' in select.first_selected_option.text
def test_click_stats_rating_bar(selenium, base_url, variables): extension = variables['addon_with_stats'] selenium.get(f'{base_url}/addon/{extension}') addon = Detail(selenium, base_url).wait_for_page_to_load() # clicks on the first rating bar, verifies that all reviews page opens and # is filtered by the correct rating score, which is 5 stars for the first bar addon.stats.rating_bars[0].click() reviews = Reviews(selenium, base_url).wait_for_page_to_load() select = Select(reviews.filter_by_score) assert 'Show only five-star reviews' in select.first_selected_option.text
def test_user_review_permalink(selenium, base_url, variables): extension = variables['detail_extension_slug'] selenium.get(f'{base_url}/addon/{extension}') addon = Detail(selenium, base_url).wait_for_page_to_load() addon.login('rating_user') # click on the review permalink (post date) and check that the All reviews page opens # with the posted user review on top (i.e. the user display name is in the All Reviews page title) addon.ratings.review_permalink.click() reviews = Reviews(selenium, base_url).wait_for_page_to_load() assert 'rating_user' in reviews.user_review_permalink
def test_click_stats_bar_rating_counts(selenium, base_url, variables): extension = variables['addon_with_stats'] selenium.get(f'{base_url}/addon/{extension}') addon = Detail(selenium, base_url).wait_for_page_to_load() # clicks on the second bar ratings count (number displayed on the right side of the bar) # verifies that all reviews page opens and is filtered by the correct rating score # which should be 4 stars in this case addon.stats.bar_rating_counts[1].click() reviews = Reviews(selenium, base_url).wait_for_page_to_load() select = Select(reviews.filter_by_score) assert 'Show only four-star reviews' in select.first_selected_option.text
def test_click_on_review_posting_time_link(selenium, base_url, variables): # this test checks that if we go to all reviews page and clik on a review's posting time link (ex: 2 months ago) # it displays the review in a different section from the others extension = variables['detail_extension_slug'] selenium.get(f'{base_url}/addon/{extension}/reviews') reviews = Reviews(selenium, base_url).wait_for_page_to_load() # save the review info review_rating = reviews.review_items[0].rating_stars.get_attribute('title') review_author = reviews.review_items[0].rating_user.text review_body = reviews.review_items[0].review_body # click on posting time link reviews.review_items[0].posting_date.click() # check that the featured review is the same one assert review_rating in reviews.featured_review_section.rating_stars.get_attribute( 'title') assert review_author in reviews.featured_review_section.author.text assert review_body in reviews.featured_review_section.body.text
def click_all_reviews_link(self): self.find_element(*self._all_reviews_link_locator).click() return Reviews(self.selenium, self.page.base_url).wait_for_page_to_load()
def stats_reviews_link(self): self.addon_reviews_stats.find_element(By.CSS_SELECTOR, 'dt a').click() return Reviews(self.selenium, self.page.base_url).wait_for_page_to_load()
def user_review_items(self): items = self.find_elements(*self._user_review_list_locator) reviews = Reviews(self.selenium, self.page.base_url).wait_for_page_to_load() return [reviews.UserReview(self, el) for el in items]