def testDeleteGoods(self): try: # add goods to cart self.logger.info("Add 2 goods to cart") self.goods_name_list = bsnsCommon.add_goods_in_cart(2) # Enter to the shopping cart self.logger.info("Enter to the shopping cart") Element("Shopping_cart", "shopping_cart").click() bsnsCommon.wait_loading() # delete one goods bsnsCommon.delete_goods_in_cart(self.goods_name_list[0]) # get the total_price total_price = bsnsCommon.get_total_price_in_cart() # check result self.check_result(total_price) except Exception as ex: self.logger.error(str(ex))
def testCheckOut(self): try: email = loginGls[0][1] password = loginGls[0][2] bsnsCommon.login(email, password) bsnsCommon.wait_loading() bsnsCommon.cancel_update() bsnsCommon.add_goods_in_cart(1) # enter shopping bag Element("title", "right_shopping_bag").click() bsnsCommon.wait_loading() # get total price in shopping car self.total_price = bsnsCommon.get_total_price_in_cart() Element("shopping_bag", "checkout").click() # add address bsnsCommon.add_address_in_checkout( addressGls[0][1], addressGls[0][2], addressGls[0][3], addressGls[0][4], addressGls[0][5], addressGls[0][6], addressGls[0][7], addressGls[0][8], addressGls[0][9]) bsnsCommon.wait_loading() # choose shipping and payment method bsnsCommon.choose_shipping_payment_methods_in_checkout( self.shipping_method, self.payment_method) # input coupon code self.code_coupon = bsnsCommon.input_coupon_code(self.coupon_code) # input freebie self.code_freebie = bsnsCommon.input_freebie(self.freebie) # check price if self.check_price(): # enter payment page Element("checkout", "place_order").click() bsnsCommon.wait_loading() if bsnsCommon.input_card_paypal_message_in_payment( self.payment_method, self.card_number, self.cvv): self.result = 0 # check result self.check_result() except Exception as ex: self.logger.error(str(ex))
def testFreight(self): try: # Enter to the shopping cart self.logger.info("Enter to the shopping cart") Element("Shopping_cart", "shopping_cart").click() # clear the shopping cart bsnsCommon.clear_cart() # add goods to shopping cart self.logger.info("Add 1 goods to cart") self.goods_name_list = bsnsCommon.add_goods_in_cart("1") # enter the shopping cart self.logger.info("Enter to the shopping cart") Element("Shopping_cart", "shopping_cart").click() bsnsCommon.wait_loading() self.check_result() except Exception as ex: self.logger.error(str(ex))
def testQty_plus(self): try: # add goods to cart self.logger.info("Add 1 goods to cart") self.goods_name_list = bsnsCommon.add_goods_in_cart(1) # Enter to the shopping cart self.logger.info("Enter to the shopping cart") Element("Shopping_cart", "shopping_cart").click() bsnsCommon.wait_loading() Element("Shopping_cart", "goods_num").send_keys(0, "999") os.popen("adb shell input keyevent 61") sleep(1) os.popen("adb shell input keyevent 66") # change qty_add Element("Shopping_cart", "plus_qty").clicks(0) if Element("Alert", "layout").does_exist(): value = Element("Alert", "message").get_attribute("text") self.assertEqual(value, self.message_max) sleep(1) Element("Alert", "confirm").click() # return the index bsnsCommon.return_index() except Exception as ex: self.logger.error(str(ex))