def test_that_clicking_on_theme_name_loads_its_detail_page(self, mozwebqa): """test for litmus 15363""" amo_home_page = AddonsHomePage(mozwebqa) amo_themes_page = amo_home_page.click_themes() addon_name = amo_themes_page.addon_names[0] amo_theme_page = amo_themes_page.click_on_first_addon() Assert.contains(addon_name, amo_theme_page.addon_title)
def test_the_featured_personas_section(self, mozwebqa): """ Test for Litmus 15392 https://litmus.mozilla.org/show_test.cgi?id=15392""" amo_home_page = AddonsHomePage(mozwebqa) amo_personas_page = amo_home_page.click_personas() Assert.true(amo_personas_page.is_the_current_page) Assert.equal(6, amo_personas_page.featured_personas_count)
def test_that_category_names_are_correct(self, mozwebqa): """Test for Litmus 25795""" expected_categories = [ "Alerts & Updates", "Appearance", "Bookmarks", "Download Management", "Feeds, News & Blogging", "Games & Entertainment", "Language Support", "Photos, Music & Videos", "Privacy & Security", "Shopping", "Social & Communication", "Tabs", "Web Development", "Other"] # Get actual categories amo_home_page = AddonsHomePage(mozwebqa) categories = amo_home_page.categories() # Catch extra/missing categories with a simple count check Assert.equal(len(categories), len(expected_categories)); # Check the categories that are there against the expected list for category in categories: Assert.contains(category.name, expected_categories)
def test_themes_subcategory_page_breadcrumb(self, mozwebqa): amo_home_page = AddonsHomePage(mozwebqa) amo_themes_page = amo_home_page.click_themes() selected_category = amo_themes_page.themes_category amo_category_page = amo_themes_page.click_on_first_category() expected_breadcrumb = "Add-ons for Firefox Themes %s" % selected_category Assert.equal(expected_breadcrumb, amo_category_page.breadcrumb)
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 amo_home_page = AddonsHomePage(mozwebqa) amo_home_page.login() Assert.true(amo_home_page.is_the_current_page) Assert.true(amo_home_page.header.is_user_logged_in) # Step 2 - Load any addon detail page details_page = AddonsDetailsPage(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_clicking_on_a_subcategory_loads_expected_page(self, mozwebqa): """test for litmus 15949""" amo_home_page = AddonsHomePage(mozwebqa) amo_themes_page = amo_home_page.click_themes() selected_category = amo_themes_page.themes_category amo_category_page = amo_themes_page.click_on_first_category() Assert.equal(selected_category, amo_category_page.title)
def test_that_extensions_link_loads_extensions_page(self, mozwebqa): """ Litmus 25746 https://litmus.mozilla.org/show_test.cgi?searchType=by_id&id=25746 """ amo_home_page = AddonsHomePage(mozwebqa) extensions_page = amo_home_page.click_extensions() Assert.true(extensions_page.is_the_current_page)
def test_the_most_popular_section(self, mozwebqa): """ Test for Litmus 15394 https://litmus.mozilla.org/show_test.cgi?id=15394""" amo_home_page = AddonsHomePage(mozwebqa) amo_personas_page = amo_home_page.click_personas() Assert.true(amo_personas_page.is_the_current_page) Assert.equal(6, amo_personas_page.most_popular_count) downloads = amo_personas_page.most_popular_downloads Assert.is_sorted_descending(downloads)
def test_that_clicking_mozilla_logo_loads_mozilla_dot_org(self, mozwebqa): """ Litmus 22922 https://litmus.mozilla.org/show_test.cgi?id=22922 """ amo_home_page = AddonsHomePage(mozwebqa) Assert.true(amo_home_page.is_mozilla_logo_visible) amo_home_page.click_mozilla_logo() Assert.equal(amo_home_page.get_url_current_page(), "http://www.mozilla.org/")
def test_the_top_rated_section(self, mozwebqa): """ Test for Litmus 15395 https://litmus.mozilla.org/show_test.cgi?id=15395""" amo_home_page = AddonsHomePage(mozwebqa) amo_personas_page = amo_home_page.click_personas() Assert.true(amo_personas_page.is_the_current_page) Assert.equal(6, amo_personas_page.top_rated_count) ratings = amo_personas_page.top_rated_ratings Assert.is_sorted_descending(ratings)
def test_searching_for_collections_returns_results(self, mozwebqa): """ Litmus 17352 https://litmus.mozilla.org/show_test.cgi?id=17352 """ amo_home_page = AddonsHomePage(mozwebqa) amo_collection_page = amo_home_page.click_collections() amo_search_results_page = amo_collection_page.search_for("web") Assert.true(amo_search_results_page.result_count > 0)
def test_that_clicking_see_all_personas_link_works(self, mozwebqa): """ Litmus 29699 https://litmus.mozilla.org/show_test.cgi?id=29699 """ amo_home_page = AddonsHomePage(mozwebqa) featured_persona_page = amo_home_page.click_featured_personas_see_all_link() Assert.true(featured_persona_page.is_the_current_page) Assert.equal(featured_persona_page.persona_header, 'Personas')
def test_that_all_category_links_work(self, mozwebqa): "Test for Litmus 25796" amo_home_page = AddonsHomePage(mozwebqa) categories = amo_home_page.categories() for category in categories: category_name = category.name category_page = category.click_link() Assert.contains(category_name, category_page.category_page_title) Assert.equal(category_name, category_page.category_header_title) amo_home_page = AddonsHomePage(mozwebqa)
def test_start_exploring_link_in_the_promo_box(self, mozwebqa): """ Test for Litmus 12037 https://litmus.mozilla.org/show_test.cgi?id=12037""" amo_home_page = AddonsHomePage(mozwebqa) amo_personas_page = amo_home_page.click_personas() Assert.true(amo_personas_page.is_the_current_page) Assert.true(amo_personas_page.is_featured_addons_present) browse_personas_page = amo_personas_page.click_start_exploring() Assert.true(browse_personas_page.is_the_current_page) Assert.equal("up-and-coming", browse_personas_page.sort_key) Assert.equal("Up & Coming", browse_personas_page.sort_by)
def test_that_themes_can_be_sorted_by_created_date(self, mozwebqa): """ test for litmus 11638 """ amo_home_page = AddonsHomePage(mozwebqa) amo_themes_page = amo_home_page.click_themes() amo_themes_page.click_sort_by("created") addons = amo_themes_page.addon_names addons_set = set(addons) Assert.equal(len(addons), len(addons_set), "There are duplicates in the names") created_dates = amo_themes_page.addon_created_dates Assert.is_sorted_descending(created_dates) amo_themes_page.page_forward() created_dates.extend(amo_themes_page.addon_created_dates) Assert.is_sorted_descending(created_dates)
def test_that_themes_can_be_sorted_by_popularity(self, mozwebqa): """ test for litmus 11638 """ amo_home_page = AddonsHomePage(mozwebqa) amo_themes_page = amo_home_page.click_themes() amo_themes_page.click_sort_by("popular") addons = amo_themes_page.addon_names addons_set = set(addons) Assert.equal(len(addons), len(addons_set), "There are duplicates in the names") downloads = amo_themes_page.addon_download_number Assert.is_sorted_descending(downloads) amo_themes_page.page_forward() downloads.extend(amo_themes_page.addon_download_number) Assert.is_sorted_descending(downloads)
def test_other_applications_thunderbird(self, mozwebqa): """ Test for litmus 5037 https://litmus.mozilla.org/show_test.cgi?id=5037 """ amo_home_page = AddonsHomePage(mozwebqa) amo_home_page.header.click_other_applications() amo_home_page.header.click_thunderbird() Assert.true("thunderbird" in amo_home_page.get_url_current_page()) amo_home_page.header.click_other_applications() Assert.false(amo_home_page.header.is_thunderbird_visible())
def test_that_themes_categories_are_listed_on_left_hand_side(self, mozwebqa): """ test for litmus 15342""" amo_home_page = AddonsHomePage(mozwebqa) amo_themes_page = amo_home_page.click_themes() current_page_url = amo_home_page.get_url_current_page() Assert.true(current_page_url.endswith("/themes/")) default_categories = ["Animals", "Compact", "Large", "Miscellaneous", "Modern", "Nature", "OS Integration", "Retro", "Sports"] Assert.equal(amo_themes_page.categories_count, len(default_categories)) count = 0 for category in default_categories: count += 1 current_category = amo_themes_page.get_category(count) Assert.equal(category, current_category)
def test_user_can_login_and_logout(self, mozwebqa): """ Test for litmus 7857 https://litmus.mozilla.org/show_test.cgi?id=7857 Test for litmus 4859 https://litmus.mozilla.org/show_test.cgi?id=4859 """ amo_home_page = AddonsHomePage(mozwebqa) amo_home_page.login() Assert.true(amo_home_page.is_the_current_page) Assert.true(amo_home_page.header.is_user_logged_in) amo_home_page.header.click_logout() Assert.false(amo_home_page.header.is_user_logged_in)
def test_user_can_access_the_view_profile_page(self, mozwebqa): """ Test for litmus 15400 https://litmus.mozilla.org/show_test.cgi?id=15400 """ amo_home_page = AddonsHomePage(mozwebqa) amo_home_page.login() Assert.true(amo_home_page.is_the_current_page) Assert.true(amo_home_page.header.is_user_logged_in) amo_view_profile_page = amo_home_page.header.click_view_profile() Assert.equal(amo_view_profile_page.about_me, 'About Me')
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 amo_home_page = AddonsHomePage(mozwebqa) #Step 2:user logs in to submit a review amo_home_page.login() Assert.true(amo_home_page.header.is_user_logged_in) #Step 3: user loads an addon details page and clicks write a review button amo_details_page = AddonsDetailsPage(mozwebqa, 'Firebug') addon_review_box = amo_details_page.click_to_write_review() Assert.true(addon_review_box.is_review_box_visible)
def test_that_themes_can_be_sorted_by_name(self, mozwebqa): """ Test for Litmus 11727, 4839 """ amo_home_page = AddonsHomePage(mozwebqa) amo_themes_page = amo_home_page.click_themes() amo_themes_page.click_sort_by("name") addons = amo_themes_page.addon_names addons_set = set(addons) Assert.equal(len(addons), len(addons_set), "There are duplicates in the names") addons_orig = addons addons.sort() [Assert.equal(addons_orig[i], addons[i]) for i in xrange(len(addons))] amo_themes_page.page_forward() addons = amo_themes_page.addon_names addons_set = set(addons) Assert.equal(len(addons), len(addons_set), "There are duplicates in the names") addons_orig = addons addons.sort() [Assert.equal(addons_orig[i], addons[i]) for i in xrange(len(addons))]
def test_user_can_access_the_edit_profile_page(self, mozwebqa): """ Test for litmus 5039 https://litmus.mozilla.org/show_test.cgi?id=5039 """ amo_home_page = AddonsHomePage(mozwebqa) amo_home_page.login() Assert.true(amo_home_page.is_the_current_page) Assert.true(amo_home_page.header.is_user_logged_in) amo_user_edit_page = amo_home_page.header.click_edit_profile() Assert.contains("/users/edit", amo_user_edit_page.get_url_current_page()) Assert.true(amo_user_edit_page.is_the_current_page) Assert.equal("My Account", amo_user_edit_page.is_account_visible) Assert.equal("Profile", amo_user_edit_page.is_profile_visible) Assert.equal("Details", amo_user_edit_page.is_details_visible) Assert.equal("Notifications", amo_user_edit_page.is_notification_visible)
def test_that_breadcrumb_links_in_addons_details_page_work(self, mozwebqa): """ Litmus 11923 https://litmus.mozilla.org/show_test.cgi?searchType=by_id&id=11923 """ amo_home_page = AddonsHomePage(mozwebqa) amo_detail_page = AddonsDetailsPage(mozwebqa, 'firebug') Assert.true(amo_detail_page.is_breadcrumb_menu_visible) Assert.equal(amo_detail_page.breadcrumbs[0].name, 'Add-ons for Firefox') link = amo_detail_page.breadcrumbs[0].link_value amo_detail_page.breadcrumbs[0].click() Assert.true(amo_home_page.is_the_current_page) Assert.true(amo_home_page.get_url_current_page().endswith(link)) amo_home_page.return_to_previous_page() Assert.equal(amo_detail_page.breadcrumbs[1].name, 'Extensions') link = amo_detail_page.breadcrumbs[1].link_value amo_detail_page.breadcrumbs[1].click() amo_extenstions_page = ExtensionsHomePage(mozwebqa) Assert.true(amo_extenstions_page.is_the_current_page) Assert.true(amo_extenstions_page.get_url_current_page().endswith(link)) amo_home_page.return_to_previous_page() Assert.equal(amo_detail_page.breadcrumbs[2].name, 'Firebug')
def test_breadcrumb_menu_in_persona_details_page(self, mozwebqa): """ Test for Litmus 12046 https://litmus.mozilla.org/show_test.cgi?id=12046""" # Step 1, 2: Access AMO Homepage, Click on Persona category link. amo_home_page = AddonsHomePage(mozwebqa) amo_personas_page = amo_home_page.click_personas() Assert.true(amo_personas_page.is_the_current_page) # Step 3: Click on any persona. random_persona_index = random.randint(1, amo_personas_page.persona_count) print 'random_persona_index: %s' % str(random_persona_index) amo_personas_detail_page = amo_personas_page.click_persona(random_persona_index) print 'url_current_page: %s' % str(amo_personas_detail_page.get_url_current_page()) Assert.true(amo_personas_detail_page.is_the_current_page) # Verify breadcrumb menu format, i.e. Add-ons for Firefox > Personas > {Persona Name}. persona_title = amo_personas_detail_page.personas_title Assert.equal("Add-ons for Firefox", amo_personas_detail_page.get_breadcrumb_item_text(1)) Assert.equal("Personas", amo_personas_detail_page.get_breadcrumb_item_text(2)) persona_breadcrumb_title = len(persona_title) > 40 and '%s...' % persona_title[:40] or persona_title Assert.equal(amo_personas_detail_page.get_breadcrumb_item_text(3), persona_breadcrumb_title) # Step 4: Click on the links present in the Breadcrumb menu. # Verify that the Personas link loads the Personas home page. amo_personas_detail_page.click_breadcrumb_item("Personas") Assert.true(amo_personas_page.is_the_current_page) amo_personas_page.return_to_previous_page() Assert.true(amo_personas_detail_page.is_the_current_page) # Verify that the Add-ons for Firefox link loads the AMO home page. amo_personas_detail_page.click_breadcrumb_item("Add-ons for Firefox") Assert.true(amo_home_page.is_the_current_page)
def test_that_clicking_on_addon_name_loads_details_page(self, mozwebqa): """ Litmus 25812 https://litmus.mozilla.org/show_test.cgi?id=25812""" amo_home_page = AddonsHomePage(mozwebqa) amo_details_page = amo_home_page.click_on_first_addon() Assert.true(amo_details_page.is_the_current_page)
def test_that_other_applications_link_has_tooltip(self, mozwebqa): """ Litmus 22925 https://litmus.mozilla.org/show_test.cgi?id=29698 """ amo_home_page = AddonsHomePage(mozwebqa) tooltip = amo_home_page.get_title_of_link('Other applications') Assert.equal(tooltip, 'Find add-ons for other applications')
def test_that_themes_page_has_correct_title(self, mozwebqa): """test for litmus 15340""" amo_home_page = AddonsHomePage(mozwebqa) amo_themes_page = amo_home_page.click_themes() expected_title = "Most Popular :: Themes :: Add-ons for Firefox" Assert.equal(expected_title, amo_themes_page.page_title)
def test_themes_page_breadcrumb(self, mozwebqa): """test for litmus 15344""" amo_home_page = AddonsHomePage(mozwebqa) amo_themes_page = amo_home_page.click_themes() expected_breadcrumb = "Add-ons for Firefox Themes" Assert.equal(expected_breadcrumb, amo_themes_page.themes_breadcrumb)
def test_that_counters_show_the_same_number_of_themes(self, mozwebqa): """test for litmus 15345""" amo_home_page = AddonsHomePage(mozwebqa) amo_themes_page = amo_home_page.click_themes() Assert.equal(amo_themes_page.top_counter, amo_themes_page.bottom_counter)