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_desktop_version_link(self, mozwebqa): home = Home(mozwebqa) 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_firefox_logo(self, mozwebqa): home = Home(mozwebqa) Assert.true(home.is_the_current_page) Assert.true(home.is_header_firefox_logo_visible) Assert.contains('firefox.png', home.firefox_header_logo_src)
def test_that_checks_the_search_box_and_button(self, mozwebqa): home = Home(mozwebqa) Assert.true(home.is_the_current_page) Assert.true(home.is_search_box_visible) Assert.equal('search for add-ons', home.search_box_placeholder) Assert.true(home.is_search_button_visible)
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.nav_menu.click_sign_in() home_page.login(new_user['email'], new_user['password']) details_page = home_page.go_to_first_free_app_page() Assert.true(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.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, new_user['email']) Assert.contains(review.text, mock_review['body'])
def test_expandable_header(self, mozwebqa): home = Home(mozwebqa) home.header.click_header_menu() Assert.true(home.header.is_dropdown_menu_visible) menu_names = [menu.name for menu in home.header.dropdown_menu_items] Assert.equal(menu_names, self.expected_menu_items)
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_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
def test_that_checks_header_text_and_page_title(self, mozwebqa): home = Home(mozwebqa) Assert.true(home.is_the_current_page) Assert.equal('ADD-ONS', home.header_text) Assert.equal('Return to the Firefox Add-ons homepage', home.header_title) Assert.equal('Easy ways to personalize.', home.header_statement_text)
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): """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_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, 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_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_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() app_name = home_page.app_under_test # 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(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() 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 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_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_the_amo_logo_text_and_title(self, base_url, selenium): home = Home(base_url, selenium) assert home.is_the_current_page assert 'Return to the Firefox Add-ons homepage', home.logo_title assert 'ADD-ONS', home.logo_text assert '/img/zamboni/app_icons/firefox.png' in home.logo_image_src assert 'Easy ways to personalize.' == home.subtitle
def click_logout(self): self.scroll_to_element(*self._logout_locator) self.selenium.find_element(*self._logout_locator).click() WebDriverWait(self.selenium, self.timeout).until( lambda s: self.is_element_not_visible(*self._logout_locator)) from pages.mobile.home import Home return Home(self.testsetup)
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_that_checks_the_footer_items(self, mozwebqa): home = Home(mozwebqa) Assert.true(home.is_the_current_page) Assert.true(home.footer.is_other_language_dropdown_visible) Assert.equal('Other languages', home.footer.other_language_text) Assert.equal('Privacy Policy', home.footer.privacy_text) Assert.equal('Legal Notices', home.footer.legal_text)
def test_that_checks_the_desktop_version_link(self, mozwebqa): home = Home(mozwebqa) Assert.true(home.is_the_current_page) Assert.equal('VIEW FULL SITE', home.footer.desktop_version_text) home_desktop = home.footer.click_desktop_version() Assert.true(home_desktop.is_the_current_page)
def click_sign_out(self): sign_out_button = self.selenium.find_element(*self._sign_out_locator) self.scroll_to_element(sign_out_button) sign_out_button.click() sign_in_button = self.selenium.find_element(*self._sign_in_locator) WebDriverWait(self.selenium, self.timeout).until(lambda s: sign_in_button.is_displayed()) from pages.mobile.home import Home return Home(self.testsetup)
def test_the_amo_logo_text_and_title(self, mozwebqa): home = Home(mozwebqa) Assert.true(home.is_the_current_page) Assert.equal('Return to the Firefox Add-ons homepage', home.logo_title) Assert.equal('ADD-ONS', home.logo_text) Assert.contains('/img/zamboni/app_icons/firefox.png', home.logo_image_src) Assert.equal('Easy ways to personalize.', home.subtitle)
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_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_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_user_can_login_and_logout(self, mozwebqa, new_user): 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']) 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_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 click_sign_out(self): self.open() el = self.selenium.find_element(*self._sign_out_menu_item_locator) self.scroll_to_element(el) el.click() from pages.mobile.home import Home home = Home(self.testsetup) WebDriverWait(self.selenium, self.timeout).until(lambda s: home.is_sign_in_visible) return home
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]