QA/Execution/Web Testing/Docs/Automation/Testcases/AMO POM Libraries/amo page class

From MozillaWiki
Jump to: navigation, search

amo_page class

Actions

go_to_app_home_page()

  • Clicks on the application home page link in the page header.

go_to_application(app_name)

  • Go to a Mozilla application home page specified by app_name. If app_name is the current application (i.e. app_name is in the current page's URL) the home page link in the page header is clicked. If app_name isn't in the current page URL the application link in the page header is clicked.

go_to_extensions_category_by_index(category_index)

  • Click on the category specified by category_index from the category list in the sidebar. category_index is assumed to be an integer starting from 1.

go_to_themes_landing(themes_landing_page_object)

  • Click on the Themes link from sidebar menu. To verify that the themes landing page was opened the verify_themes_landing_page_is_present() method is called from themes_landing_page_object, which is assumed to be a ThemesLandingPage object.

go_to_collections_directory(collections_directory_page_object)

  • Click on the Collections link from sidebar menu. To verify that the collection landing page was opened the verify_collections_directory_page_is_present() is called from collections_directory_page_object, which is assumed to be a CollectionsDiretoryPage object.

go_to_personas_landing(personas_landing_page_object)

  • Click on the Personas link from sidebar menu. To verify that the the personas landing page was opened the verify_personas_landing_page_is_present() method is called from personas_landing_page_object, which is assumed to be a PersonasLandingPage object.

go_back_to_previous_page(previous_page_check, previous_page_name)

  • Call the Selenium go_back() method which simulates selecting the Back button on the browser. previous_page_check is the name of a method which verifies the page expected after the go_back command. The previous_page_check method is expected to return True if the page is present, otherwise False. previous_page_check is passed without () so that it isn't executed when the parameters values are passed to go_back_to_previous_page. When previous_page_check returns False an exception is thrown containing previous_page_name and text from the top of the page.

submit_search_query_from_page_header(search_results_page_object, results_expected, ... )

  • Submit a search query from the page header search panel. To verify whether any search results were returned the presence is checked for certain elements defined in search_results_page_object, which is assumed to be a SearchResultsPage object. If the parameter results_expected is True the presence of at least one search result element is expected. If results_expected is False the search results message element is expected with the text 'no results found', case-insensitive. The method returns no value if the expected element is present. If the expected element is not present an exception is thrown with text from the top of the page.
  • Search criteria is specified with the following parameters:
    • query_text: text typed into query form search value
    • category_option: category option to select
    • version_option: version option to select
    • type_option: add-on type option to select
    • platform_option: platform to select
    • last_updated_option: Last Updated date range option to select
    • per_page_option: Per Page option to select
    • sort_option: sort option to select
  • Parameter and values are specified using 'name=value' format, ex: queryText=abc.  The value with query_text is passed to selenium.type() as the value parameter. The value with any *_option parameter is passed to selenium.select() as the optionLocator parameter.
  • Examples:
    • To submit a search with the query term 'firefox sync' and sort option 'name': submit_search_query_from_page_header(search_results_page, query_text='firefox sync', sort_option='name'), where search_results_page is an instance of the SearchResultsPage class.
    • To submit a search which is expected to return no results: submit_search_query_from_page_header(search_results_page, results_expected=False, query_text='itwasadarkandstormynight'), where the query text is not expected to match anything.