def test_that_checks_editing_basic_info_for_a_free_app(self, mozwebqa, login, free_app): """Test the happy path for editing the basic information for a free submitted app.""" updated_app = MockApplication( categories=[('Entertainment', False), ('Games', True), ('Music', True)], ) edit_listing = self._go_to_edit_listing_page(mozwebqa, free_app) # bring up the basic info form for the first free app basic_info_region = edit_listing.click_edit_basic_info() # update the details of the app basic_info_region.type_url_end(updated_app['url_end']) basic_info_region.type_description(updated_app['description']) for category in updated_app['categories']: # check/uncheck the checkbox according to the app value basic_info_region.select_categories(*category) basic_info_region.click_save_changes() # check that the listing has been updated Assert.true(edit_listing.no_forms_are_open) Assert.contains(updated_app['url_end'], edit_listing.url_end) Assert.equal(edit_listing.description, updated_app['description']) Assert.equal(edit_listing.categories.sort(), updated_app['categories'].sort())
def test_assert_that_a_app_can_be_added_and_deleted_via_the_api(self, mozwebqa_devhub_logged_in): mock_app = MockApplication() # generate mock app # init API client mk_api = MarketplaceAPI.get_client(mozwebqa_devhub_logged_in.base_url, mozwebqa_devhub_logged_in.credentials) mk_api.submit_app(mock_app) # submit app app_status = mk_api.app_status(mock_app) # get app data from API # check that app is pending Assert.equal(2, app_status['status']) # Check for app on the site dev_home = Home(mozwebqa_devhub_logged_in) app_status_page = dev_home.go_to_app_status_page(mock_app) Assert.contains(mock_app.name, app_status_page.page_title) # Delete the app mk_api.delete_app(mock_app) app_status_page = dev_home.go_to_app_status_page(mock_app) Assert.contains("We're sorry, but we can't find what you're looking for.", app_status_page.app_not_found_message)
def test_that_checks_required_field_validations_on_device_types_for_hosted_apps(self, mozwebqa_devhub_logged_in, free_app): edit_listing = self._go_to_edit_listing_page(mozwebqa_devhub_logged_in, free_app) compatibility_page = edit_listing.left_nav_menu.click_compatibility_and_payments() compatibility_page.clear_device_types() compatibility_page.click_save_changes() Assert.contains('Please select a device.', compatibility_page.device_types_error_message)
def test_that_clicking_on_theme_name_loads_its_detail_page(self, mozwebqa): """Test for Litmus 15363.""" home_page = Home(mozwebqa) themes_page = home_page.header.site_navigation_menu("Themes").click() theme_name = themes_page.addon_name(1) theme_page = themes_page.click_on_first_addon() Assert.contains(theme_name, theme_page.addon_title)
def _verify_reports_form_have_same_product(self, mozwebqa, product_name): csp = CrashStatsHomePage(mozwebqa) csp.header.select_product(product_name) Assert.contains(product_name, csp.page_title) if csp.results_found: crash_adu = csp.header.select_report("Crashes per User") Assert.equal(csp.header.current_product, crash_adu.product_select)
def test_that_verifies_the_url_of_the_statistics_page(self, mozwebqa): details_page = Details(mozwebqa, "Firebug") statistics_page = details_page.click_view_statistics() Assert.true(statistics_page.is_the_current_page) Assert.contains("/statistics", statistics_page.get_url_current_page())
def test_view_the_source_in_the_version_information(self, mozwebqa): details_page = Details(mozwebqa, "Firebug") Assert.equal(details_page.version_information_heading, "Version Information") details_page.expand_version_information() Assert.equal("View the source", details_page.view_source_code_text) view_source = details_page.click_view_source_code() Assert.contains('/files/browse/', view_source.get_url_current_page())
def test_2_upload_doc_questionnaire(self): home = MainPage() home.login(self.email, self.password) home.click_apps_menu() home.click_item("Assembly") file_name = self.doc_folder + "fw4.pdf" home.upload_doc(file_name) fields = home.input_fields # Fill all fields print len(fields) for i in range(len(fields)): home.enter_question_for_field(fields[i], "Question Number %s" % i) home.save_template("TestTemplate", "TestDescription") # Goto My Files home.back_to_home_folder() # Open Templates folder home.click_to_view("templates") home.elements[0].click_dropdown() home.elements[0].click_item() home._wait_for_results_refresh() fields = home.input_fields for i in range(len(fields)): Assert.contains("Question Number %s" % i, home.question_text) if not i == len(fields) - 1: home.click_next_tag() home.back_to_home_folder() # Cleaning up after our tests home.clear_test_data("all") home.close_browser()
def test_that_article_can_be_translated(self, mozwebqa): """ Creates a new knowledge base article. Translate article """ kb_new_article = PageProvider(mozwebqa).new_kb_article_page() # create a new article mock_article = MockArticle() kb_new_article.set_article(mock_article) kb_new_article.submit_article() kb_article_history = kb_new_article.set_article_comment_box(mock_article["comment"]) # translating kb_translate_pg = kb_article_history.navigation.click_translate_article() kb_translate_pg.click_translate_language("Esperanto (eo)") # enter the tranlation mock_article_esperanto = MockArticle(suffix="_esperanto") kb_translate_pg.type_title(mock_article_esperanto["title"]) kb_translate_pg.type_slug(mock_article_esperanto["slug"]) kb_translate_pg.type_search_result_summary(mock_article_esperanto["summary"]) kb_translate_pg.click_submit_review() change_comment = mock_article_esperanto["comment"] kb_translate_pg.type_modal_describe_changes(change_comment) kb_article_history = kb_translate_pg.click_modal_submit_changes_button() # verifying Assert.equal(change_comment, kb_article_history.most_recent_revision_comment) Assert.contains("Esperanto", kb_article_history.revision_history) # deleting kb_article_history.delete_entire_article_document()
def test_that_clicking_on_theme_name_loads_its_detail_page(self, mozwebqa): """test for litmus 15363""" home_page = Home(mozwebqa) themes_page = home_page.click_themes() theme_name = themes_page.addon_name(1) theme_page = themes_page.click_on_first_addon() Assert.contains(theme_name, theme_page.addon_title)
def test_cant_find_what_youre_looking_for_test(self, mozwebqa, search_term): search_page_obj = PageProvider(mozwebqa).search_page() search_page_obj.do_search_on_search_box(search_term) expected_text = "Can't find what you're looking for?" Assert.contains(expected_text, search_page_obj.ask_a_question_text) Assert.true(search_page_obj.is_ask_a_question_present, "Ask question link not present")
def test_view_the_source_in_the_version_information(self, mozwebqa): details_page = Details(mozwebqa, "MemChaser") Assert.equal(details_page.version_information_heading, "Version Information") details_page.click_version_information_header() Assert.equal("View the source", details_page.view_source_code.text) details_page.view_source_code.click() Assert.contains('/files/browse/', details_page.get_url_current_page())
def test_that_the_search_tag_is_present_in_the_search_results(self, mozwebqa): """Litmus 53263""" search_term = "SeaVan" home_page = Home(mozwebqa) home_page.go_to_homepage() home_page.login() Assert.true(home_page.is_the_current_page) search_page = home_page.header.search(search_term) # Check page title Assert.equal("%s | Search | Mozilla Marketplace" % search_term, search_page.page_title) # Check the breadcrumbs Assert.equal("Home", search_page.breadcrumbs[0].text) Assert.equal("Search", search_page.breadcrumbs[1].text) Assert.equal("SeaVan", search_page.breadcrumbs[2].text) # Check title for the search Assert.equal('Search Results for "%s"' % search_term, search_page.title) # Check that the first result contains the search term Assert.contains(search_term, search_page.results[0].name)
def test_assert_that_a_app_can_be_added_by_api(self, mozwebqa): mock_app = MockApplication() # generate mock app mock_app.name = "API %s" % mock_app.name # init API client mk_api = MarketplaceAPI.get_client(mozwebqa.base_url, mozwebqa.credentials) mk_api.submit_app(mock_app) # submit app app_status = mk_api.app_status(mock_app) # get app data from API # Selenium dev_home = Home(mozwebqa) dev_home.go_to_developers_homepage() dev_home.login(user="******") dev_submissions = dev_home.header.click_my_submissions() dev_submissions.sorter.sort_by("created") apps = dev_submissions.submitted_apps app_names = [] for app in apps: app_names.append(app.name) Assert.contains(app_status["name"], app_names)
def test_that_reports_form_has_same_product(self, mozwebqa, product): csp = CrashStatsHomePage(mozwebqa) csp.header.select_product(product) Assert.contains(product, csp.page_title) crash_adu = csp.header.select_report('Crashes per User') Assert.equal(crash_adu.header.current_product, crash_adu.product_select)
def test_that_products_page_links_work(self, mozwebqa, product): products_page = ProductsLinksPage(mozwebqa) Assert.equal(products_page.page_heading, 'Mozilla Products in Crash Reporter') csp = products_page.click_product(product) Assert.true(csp.get_url_current_page().endswith(product)) Assert.contains(product, csp.page_heading)
def is_the_current_page(self): if self._page_title: WebDriverWait(self.selenium, self.timeout).until(lambda s: s.title) Assert.contains(self._page_title, self.selenium.title, 'Expected page title does not match actual page title.') return True
def test_that_checks_editing_basic_info_for_a_free_app(self, mozwebqa): """Test the happy path for editing the basic information for a free submitted app. Litmus link: https://litmus.mozilla.org/show_test.cgi?id=50478 """ updated_app = MockApplication( categories=[('Entertainment', False), ('Games', True), ('Music', True)], ) dev_home = Home(mozwebqa) dev_home.go_to_developers_homepage() dev_home.login(user="******") my_apps = dev_home.header.click_my_submissions() edit_listing = my_apps.first_free_app.click_edit() # bring up the basic info form for the first free app basic_info_region = edit_listing.click_edit_basic_info() # update the details of the app basic_info_region.type_url_end(updated_app['url_end']) basic_info_region.type_description(updated_app['description']) for category in updated_app['categories']: # check/uncheck the checkbox according to the app value basic_info_region.select_categories(*category) basic_info_region.click_save_changes() # check that the listing has been updated Assert.true(edit_listing.no_forms_are_open) Assert.contains(updated_app['url_end'], edit_listing.url_end) Assert.equal(edit_listing.description, updated_app['description']) Assert.equal(edit_listing.categories.sort(), updated_app['categories'].sort())
def test_filter_results_by_location(self, mozwebqa): query = u"Greece" home_page = Home(mozwebqa) events_page = home_page.header.click_events_link() events_page.filter_for(query) Assert.contains(u"Greece", events_page.event_profile_location_text)
def test_that_checks_required_field_validations_on_basic_info_for_a_free_app(self, mozwebqa): """Ensure that all required fields generate warning messages and prevent form submission. Litmus link: https://litmus.mozilla.org/show_test.cgi?id=50478 """ dev_home = Home(mozwebqa) dev_home.go_to_developers_homepage() dev_home.login(user="******") my_apps = dev_home.header.click_my_submissions() # bring up the basic info form for the first free app edit_listing = my_apps.first_free_app.click_edit() # check App URL validation basic_info_region = edit_listing.click_edit_basic_info() basic_info_region.type_url_end('') basic_info_region.click_save_changes() Assert.true(basic_info_region.is_this_form_open) Assert.contains('This field is required.', basic_info_region.url_end_error_message) basic_info_region.click_cancel() # check Summary validation basic_info_region = edit_listing.click_edit_basic_info() basic_info_region.type_description('') basic_info_region.click_save_changes() Assert.true(basic_info_region.is_this_form_open) Assert.contains('This field is required.', basic_info_region.description_error_message) basic_info_region.click_cancel()
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() # 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(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() add_review_box = AddReview(mozwebqa) details_page = add_review_box.write_a_review(mock_review['rating'], mock_review['body']) details_page.wait_for_page_to_load() Assert.true(details_page.is_success_message_visible, "Review not added: %s" % details_page.success_message) Assert.equal(details_page.success_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_visitor_can_watch_page(self, mozwebqa): home_pg = HomePage(mozwebqa) home_pg.go_to_home_page() home_pg.personal_tools_region.click_log_in_or_create_account() log_in_or_create_account_pg = LogInOrCreateAccountPage(mozwebqa) log_in_or_create_account_pg.log_in() Assert.true(home_pg.personal_tools_region.is_log_out_visible) # Refs bug: 1058819 home_pg.header_region.unfurl_header_dropdown() # Make sure page is not currently watched if home_pg.header_region.is_unwatch_visible: home_pg.header_region.click_unwatch() home_pg.go_to_home_page() # Refs bug: 1058819 home_pg.header_region.unfurl_header_dropdown() Assert.true(home_pg.header_region.is_watch_visible) watch_pg = home_pg.header_region.click_watch() Assert.true(watch_pg.is_the_current_page) Assert.contains('The page "Main Page" has been added to your watchlist. Future changes to this page and its associated talk page will be listed there.', watch_pg.watchlist_message) watch_pg.click_return_to_page() # Refs bug: 1058819 home_pg.header_region.unfurl_header_dropdown() Assert.true(home_pg.header_region.is_unwatch_visible) unwatch_pg = home_pg.header_region.click_unwatch() Assert.equal('The page "Main Page" has been removed from your watchlist.', unwatch_pg.watchlist_message) unwatch_pg.click_return_to_page() # Refs bug: 1058819 home_pg.header_region.unfurl_header_dropdown() Assert.true(home_pg.header_region.is_watch_visible)
def test_that_checks_the_addition_of_a_review(self, mozwebqa): mock_review = MockReview() home_page = Home(mozwebqa) home_page.go_to_homepage() # Create new user and login. new_user = home_page.create_new_user() home_page.login(user=new_user) # 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() 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() # Check review Assert.true(review_page.is_successful_message, "Review not added: %s" % review_page.notification_message) Assert.equal(review_page.notification_message, "Your review was successfully added!") review = review_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_that_checks_that_summary_must_be_limited_to_1024_chars_on_basic_info_for_a_free_app(self, mozwebqa): """Ensure that the summary field cannot contain over 1024 characters. Tests: - the message showing the number of characters remaining appears with an error class if the limit is exceeded - after submission with the limit exceeded an error message is displayed - the form cannot be successfully submitted if the limit is exceeded Litmus link: https://litmus.mozilla.org/show_test.cgi?id=50478 """ dev_home = Home(mozwebqa) dev_home.go_to_developers_homepage() dev_home.login(user="******") my_apps = dev_home.header.click_my_submissions() # bring up the basic info form for the first free app edit_listing = my_apps.first_free_app.click_edit() basic_info_region = edit_listing.click_edit_basic_info() basic_info_region.type_summary('1234567890' * 103) Assert.false(basic_info_region.is_summary_char_count_ok, 'The character count for summary should display as an error but it does not') basic_info_region.click_save_changes() Assert.contains('Ensure this value has at most 1024 characters', basic_info_region.summary_error_message) Assert.true(basic_info_region.is_this_form_open)
def test_top_crasher_reports_tab_has_uuid_report(self, mozwebqa): csp = CrashStatsHomePage(mozwebqa) top_crashers = csp.click_last_product_top_crashers_link() crash_signature = top_crashers.click_first_signature() crash_signature.click_reports_tab() reports_table_count = len(crash_signature.reports) # verify crash reports table is populated Assert.greater(crash_signature.results_count_total, 0) Assert.greater(reports_table_count, 0, "No reports found") most_recent_report = crash_signature.reports[0] uuid_report = most_recent_report.click_report_date() # verify the uuid report page Assert.not_equal(uuid_report.uuid_in_body, "", "UUID not found in body") Assert.not_equal(uuid_report.uuid_in_table, "", "UUID not found in table") Assert.not_equal(uuid_report.signature_in_body, "", "Signature not found in body") Assert.not_equal(uuid_report.signature_in_table, "", "Signature not found in table") Assert.equal(uuid_report.uuid_in_body, uuid_report.uuid_in_table, 'UUID in body did not match the UUID in the table: ' 'body "%s", table "%s"' % (uuid_report.uuid_in_body, uuid_report.uuid_in_table)) Assert.contains(uuid_report.signature_in_body, uuid_report.signature_in_table, 'Signature in body did not match the signature in the ' 'table: body "%s", table "%s"' % (uuid_report.signature_in_body, uuid_report.signature_in_table))
def test_create_addon(self, mozwebqa): #This test is to check the labels of an add-on on the dashboard #Create page objects homepage_obj = HomePage(mozwebqa) homepage_obj.go_to_home_page() loginpage_obj = homepage_obj.header.click_signin() dashboard_obj = loginpage_obj.login() #Create an addon. Then go to dashboard and assert that the label is 'initial'. homepage_obj = dashboard_obj.go_to_home_page() addonpage_obj = homepage_obj.click_create_addon_btn() addon_name = addonpage_obj.package_name dashboard_obj = addonpage_obj.header.click_dashboard() Assert.true(dashboard_obj.is_the_current_page) Assert.true(dashboard_obj.addon(addon_name).is_displayed, "Addon %s not found" % addon_name) #Click on the edit button of the addon.Then create a copy of that addon and assert that the label is 'copy' addonpage_obj = dashboard_obj.addon(addon_name).click_edit() addonpage_obj.click_copy() copy_addon_name = addonpage_obj.package_name Assert.contains(addon_name, copy_addon_name) Assert.contains('copy', copy_addon_name) dashboard_obj = homepage_obj.header.click_dashboard() Assert.true(dashboard_obj.addon(copy_addon_name).is_displayed, "Addon %s not found" % copy_addon_name) dashboard_obj.delete_test_data()
def test_that_article_can_be_deleted(self, mozwebqa): """ Creates a new knowledge base article. Deletes the article. Verifies the deletion. """ kb_new_article = PageProvider(mozwebqa).new_kb_article_page() # create a new article mock_article = MockArticle() kb_new_article.set_article(mock_article) kb_new_article.submit_article() kb_article_history = kb_new_article.set_article_comment_box(mock_article["comment"]) # go to article and get URL kb_article = kb_article_history.navigation.click_article() article_url = kb_article.url_current_page # delete the same article kb_article_history = kb_article.navigation.click_show_history() kb_article_history.delete_entire_article_document() kb_article_history.selenium.get(article_url) actual_page_title = kb_article_history.page_title Assert.contains("Page Not Found", actual_page_title)
def test_dict_does_not_contain_key_failure_with_message(self): try: Assert.contains("dog", {"cat": "siamese", "horse": "arabian"}, msg="failure message") except AssertionError as e: Assert.equal(e.msg, "dog is not found in {'horse': 'arabian', 'cat': 'siamese'}. failure message")
def test_redirect_for_firefox_aliases(self, testsetup, product_alias): url = testsetup.base_url param = { 'product': product_alias['product_name'], 'os': 'win', 'lang': product_alias['lang'] } response = self._head_request(url, params=param) parsed_url = urlparse(response.url) if not ( product_alias['product_name'] == 'firefox-latest-euballot' and "download.allizom.org" in testsetup.base_url ): Assert.equal(response.status_code, requests.codes.ok, 'Redirect failed with HTTP status %s on %s \n \ For %s\n \ Redirected to %s' % \ (response.status_code, url, param, response.url)) Assert.equal(parsed_url.scheme, 'http', 'Failed on %s \nUsing %s' % (url, param)) Assert.equal(parsed_url.netloc, 'download.cdn.mozilla.net', 'Failed on %s \nUsing %s' % (url, param)) if ( product_alias['product_name'] != 'firefox-nightly-latest' and product_alias['product_name'] != 'firefox-aurora-latest' and product_alias['product_name'] != 'firefox-latest-euballot' ): Assert.contains('/%s/' % 'win32', parsed_url.path)
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 home_page = Home(mozwebqa) categories = 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_add_new_zone(cnf_configuration_pg, zone, cfme_data): '''Add new zone ''' win_domain_data = cfme_data['ldap_server'] smartproxy_ip = urlparse(cnf_configuration_pg.testsetup.base_url).netloc zone_pg = cnf_configuration_pg.click_on_settings().click_on_zones()\ .click_on_add_new() zone_pg.set_zone_info(zone['name'], zone['description'], smartproxy_ip) zone_pg.set_ntp_servers(*zone['ntp_servers']) zone_pg.set_windows_credentials(win_domain_data['bind_dn'], win_domain_data['bind_passwd']) zones_pg = zone_pg.save() Assert.contains('Zone "%s" was added' % zone['name'], zones_pg.flash.message, FLASH_MESSAGE_NOT_MATCHED)
def test_searching_for_theme_returns_results(self, mozwebqa): """ Test for Litmus 17350 https://litmus.mozilla.org/show_test.cgi?id=17350 """ amo_home_page = Home(mozwebqa) amo_themes_page = amo_home_page.header.site_navigation_menu("Themes").click() search_results = amo_themes_page.header.search_for('nasa') Assert.true(search_results.result_count > 0) for i in range(search_results.result_count): addon = search_results.result(i).click_result() Assert.contains('Themes', addon.breadcrumb) addon.return_to_previous_page()
def test_that_verifies_the_search_suggestions_list_under_the_search_field( self, mozwebqa): home_page = self._take_random_new_app_name(mozwebqa) Assert.true(home_page.is_the_current_page) search_term = self._take_first_free_app_name(mozwebqa) home_page.header.type_search_term_in_search_field(search_term) Assert.true(home_page.header.is_search_suggestion_list_visible) Assert.greater_equal(len(home_page.header.search_suggestions), 0) for suggestion in home_page.header.search_suggestions: Assert.contains(search_term, suggestion.app_name)
def test_filter_results_by_name(self, mozwebqa): # Verify name in search matches query results query = u'Reps' people_page = People(mozwebqa) people_page.go_to_people_page() people_page.filter_for(query) Assert.contains(u'Reps', people_page.people_name_text) # Check profile to verify search results where search does not match name query = u'moz_reps_user' people_page = People(mozwebqa) people_page.go_to_people_page() people_page.filter_for(query) profile_page = people_page.click_to_open_profile() Assert.contains(query, profile_page.profile_text)
def test_configure_auth_mode(cnf_configuration_pg, cfme_data): '''Configure authentication mode ''' server_data = cfme_data['ldap_server'] auth_pg = cnf_configuration_pg.click_on_settings().\ click_on_current_server_tree_node().click_on_authentication_tab() if auth_pg.current_auth_mode != server_data['mode']: auth_pg.ldap_server_fill_data(**server_data) if server_data['get_groups'] and server_data['mode'] != "database": auth_pg.validate() Assert.contains("LDAP Settings validation was successful", auth_pg.flash.message, FLASH_MESSAGE_NOT_MATCHED) auth_pg = auth_pg.save() Assert.contains("Authentication settings saved", auth_pg.flash.message, FLASH_MESSAGE_NOT_MATCHED)
def test_that_the_search_tag_is_present_in_the_search_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.header.search(search_term) # Check title for the search Assert.contains('results', search_page.search_results_section_title) # 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_the_displayed_message_for_incompatible_complete_themes( self, mozwebqa): home_page = Home(mozwebqa) complete_themes_page = home_page.header.click_complete_themes() complete_themes_page.clear_hover_cards() complete_themes = complete_themes_page.complete_themes for complete_theme in complete_themes: if complete_theme.is_incompatible: Assert.true(complete_theme.is_incompatible_flag_visible) Assert.contains('Not available', complete_theme.not_available_flag_text) else: Assert.false(complete_theme.is_incompatible_flag_visible)
def test_that_a_screenshot_cannot_be_added_via_an_invalid_file_format(self, mozwebqa_devhub_logged_in, free_app): """Check that a tiff cannot be successfully uploaded as a screenshot.""" edit_listing = self._go_to_edit_listing_page(mozwebqa_devhub_logged_in, free_app) # bring up the media form for the first free app media_region = edit_listing.click_edit_media() # upload a new screenshot media_region.screenshot_upload(self._get_resource_path('img.tiff')) # check that the expected error message is displayed screenshot_upload_error_message = media_region.screenshot_upload_error_message Assert.contains('There was an error uploading your file.', screenshot_upload_error_message) Assert.contains('Images must be either PNG or JPG.', screenshot_upload_error_message)
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_that_an_icon_cannot_be_added_via_an_invalid_file_format( self, mozwebqa, login, free_app): """Check that a tiff cannot be successfully uploaded as an app icon.""" edit_listing = self._go_to_edit_listing_page(mozwebqa, free_app) # bring up the media form for the first free app media_region = edit_listing.click_edit_media() # upload a new icon with an invalid format media_region.icon_upload(self._get_resource_path('img.tiff')) # check that the expected error message is displayed Assert.contains('Images must be either PNG or JPG.', media_region.icon_upload_error_message)
def test_user_reply_to_question_to_consignment_from_provider_should_succeed(self): home_page = HomePage(self.driver).open_home_page() user = home_page.header.login(USER, PASSWORD) add_consignment_page = home_page.header.add_consignment_page() add_consignment_page.new_furniture_consignment() provider = home_page.header.login(PROVIDER_USER, PROVIDER_PASSWORD) view_consignments_page = home_page.header.view_consignments_page() consignment = view_consignments_page.check_added_consignment() consignment.provider_add_question_to_consignment() user = home_page.header.login(USER, PASSWORD) profile = home_page.header.open_profile_page() consignment = profile.user_open_first_message() consignment.reply_to_provider_question_to_consignment() Assert.contains(u"Twoja odpowiedź została dodana.", consignment.get_page_source()) Assert.contains(u"This is my reply", consignment.get_page_source())
def test_the_displayed_message_for_incompatible_themes(self, mozwebqa): """ Test for Litmus 15361 https://litmus.mozilla.org/show_test.cgi?id=15361 """ home_page = Home(mozwebqa) themes_page = home_page.header.site_navigation_menu("Themes").click() themes = themes_page.themes for theme in themes: if theme.is_incompatible: Assert.true(theme.is_incompatible_flag_visible) Assert.contains('Not available', theme.not_available_flag_text) else: Assert.false(theme.is_incompatible_flag_visible)
def test_add_new_user(self, cnf_configuration_pg): _user_name = 'testuser' _user_id = 'testuser' _user_email = '*****@*****.**' _user_group = 'EvmGroup-administrator' _password = '******' Assert.true(cnf_configuration_pg.is_the_current_page) new_user_pg = cnf_configuration_pg.click_on_access_control()\ .click_on_users().click_on_add_new() new_user_pg.fill_info(_user_name, _user_id, _password, _password, _user_email, _user_group) show_user_pg = new_user_pg.click_on_cancel() Assert.contains("Add of new User was cancelled by the user", show_user_pg.flash.message, "Flash message does not match")
def test_report_violation_to_offer_should_succeed(self): home_page = HomePage(self.driver).open_home_page() user = home_page.header.login(USER, PASSWORD) add_consignment_page = home_page.header.add_consignment_page() add_consignment_page.new_furniture_consignment() provider = home_page.header.login(PROVIDER_USER, PROVIDER_PASSWORD) view_consignments_page = home_page.header.view_consignments_page() submit_offer = view_consignments_page.check_added_consignment() submit_offer.submit_offer() submit_offer.confirm_submit_offer() account_page = home_page.header.login(USER, PASSWORD) profile = home_page.header.open_profile_page() consignment = profile.open_first_auction() consignment.report_violation_to_offer() Assert.contains(u"Zgłoszenie zostało odnotowane.", consignment.get_page_source())
def test_that_the_search_tag_is_present_in_the_search_results( self, mozwebqa): """Litmus 53263""" home_page = Home(mozwebqa) home_page.go_to_homepage() Assert.true(home_page.is_the_current_page) search_page = home_page.header.search(self.search_term) # Check title for the search Assert.contains('Result', search_page.search_results_section_title) # Check that the first result contains the search term Assert.contains(self.search_term, search_page.results[0].name)
def test_favicon_exist(self, mozwebqa): main_page = MySiteHomePage(mozwebqa) link = main_page.get_favicon_link(main_page.base_url) if link: match = re.search('favicon.(ico|png|gif)', link) if match: Assert.contains('favicon', link) response = main_page.get_response_code(link) elif link == None: u = urlparse(main_page.base_url) link = "%s://%s/favicon.ico" % (u.scheme, u.netloc) response = main_page.get_response_code(link) else: link = '%sfavicon.ico' % main_page.base_url response = main_page.get_response_code(link) Assert.equal(response, 'The request returned an HTTP 200 response.', 'in url: %s' % link)
def test_footer_section_links(self, mozwebqa): page = MozillaBasedPage(mozwebqa) page.go_to_page() Assert.contains(page.footer.expected_footer_logo_destination, page.footer.footer_logo_destination) Assert.contains(page.footer.expected_footer_logo_img, page.footer.footer_logo_img) bad_links = [] for link in MozillaBasedPage.Footer.footer_links_list: url = page.link_destination(link.get('locator')) if not url.endswith(link.get('url_suffix')): bad_links.append('%s does not end with %s' % (url, link.get('url_suffix'))) Assert.equal( 0, len(bad_links), '%s bad links found: ' % len(bad_links) + ', '.join(bad_links))
def test_footer_section(self, mozwebqa): dnt_page = DoNotTrack(mozwebqa) dnt_page.go_to_page() Assert.contains(dnt_page.footer.expected_footer_logo_destination, dnt_page.footer.footer_logo_destination) Assert.contains(dnt_page.footer.expected_footer_logo_img, dnt_page.footer.footer_logo_img) bad_links = [] for link in DoNotTrack.Footer.footer_links_list: url = dnt_page.link_destination(link.get('locator')) if not url.endswith(link.get('url_suffix')): bad_links.append('%s does not end with %s' % (url, link.get('url_suffix'))) Assert.equal( 0, len(bad_links), '%s bad links found: ' % len(bad_links) + ', '.join(bad_links))
def test_that_selecting_exact_version_doesnt_show_other_versions(self, mozwebqa): csp = CrashStatsHomePage(mozwebqa) product = csp.header.current_product versions = csp.header.current_versions if len(versions) > 0: csp.header.select_version(versions[1]) report_list = csp.click_first_product_top_crashers_link() report = report_list.click_first_valid_signature() for i in range(report.row_count): report = report.get_row(i + 1) Assert.equal(report.product, product, report.get_url_current_page()) Assert.contains(report.version, str(versions[1]))
def test_that_products_page_links_work(self, mozwebqa): products_page = ProductsLinksPage(mozwebqa) #An extra check that products page is loaded Assert.equal(products_page.get_products_page_name, 'Mozilla Products in Crash Reporter') products = [ 'Firefox', 'Thunderbird', 'Camino', 'SeaMonkey', 'Fennec', 'FennecAndroid' ] for product in products: csp = products_page.click_product(product) Assert.true(csp.get_url_current_page().endswith(product), csp.get_url_current_page()) Assert.contains(product, csp.get_page_name) products_page = ProductsLinksPage(mozwebqa)
def test_footer_link_destinations_are_correct(self, mozwebqa): about_page = AboutPage(mozwebqa) about_page.go_to_page() Assert.contains(about_page.footer.expected_footer_logo_destination, about_page.footer.footer_logo_destination) Assert.contains(about_page.footer.expected_footer_logo_img, about_page.footer.footer_logo_img) bad_links = [] for link in AboutPage.Footer.footer_links_list: url = about_page.link_destination(link.get('locator')) if not url.endswith(link.get('url_suffix')): bad_links.append('%s does not end with %s' % (url, link.get('url_suffix'))) Assert.equal( 0, len(bad_links), '%s bad links found: ' % len(bad_links) + ', '.join(bad_links))
def test_that_checks_if_the_extensions_are_sorted_by_featured( self, mozwebqa): """ Test for Litmus 29713 https://litmus.mozilla.org/show_test.cgi?searchType=by_id&id=29713 """ home_page = Home(mozwebqa) featured_extensions_page = home_page.header.site_navigation_menu( "Extensions").click() featured_extensions_page.sort_by('most users') featured_extensions_page.sort_by('featured') Assert.contains("sort=featured", featured_extensions_page.get_url_current_page()) for extension in featured_extensions_page.extensions: Assert.equal("FEATURED", extension.featured)
def test_that_checks_required_field_validations_on_basic_info_for_a_free_app(self, mozwebqa): """Ensure that all required fields generate warning messages and prevent form submission. Litmus link: https://litmus.mozilla.org/show_test.cgi?id=50478 """ dev_home = Home(mozwebqa) dev_home.go_to_developers_homepage() dev_home.login(user="******") my_apps = dev_home.header.click_my_apps() # bring up the basic info form for the first free app edit_listing = my_apps.first_free_app.click_edit() basic_info_region = edit_listing.click_edit_basic_info() # check name validation basic_info_region.type_name('') basic_info_region.click_save_changes() Assert.true(basic_info_region.is_this_form_open) Assert.contains('This field is required.', basic_info_region.name_error_message) basic_info_region.type_name('something') # check App URL validation basic_info_region.type_url_end('') basic_info_region.click_save_changes() Assert.true(basic_info_region.is_this_form_open) Assert.contains('This field is required.', basic_info_region.url_end_error_message) basic_info_region.type_url_end('something') # check Summary validation basic_info_region.type_summary('') basic_info_region.click_save_changes() Assert.true(basic_info_region.is_this_form_open) Assert.contains('This field is required.', basic_info_region.summary_error_message) basic_info_region.type_summary('something') # check Categories validation basic_info_region.clear_categories() basic_info_region.click_save_changes() Assert.true(basic_info_region.is_this_form_open) Assert.contains('This field is required.', basic_info_region.categories_error_message) basic_info_region.select_categories('Music', True) # check Device Types basic_info_region.clear_device_types() basic_info_region.click_save_changes() Assert.true(basic_info_region.is_this_form_open) Assert.contains('This field is required.', basic_info_region.device_types_error_message)
def test_reject_offer_should_succeed(self): home_page = HomePage(self.driver).open_home_page() user = home_page.header.login(USER, PASSWORD) add_consignment_page = home_page.header.add_consignment_page() add_consignment_page.new_furniture_consignment() provider = home_page.header.login(PROVIDER_USER, PROVIDER_PASSWORD) view_consignments_page = home_page.header.view_consignments_page() submit_offer = view_consignments_page.check_added_consignment() submit_offer.submit_offer() submit_offer.confirm_submit_offer() user = home_page.header.login(USER, PASSWORD) profile = home_page.header.open_profile_page() consignment = profile.open_first_auction() consignment.reject_offer() sleep(3) Assert.contains(u"Oferta została odrzucona.", consignment.get_page_source())
def test_that_an_icon_cannot_be_added_via_an_invalid_file_format(self, mozwebqa): """Check that a tiff cannot be successfully uploaded as an app icon.""" dev_home = Home(mozwebqa) dev_home.go_to_developers_homepage() dev_home.login(user="******") my_apps = dev_home.header.click_my_submissions() edit_listing = my_apps.first_free_app.click_edit() # bring up the media form for the first free app media_region = edit_listing.click_edit_media() # upload a new icon with an invalid format media_region.icon_upload(self._get_resource_path('img.tiff')) # check that the expected error message is displayed Assert.contains('Images must be either PNG or JPG.', media_region.icon_upload_error_message)
def test_the_displayed_message_for_incompatible_complete_themes(self, mozwebqa): """ Test for Litmus 15361 https://litmus.mozilla.org/show_test.cgi?id=15361 """ home_page = Home(mozwebqa) complete_themes_page = home_page.header.click_complete_themes() complete_themes = complete_themes_page.complete_themes for complete_theme in complete_themes: if complete_theme.is_incompatible: Assert.true(complete_theme.is_incompatible_flag_visible) Assert.contains('Not available', complete_theme.not_available_flag_text) else: Assert.false(complete_theme.is_incompatible_flag_visible)
def test_footer_links_are_valid(self, mozwebqa): about_page = AboutPage(mozwebqa) about_page.go_to_page() Assert.contains(about_page.footer.expected_footer_logo_destination, about_page.footer.footer_logo_destination) Assert.contains(about_page.footer.expected_footer_logo_img, about_page.footer.footer_logo_img) bad_urls = [] for link in AboutPage.Footer.footer_links_list: url = about_page.link_destination(link.get('locator')) response_code = about_page.get_response_code(url) if response_code != requests.codes.ok: bad_urls.append('%s is not a valid url - status code: %s.' % (url, response_code)) Assert.equal( 0, len(bad_urls), '%s bad links found: ' % len(bad_urls) + ', '.join(bad_urls))
def test_user_can_access_the_edit_profile_page(self, mozwebqa): home_page = Home(mozwebqa) home_page.login() Assert.true(home_page.is_the_current_page) Assert.true(home_page.header.is_user_logged_in) amo_user_edit_page = 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.account_header_text) Assert.equal("Profile", amo_user_edit_page.profile_header_text) Assert.equal("Details", amo_user_edit_page.details_header_text) Assert.equal("Notifications", amo_user_edit_page.notification_header_text)
def test_user_can_update_profile_information_in_account_settings_page( self, mozwebqa): """ Test for Litmus 11563. https://litmus.mozilla.org/show_test.cgi?id=11563 """ home_page = Home(mozwebqa) home_page.login(method="browserID", user="******") Assert.true(home_page.is_the_current_page) Assert.true(home_page.header.is_user_logged_in) user_edit_page = home_page.header.click_edit_profile() Assert.true(user_edit_page.is_the_current_page) # save initial values to restore them after the test is finished fields_no = len(user_edit_page.profile_fields) - 1 initial_value = [None] * fields_no random_name = "test%s" % random.randrange(1, 100) # enter new values for i in range(0, fields_no): initial_value[i] = deepcopy( user_edit_page.profile_fields[i].field_value) user_edit_page.profile_fields[i].clear_field() user_edit_page.profile_fields[i].type_value(random_name) user_edit_page.click_update_account() Assert.equal(user_edit_page.update_message, "Profile Updated") # using try finally to ensure that the initial values are restore even if the Asserts fail. try: for i in range(0, fields_no): Assert.contains(random_name, user_edit_page.profile_fields[i].field_value) except Exception as exception: Assert.fail(exception.msg) finally: # restore initial values for i in range(0, fields_no): user_edit_page.profile_fields[i].clear_field() user_edit_page.profile_fields[i].type_value(initial_value[i]) user_edit_page.click_update_account()
def test_that_checks_if_the_extensions_are_sorted_by_most_user( self, mozwebqa): """ Test for Litmus 29715 https://litmus.mozilla.org/show_test.cgi?searchType=by_id&id=29715 """ home_page = Home(mozwebqa) featured_extensions_page = home_page.header.site_navigation_menu( "Extensions").click() featured_extensions_page.sort_by('most_users') Assert.contains("sort=users", featured_extensions_page.get_url_current_page()) user_counts = [ extension.user_count for extension in featured_extensions_page.extensions ] Assert.is_sorted_descending(user_counts)