def test_that_breadcrumb_links_in_details_page_work(self, mozwebqa): """ Test for Litmus 11923. https://litmus.mozilla.org/show_test.cgi?searchType=by_id&id=11923 """ home_page = Home(mozwebqa) detail_page = Details(mozwebqa, 'firebug') Assert.equal(detail_page.breadcrumbs[0].text, 'Add-ons for Firefox') link = detail_page.breadcrumbs[0].href_value detail_page.breadcrumbs[0].click() Assert.true(home_page.is_the_current_page) Assert.true(home_page.get_url_current_page().endswith(link)) home_page.return_to_previous_page() Assert.equal(detail_page.breadcrumbs[1].text, 'Extensions') link = detail_page.breadcrumbs[1].href_value detail_page.breadcrumbs[1].click() amo_extenstions_page = ExtensionsHome(mozwebqa) Assert.true(amo_extenstions_page.is_the_current_page) Assert.true(amo_extenstions_page.get_url_current_page().endswith(link)) home_page.return_to_previous_page() Assert.equal(detail_page.breadcrumbs[2].text, 'Firebug')
def test_searching_for_extensions(self, base_url, selenium): page = ExtensionsHome(base_url, selenium).open() results_page = page.search_for('fire') 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 'Extensions' in addon.breadcrumb selenium.back()
def click_see_all(self): see_all_url = self.see_all_link self._root.find_element(*self._see_all_locator).click() if 'extensions' in see_all_url: from pages.desktop.extensions import ExtensionsHome return ExtensionsHome(self.testsetup) elif 'personas' in see_all_url: from pages.desktop.personas import Personas return Personas(self.testsetup) elif 'collections' in see_all_url: from pages.desktop.collections import Collections return Collections(self.testsetup)
def test_that_breadcrumb_links_in_details_page_work(self, base_url, selenium): home_page = Home(base_url, selenium) detail_page = Details(base_url, selenium, 'firebug') assert 'Add-ons for Firefox' == detail_page.breadcrumbs[0].text link = detail_page.breadcrumbs[0].href_value detail_page.breadcrumbs[0].click() assert home_page.is_the_current_page assert home_page.get_url_current_page().endswith(link) home_page.return_to_previous_page() assert 'Extensions' == detail_page.breadcrumbs[1].text link = detail_page.breadcrumbs[1].href_value detail_page.breadcrumbs[1].click() amo_extensions_page = ExtensionsHome(base_url, selenium) assert amo_extensions_page.is_the_current_page assert amo_extensions_page.get_url_current_page().endswith(link) home_page.return_to_previous_page() assert 'Firebug' == detail_page.breadcrumbs[2].text
def test_that_breadcrumb_links_in_details_page_work(self, mozwebqa): home_page = Home(mozwebqa) detail_page = Details(mozwebqa, 'firebug') Assert.equal(detail_page.breadcrumbs[0].text, 'Add-ons for Firefox') link = detail_page.breadcrumbs[0].href_value detail_page.breadcrumbs[0].click() Assert.true(home_page.is_the_current_page) Assert.true(home_page.get_url_current_page().endswith(link)) home_page.return_to_previous_page() Assert.equal(detail_page.breadcrumbs[1].text, 'Extensions') link = detail_page.breadcrumbs[1].href_value detail_page.breadcrumbs[1].click() amo_extensions_page = ExtensionsHome(mozwebqa) Assert.true(amo_extensions_page.is_the_current_page) Assert.true(amo_extensions_page.get_url_current_page().endswith(link)) home_page.return_to_previous_page() Assert.equal(detail_page.breadcrumbs[2].text, 'Firebug')
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 click_to_explore(self, what): what = what.replace(' ', '_').lower() self.selenium.find_element(*getattr(self, "_explore_%s_link_locator" % what)).click() from pages.desktop.extensions import ExtensionsHome return ExtensionsHome(self.testsetup)
def click_featured_extensions_see_all_link(self): self.selenium.find_element( *self._featured_extensions_see_all_locator).click() from pages.desktop.extensions import ExtensionsHome return ExtensionsHome(self.testsetup)
def test_searching_for_extensions(self, base_url, selenium): page = ExtensionsHome(base_url, selenium).open() results_page = page.search_for('fire') assert len(results_page.results) > 0