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 app(request): global browser if browser is None: browser = App() # if server == 'stage': # browser.wd.get('http://*****:*****@stage.restaurantsupply.com') if is_logged == True: get(base_url) browser.index_page.login() sleep( 3 ) # значение подгружается через какое-то время, а не при открытии страницы if int(browser.index_page.cart_counter_number.text) > 0: browser.cart_page.empty_cart() def fin(): global browser browser.destroy() browser = None request.addfinalizer(fin) return browser
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.'
def test_add_one_product_to_cart(app): get(base_url) app.search_page.find('empura') title = app.search_page.item().title.get_attribute('title') app.search_page.add_to_cart() 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 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 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_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()
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')
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 make_screenshot(url, file_name=None): get(url) sleep(1) fullpage_screenshot(browser + '/' + Screenshooter.todays_date + '/' + Screenshooter.resolution_catalog + '/' + file_name)
# # index -> popup -> checkout -> select method -> b=s -> F5 -> b=s -> order - pass # index -> popup -> checkout -> select method -> b!=s -> F5 -> b!=s -> order ---pass #--------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