class HomePageTest(BrowserTestCase):
    def test_homepage_loaded(self):
        """ Asserts the home page title is correct
        """
        self.home_page = HomePage(self.driver, self.url)
        self.assertIn(TestData.HOME_TITLE_ATM, self.home_page.driver.title)

    def test_homepage_search_toggle(self):
        """Asserts the search toggle is present on home page
        """
        self.home_page = HomePage(self.driver, self.url)
        self.assertTrue(self.home_page.is_enabled(
            Locators.SEARCH_TOGGLE))

    def test_homepage_top_cards(self):
        """ Asserts both air forecasts cards are loaded
        """
        self.home_page = HomePage(self.driver, self.url)
        cards_list = self.home_page.get_elements(Locators.HOME_CARD)
        first_two_cards = [card.text for card in cards_list[:2]]
        self.assertEqual(first_two_cards, TestData.TOP_CARDS_ATM)

    def test_homepage_top_menu_data_link(self):
        """ Checks for the Data link in the header
        """
        self.home_page = HomePage(self.driver, self.url)
        self.home_page.is_enabled(Locators.DATA_LINK)
 def test_homepage_top_cards(self):
     """ Asserts both air forecasts cards are loaded
     """
     self.home_page = HomePage(self.driver, self.url)
     cards_list = self.home_page.get_elements(Locators.HOME_CARD)
     first_two_cards = [card.text for card in cards_list[:2]]
     self.assertEqual(first_two_cards, TestData.TOP_CARDS_ATM)
 def test_access_the_catalogue(self):
     """ Clicks on the Data Catalogue page link
     """
     self.data_page = HomePage(self.driver, self.url)
     catalogue_link = self.data_page.is_enabled(Locators.CATALOGUE_LINK)
     catalogue_link.click()
     self.assertTrue(
         self.driver.current_url.endswith(TestData.CATALOGUE_URL_EXT))
Beispiel #4
0
 def test_charts_image(self):
     """ Checks for the Forecast charts link and image 
     """
     self.home_page = HomePage(self.driver, self.url)
     link_to_charts_element = self.home_page.click(Locators.CHARTS_LINK)
     self.assertTrue(link_to_charts_element,
                     'Link to forecast charts not found')
     # self.home_page.switch_to_new_window()
     image_element = self.home_page.is_visible(Locators.CHART_IMAGE)
     self.assertTrue(image_element,
                     'Image on the forecast chart detail page not found')
Beispiel #5
0
 def test_catalogue_search_links(self):
     """ Clicks on the first product listed in Catalogue page
         Asserts the image alt corresponds to the first product title
         when clicked on
     """
     self.catalogue_page = HomePage(self.driver, self.url)
     first_product_elem = self.catalogue_page.is_visible(
         Locators.TOP_PRODUCT)
     self.catalogue_page.click(Locators.TOP_PRODUCT)
     first_product_title = first_product_elem.text
     self.catalogue_page.switch_to_new_window()
     image_element = self.catalogue_page.is_enabled(Locators.CATALOGUE_IMG)
     image_alt = " ".join(image_element.get_attribute('alt').split())
     self.assertEqual(first_product_title, image_alt)
Beispiel #6
0
 def test_search_by_text(self):
     """ Clicks the search toggle, perform search, asserts counter works
     """
     self.home_page = HomePage(self.driver, self.url)
     self.search_toggle = self.home_page.is_enabled(Locators.SEARCH_TOGGLE)
     self.search_toggle.click()
     self.search_input = self.home_page.is_enabled(Locators.SEARCH_INPUT)
     self.search_input.clear()
     # enter search keyword and submit
     self.search_input.send_keys(TestData.SEARCH_TEXT_ATM)
     self.search_input.submit()
     # get the list of elements displayed after the search
     results = self.home_page.get_elements(Locators.SEARCH_RESULTS)
     self.header = self.home_page.is_enabled(Locators.SEARCH_RESULTS_HEADER)
     first_page_results_count = int(self.header.text.split()[3])
     self.assertEqual(len(results), first_page_results_count)
 def test_homepage_loaded(self):
     """ Asserts the home page title is correct
     """
     self.home_page = HomePage(self.driver, self.url)
     self.assertIn(TestData.HOME_TITLE_ATM, self.home_page.driver.title)
 def test_homepage_top_menu_data_link(self):
     """ Checks for the Data link in the header
     """
     self.home_page = HomePage(self.driver, self.url)
     self.home_page.is_enabled(Locators.DATA_LINK)
 def test_homepage_search_toggle(self):
     """Asserts the search toggle is present on home page
     """
     self.home_page = HomePage(self.driver, self.url)
     self.assertTrue(self.home_page.is_enabled(
         Locators.SEARCH_TOGGLE))