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_searching_with_empty_field_returns_results(self, mozwebqa): home_page = Home(mozwebqa) home_page.go_to_homepage() search_page = home_page.search_for("") Assert.greater(len(search_page.results), 0)
def test_that_after_writing_a_review_clicking_back_goes_to_app_page( self, mozwebqa, new_user): """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() details_page = home_page.go_to_first_free_app_page() assert details_page.is_product_details_visible app_name = details_page.title # Write a review. review_box = details_page.click_write_review() details_page.login(new_user['email'], new_user['password']) 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() reviews_page.header.click_back() assert details_page.is_product_details_visible assert app_name == details_page.title
def test_category_items(self, mozwebqa): home = Home(mozwebqa) home.tab("Categories").click() Assert.true(home.is_categories_region_visible) for i in range(len(home.categories)): Assert.equal(home.categories[i].name, self.expected_category_items[i])
def test_that_verifies_categories_menu(self, mozwebqa): home_page = Home(mozwebqa) home_page.go_to_homepage() categories = home_page.nav_menu.click_categories() Assert.greater(len(categories.categories), 0)
def test_searching_with_no_matching_results(self, mozwebqa): home_page = Home(mozwebqa) home_page.go_to_homepage() search_page = home_page.search_for(self.search_term_with_no_result) Assert.equal("No results found", search_page.no_results_text)
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() details_page = home_page.go_to_first_free_app_page() Assert.true(details_page.is_product_details_visible) app_name = details_page.title # Write a review. review_box = details_page.click_write_review() acct = self.create_new_user(mozwebqa) details_page.login(acct) review_box.write_a_review(mock_review['rating'], mock_review['body']) 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(app_name, details_page.title)
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_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() details_page.login_with_user_from_other_pages(user="******") add_review_page = AddReview(mozwebqa) review_page = add_review_page.write_a_review(mock_review['rating'], mock_review['body']) review_page.wait_for_ajax_on_page_finish() review_page.wait_for_reviews_visible() Assert.true(review_page.is_successful_message, "Review not added: %s" % review_page.notification_message) # After clicking back, current page is the app's details page. review_page.header.click_back() Assert.true(details_page.is_product_details_visible) Assert.equal(self.app_name, details_page.title)
def test_that_after_writing_a_review_clicking_back_goes_to_app_page(self, mozwebqa, new_user): """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() details_page = home_page.go_to_first_free_app_page() assert details_page.is_product_details_visible app_name = details_page.title # Write a review. review_box = details_page.click_write_review() details_page.login(new_user["email"], new_user["password"]) 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() reviews_page.header.click_back() assert details_page.is_product_details_visible assert app_name == details_page.title
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_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. review_box = details_page.click_write_review() details_page.login_with_user_from_other_pages(user="******") review_box.write_a_review(mock_review['rating'], mock_review['body']) Assert.equal(details_page.notification_message, "Your review was posted") # Go to the reviews page and delete the review reviews_page = details_page.click_view_reviews() reviews = reviews_page.reviews[0] reviews.delete() reviews_page.wait_notification_box_visible() Assert.equal(details_page.notification_message, "Your review was deleted") # After clicking back, current page is the app's details page. reviews_page.header.click_back() Assert.true(details_page.is_product_details_visible) Assert.equal(self.app_name, details_page.title)
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_that_verifies_categories_section(self, mozwebqa): home_page = Home(mozwebqa) home_page.go_to_homepage() Assert.true(home_page.is_category_section_visible) Assert.equal(len(home_page.categories), 9)
def test_searching_with_no_matching_results(self, mozwebqa): home_page = Home(mozwebqa) home_page.go_to_homepage() search_page = home_page.search_for(self.search_term_with_no_result) Assert.equal('No results found', search_page.no_results_text)
def test_that_negative_search_does_not_return_results( self, base_url, selenium): home = Home(base_url, selenium).open() search_page = home.search_for('frfx') assert 0 == len( search_page.results), 'Search results found but none expected'
def test_category_items(self, mozwebqa): home = Home(mozwebqa) home.tab('Categories').click() Assert.true(home.is_categories_region_visible) for i in range(len(home.categories)): Assert.equal(home.categories[i].name, self.expected_category_items[i])
def test_that_verifies_featured_application_section(self, mozwebqa): home_page = Home(mozwebqa) home_page.go_to_homepage() # Check if featured section is visible and contains applications Assert.true(home_page.is_featured_section_visible) Assert.equal(home_page.featured_section_elements_count, 6)
def test_searching_with_no_matching_results(self, mozwebqa): search_term_with_no_result = 'abcdefghij' home_page = Home(mozwebqa) home_page.go_to_homepage() search_page = home_page.header.search(search_term_with_no_result) Assert.equal('No results found', search_page.no_results_text)
def test_that_checks_the_vote_of_an_article(self, base_url, selenium): home = Home(base_url, selenium).open() article_page = home.search_for('firefox').results[0].click() assert '| Mozilla Support' in article_page.page_title assert 'Was this article helpful?' == article_page.helpful_header_text article_page.click_helpful_button() article_page.wait_for_vote_message_text('Glad to hear it \u2014 thanks for the feedback!')
def test_that_searching_returns_results(self, mozwebqa): home_page = Home(mozwebqa) home_page.go_to_homepage() search_page = home_page.search_for(self.search_term) Assert.greater(len(search_page.results), 0) Assert.contains(self.search_term, search_page.results[0].name)
def test_that_checks_the_vote_of_an_article(self, base_url, selenium): home = Home(base_url, selenium).open() article_page = home.search_for('firefox').results[0].click() assert '| Mozilla Support' in article_page.page_title assert 'Was this article helpful?' == article_page.helpful_header_text article_page.click_helpful_button() article_page.wait_for_vote_message_text(u'Glad to hear it \u2014 thanks for the feedback!')
def test_all_featured_extensions_link(self, base_url, selenium): home = Home(base_url, selenium) assert home.is_the_current_page assert 'Featured' == home.default_selected_tab_text featured_extensions = home.click_all_featured_addons_link() assert 'ADD-ONS' == featured_extensions.title assert 'Featured Extensions' == featured_extensions.page_header assert 'sort=featured' in featured_extensions.get_url_current_page()
def test_user_can_login_and_logout(self, base_url, selenium, new_user): home_page = Home(base_url, selenium) home_page.go_to_homepage() home_page.more_menu.click_sign_in() home_page.login(new_user['email'], new_user['password']) settings_page = home_page.more_menu.click_settings() assert new_user['email'] == settings_page.email_text home_page = settings_page.more_menu.click_sign_out() assert home_page.is_sign_in_visible
def test_all_featured_extensions_link(self, mozwebqa): home = Home(mozwebqa) assert home.is_the_current_page assert 'Featured' == home.default_selected_tab_text featured_extensions = home.click_all_featured_addons_link() assert 'ADD-ONS' == featured_extensions.title assert 'Featured Extensions' == featured_extensions.page_header assert 'sort=featured' in featured_extensions.get_url_current_page()
def test_that_checks_learn_more_link(self, mozwebqa): home = Home(mozwebqa) Assert.true(home.is_the_current_page) Assert.equal(u'Learn More\xbb', home.learn_more_text) home.click_learn_more() Assert.true(home.is_learn_more_msg_visible) Assert.equal("Add-ons are applications that let you personalize Firefox with extra functionality and style. Whether you mistype the name of a website or can't read a busy page, there's an add-on to improve your on-the-go browsing.", home.learn_more_msg_text)
def test_user_can_login_and_logout(self, mozwebqa, new_user): home_page = Home(mozwebqa) home_page.go_to_homepage() home_page.nav_menu.click_sign_in() home_page.login(new_user['email'], new_user['password']) settings_page = home_page.nav_menu.click_settings() assert new_user['email'] == settings_page.email_text settings_page.click_sign_out() assert settings_page.is_sign_in_visible
def test_switch_between_new_and_popular_pages(self, mozwebqa): home_page = Home(mozwebqa) home_page.go_to_homepage() popular_apps = home_page.nav_menu.click_popular() assert 'Popular' == home_page.feed_title_text assert len(popular_apps) > 0 new_apps = home_page.nav_menu.click_new() assert 'New' == home_page.feed_title_text assert len(new_apps) > 0
def test_that_verifies_categories_menu(self, mozwebqa): home_page = Home(mozwebqa) home_page.go_to_homepage() Assert.true(home_page.is_nav_menu_visible) home_page.open_categories_menu() Assert.true(home_page.is_category_section_visible) Assert.greater(len(home_page.categories), 0)
def test_category_items(self, mozwebqa): """ https://www.pivotaltracker.com/story/show/26074381 """ home = Home(mozwebqa) home.tab('Categories').click() Assert.true(home.is_categories_region_visible) for i in range(len(home.categories)): Assert.equal(home.categories[i].name, self.expected_category_items[i])
def test_that_searching_returns_results(self, mozwebqa): home_page = Home(mozwebqa) home_page.go_to_homepage() details_page = home_page.go_to_first_free_app_page() search_term = details_page.title details_page.header.click_back() search_page = home_page.header.search(search_term) results = search_page.results() assert len(results) > 0 assert search_term in [result.name for result in results]
def test_that_searching_returns_results(self, mozwebqa): home_page = Home(mozwebqa) home_page.go_to_homepage() details_page = home_page.go_to_first_free_app_page() search_term = details_page.title details_page.header.click_back() search_page = home_page.header.search(search_term) results = search_page.items() assert len(results) > 0 assert search_term in [result.name for result in results]
def test_user_sign_in_from_my_apps(self, mozwebqa): home_page = Home(mozwebqa) home_page.go_to_homepage() settings_page = home_page.header.click_settings() my_apps = settings_page.click_my_apps(logged_in=False) my_apps.login(user="******") Assert.true(my_apps.are_my_app_visible)
def test_switch_between_new_and_popular_pages(self, mozwebqa): home_page = Home(mozwebqa) home_page.go_to_homepage() page = home_page.click_apps() page.click_popular() assert page.is_popular_selected assert len(page.items()) > 0 page.click_new() assert page.is_new_selected assert len(page.items()) > 0
def test_switch_between_new_and_popular_pages(self, mozwebqa): home_page = Home(mozwebqa) home_page.go_to_homepage() popular_apps = home_page.nav_menu.click_popular() Assert.equal('Popular', home_page.feed_title_text) Assert.true(len(popular_apps) > 0) new_apps = home_page.nav_menu.click_new() Assert.equal('New', home_page.feed_title_text) Assert.true(len(new_apps) > 0)
def test_logout(self, base_url, selenium, variables): user = variables['users']['default'] home_page = Home(base_url, selenium).open() home_page.log_in(user['username'], user['password']) assert home_page.is_user_logged_in, 'User is not shown to be logged in' # sign out home_page.log_out() home_page.is_the_current_page assert not home_page.is_user_logged_in
def test_user_can_login_and_logout(self, mozwebqa): home_page = Home(mozwebqa) home_page.go_to_homepage() settings_page = home_page.header.click_settings() settings_page.login(user="******") Assert.equal(settings_page.email_text, mozwebqa.credentials["default"]["email"]) settings_page.click_logout() Assert.true(settings_page.is_sign_in_visible)
def test_that_verifies_categories_section(self, mozwebqa): home_page = Home(mozwebqa) home_page.go_to_homepage() Assert.true(home_page.is_featured_section_visible) Assert.true(home_page.is_gallery_section_visible) home_page.expand_all_categories_section() Assert.true(home_page.is_category_section_visible) Assert.greater(len(home_page.categories), 0)
def test_that_checks_learn_more_link(self, mozwebqa): home = Home(mozwebqa) assert home.is_the_current_page assert u'Learn More\xbb' == home.learn_more_text home.click_learn_more() assert home.is_learn_more_msg_visible assert ('Add-ons are applications that let you personalize Firefox ' 'with extra functionality and style. Whether you mistype the ' 'name of a website or can\'t read a busy page, there\'s an ' 'add-on to improve your on-the-go browsing.' == home.learn_more_msg_text)
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() details_page = home_page.go_to_first_free_app_page() assert details_page.header.is_back_button_visible assert details_page.is_author_visible assert details_page.is_app_icon_present assert details_page.is_rating_visible assert details_page.is_product_details_visible assert details_page.is_description_visible
def test_that_checks_learn_more_link(self, base_url, selenium): home = Home(base_url, selenium) assert home.is_the_current_page assert u'Learn More\xbb' == home.learn_more_text home.click_learn_more() assert home.is_learn_more_msg_visible assert ('Add-ons are applications that let you personalize Firefox ' 'with extra functionality and style. Whether you mistype the ' 'name of a website or can\'t read a busy page, there\'s an ' 'add-on to improve your on-the-go browsing.' == home.learn_more_msg_text)
def test_all_featured_extensions_link(self, mozwebqa): home = Home(mozwebqa) Assert.true(home.is_the_current_page) Assert.equal(home.default_selected_tab_text, 'Featured') featured_extensions = home.click_all_featured_addons_link() Assert.equal(featured_extensions.title, 'ADD-ONS') Assert.equal(featured_extensions.page_header, 'Featured Extensions') Assert.contains('sort=featured', featured_extensions.get_url_current_page())
def test_user_sign_in_from_my_apps(self, mozwebqa): home_page = Home(mozwebqa) home_page.go_to_homepage() settings_page = home_page.header.click_settings() my_apps = settings_page.click_my_apps(logged_in=False) my_apps.click_sign_in() acct = self.get_user(mozwebqa) my_apps.login(acct) Assert.true(my_apps.are_my_app_visible)
def test_that_searching_returns_results(self, mozwebqa): home_page = Home(mozwebqa) home_page.go_to_homepage() search_term = self._take_first_new_app_name(mozwebqa) search_page = home_page.search_for(search_term) Assert.greater(len(search_page.results), 0) # Check that the results contains the search term for i in range(len(search_page.results)): if search_term == search_page.results[i].name: Assert.equal(search_term, search_page.results[i].name)
def test_sort_by_region(self, base_url, selenium): home = Home(base_url, selenium) extensions_page = home.click_all_featured_addons_link() sort_menu = extensions_page.click_sort_by() assert sort_menu.is_extensions_dropdown_visible actual_options = sort_menu.options expected_options = self.sort_options assert len(expected_options) == len(actual_options) for i in range(len(actual_options)): assert expected_options[i] == actual_options[i].name assert actual_options[i].is_option_visible
def test_sort_by_region(self, mozwebqa): home = Home(mozwebqa) extensions_page = home.click_all_featured_addons_link() sort_menu = extensions_page.click_sort_by() Assert.true(sort_menu.is_extensions_dropdown_visible) actual_options = sort_menu.options expected_options = self.sort_options Assert.equal(len(actual_options), len(expected_options)) for i in range(len(actual_options)): Assert.equal(actual_options[i].name, expected_options[i]) Assert.true(actual_options[i].is_option_visible)
def test_all_featured_extensions_link(self, mozwebqa): """ litmus 15136 https://litmus.mozilla.org/show_test.cgi?id=15136 """ home = Home(mozwebqa) Assert.true(home.is_the_current_page) Assert.equal(home.default_selected_tab_text, 'Featured') featured_extensions = home.click_all_featured_addons_link() Assert.equal(featured_extensions.title, 'MOBILE ADD-ONS') Assert.equal(featured_extensions.page_header, 'Featured Extensions') Assert.contains('sort=featured', featured_extensions.get_url_current_page())
def test_user_can_login_and_logout(self, mozwebqa): home_page = Home(mozwebqa) home_page.go_to_homepage() settings_page = home_page.header.click_settings() settings_page.click_sign_in() acct = self.create_new_user(mozwebqa) settings_page.login(acct) Assert.equal(settings_page.email_text, acct.email) settings_page.click_logout() Assert.true(settings_page.is_sign_in_visible)
def test_that_searching_returns_results(self, mozwebqa): home_page = Home(mozwebqa) home_page.go_to_homepage() search_term = self._take_first_new_app_name(mozwebqa) search_page = home_page.search_for(search_term) Assert.greater(len(search_page.results), 0) # Check that the results contains the search term # Bug 1058467 - [prod] Search results are not very exact # We change the weights of search results based on popularity. That is why you see other apps in there. for i in range(len(search_page.results)): if search_term == search_page.results[i].name: Assert.equal(search_term, search_page.results[i].name)
def test_that_checks_the_desktop_version_link(self, base_url, selenium): home = Home(base_url, selenium) assert home.is_the_current_page assert 'VIEW FULL SITE' == home.footer.desktop_version_text home_desktop = home.footer.click_desktop_version() assert home_desktop.is_the_current_page
def test_that_checks_the_footer_items(self, base_url, selenium): home = Home(base_url, selenium) assert home.is_the_current_page assert home.footer.is_other_language_dropdown_visible assert 'Other languages' == home.footer.other_language_text assert 'Privacy Policy' == home.footer.privacy_text assert 'Legal Notices' == home.footer.legal_text