def test_that_new_review_is_saved(self, mozwebqa): """ Litmus 22921 https://litmus.mozilla.org/show_test.cgi?id=22921 """ # Step 1 - Login into AMO home_page = Home(mozwebqa) home_page.login() Assert.true(home_page.is_the_current_page) Assert.true(home_page.header.is_user_logged_in) # Step 2 - Load any addon detail page details_page = Details(mozwebqa, 'Adblock Plus') # Step 3 - Click on "Write review" button write_review_block = details_page.click_to_write_review() # Step 4 - Write a review body = 'Automatic addon review by Selenium tests' write_review_block.enter_review_with_text(body) write_review_block.set_review_rating(1) review_page = write_review_block.click_to_save_review() # Step 5 - Assert review review = review_page.review() Assert.equal(review.rating, 1) Assert.equal(review.author, mozwebqa.credentials['default']['name']) date = datetime.now().strftime("%B %d, %Y") # there are no leading zero-signs on day so we need to remove them too date = date.replace(' 0', ' ') Assert.equal(review.date, date) Assert.equal(review.text, body)
def test_that_five_star_rating_increments(self, mozwebqa): """ Litmus 22920 https://litmus.mozilla.org/show_test.cgi?id=22920 """ # Step 1 - Login into AMO home_page = Home(mozwebqa) home_page.login() Assert.true(home_page.header.is_user_logged_in) # Step 2 - Go to add-ons listing page sorted by rating extensions_home_page = home_page.click_to_explore('Top Rated') # Step 3 - Pick an addon with no reviews extensions_home_page.go_to_last_page() addon = extensions_home_page.extensions[-1] # the last one is without rating addon_name = addon.name details_page = Details(mozwebqa, addon_name) # Step 4 - Click on the "Write review" button write_review_block = details_page.click_to_write_review() # Step 5 - Add review with 1-star rating body = 'Automatic addon review by Selenium tests' write_review_block.enter_review_with_text(body) write_review_block.set_review_rating(5) write_review_block.click_to_save_review() # Step 6 - Ensure rating increased by one details_page = Details(mozwebqa, addon_name) new_rating_counter = details_page.get_rating_counter(5) Assert.equal(new_rating_counter, 1)
def test_that_clicking_info_link_slides_down_page_to_version_info(self, mozwebqa): """ Test for Litmus 25725 https://litmus.mozilla.org/show_test.cgi?id=25725 """ details_page = Details(mozwebqa, "firebug") Assert.true(details_page.is_version_info_link_visible) details_page.click_version_info_link() Assert.equal(details_page.version_info_link, details_page.version_information) Assert.true(details_page.is_version_information_section_expanded) Assert.true(details_page.does_page_scroll_to_version_information_section)
def test_the_developers_comments_section(self, mozwebqa): """ Test for Litmus 25724 https://litmus.mozilla.org/show_test.cgi?id=25724 """ details_page = Details(mozwebqa, "Firebug") Assert.equal(details_page.devs_comments_title, u"Developer\u2019s Comments") details_page.click_devs_comments_title() Assert.true(details_page.is_devs_comments_section_expanded()) Assert.true(details_page.is_devs_comments_section_visible) Assert.not_none(re.match("(\w+\s*){3,}", details_page.devs_comments_message))
def test_that_external_link_leads_to_addon_website(self, mozwebqa): """ Litmus 11809 https://litmus.mozilla.org/show_test.cgi?id=11809 """ # Step 1 - Open AMO Home # Step 2 - Open Adblock Plus details page details_page = Details(mozwebqa, "Adblock Plus") website_link = details_page.website Assert.true(website_link != "") # Step 3 - Follow external website link details_page.click_website_link() Assert.true(website_link in details_page.get_url_current_page())
def test_that_add_to_collection_flyout_for_anonymous_users(self, mozwebqa): """ Litmus 25711 https://litmus.mozilla.org/show_test.cgi?searchType=by_id&id=25711 """ details_page = Details(mozwebqa, "Firebug") details_page.click_add_to_collection_widget() Assert.true(details_page.is_collection_widget_visible) Assert.true(details_page.is_collection_widget_button_visible) Assert.equal(details_page.collection_widget_button, "Create an Add-ons Account") Assert.true(details_page.is_collection_widget_login_link_visible) Assert.equal(details_page.collection_widget_login_link, "log in to your current account")
def test_that_review_usernames_are_clickable(self, mozwebqa): """ Litmus 4842 https://litmus.mozilla.org/show_test.cgi?id=4842 """ addon_name = "firebug" detail_page = Details(mozwebqa, addon_name) for review in detail_page.reviews(): username = review.username amo_user_page = review.click_username() Assert.equal(username, amo_user_page.username) Details(mozwebqa, addon_name)
def test_navigating_to_other_addons(self, mozwebqa): """ Litmus 11926 https://litmus.mozilla.org/show_test.cgi?id=11926""" addon_name = "firebug" detail_page = Details(mozwebqa, addon_name) addons = detail_page.other_addons() for addon in addons: name = addon.name addon.click_addon_link() Assert.contains(name, detail_page.name) detail_page = Details(mozwebqa, addon_name)
def test_click_on_other_collections(self, mozwebqa): """ Litmus 25722 https://litmus.mozilla.org/show_test.cgi?searchType=by_id&id=25722 """ details_pg = Details(mozwebqa, "Firebug") collections = details_pg.part_of_collections() for collection in collections: name = collection.name collection_pg = collection.click_collection() Assert.equal(name, collection_pg.collection_name, "expected collection name doesn't match the page header") details_pg = Details(mozwebqa, "Firebug")
def test_that_the_development_channel_expands(self, mozwebqa): """ Litmus 25711 https://litmus.mozilla.org/show_test.cgi?searchType=by_id&id=25711 """ details_page = Details(mozwebqa, "Firebug") Assert.true(details_page.is_development_channel_header_visible) Assert.equal("Development Channel", details_page.development_channel_text) Assert.false(details_page.is_development_channel_content_visible) details_page.click_development_channel() Assert.true(details_page.is_development_channel_content_visible) details_page.click_development_channel() Assert.false(details_page.is_development_channel_content_visible)
def test_that_add_a_review_button_works(self, mozwebqa): """ Litmus 25729 https://litmus.mozilla.org/show_test.cgi?searchType=by_id&id=25729 """ # Step 1: Addons Home Page loads and Addons Details loads home_page = Home(mozwebqa) # Step 2:user logs in to submit a review home_page.login() Assert.true(home_page.header.is_user_logged_in) # Step 3: user loads an addon details page and clicks write a review button details_page = Details(mozwebqa, "Firebug") review_box = details_page.click_to_write_review() Assert.true(review_box.is_review_box_visible)
def test_that_whats_this_link_for_source_license_links_to_an_answer_in_faq(self, mozwebqa): """ Test for Litmus 11530""" details_page = Details(mozwebqa, "Firebug") user_faq_page = details_page.click_whats_this_license() Assert.not_none(re.match("(\w+\s*){3,}", user_faq_page.license_question)) Assert.not_none(re.match("(\w+\s*){3,}", user_faq_page.license_answer))
def test_that_all_reviews_hyperlink_works(self, mozwebqa): """ Test for litmus 4843 https://litmus.mozilla.org/show_test.cgi?id=4843 """ #Open details page for Adblock Plus details_page = Details(mozwebqa, 'Adblock Plus') Assert.true(details_page.has_reviews) details_page.click_all_reviews_link() Assert.equal(details_page.review_count, 20) #Go to the last page and check that the next button is not present details_page.go_to_last_page() Assert.false(details_page.is_next_link_enabeld) #Go one page back, check that it has 20 reviews #that the page number decreases and that the next link is visible page_number = details_page.current_page details_page.page_back() Assert.true(details_page.is_next_link_visible) Assert.equal(details_page.review_count, 20) Assert.equal(details_page.current_page, page_number - 1) #Go to the first page and check that the prev button is not present details_page.go_to_first_page() Assert.false(details_page.is_prev_link_enabled) #Go one page forward, check that it has 20 reviews, #that the page number increases and that the prev link is visible page_number = details_page.current_page details_page.page_forward() Assert.true(details_page.is_prev_link_visible) Assert.equal(details_page.review_count, 20) Assert.equal(details_page.current_page, page_number + 1)