def fill_billing_form(self, billing_equal_shipping=True): self.billing.credit_cart_method.click() if billing_equal_shipping: Wait.visible(self.billing_equal_shipping_checkbox_lo) Wait.invisible(self.full_page_loader_lo) self.billing.billing_equal_shipping_checkbox.click() else: Wait.visible(self.billing_name_lo) self.billing.name.clear() self.billing.name.send_keys(Random.name()) self.billing.last_name.clear() self.billing.last_name.send_keys(Random.name()) self.billing.company.clear() self.billing.company.send_keys(Random.name()) self.billing.address_1.clear() self.billing.address_1.send_keys(Random.name()) self.billing.address_2.clear() self.billing.address_2.send_keys(Random.name()) self.billing.zip.clear() self.billing.zip.send_keys(20047) Wait.visible(self.full_page_loader_lo) Wait.invisible(self.full_page_loader_lo) self.fill_phone(2)
def order(self, billing_equal_shipping = True): get(product) self.product_page.add_to_cart() Wait.visible(self.product_page.minicart_popup_lo) self.product_page.minicart_popup.view_cart_link.click() # *****************************on cart page Wait.invisible(self.cart_page.full_page_loader_lo) self.cart_page.enter_zip(10001) Wait.invisible(self.cart_page.full_page_loader_lo) self.cart_page.checkout_button.click() Wait.invisible(self.cart_page.full_page_loader_lo) self.checkout_page.fill_shipping_form() Wait.invisible(self.cart_page.full_page_loader_lo) #sleep(5) self.checkout_page.fill_billing_form(billing_equal_shipping) self.checkout_page.fill_cc_form() self.checkout_page.billing.place_order_button.click()
def add_to_cart(self, qty=1): Wait.visible(self.product_img_lo) if qty > 1: self.product_qty.clear() self.product_qty.send_keys(qty) self.add_to_cart_button.click() else: self.add_to_cart_button.click()
def fill_shipping_form(self): if is_logged == True: #self.shipping.shipping_ship_here_button().click() self.shipping.next_button.click() else: self.shipping.email.clear() self.shipping.email.send_keys(Random.email()) self.shipping.name.clear() self.shipping.name.send_keys(Random.name()) self.shipping.company.clear() self.shipping.company.send_keys(Random.name()) self.shipping.last_name.clear() self.shipping.last_name.send_keys(Random.name()) self.shipping.address_1.clear() self.shipping.address_1.send_keys(Random.name()) self.shipping.address_2.clear() self.shipping.address_2.send_keys(Random.name()) self.shipping.zip.clear() self.shipping.zip.send_keys(20047) Wait.visible(self.full_page_loader_lo) Wait.invisible(self.full_page_loader_lo) self.fill_phone() self.shipping.next_button.click() Wait.visible(self.full_page_loader_lo) Wait.invisible(self.full_page_loader_lo)
def shipping_page(app): get(simple_product) app.product_page.add_to_cart() Wait.visible(app.product_page.minicart_popup_lo) app.product_page.minicart_popup.view_cart_link.click() Wait.invisible(app.cart_page.full_page_loader_lo) Wait.is_clickable(app.cart_page.checkout_button_lo) app.cart_page.checkout_button.click() Wait.visible(app.cart_page.full_page_loader_lo) Wait.invisible(app.cart_page.full_page_loader_lo) sleep(0.5) fullpage_screenshot(browser + '/' + Screenshooter.todays_date + '/' + Screenshooter.resolution_catalog + '/' + 'shipping-page.png')
def test_add_one_product_to_cart(app): get(category) title = app.category_page.item().title.text app.category_page.add_to_cart(1) Wait.visible(app.product_page.minicart_popup_lo) assert '1 item(s) added to your cart' == app.product_page.minicart_popup.title.text assert title == app.product_page.minicart_popup.product_link.text app.product_page.minicart_popup.view_cart_link.click() # now we are on cart page cart_qty = int(app.cart_page.item().qty.get_attribute('value')) title_in_cart = app.cart_page.item().title.text assert cart_qty == 1 assert title == title_in_cart
def test_add_one_product_from_related_products_block(app): get(product_with_related) rel_title = app.product_page.related().title.text app.product_page.add_related() Wait.visible(app.product_page.minicart_popup_lo) assert '1 item(s) added to your cart' == app.product_page.minicart_popup.title.text assert rel_title == app.product_page.minicart_popup.product_link.text assert int(app.product_page.cart_counter_number.text) == 1 sleep(1) app.product_page.minicart_popup.view_cart_link.click() cart_qty = int(app.cart_page.item().qty.get_attribute('value')) title_in_cart = app.cart_page.item().title.text assert cart_qty == 1 assert rel_title == title_in_cart
def test_add_multiple_product_to_cart(app): get(product) qty = 11 title = app.product_page.product_title.text app.product_page.add_to_cart(qty) Wait.visible(app.product_page.minicart_popup_lo) assert str( qty ) + ' item(s) added to your cart' == app.product_page.minicart_popup.title.text assert title == app.product_page.minicart_popup.product_link.text app.product_page.minicart_popup.view_cart_link.click() #now we are on cart page cart_qty = int(app.cart_page.item().qty.get_attribute('value')) title_in_cart = app.cart_page.item().title.text assert cart_qty == qty assert title == title_in_cart
def billing_page(app, billing_equal_shipping=False): get(simple_product) app.product_page.add_to_cart() Wait.visible(app.product_page.minicart_popup_lo) app.product_page.minicart_popup.view_cart_link.click() Wait.invisible(app.cart_page.full_page_loader_lo) app.cart_page.enter_zip(10001) Wait.invisible(app.cart_page.full_page_loader_lo) app.cart_page.checkout_button.click() Wait.invisible(app.cart_page.full_page_loader_lo) app.checkout_page.fill_shipping_form() app.checkout_page.billing.credit_cart_method.click() Wait.invisible(app.cart_page.full_page_loader_lo) sleep(0.5) fullpage_screenshot(browser + '/' + Screenshooter.todays_date + '/' + Screenshooter.resolution_catalog + '/' + 'billing-page.png')
def empty_cart(self): if 'checkout/cart' not in self.wd.current_url: self.wd.get(base_url + '/checkout/cart/') try: Wait.invisible(self.full_page_loader_lo) self.empty_cart_link.click() sleep(1) except Exception as e: Wait.invisible(self.full_page_loader_lo) self.empty_cart_link.click() sleep(1) else: try: Wait.invisible(self.full_page_loader_lo) self.empty_cart_link.click() sleep(1) except Exception as e: Wait.invisible(self.full_page_loader_lo) self.empty_cart_link.click() sleep(1)
def cart_page(app): get(product_with_related) app.product_page.add_related(1, 2) app.product_page.add_related(2, 3) app.product_page.add_to_cart() Wait.visible(app.product_page.minicart_popup_lo) app.product_page.minicart_popup.view_cart_link.click() Wait.visible(app.cart_page.checkout_button_lo ) # for firefox, otherwise don't work Wait.invisible(app.cart_page.full_page_loader_lo) sleep(0.5) fullpage_screenshot(browser + '/' + Screenshooter.todays_date + '/' + Screenshooter.resolution_catalog + '/' + 'cart-page.png')
def test_order_pp_popup_bs1(app): get(product) app.product_page.add_to_cart() Wait.visible(app.product_page.minicart_popup_lo) app.product_page.minicart_popup.checkout_link.click() # *****************************on chechout page Wait.invisible(app.cart_page.full_page_loader_lo) app.checkout_page.fill_shipping_form() Wait.invisible(app.cart_page.full_page_loader_lo) app.checkout_page.fill_billing_form(True) app.checkout_page.fill_cc_form() app.checkout_page.billing.place_order_button.click()
from pages.admin_product_page import AdminProductPage from app.tools import get, find, Wait a = AdminProductPage() # a.login() get('http://dev.restaurantsupply.com/restaura_admin/catalog/product/new/set/4/type/simple/' ) Wait.invisible('//div[@class="admin__form-loading-mask"]') # a.open_all_collapsed_settings() # # a.product_name.clear() # a.product_name.send_keys('dddddddd') # # a.original_product_name.clear() # a.original_product_name.send_keys('dddddddd') # # # a.open_price.click() # a.price.clear() # a.price.send_keys('155') # # a.internal_id_magento.send_keys('1dddddddd55') # a.export_description.send_keys('1dddddddd55') a.enable_all_switchers() #a.wd.quit()
def test_invalid_zip_on_shipping_page(app): get(product) app.product_page.add_to_cart() Wait.visible(app.product_page.minicart_popup_lo) app.product_page.minicart_popup.view_cart_link.click() Wait.invisible(app.cart_page.full_page_loader_lo) app.cart_page.enter_zip('06001') Wait.invisible(app.cart_page.full_page_loader_lo) app.cart_page.checkout_button.click() Wait.invisible(app.cart_page.full_page_loader_lo) app.checkout_page.shipping.zip.clear() app.checkout_page.shipping.zip.send_keys('06001') Wait.visible(app.cart_page.full_page_loader_lo) Wait.invisible(app.cart_page.full_page_loader_lo) app.checkout_page.shipping.zip.clear() app.checkout_page.shipping.zip.send_keys('55555') errors_text_array = finds('//div[@class="mage-error"]') assert errors_text_array[0].text == 'This is a required field.' assert errors_text_array[1].text == 'This is a required field.'
#--------guest - pp - # index -> cart -> checkout -> b=s -> order --- pass # index -> cart -> checkout -> b!=s -> order --- pass # # index -> cart -> checkout -> F5 -> b=s -> order -- pass # index -> cart -> checkout -> F5 -> b!=s -> order # # index -> cart -> checkout -> select method -> b=s -> F5 -> b=s -> order # index -> cart -> checkout -> select method -> b!=s -> F5 -> b!=s -> order #http://dev.restaurantsupply.com/bloomfield-8543-d2 get('http://*****:*****@dev.restaurantsupply.com/bloomfield-8543-d2') app.product_page.add_to_cart() Wait.visible(app.product_page.minicart_popup_lo) app.product_page.minicart_popup.view_cart_link.click() Wait.invisible(app.cart_page.full_page_loader_lo) # app.cart_page.enter_zip(10001) # # Wait.invisible(app.cart_page.full_page_loader_lo) app.cart_page.checkout_button.click() # *****************************on chechout page Wait.invisible(app.cart_page.full_page_loader_lo) app.checkout_page.fill_shipping_form()