def test_2(self): # self.driver = webdriver.PhantomJS(executable_path='/Users/user/phantomjs-2.1.1-macosx/bin/phantomjs') self.driver = webdriver.Firefox() self.driver.get(TestHelper.server) navigate = Checkout.VipOutletTestCheckout(self.driver) navigate.testCheckout() placeOrder = TestHelper.AddAddressCheckout(self.driver) while True: try: placeOrder.placeOrder() except WebDriverException: print "Unable to click Place Order, retrying" else: break while True: try: orderID = self.driver.find_element_by_css_selector( ".order-id-row__id > a:nth-child(1)") except NoSuchElementException: print "Waiting Page reload" else: break while True: try: orderIdElement = self.driver.find_element_by_css_selector( TestHelper.orderId) print "Order Number " + orderIdElement.text + " is created" orderIdElement.click() except WebDriverException: print "Unable to click Order ID, retrying" else: break
class editAddressinCheckout(unittest.TestCase): def test_2(self): self.driver = webdriver.Firefox() self.driver.get(TestHelper.server) navigate = Checkout.VipOutletTestCheckout(self.driver) if navigate.test_1_register(): changePaymentClick = TestHelper.changePayment(self.driver) if changePaymentClick.chagePaymentClickCheckout(): print "change Payment is clicked" else: changePaymentClick.chagePaymentClickCheckout() while True: try: addNewPaymentCheckout = TestHelper.addNewPaymentChekoutExisterPayment(self.driver) addNewPaymentCheckout.addNewPaymentCheckout() except NoSuchElementException, e: print "Button Add New Payment is missed" else: break addcreditcard =TestHelper.AddAddressCheckout(self.driver) if addcreditcard.credit_card_checkout(): while True: try: chooseAddress = TestHelper.chooseAddress(self.driver) chooseAddress.chooseAddressAddPayment() except NoSuchElementException,e: print "No exister address books in dropdown" else: addcreditcard.addAddressCheckoutPayment()
def test_PVG939(self): self.driver = webdriver.Firefox() self.driver.get(TestHelper.server) navigate = Checkout.VipOutletTestCheckout(self.driver) navigate.test_1_register() addNewCreditCard = TestHelper.AddAddressCheckout(self.driver) addNewCreditCard.cancelWishlistButton
def test_guestCheckout(self): self.driver = webdriver.Firefox() self.driver.get(TestHelper.server) product = TestHelper.HomePage(self.driver) product.productOnHomePage() addToCart =TestHelper.addtoCartProductPage(self.driver) addToCart.addToCart() addressGuestCheckout = TestHelper.AddAddressCheckout(self.driver) addressGuestCheckout.add_address_checkout()
def test_2(self): self.driver = webdriver.Firefox() self.driver.get(TestHelper.server) navigate = Checkout.VipOutletTestCheckout(self.driver) navigate.test_1_register() addNewCreditCard = TestHelper.AddAddressCheckout(self.driver) while True: try: placeOrder = TestHelper.AddAddressCheckout(self.driver) placeOrder.placeOrder() except WebDriverException: print "Unable to click Place Order, retrying" else: break while True: try: orderIdElement = self.driver.find_element_by_css_selector(TestHelper.orderId) orderIdElement.click() except WebDriverException: print "Unable to click Order ID, retrying" else: break
addtocart.addToCartProductPageMethod() except NoSuchElementException, e: print "Click button [Add to Cart] on product page" else: break checkout = TestHelper.CheckoutPage(self.driver) # while True: # try: # checkout.addtoWishlistCheckoutElement() # except NoSuchElementException: # print "Click [Add to Wishlist] button" # else: # break # if checkout.checkwishlistCheckout: # if (checkout.checkwishlistCheckout.text == 1): # print "Wishlist"+checkout.checkwishlistCheckout.text+"Product is Added to Wishlist" # else: # print "Product is not added to Wishlist - Fail" while True: try: checkout.addNewPaymentCheckout() except WebDriverException, e: print "Unable to click Add Payment in Checkout, retrying" else: break checkoutAddress = TestHelper.AddAddressCheckout(self.driver) checkoutAddress.credit_card_checkout() checkoutAddress.addAddressIcon() checkoutAddress.add_address_checkout() checkoutAddress.addAddressCheckoutPayment()