Ejemplo n.º 1
0
    def test_search_results(self):
        """
        Verify all the search results contain the search text.
        """
        driver = self.driver

        home = HomePage(driver)
        search_text = "shirt"
        home.enter_search_text(search_text)
        home.click_search_button()

        result = home.validate_search_results(search_text)
        self.assertTrue(result)
    def add_product_in_cart(self, search_category, search_product):
        logger = self.getLogger()

        driver = self.driver
        search_From_Home = HomePage(driver)
        search_From_Home.enter_search_query(search_category)
        search_result_page = search_From_Home.click_search_button()

        products = search_result_page.return_search_products()
        product_name = None
        selected_product = None
        for product in products:
            selected_product = product
            selected_product_name = search_result_page.return_product_name(
                selected_product)
            #print(selected_product_name)
            #print("\n")
            #logger.info(selected_product_name+"\n")
            if search_product in selected_product_name.lower():
                break
        time.sleep(5)

        search_result_page.add_selected_product(selected_product)
        product_name = selected_product_name
        self.added_products.append(product_name)
        return product_name