class ProductsCatalogueTest(BrowserTestCase): 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)
class ChartsTest(BrowserTestCase): 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')