def test_submit_sad_feedback(self, mozwebqa): timestamp = str(time.time()) desc = 'input-tests testing sad feedback ' + timestamp url = 'http://sad.example.com/' + timestamp # 1. go to the feedback form feedback_pg = GenericFeedbackFormPage(mozwebqa) feedback_pg.go_to_feedback_page() # 2. click on sad feedback_pg.click_sad_feedback() # 3. fill out description and url feedback_pg.set_description(desc) feedback_pg.set_url(url) feedback_pg.click_moreinfo_next() # 4. fill in email address feedback_pg.check_email_checkbox() feedback_pg.set_email('*****@*****.**') # 5. submit thanks_pg = feedback_pg.submit(expect_success=True) Assert.true(thanks_pg.is_the_current_page) # 6. verify dashboard_pg = DashboardPage(mozwebqa) dashboard_pg.go_to_dashboard_page() dashboard_pg.search_for(desc) resp = dashboard_pg.messages[0] Assert.equal(resp.type.strip(), 'Sad') Assert.equal(resp.body.strip(), desc.strip()) Assert.equal(resp.locale.strip(), 'English (US)') Assert.equal(resp.site.strip(), 'example.com')
def is_the_current_page(self): if self._page_title: WebDriverWait(self.selenium, 10).until(lambda s: self.selenium.title) Assert.equal(self.selenium.title, self._page_title, "Expected page title: %s. Actual page title: %s" % (self._page_title, self.selenium.title)) return True
def test_search_by_library_name_returns_library(self, mozwebqa): homepage_obj = HomePage(mozwebqa) loginpage_obj = LoginPage(mozwebqa) dashboard_obj = DashboardPage(mozwebqa) librarypage_obj = LibraryEditorPage(mozwebqa) searchpage_obj = SearchPage(mozwebqa) homepage_obj.go_to_home_page() homepage_obj.header.click_signin() loginpage_obj.login() #create a new library with the valid criteria (version not initial) dashboard_obj.header.click_home_logo() homepage_obj.click_create_lib_btn() librarypage_obj.type_library_version('searchable') librarypage_obj.click_save() searchterm = librarypage_obj.library_name librarypage_obj.header.click_home_logo() homepage_obj.header.click_search() searchpage_obj.search_until_package_exists(searchterm, searchpage_obj.library(searchterm)) Assert.true(searchpage_obj.library(searchterm).is_displayed, '%s not found before timeout' % searchterm) searchpage_obj.delete_test_data()
def test_that_verifies_the_tooltip_for_Other_Applications(self, mozwebqa): """ Litmus 22925 https://litmus.mozilla.org/show_test.cgi?id=22925 """ amo_home_page = AddonsHomePage(mozwebqa) Assert.equal(amo_home_page.header.other_applications_tooltip, 'Find add-ons for other applications')
def test_that_events_front_page_shows_upcoming_events(self, mozwebqa): home_page = HomePage(mozwebqa) home_page.go_to_page() events_page = home_page.header.go_to_events_page() Assert.true(events_page.upcoming_events_count > 0) Assert.true(events_page.upcoming_events_is_visible)
def test_that_one_star_rating_increments(self, mozwebqa): """ Test for Litmus 22916. https://litmus.mozilla.org/show_test.cgi?id=22916 """ # Step 1 - Login into AMO home_page = Home(mozwebqa) home_page.login("browserID") 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.paginator.click_last_page() addon = extensions_home_page.extensions[-1] # the last one is without rating details_page = addon.click() # 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(1) view_reviews = write_review_block.click_to_save_review() # Step 6 - Ensure rating increased by one view_reviews.breadcrumbs[2].click() details_page = Details(mozwebqa) new_rating_counter = details_page.get_rating_counter(1) Assert.equal(new_rating_counter, 1)
def test_that_resources_page_display_makes(self, mozwebqa): home_page = HomePage(mozwebqa) home_page.go_to_page() resources_page = home_page.header.click_teach_tab() Assert.greater(resources_page.teach_make_count, 0) Assert.true(resources_page.is_teach_makes_visible)
def test_browserid_link_present(self, mozwebqa): home_page = Home(mozwebqa) home_page.login() profile_page = home_page.header.click_view_profile_menu_item() edit_profile_page = profile_page.click_edit_my_profile_button() account_tab = edit_profile_page.go_to_tab("account") Assert.true(account_tab.is_browserid_link_present)
def test_creating_profile_without_checking_privacy_policy_checkbox(self, mozwebqa): user = self.get_new_user() home_page = Home(mozwebqa) profile = home_page.create_new_user(user) profile.set_full_name("User that doesn't like policy") profile.set_bio("Hello, I'm new here and trying stuff out. Oh, and by the way: I'm a robot, run in a cronjob, and will not check accept the privacy policy") skills = profile.click_next_button() skills.add_skill('test') skills.add_language('english') location = skills.click_next_button() location.select_country('us') location.set_state('California') location.set_city('Mountain View') location.click_create_profile_button() profile = ProfileTab(mozwebqa) Assert.equal('new error message', profile.error_message) location = profile.go_to_tab('location') Assert.equal('This field is required.', location.privacy_error_message)
def test_themes_subcategory_page_breadcrumb(self, mozwebqa): home_page = Home(mozwebqa) themes_page = home_page.click_themes() selected_category = themes_page.themes_category amo_category_page = 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_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_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_that_clicking_on_a_subcategory_loads_expected_page(self, mozwebqa): """test for litmus 15949""" home_page = Home(mozwebqa) themes_page = home_page.click_themes() selected_category = themes_page.themes_category amo_category_page = themes_page.click_on_first_category() Assert.equal(selected_category, amo_category_page.title)
def test_filter_results_by_owner(self, mozwebqa): query = u"John Giannelos" home_page = Home(mozwebqa) events_page = home_page.header.click_events_link() events_page.filter_for(query) Assert.equal(u"John Giannelos", events_page.event_profile_owner_text)
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_events_timeline_is_visible(self, mozwebqa): home_page = Home(mozwebqa) events_page = home_page.header.click_events_link() events_page.click_timeline() events_page.wait_for_page_to_load() Assert.true(events_page.is_events_timeline_visible)
def test_advanced_options_are_visible(self, mozwebqa): home_page = Home(mozwebqa) events_page = home_page.header.click_events_link() events_page.click_advanced_options() Assert.true(events_page.is_advanced_search_form_visible) Assert.true(events_page.is_events_icalendar_export_button_visible)
def test_that_search_results_return_20_results_per_page(self, mozwebqa): """ Test for Litmus 17346. https://litmus.mozilla.org/show_test.cgi?id=17346 """ home_page = Home(mozwebqa) search_page = home_page.header.search_for('deutsch') first_expected = 1 second_expected = 20 while not search_page.paginator.is_next_page_disabled: first_count = search_page.paginator.start_item second_count = search_page.paginator.end_item Assert.equal(first_expected, first_count) Assert.equal(second_expected, second_count) Assert.equal(search_page.result_count, 20) search_page.paginator.click_next_page() first_expected += 20 second_expected += 20 number = search_page.paginator.total_items % 20 if number == 0: Assert.equal(search_page.result_count, 20) else: Assert.equal(search_page.result_count, number)
def test_the_featured_personas_section(self, testsetup): """ Test for Litmus 15392 https://litmus.mozilla.org/show_test.cgi?id=15392""" amo_home_page = AddonsHomePage(testsetup) 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 home_page_logged_in(mozwebqa): from pages.login import LoginPage login_pg = LoginPage(mozwebqa) login_pg.go_to_login_page() home_pg = login_pg.login() Assert.true(home_pg.is_logged_in, "Could not determine if logged in") return home_pg
def test_visitor_can_view_history(self, mozwebqa): home_pg = HomePage(mozwebqa) home_pg.go_to_home_page() history_pg = home_pg.header_region.click_history() Assert.true(history_pg.is_the_current_page) Assert.greater(len(history_pg.history_list.strip()), 0)
def test_that_search_results_return_20_results_per_page(self, mozwebqa): """ Litmus 17346 https://litmus.mozilla.org/show_test.cgi?id=17346 """ amo_home_page = AddonsHomePage(mozwebqa) amo_search_page = amo_home_page.header.search_for("deutsch") first_expected = 1 second_expected = 20 while(amo_search_page.is_forword_present): results_summary = amo_search_page.results_displayed results = re.split("\W+", results_summary) first_count = results[1] second_count = results[2] Assert.equal(str(first_expected), first_count) Assert.equal(str(second_expected), second_count) Assert.equal(amo_search_page.result_count, 20) amo_search_page.page_forward() first_expected += 20 second_expected += 20 number = int(re.split("\W+", results_summary)[4]) % 20 if number == 0: Assert.equal(amo_search_page.result_count, 20) else: Assert.equal(amo_search_page.result_count, number)
def test_sorting_by_downloads(self, mozwebqa): """ Litmus 17342 https://litmus.mozilla.org/show_test.cgi?id=17342 """ AddonsHomePage(mozwebqa).header.search_for('firebug') amo_search_page = AddonsSearchHomePage(mozwebqa).sort_by('downloads') Assert.true('sort=weeklydownloads' in amo_search_page.get_url_current_page()) Assert.is_sorted_descending([i.downloads for i in amo_search_page.results()])
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_the_search_field_placeholder(self, mozwebqa): """ Litmus 4826 https://litmus.mozilla.org/show_test.cgi?id=4826 """ amo_home_page = AddonsHomePage(mozwebqa) Assert.equal(amo_home_page.header.search_field_placeholder, 'search for add-ons')
def test_that_checks_editing_support_information_for_a_free_app(self, mozwebqa): """ Test edit support information for a free app. Pivotal task: https://www.pivotaltracker.com/story/show/27741207 Litmus: https://litmus.mozilla.org/show_test.cgi?id=50481 """ updated_app = MockApplication() 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() # update fields in support information support_info_region = edit_listing.click_support_information() support_info_region.type_support_email(updated_app['support_email']) support_info_region.type_support_url(updated_app['support_website']) support_info_region.click_save_changes() # Verify the changes have been made Assert.equal(edit_listing.email, updated_app['support_email']) Assert.equal(edit_listing.website, updated_app['support_website'])
def test_that_a_screenshot_can_be_added(self, mozwebqa): """Test the happy path for adding a screenshot for a free submitted app. Litmus link: https://litmus.mozilla.org/show_test.cgi?id=50479 """ 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() before_screenshots_count = len(edit_listing.screenshots_previews) # bring up the media form for the first free app media_region = edit_listing.click_edit_media() screenshots_count = len(media_region.screenshots) # upload a new screenshot media_region.screenshot_upload(self._get_resource_path('img.jpg')) # check that the screenshot list is updated new_screenshots_count = len(media_region.screenshots) Assert.equal(screenshots_count + 1, new_screenshots_count, 'Expected %s screenshots, but there are %s.' % (screenshots_count + 1, new_screenshots_count)) # save the changes media_region.click_save_changes() # check that the icon preview has been updated after_screenshots_count = len(edit_listing.screenshots_previews) Assert.equal(before_screenshots_count + 1, len(edit_listing.screenshots_previews), 'Expected %s screenshots, but there are %s.' % (before_screenshots_count + 1, after_screenshots_count))
def test_sorting_by_updated_date(self, mozwebqa): """ Litmus 17345 https://litmus.mozilla.org/show_test.cgi?id=17345 """ AddonsHomePage(mozwebqa).header.search_for('firebug') amo_search_page = AddonsSearchHomePage(mozwebqa).sort_by('updated') Assert.true('sort=updated' in amo_search_page.get_url_current_page()) Assert.is_sorted_descending([i.updated_date for i in amo_search_page.results()])
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 force_wait(self, wait_time): try: time.sleep(int(wait_time)) except TimeoutException: Assert.fail(TimeoutException) finally: self.selenium.implicitly_wait(self.testsetup.default_implicit_wait)
def test_is_id_mainContent_locator_available(self, mozwebqa): page = RecreationalActivitiesWarmWeatherActivitesCfm(mozwebqa) Assert.true(page.is_id_mainContent_locator_available)
def test_provider_edit(self, infra_providers_pg, provider, random_uuid_as_string): '''Tests that editing a management system shows the proper detail after an edit ''' prov_pg = infra_providers_pg edit_name = random_uuid_as_string prov_pg.taskbar_region.view_buttons.change_to_grid_view() Assert.true(prov_pg.taskbar_region.view_buttons.is_grid_view) prov_pg.select_provider(provider['name']) Assert.equal(len(prov_pg.quadicon_region.selected), 1, 'More than one quadicon was selected') prov_edit_pg = prov_pg.click_on_edit_providers() provider['edit_name'] = edit_name prov_detail_pg = prov_edit_pg.edit_provider(provider) Assert.equal(prov_detail_pg.flash.message, 'Infrastructure Provider "%s" was saved' \ % provider['edit_name'], FLASH_MESSAGE_NOT_MATCHED) Assert.equal(prov_detail_pg.name, provider['edit_name'], DETAIL_NOT_MATCHED_TEMPLATE % 'Edited name') Assert.equal(prov_detail_pg.hostname, provider['hostname'], DETAIL_NOT_MATCHED_TEMPLATE % 'Hostname') Assert.equal(prov_detail_pg.zone, provider['server_zone'], DETAIL_NOT_MATCHED_TEMPLATE % 'Server zone') if 'host_vnc_port' in provider: Assert.equal(prov_detail_pg.vnc_port_range, provider['host_vnc_port'], DETAIL_NOT_MATCHED_TEMPLATE % 'VNC port range')
def test_iphone_kb_redirects_status_ok(self, mozwebqa, input): r = self._check_redirect(mozwebqa, input) Assert.equal(r.status_code, requests.codes.ok)
def test_old_mobile_redirects(self, mozwebqa, input, expected): expected_url = mozwebqa.base_url + expected r = self._check_redirect(mozwebqa, input) Assert.equal(urllib.unquote(r.url), expected_url) Assert.equal(r.status_code, requests.codes.ok)
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) # 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() 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.', watch_pg.watchlist_message) watch_pg.click_return_to_page() 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() Assert.true(home_pg.header_region.is_watch_visible)
def test_that_test_run_saves_right_order_of_test_cases( self, mozwebqa_logged_in, product, element): self.connect_product_to_element(mozwebqa_logged_in, product, element) version = product['version'] #create several test case via bulk create cases = self.create_bulk_cases(mozwebqa_logged_in, product, use_API=True, cases_amount=5) #create first test suite suite_a_cases = (cases[3], cases[1]) suite_a = self.create_suite(mozwebqa_logged_in, product=product, use_API=True, name='suite A', case_list=suite_a_cases) #create second test suite suite_b_cases = (cases[2], cases[0], cases[4]) suite_b = self.create_suite(mozwebqa_logged_in, product=product, use_API=True, name='suite B', case_list=suite_b_cases) #create first test run (suite a, suite b) first_suite_order = (suite_a['name'], suite_b['name']) first_run = self.create_run(mozwebqa_logged_in, product=product, activate=True, version=version, suite_name_list=first_suite_order) #execute first test run home_page = MozTrapHomePage(mozwebqa_logged_in) home_page.go_to_home_page() home_page.go_to_run_test(product_name=product['name'], version_name=version['name'], run_name=first_run['name'], env_category_name=element['category']['name'], env_element_name=element['name']) run_tests_pg = MozTrapRunTestsPage(mozwebqa_logged_in) actual_order = [(item.case_name, item.suite_name) for item in run_tests_pg.test_results] expected_order = [(case['name'], suite) for case in suite_a_cases for suite in (suite_a['name'],)] + \ [(case['name'], suite) for case in suite_b_cases for suite in (suite_b['name'],)] #assert that right order saved Assert.equal(actual_order, expected_order) #edit run to reorder suites manage_runs_pg = MozTrapManageRunsPage(mozwebqa_logged_in) manage_runs_pg.go_to_manage_runs_page() #push run into draft mode manage_runs_pg.filter_form.filter_by(lookup='name', value=first_run['name']) manage_runs_pg.make_run_draft(first_run['name']) #go to edit run page and reorder suites by name (suite b, suite a) edit_run_pg = manage_runs_pg.go_to_edit_run_page(first_run['name']) edit_run_pg.edit_run(first_run, reorder_suites=True) #make run active again manage_runs_pg.activate_run(first_run['name']) #execute run again home_page.go_to_home_page() home_page.go_to_run_test(product_name=product['name'], version_name=version['name'], run_name=first_run['name'], env_category_name=element['category']['name'], env_element_name=element['name']) #check actual order of items on run tests page actual_order = [(item.case_name, item.suite_name) for item in run_tests_pg.test_results] expected_order = [(case['name'], suite) for case in suite_b_cases for suite in (suite_b['name'],)] + \ [(case['name'], suite) for case in suite_a_cases for suite in (suite_a['name'],)] #assert that right order saved Assert.equal(actual_order, expected_order)
Assert.false(result.is_test_passed) result.pass_test() result = run_tests_pg.get_test_result(case['name']) Assert.true(result.is_test_passed) @pytest.mark.moztrap(206) def test_that_user_can_fail_test(self, mozwebqa_logged_in, product, element): case = self.create_and_run_test(mozwebqa_logged_in, product, element)[0] run_tests_pg = MozTrapRunTestsPage(mozwebqa_logged_in) result = run_tests_pg.get_test_result(case['name']) Assert.false(result.is_test_failed) result.fail_test() result = run_tests_pg.get_test_result(case['name']) Assert.true(result.is_test_failed) @pytest.mark.moztrap(207) def test_that_user_can_mark_test_invalid(self, mozwebqa_logged_in, product, element): case = self.create_and_run_test(mozwebqa_logged_in, product, element)[0] run_tests_pg = MozTrapRunTestsPage(mozwebqa_logged_in) result = run_tests_pg.get_test_result(case['name']) Assert.false(result.is_test_invalid)
def test_faq_sidebar(self, mozwebqa): home = Home(mozwebqa) home.go_to_homepage() faq = home.header.click_faq_link() Assert.true(faq.is_faq_sidebar_visible)
def test_add_shift_should_succeed(self): home_page = HomePage(self.driver).open_home_page() WebDriverWait(self.driver, 60).until( EC.text_to_be_present_in_element(home_page.header._einloggen_text, "Einloggen")) account_page = home_page.header.login(USER, PASSWORD) sleep(5) if "Einloggen" in home_page.header.get_page_source(): account_page = home_page.header.login(USER, PASSWORD) account_page.open_AUTOTESTa_restaurant() restaurant_settings_page = account_page.open_restaurant_settings() restaurant_settings_page.open_shift_tab() restaurant_settings_page.add_shift_first_accordeon() restaurant_settings_page.add_shift_second_accordeon() restaurant_settings_page.save_shift() restaurant_settings_page.open_first_shift_details() restaurant_settings_page.first_shift_get_values() Assert.equal(restaurant_settings_page.added_shift_name, restaurant_settings_page._shift_name_value) Assert.equal(restaurant_settings_page.added_shift_internal_name, restaurant_settings_page._shift_internal_name_value) # Assert.equal(restaurant_settings_page.added_shift_capacity, restaurant_settings_page._shift_capacity_value) Assert.equal(restaurant_settings_page.added_shift_buffer, restaurant_settings_page._shift_buffer_value) Assert.equal( restaurant_settings_page.added_shift_daily_deadlinie, restaurant_settings_page._shift_daily_online_deadline_value) Assert.equal(restaurant_settings_page.added_shift_kitchen_start, restaurant_settings_page._shift_kitchen_start_value) Assert.equal(restaurant_settings_page.added_shift_kitchen_end, restaurant_settings_page._shift_kitchen_end_value) Assert.equal(restaurant_settings_page.added_shift_timeslot_capacity, restaurant_settings_page._shift_timeslot_capacity_value) Assert.equal( restaurant_settings_page.added_shift_reservations_confirmed, restaurant_settings_page._shift_reservations_confirmed_value) Assert.equal(restaurant_settings_page.added_shift_minimum_guests, restaurant_settings_page._shift_minimum_guests_value) Assert.equal(restaurant_settings_page.added_shift_maximum_guests, restaurant_settings_page._shift_maximum_guests_value) restaurant_settings_page = account_page.open_restaurant_settings() restaurant_settings_page.open_shift_tab() restaurant_settings_page.remove_first_shift() self.not_contains(restaurant_settings_page._shift_name_value, restaurant_settings_page.get_page_source()) self.not_contains(restaurant_settings_page._shift_internal_name_value, restaurant_settings_page.get_page_source())
def test_smartproxies(self, cnf_smartproxies_pg): Assert.true(cnf_smartproxies_pg.is_the_current_page)
def test_randomizevalues_again(self): # If we generate the dict again, it should be newly randomized Assert.not_equal(self.after, self.again)
def test_register_restaurant_should_succeed(self): home_page = HomePage(self.driver).open_home_page() WebDriverWait(self.driver, 60).until( EC.text_to_be_present_in_element(home_page.header._einloggen_text, "Einloggen")) home_page.header.login(USER, PASSWORD) sleep(5) if "Einloggen" in home_page.header.get_page_source(): home_page.header.login(USER, PASSWORD) register_restaurant_page = home_page.header.open_register_restaurant_page( ) register_restaurant_page.enter_restaurant_data() account_page = register_restaurant_page.save_restaurant() home_page.header.click_account_page() # account_page.open_registered_restaurant(register_restaurant_page._last_name_value) sleep(6) restaurant_settings_page = account_page.open_restaurant_settings() restaurant_settings_page.get_restaurant_info() Assert.equal(restaurant_settings_page.restaurant_info_last_name, register_restaurant_page._last_name_value) Assert.equal(restaurant_settings_page.restaurant_info_address, register_restaurant_page._address_value) Assert.equal(restaurant_settings_page.restaurant_info_zip, register_restaurant_page._zip_code_value) Assert.equal(restaurant_settings_page.restaurant_info_city, register_restaurant_page._city_value) Assert.equal(restaurant_settings_page.restaurant_info_country, register_restaurant_page._country_value) Assert.equal(restaurant_settings_page.restaurant_info_email, register_restaurant_page._email_value) Assert.equal(restaurant_settings_page.restaurant_info_senders_email, register_restaurant_page._senders_email_value) Assert.equal(restaurant_settings_page.restaurant_info_msgIn_email, register_restaurant_page._msgIn_email_value) Assert.equal(restaurant_settings_page.restaurant_info_website, register_restaurant_page._website_value) Assert.equal(restaurant_settings_page.restaurant_info_facebook, register_restaurant_page._facebook_value) Assert.equal(restaurant_settings_page.restaurant_info_fan_page, register_restaurant_page._fan_page_url_value) Assert.equal(restaurant_settings_page.restaurant_info_trip_advisor, register_restaurant_page._trip_advisor_value) Assert.equal(restaurant_settings_page.restaurant_info_google, register_restaurant_page._google_value) Assert.equal(restaurant_settings_page.restaurant_info_yelp, register_restaurant_page._yelp_value) Assert.equal(restaurant_settings_page.restaurant_info_phone, register_restaurant_page._phone_value) Assert.equal(restaurant_settings_page.restaurant_info_image_url, register_restaurant_page._image_url_value)
def test_randomizevalues_type(self): # Object type should still be dict Assert.true(isinstance(self.after, type(self.before)))
def test_that_notes_page_is_reachable(self, mozwebqa): notes_page = Notes(mozwebqa) notes_page.go_to_page() Assert.contains("Notes", notes_page.firefox_notes_header_text)
def test_randomness_fixtures(random_uuid_as_string, random_string): # Make sure the fixtures work as intended Assert.equal(len(random_uuid_as_string), 36) Assert.true(isinstance(random_uuid_as_string, basestring)) Assert.true(isinstance(random_string, basestring))
def test_randomizevalues_bogus_randomizer(self): # Unmatched randomizer shouldn't change Assert.equal(self.after['notrandom'], self.before['notrandom'])
def test_generate_random_int_args(): maxvalue = 1 random_int = randomness.generate_random_int(maxvalue) Assert.greater_equal(random_int, 0) Assert.less_equal(random_int, maxvalue)
def test_randomizevalues(self): # These should be different in the two dicts Assert.not_equal(self.after['str'], self.before['str']) Assert.not_equal(self.after['tuple'], self.before['tuple']) Assert.not_equal(self.after['list'], self.before['list']) Assert.not_equal(self.after['set'], self.before['set'])
def test_generate_random_string_args(): length = 16 random_string = randomness.generate_random_string(length) Assert.equal(len(random_string), length)
def test_generate_random_uuid(): # Not sure if there's a better test than a string of normal uuid length (36) uuid = randomness.generate_random_uuid_as_str() Assert.equal(len(uuid), 36) Assert.true(isinstance(uuid, basestring))
def is_the_current_page(self): # This overrides the method in the Page super class. actual_page_title = self.page_title Assert.not_none(re.match(self._page_title_regex, actual_page_title), 'Expected the current page to be the personas detail page.\n Actual title: %s' % actual_page_title) return True
def test_generate_random_int_noargs(): # maxint is the default max, so no need to check against it random_int = randomness.generate_random_int() Assert.greater(random_int, 0)
def test_hosted_paid_app_submission(self, mozwebqa_devhub_logged_in): if '-dev.allizom' in mozwebqa_devhub_logged_in.base_url: env = 'dev' else: env = 'stage' app = MockApplication(env) dev_home = Home(mozwebqa_devhub_logged_in) dev_agreement = dev_home.click_submit_new_app() """Agree with the developer agreement and continue if it was not accepted in a previous app submit""" manifest_validation_form = dev_agreement.click_continue() # select a premium manifest_validation_form.premium_type('paid') # select device type for device in app['device_type']: if device[1]: manifest_validation_form.device_type(device[0], 'paid') # submit the app manifest url and validate it manifest_validation_form.type_app_manifest_url(app['url']) manifest_validation_form.click_validate() Assert.true(manifest_validation_form.app_validation_status, msg=manifest_validation_form.app_validation_message) app_details = manifest_validation_form.click_continue() Assert.true( app_details.is_the_current_submission_stage, '\n Expected step is: Details \n Actual step is: %s' % app_details.current_step) # add custom app details for every field app_details.click_change_name() app_details.type_url_end(app['url_end']) app_details.type_description(app['description']) app_details.type_privacy_policy(app['privacy_policy']) app_details.type_homepage(app['homepage']) app_details.type_support_url(app['support_website']) app_details.type_support_email(app['support_email']) for category in app['categories']: # check/uncheck the checkbox according to the app value app_details.select_categories(*category) app_details.screenshot_upload(app['screenshot_link']) try: next_steps = app_details.click_continue() Assert.equal('Almost There!', next_steps.almost_there_message) content_ratings = next_steps.click_continue() Assert.equal('Get My App Rated', content_ratings.get_app_rated_message) # insert Submission ID and Security code to get app rated content_ratings.fill_in_app_already_rated_info( app['submission_id'], app['security_code']) content_ratings.click_submit() Assert.equal('Content ratings successfully saved.', content_ratings.saved_ratings_message) # setup payments payments = content_ratings.click_setup_payments() # select payment account payments.select_payment_account() # setup price tier app_price = '0.99 USD' payments.select_price(app_price) payments.click_payments_save_changes() Assert.true(payments.is_update_notification_visible) Assert.equal( payments.app_price, app_price, '\n Expected price is: %s \n Actual price is: %s' % (app_price, payments.app_price)) except Exception as exception: Assert.fail(exception) finally: # Clean up app edit_app = dev_home.go_to_app_status_page(app) delete_popup = edit_app.click_delete_app() delete_popup.delete_app()
def test_generate_random_string_noargs(): random_string = randomness.generate_random_string() # 8 is the default length Assert.equal(len(random_string), 8)
def test_is_id_ft_locator_available(self, mozwebqa): """ Test pages elements defined in CoursesCsce499PresentationRequirementsHtmlpage object: coursescsce499presentationrequirementshtml.py """ page = CoursesCsce499PresentationRequirementsHtml(mozwebqa) Assert.true(page.is_id_ft_locator_available)
def is_the_current_page(self): # This overrides the method in the Page super class. Assert.true(self.is_element_present(*self._personas_grid_locator), 'Expected the current page to be the personas browse page.') return True
def test_search_decoding(self, testsetup): sel = testsetup.selenium search_page_obj = search_page.SearchPage(testsetup) search_term = "%3D" search_page_obj.go_to_search_page() search_page_obj.do_search_on_search_box(search_term) not_found = True counter = 0 while not_found and counter < 3: if not(search_page_obj.is_search_available()): search_page_obj.refresh() counter = counter + 1 else: not_found = False Assert.not_equal("=", sel.get_value(search_page_obj.search_box)) Assert.equal(search_term, sel.get_value(search_page_obj.search_box)) search_term = "%25D" search_page_obj.go_to_search_page() search_page_obj.do_search_on_search_box(search_term) not_found = True counter = 0 while not_found and counter < 3: if not(search_page_obj.is_search_available()): search_page_obj.refresh() counter = counter + 1 else: not_found = False Assert.not_equal("=", sel.get_value(search_page_obj.search_box)) Assert.equal(search_term, sel.get_value(search_page_obj.search_box)) search_term = "&lsquo" search_page_obj.go_to_search_page() search_page_obj.do_search_on_search_box(search_term) not_found = True counter = 0 while not_found and counter < 3: if not(search_page_obj.is_search_available()): search_page_obj.refresh() counter = counter + 1 else: not_found = False Assert.not_equal("'", sel.get_value(search_page_obj.search_box)) Assert.equal(search_term, sel.get_value(search_page_obj.search_box))
def test_packaged_app_submission(self, mozwebqa_devhub_logged_in): if '-dev.allizom' in mozwebqa_devhub_logged_in.base_url: env = 'dev' else: env = 'stage' app = MockApplication(env, app_type='packaged') dev_home = Home(mozwebqa_devhub_logged_in) dev_agreement = dev_home.click_submit_new_app() """Agree with the developer agreement and continue if it was not accepted in a previous app submit""" manifest_validation_form = dev_agreement.click_continue() # select device type for device in app['device_type']: if device[1]: manifest_validation_form.device_type(device[0]) # select app type manifest_validation_form.app_type(app['app_type']) # submit the hosted app and validate it manifest_validation_form.upload_file(app['app_path']) manifest_validation_form.wait_for_app_validation() Assert.true(manifest_validation_form.app_validation_status, msg=manifest_validation_form.app_validation_message) app_details = manifest_validation_form.click_continue() Assert.true( app_details.is_the_current_submission_stage, '\n Expected step is: Details \n Actual step is: %s' % app_details.current_step) # add custom app details for every field app_details.click_change_name() app_details.type_url_end(app['url_end']) app_details.type_description(app['description']) app_details.type_privacy_policy(app['privacy_policy']) app_details.type_homepage(app['homepage']) app_details.type_support_url(app['support_website']) app_details.type_support_email(app['support_email']) for category in app['categories']: # check/uncheck the checkbox according to the app value app_details.select_categories(*category) app_details.screenshot_upload(app['screenshot_link']) try: next_steps = app_details.click_continue() Assert.equal('Almost There!', next_steps.almost_there_message) content_ratings = next_steps.click_continue() Assert.equal('Get My App Rated', content_ratings.get_app_rated_message) # insert Submission ID and Security code to get app rated content_ratings.fill_in_app_already_rated_info( app['submission_id'], app['security_code']) content_ratings.click_submit() Assert.equal( 'Congratulations, your app submission is now complete and will be reviewed shortly!', content_ratings.saved_ratings_message) except Exception as exception: Assert.fail(exception) finally: # Clean up app edit_app = dev_home.go_to_app_status_page(app) delete_popup = edit_app.click_delete_app() delete_popup.delete_app()
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 page title Assert.equal("%s | Search | Mozilla Marketplace" % self.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(self.search_term, search_page.breadcrumbs[2].text) # Check title for the search Assert.equal('Search Results for "%s"' % self.search_term, search_page.title) # Check that the first result contains the search term Assert.contains(self.search_term, search_page.results[0].name)
def test_that_page_has_correct_title(self, mozwebqa): home_page = HomePage(mozwebqa) home_page.go_to_page() Assert.equal('Firefox Health Report', home_page.page_title)