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_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()