def test_04_empty_cart(self): driver = self.driver home = HomePage(driver) home.click_home() home.click_on_cart() assert "Your cart is currently empty" in driver.page_source
def test_10_about_us_page_redirection(self): driver = self.driver home = HomePage(driver) home.click_home() home.click_about_us() assert 'About Us' in driver.title
def test_13_latest_news(self): driver = self.driver home = HomePage(driver) home.click_home() home.click_latest_news() assert 'News' in driver.title
def test_09_recipe_page_redirection(self): driver = self.driver home = HomePage(driver) home.click_home() home.click_recipe() assert 'Recipe' in driver.title
def test_08_products_page_redirection(self): driver = self.driver home = HomePage(driver) home.click_home() home.click_products() assert 'Products' in driver.title
def test_15_follow_us_from_footer(self): driver = self.driver home = HomePage(driver) home.click_home() try: home.check_social_links_present() except NoSuchElementException: return False return True
def test_12_all_collections(self): driver = self.driver home = HomePage(driver) home.click_home() for collection_name in settings.COLLECTIONS: home.click_home() driver.find_element_by_partial_link_text(collection_name).click() assert collection_name in driver.title
def test_14_links_from_footer(self): driver = self.driver home = HomePage(driver) home.click_home() for link_text in settings.FOOTER_LINKS: home.click_home() home.click_links_one_after_another(link_text) assert link_text in driver.title
def test_16_subscribe(self): driver = self.driver home = HomePage(driver) home.click_home() home.enter_email_subscribe(settings.EMAIL_GENERATOR) home.click_subscribe_button() if home.success_message_is_shown(): print("Element exists") else: print("No such element exist")
def test_06_valid_search(self): driver = self.driver home = HomePage(driver) home.click_home() search_term = 'Chicken' home.enter_search_query(search_term) home.press_enter_from_keyboard() time.sleep(4) try: assert search_term in driver.title print("Assertion Test Passed") except Exception as e: print("Assertion Test Failed", format(e))
def test_05_add_product_to_cart(self): driver = self.driver home = HomePage(driver) products = ProductsPage(driver) product_details = ProductDetailsPage(driver) cart = CartPage(driver) home.click_home() home.click_products() products.click_on_a_random_product() product_details.click_add_to_cart() assert "Your Shopping Cart" in driver.title WebDriverWait(driver, 10).until( EC.presence_of_element_located((By.CLASS_NAME, "btn"))) cart.click_remove_cart() assert "Your cart is currently empty" in driver.page_source
def test_18_complete_checkout_by_discount_code(self): driver = self.driver home = HomePage(driver) products = ProductsPage(driver) product_details = ProductDetailsPage(driver) cart = CartPage(driver) shippingInfo = ShippingInfoPage(driver) shippingSelection = ShippingPage(driver) payment = PaymentPage(driver) order_success = OrderConfirmationPage(driver) home.click_home() home.click_products() products.click_on_a_random_product() product_details.click_add_to_cart() cart.click_checkout_button() WebDriverWait(driver, 10).until( EC.presence_of_element_located((By.ID, "checkout_email_or_phone"))) shippingInfo.enter_discount_code(settings.DISCOUNT_CODE) shippingInfo.press_enter_from_keyboard() shippingInfo.enter_checkout_email_or_phone(settings.EMAIL_GENERATOR) shippingInfo.enter_shipping_address_last_name(settings.NAME_GENERATOR) shippingInfo.enter_checkout_shipping_address_address1( settings.ADDRESS_GENERATOR) shippingInfo.enter_checkout_shipping_address_city(settings.CITY) shippingInfo.enter_checkout_shipping_address_zip( settings.ZIP_GENERATOR) shippingInfo.click_continue_to_shipping() WebDriverWait(driver, 10).until( EC.element_to_be_clickable((By.ID, "continue_button"))) shippingSelection.click_continue_to_payment_button() payment.click_complete_order_button() WebDriverWait(driver, 10).until( EC.presence_of_element_located((By.CLASS_NAME, "os-order-number"))) assert 'Thank you for your purchase' in driver.title order_success.print_order_number() order_success.click_continue_shopping()
def test_07_homepage_redirection(self): driver = self.driver any_page = HomePage(driver) any_page.click_home() assert 'Home' in driver.title