def test_searching_for_themes(self, base_url, selenium): page = Themes(base_url, selenium).open() results_page = page.search_for('fox') assert len(results_page.results) > 0 # click through to each result and verify navigation breadcrumbs for i in range(len(results_page.results)): addon = results_page.result(i).click_result() assert 'Themes' in addon.breadcrumb selenium.back()
def test_themes_landing_header(base_url, selenium): themes = Themes(selenium, base_url).open() # checking that 'Themes' is underlined in the header menu assert 'Themes' in themes.header.is_active_link assert 'Themes' in themes.title assert "Change your browser's appearance" \ in themes.header_summary
def test_browse_more_top_rated_themes(base_url, selenium): themes = Themes(selenium, base_url).open() themes.shelves.top_rated_addons.browse_all() assert 'sort=rating&type=statictheme' in selenium.current_url search_results = Search(selenium, base_url) ratings = search_results.result_list.themes for rating in ratings: assert rating.rating >= 4
def test_browse_more_trending_themes(base_url, selenium): themes = Themes(selenium, base_url).open() themes.shelves.trending_addons.browse_all() assert 'sort=hotness&type=statictheme' in selenium.current_url search_results = Search(selenium, base_url) # trending add-ons don't have a predictable order so we # check that search results are displayed for this sort type assert len(search_results.result_list.themes) == 25
def test_browse_more_recommended_themes(base_url, selenium): themes = Themes(selenium, base_url).open() themes.shelves.recommended_addons.browse_all() assert 'type=statictheme' in selenium.current_url search_results = Search(selenium, base_url) select = Select(search_results.filter_by_badging) assert select.first_selected_option.text == 'Recommended' for result in search_results.result_list.extensions: assert 'Recommended' in result.promoted_badge_label
def test_themes_categories(base_url, selenium, count, category): themes = Themes(selenium, base_url).open() # clicking through each Theme Category themes.categories.category_list[count].click() category_results = Search(selenium, base_url) # checking that search results within that category are sorted correctly category_results.wait_for_contextcard_update(category) select = Select(category_results.filter_by_sort) assert 'Most Users' in select.first_selected_option.text
def test_top_rated_themes(base_url, selenium): themes = Themes(selenium, base_url).open() shelf_items = themes.shelves.top_rated_addons.list assert 'Top rated themes' in themes.shelves.top_rated_addons.card_header # the following statements are checking that each shelf has three themes # and each theme has a name, preview and number of users assert len(shelf_items) == 3 for item in shelf_items: assert item.name assert item.addon_icon_preview.is_displayed() assert item.addon_users_preview.is_displayed()
def click(self): menu_name = self._menu.name self._menu.hover() ActionChains(self.selenium).\ move_to_element(self._root_element).\ click().\ perform() if "EXTENSIONS" in menu_name: from pages.desktop.extensions import ExtensionsHome return ExtensionsHome(self.testsetup) elif "THEMES" in menu_name: from pages.desktop.themes import Themes return Themes(self.testsetup) elif "COLLECTIONS" in menu_name: from pages.desktop.collections import Collections return Collections(self.testsetup)
def click(self): name = self.name self._root_element.find_element(*self._name_locator).click() """This is done because sometimes the header menu drop down remains open so we move the focus to footer to close the menu We go to footer because all the menus open a window under them so moving the mouse from down to up will not leave any menu open over the desired element""" footer_element = self.selenium.find_element(*self._footer_locator) ActionChains(self.selenium).move_to_element(footer_element).perform() if "EXTENSIONS" in name: from pages.desktop.extensions import ExtensionsHome return ExtensionsHome(self.base_url, self.selenium) elif "THEMES" in name: from pages.desktop.themes import Themes return Themes(self.base_url, self.selenium) elif "COLLECTIONS" in name: from pages.desktop.collections import Collections return Collections(self.base_url, self.selenium)
def test_searching_for_themes(self, base_url, selenium): page = Themes(base_url, selenium).open() results_page = page.search_for('fox') assert len(results_page.results) > 0
def test_the_featured_themes_section(self, base_url, selenium): page = Themes(base_url, selenium).open() assert 0 < len(page.featured_themes) <= 6
def test_the_top_rated_section(self, base_url, selenium): page = Themes(base_url, selenium).open() assert 6 == len(page.top_rated_themes)
def test_the_most_popular_section(self, base_url, selenium): page = Themes(base_url, selenium).open() assert 6 == len(page.most_popular_themes)
def test_the_recently_added_section(self, base_url, selenium): page = Themes(base_url, selenium).open() assert 6 == len(page.recently_added_themes)
def click_featured_themes_see_all_link(self): self.selenium.find_element(*self._featured_themes_see_all_link).click() from pages.desktop.themes import Themes return Themes(self.testsetup)
def click_themes(self): self.find_element(*self._themes_locator).click() from pages.desktop.themes import Themes return Themes(self.selenium, self.page.base_url).wait_for_page_to_load()