def clear_cart(): """ clear the shopping cart :return: """ logger.info("Clear the shopping cart") goods_list = [] while Element("Shopping_cart", "goods_name").is_exist(): logger.info("Get the goods name") element_list = Element("Shopping_cart", "goods_name").get_element_list() if element_list is not None: last_goods_name = element_list[-1].get_attribute("text") for i in range(len(element_list)): logger.info("Delete goods") Element("Shopping_cart", "delete_goods").clicks(i) Element("Alert", "confirm").click() wait_loading() if last_goods_name not in goods_list: logger.info("Goods is not end") logger.info("Swipe up, if not end") common.my_swipe_to_up() goods_list.append(last_goods_name) else: logger.info("Goods is end") break
def testRecentlyViewed(self): try: email = loginGls[0][1] password = loginGls[0][2] bsnsCommon.login(email, password) bsnsCommon.wait_loading() if Element("Alert", "update_title").is_exist(): Element("Alert", "cancel").click() else: pass # go to daily new Element("daily_new", "daily_new").click() bsnsCommon.wait_loading() # view a goods Element("daily_new", "daily_new_goods").clicks(0) sleep(1) common.my_swipe_to_up() self.goods_name = Element("daily_new", "goods_name").get_attribute("text") # go to recently viewed common.back() sleep(1) bsnsCommon.go_to_me() bsnsCommon.wait_loading() Element("recently_viewed", "recently_viewed").click() # check result self.checkResult() except Exception as ex: self.logger.error(str(ex))
def input_coupon_code(coupon_code): """ input the coupon code :param coupon_code: :return: """ code_coupon = 0 if not coupon_code == "": # enter coupon_code if not Element("checkout", "coupon_code").is_exist(): common.my_swipe_to_up() else: Element("checkout", "coupon_code").click() wait_loading() Element("checkout", "coupon_freebie_input").send_key(coupon_code) sleep(1) Element("checkout", "coupon_freebie_save").click() if Element("Alert", "layout").is_exist(): message = Element("Alert", "message").get_attribute("text") if message == "success": logger.info("Using coupon code that is \'" + coupon_code + "\' successfully!") Element("Alert", "confirm").click() else: logger.info("The \'" + coupon_code + "\' coupon code can not be used.") Element("Alert", "confirm").click() common.back() code_coupon = 1 else: logger.info("Don't use coupon code.") return int(code_coupon)
def choose_shipping_payment_methods_in_checkout(shipping_method, payment_method): """ choose method for shipping and payment :param shipping_method: :param payment_method: :return: """ # choose shipping method shipping_methods = Element("checkout", "shopping_method").get_element_list() if shipping_methods is not None: methods = [] for i in range(len(shipping_methods)): methods[i] = shipping_methods[i].get_attribute("text") if methods[i] is not None: if methods[i] == shipping_method: logger.info("Choose the shipping method is:" + shipping_method) Element("checkout", "shopping_method").gets(i).click() else: logger.info("The shipping method is none!") # choose payment method if not Element("checkout", "payment_method").is_exist(): common.my_swipe_to_up() else: payment_methods = Element("checkout", "payment_method").get_element_list() if payment_methods is not None: payments = [] for i in range(len(payment_methods)): payments[i] = payment_methods[i].get_attribute("text") if payments[i] == payment_method: logger.info("Choose the payment method is:" + payment_method) Element("checkout", "payment_method").gets(i).click() else: logger.info("The payment method is none!")
def input_freebie(freebie): """ input the freebie :param freebie: :return: """ code_freebie = 0 if not freebie == "": # enter freebie if not Element("checkout", "freebie").is_exist(): common.my_swipe_to_up() else: Element("checkout", "freebie").click() wait_loading() Element("checkout", "coupon_freebie_input").send_key(freebie) sleep(1) Element("checkout", "coupon_freebie_save").click() if Element("Alert", "layout").is_exist(): message = Element("Alert", "message").get_attribute("text") if message == "success": logger.info("Using \'" + freebie + "\' points successfully!") Element("Alert", "confirm").click() else: logger.info("No points in account, using points failed.") Element("Alert", "confirm").click() common.back() code_freebie = 1 else: logger.info("Don't use shein points.") return int(code_freebie)
def checkResult(self): common.my_swipe_to_up() goods = Element("recently_viewed", "goods_name").gets(0) value = goods.get_attribute("text") self.logger.info("recently goods_name is : " + value) if value == self.goods_name: self.assertEqual(1, 1)
def addWishlist(self): # go to daily new Element("daily_new", "daily_new").click() bsnsCommon.wait_loading() # find a goods Element("daily_new", "daily_new_goods").clicks(0) # click new guide if Element("daily_new", "new_guide").is_exist(): Element("daily_new", "new_guide").click() else: pass # get add goods name self.goods_name = Element("daily_new", "goods_name").get_attribute("text") # add goods to wish_list while not Element("daily_new", "add_wishlist").is_exist(): common.my_swipe_to_up() else: Element("daily_new", "add_wishlist").click() if Element("Alert", "layout").does_exist(): self.addResult = self.log.take_shot(self.driver, self.case_name) self.logger.info("Take shot, the picture path is:" + self.addResult) Element("Alert", "confirm").click()
def enter_cart(): """ enter the shopping cart :return: """ logger.info("Enter add cart page") if not Element("Good_details", "add").is_exist(): common.my_swipe_to_up() else: Element("Good_details", "add").click()
def input_card_paypal_message_in_payment(payment_method, card_no, cvv): code = True title = Element("shippinginfo", "shipping_info_title").get_attribute("text") if title == "Payment": # Credit Card payment if payment_method == "Credit Card": # enter card number if not Element("payment", "card_number").is_exist(): common.my_swipe_to_up() else: Element("payment", "card_number").send_key(card_no) # enter expire date if not Element("payment", "expire_date_month").is_exist(): common.my_swipe_to_up() else: Element("payment", "expire_date_month").click() sleep(1) if Element("payment", "expire_date_dialog").is_exist(): Element("payment", "months").clicks(8) else: logger.info("No month can be chosen.") if not Element("payment", "expire_date_year").is_exist(): common.my_swipe_to_up() else: Element("payment", "expire_date_year").click() sleep(1) if Element("payment", "expire_date_dialog").is_exist(): Element("payment", "years").clicks(3) else: logger.info("No years can be chosen.") # enter cvv number if not Element("payment", "cvv_number").is_exist(): common.my_swipe_to_up() else: Element("payment", "cvv_number").send_key(cvv) # click purchase if not Element("payment", "purchase").is_exist(): common.my_swipe_to_up() else: Element("payment", "purchase").click() wait_loading() result = Element("shippinginfo", "shipping_info_title").get_attribute("text") if str(result) != "PAYMENT SUCCESS": logger.info("Pay fail.") code = False # PayPal payment elif payment_method == "PayPal": title = Element("shippinginfo", "shipping_info_title").get_attribute("text") if not title == "Payment": code = False else: logger.info("This is not the payment page.") code = False return code
def get_total_price_in_cart(): """ get the all goods price in shopping cart :return: """ logger.info("Determine whether there is a goods") goods_list = [] total_price = 0 while Element("Shopping_cart", "goods_name").is_exist(): logger.info("Get the goods name") element_list = Element("Shopping_cart", "goods_name").get_element_list() if element_list is not None: logger.info("Get the last goods name") last_goods_name = element_list[-1].get_attribute("text") for i in range(len(element_list)): goods_name = element_list[i].get_attribute("text") if goods_name not in goods_list: goods_list.append(goods_name) goods_price_text = Element( "Shopping_cart", "goods_price").gets(i).get_attribute("text") goods_price = goods_price_text[goods_price_text.find("$") + 1:] goods_num = Element( "Shopping_cart", "goods_num").gets(i).get_attribute("text") one_goods_price = float(goods_price) * int(goods_num) total_price += one_goods_price if last_goods_name not in goods_list: logger.info("Goods is not end") logger.info("Swipe up, if not end") common.my_swipe_to_up() goods_list.append(last_goods_name) else: logger.info("Goods is end") break return str(total_price)
def delete_goods_in_cart(goods_name): """ delete goods in shopping cart :param goods_name: you need delete goods's name :return: """ logger.info("Delete the goods which we choose") goods_list = [] logger.info("Determine whether there is a goods") while Element("Shopping_cart", "goods_name").is_exist(): logger.info("Get the goods name") element_list = Element("Shopping_cart", "goods_name").get_element_list() if element_list is not None: logger.info("Get the last goods name") last_goods_name = element_list[-1].get_attribute("text") for i in range(len(element_list)): value = element_list[i].get_attribute("text") if value == goods_name: logger.info("Delete goods") Element("Shopping_cart", "delete_goods").clicks(i) Element("Alert", "confirm").click() wait_loading() return if last_goods_name not in goods_list: logger.info("Goods is not end") logger.info("Swipe up, if not end") common.my_swipe_to_up() goods_list.append(last_goods_name) else: logger.info("Goods is end") return
def testSave(self): try: self.logger.info("Enter the profile") # find the bottom Navigation bar while not Element("BottomNavigation", "BottomNavigation").is_exist(): sleep(1) else: # enter the profile Element("BottomNavigation", "profile").click() bsnsCommon.wait_loading() # first login user_name = loginCls[0][1] password = loginCls[0][2] bsnsCommon.login(user_name, password) bsnsCommon.wait_loading() bsnsCommon.return_index() self.logger.info("Enter the goods details") while not Element("Shop", "goods").is_exist(): myCommon.my_swipe_to_up() else: myCommon.my_swipe_to_up() Element("Shop", "goods").clicks(0) bsnsCommon.wait_loading() self.logger.info("Get the goods's name") self.goods_name = Element("title", "title").get_attribute("text") Element("Good_details", "save").click() self.check_result(self.goods_name) except Element as ex: self.logger.error(str(ex))
def checkAddResult(self): # go to My Wishlist common.back() bsnsCommon.go_to_me() bsnsCommon.wait_loading() common.my_swipe_to_up() self.addResult = self.log.take_shot(self.driver, self.case_name) self.logger.info("Take shot, the picture path is:" + self.addResult) goods = Element("wish_list", "wish_goods_name").get_element_list() for name in goods: name.get_attribute("text") goods_name = name if goods_name == self.goods_name: self.assertEqual(1, 1) self.logger.info("Add goods successfully : OK")
def checkRemoveResult(self): # go to My Wishlist common.back() bsnsCommon.wait_loading() common.my_swipe_to_up() goods = Element("wish_list", "wish_goods_name").get_element_list() if len(goods) > 0: for name in goods: name.get_attribute("text") goods_name = name if goods_name != self.goods_name: pass else: self.assertEqual(0, 1) break
def addShoppingBag(self): # click add to bag while not Element("add_shopping_bag", "add_bag").is_exist(): common.my_swipe_to_up() else: Element("add_shopping_bag", "add_bag").click() # choose size if Element("add_shopping_bag", "size").is_exist(): Element("add_shopping_bag", "size").clicks(0) # click done if not Element("add_shopping_bag", "add_done").is_exist(): common.my_swipe_to_up() else: Element("add_shopping_bag", "add_done").click() bsnsCommon.wait_loading() self.name = Element("add_shopping_bag", "name").get_attribute("text")
def removeWishlist(self): # go to My Wishlist common.back() bsnsCommon.go_to_me() bsnsCommon.wait_loading() common.my_swipe_to_up() # get remove goods name self.re_goods_name = Element( "wish_list", "wish_goods_name").gets(0).get_attribute("text") # find a goods Element("wish_list", "wish_goods_name").clicks(0) # remove goods from wish list while not Element("daily_new", "add_wishlist").is_exist(): common.my_swipe_to_up() else: Element("daily_new", "add_wishlist").click()
def testSettingFeedBack(self): try: self.logger.info("Enter the profile") # find the bottom Navigation bar while not Element("BottomNavigation", "BottomNavigation").is_exist(): sleep(1) else: # enter the profile Element("BottomNavigation", "profile").click() bsnsCommon.wait_loading() myCommon.my_swipe_to_up() # enter my address self.logger.info("Enter the setting") element_list = Element("profile", "profile_tv").get_element_list() for i in range(len(element_list)): element_name = element_list[i] if element_name == "Setting": element_list[i].click() break bsnsCommon.wait_loading() Element("setting", "feed_back").click() bsnsCommon.wait_loading() Element("feed_back", "email").send_key(self.email) Element("feed_back", "advice").send_key(self.advice) Element("title","rightButton").click() except Exception as ex: self.logger.error(str(ex))
def get_total_price_in_cart(): """ get the all goods price in shopping cart :return: """ logger.info("Determine whether there is a goods") goods_list = [] total_price = 0 while Element("Shopping_cart", "goods_name").is_exist(): logger.info("Get the goods name") element_list = Element("Shopping_cart", "goods_name").get_element_list() if element_list is not None: logger.info("Get the last goods name") last_goods_name = element_list[-1].get_attribute("text") for i in range(len(element_list)): goods_name = element_list[i].get_attribute("text") if goods_name not in goods_list: goods_list.append(goods_name) goods_price_text = Element("Shopping_cart", "goods_price").gets(i).get_attribute("text") goods_price = goods_price_text[goods_price_text.find("$")+1:] goods_num = Element("Shopping_cart", "goods_num").gets(i).get_attribute("text") one_goods_price = float(goods_price)*int(goods_num) total_price += one_goods_price if last_goods_name not in goods_list: logger.info("Goods is not end") logger.info("Swipe up, if not end") common.my_swipe_to_up() goods_list.append(last_goods_name) else: logger.info("Goods is end") break return str(total_price)
def logout(): """ logout the app :return: """ # if already sign in , first sign out while not Element("profile", "SignOut").is_exist(): # swipe up common.my_swipe_to_up() else: logger.debug("Begin logout") Element("profile", "SignOut").click() if Element("Alert", "confirm").is_exist(): Element("Alert", "confirm").click() wait_loading() logger.debug("End logout")
def logout(): """ logout the app :return: """ # if already sign in , first sign out # join personal center if go_to_setting(): while not Element("loginOut", "loginOut").is_exist(): # swipe up common.my_swipe_to_up() else: logger.debug("Begin logout") Element("loginOut", "loginOut").click() if Element("Alert", "confirm").is_exist(): Element("Alert", "confirm").click() wait_loading() logger.debug("End logout")
def testReview(self): try: self.logger.info("Enter the goods details") while not Element("Shop", "goods").is_exist(): myCommon.my_swipe_to_up() else: myCommon.my_swipe_to_up() Element("Shop", "goods").clicks(0) bsnsCommon.wait_loading() self.logger.info("Enter the write review") while not Element("Good_details", "write_review").is_exist(): myCommon.my_swipe_to_up() else: Element("Good_details", "write_review").click() bsnsCommon.wait_loading() self.logger.info("Write review") self.write_reviews() self.check_result() except Exception as ex: self.logger.error(str(ex))
def testAddCart(self): try: self.logger.info("Enter the goods details") while not Element("Shop", "goods").is_exist(): myCommon.my_swipe_to_up() else: myCommon.my_swipe_to_up() Element("Shop", "goods").clicks(0) bsnsCommon.wait_loading() self.logger.info("Get the goods's name") self.goods_name = Element("title", "title").get_attribute("text") self.logger.info("Enter the shopping cart") Element("Shopping_cart", "shopping_cart").click() bsnsCommon.wait_loading() bsnsCommon.delete_goods_in_cart(self.goods_name) myCommon.back() bsnsCommon.wait_loading() goods_num = Element("Shopping_cart", "shopping_cart").get_attribute("text") self.logger.info("Add goods to cart") self.add_cart() self.check_result(goods_num) except Exception as ex: self.logger.error(str(ex))
def add_goods_in_cart(num): """ add goods to cart :param num: goods number :return: """ if num == 0: return goods_name_list = [] for i in range(num): if Element("BottomNavigation", "BottomNavigation").is_exist(): common.my_swipe_to_up() while not Element("Shop", "goods").is_exist(): common.my_swipe_to_up() else: Element("Shop", "goods").clicks(i) goods_name = Element("title", "title").get_attribute("text") goods_name_list.append(goods_name) enter_cart() if Element("add_cart", "add_cart").does_exist(): logger.info("Select size") Element("add_cart", "size").clicks(0) Element("add_cart", "done").click() logger.info("Return index") return_index() return goods_name_list
def add_goods_in_cart(num): """ add goods to cart :param num: goods number :return: """ if num == 0: return goods_name_list = [] for i in range(num): if Element("BottomNavigation", "BottomNavigation").is_exist(): common.my_swipe_to_up() while not Element("Shop", "goods").is_exist(): common.my_swipe_to_up() else: Element("Shop", "goods").clicks(i) goods_name = Element("title", "title").get_attribute("text") goods_name_list.append(goods_name) enter_cart() if Element("add_cart", "add_cart").does_exist(): logger.info("Select size") Element("add_cart", "size").clicks(0) Element("add_cart", "buy").click() logger.info("Return index") return_index() return goods_name_list
def testRecentlyViewed(self): try: self.logger.info("Enter the goods details") while not Element("Shop", "goods").is_exist(): myCommon.my_swipe_to_up() else: myCommon.my_swipe_to_up() Element("Shop", "goods").clicks(0) bsnsCommon.wait_loading() self.logger.info("Get the goods's name") self.goods_name = Element("title", "title").get_attribute("text") # return the index bsnsCommon.return_index() self.logger.info("Enter the profile") # find the bottom Navigation bar while not Element("BottomNavigation", "BottomNavigation").is_exist(): sleep(1) else: # enter the profile Element("BottomNavigation", "profile").click() bsnsCommon.wait_loading() myCommon.my_swipe_to_up() # enter my address self.logger.info("Enter the recently viewed") element_list = Element("profile", "profile_tv").get_element_list() for i in range(len(element_list)): element_name = element_list[i] if element_name == "Recently Viewed": element_list[i].click() break bsnsCommon.wait_loading() self.check_result(self.goods_name) except Exception as ex: self.logger.error(str(ex))
def deleteGoods(self): # add goods to shopping bag # click add to bag while not Element("add_shopping_bag", "add_bag").is_exist(): common.my_swipe_to_up() else: Element("add_shopping_bag", "add_bag").click() # choose size if Element("add_shopping_bag", "size").is_exist(): Element("add_shopping_bag", "size").clicks(0) # click done if not Element("add_shopping_bag", "add_done").is_exist(): common.my_swipe_to_up() else: Element("add_shopping_bag", "add_done").click() bsnsCommon.wait_loading() # go to shopping bag Element("add_shopping_bag", "shop_bag").click() bsnsCommon.wait_loading() # click new guide if Element("shopping_bag", "new_guide").is_exist(): Element("shopping_bag", "new_guide").click() else: pass goods = Element("shopping_bag", "name").get_element_list() self.length = len(goods) # delete a goods if len(goods) == 1: common.my_swipe_to_right_2() if Element("shopping_bag", "delete").is_exist(): Element("shopping_bag", "delete").click() elif len(goods) >= 2: while not Element("shopping_bag", "shopping").does_exist(): common.my_swipe_to_up() else: common.my_swipe_to_right() if Element("shopping_bag", "delete").is_exist(): Element("shopping_bag", "delete").click()
def testSort(self): try: email = loginGls[0][1] password = loginGls[0][2] bsnsCommon.login(email, password) bsnsCommon.wait_loading() self.logger.info("login.") if Element("Alert", "update_title").is_exist(): Element("Alert", "cancel").click() else: pass Element("daily_new", "daily_new").click() bsnsCommon.wait_loading() self.logger.info("daily new.") for i in range(1, 3): while not bsnsCommon.wait_loading(): common.my_swipe_to_up() else: break else: break goods_name = Element("wish_list", "wish_goods_name").get_element_list() if len(goods_name) != 0: for i in len(goods_name): self.names = goods_name[i].get_attribute("text") else: break self.logger.info("names are:" + self.names) else: self.logger.info("No find elements.") # self.sort_left = Element("category", "sort_left").get_element_list() # self.sort_right = Element("category", "sort_right").get_element_list() # left_category = [] # right_category = [] # if len(self.sort_left) != 0: # for i in len(self.sort_left): # left_category[i] = self.sort_left[i].get_attribute("text") # self.logger.info("Left category are:" + left_category[i] + " ") # else: # self.logger.info("Don't get the left category!") # return False # if len(self.sort_right) != 0: # for j in len(self.sort_right): # right_category[j] = self.sort_left[j].get_attribute("text") # self.logger.info("Right category are:" + right_category[j] + " ") # else: # self.logger.info("Don't get the right category!") # return False # category_name = [] # for n in range(1, 60): # if n % 2 != 0: # category_name[n] = left_category[(n+1)/2] # else: # category_name[n] = right_category[n/2] # pass except Exception as ex: self.logger.error(str(ex))
def check_result(self, goods_name): value = Element("Good_details", "save").get_attribute("text") while value != "saved": sleep(1) else: bsnsCommon.return_index() self.logger.info("Enter the profile") # find the bottom Navigation bar while not Element("BottomNavigation", "BottomNavigation").is_exist(): sleep(1) else: # enter the profile Element("BottomNavigation", "profile").click() bsnsCommon.wait_loading() self.logger.info("Enter the my wish list") Element("profile", "profile_tv").clicks(2) bsnsCommon.wait_loading() goods_list = [] self.logger.info("Determine whether there is a goods") while Element("wish_list", "goods_name").is_exist(): self.logger.info("Get the goods name") element_list = Element("Shopping_cart", "goods_name").get_element_list() if element_list is not None: self.logger.info("Get the last goods name") last_goods_name = element_list[-1].get_attribute("text") for i in range(len(element_list)): value = element_list[i].get_attribute("text") if value == goods_name: self.assertEqual("1", "1") Element("Shopping_cart", "delete_goods").clicks(i) Element("Alert", "confirm").click() bsnsCommon.wait_loading() return if last_goods_name not in goods_list: self.logger.info("Goods is not end") self.logger.info("Swipe up, if not end") myCommon.my_swipe_to_up() goods_list.append(last_goods_name) else: self.logger.info("Goods is end") self.assertEqual("1", "0") return
def check_price(self): result = True # get total price in checkout last_total_price = bsnsCommon.get_total_price_in_checkout() # get shipping price in checkout shipping_price = bsnsCommon.get_shipping_price_in_checkout() # get subtotal price in checkout subtotal_price = bsnsCommon.get_subtotal_price_in_checkout() if not Element("checkout", "place_order").is_exist(): common.my_swipe_to_up() else: if self.code_coupon == 0 and self.code_freebie == 0: if subtotal_price != self.total_price: self.logger.info( "Subtotal_price is not equal to total_price of shopping car, price is wrong." ) result = False else: if (subtotal_price + shipping_price) != last_total_price: self.logger.info( "Subtotal_price plus shipping_price equals is not last_total_price, price is wrong." ) result = False elif self.code_coupon == 1 and self.code_freebie == 0: if Element("checkout", "coupon_code_price").is_exist(): # get coupon code price in checkout coupon_code_price = bsnsCommon.get_coupon_code_price_in_checkout( ) if self.total_price >= coupon_code_price: if subtotal_price != (self.total_price - coupon_code_price): self.logger.info( "The total_price minus coupon_code_price is not subtotal_price, subtotal price is wrong." ) result = False else: if int(subtotal_price) != 0: self.logger.info("The subtotal price is wrong.") result = False else: if last_total_price != shipping_price: self.logger.info( "The total price in checkout is wrong.") result = False else: self.logger.info( "Used coupon code but it is not be shown in price list, price list is wrong." ) result = False elif self.code_coupon == 0 and self.code_freebie == 1: if Element("checkout", "freebie_price").is_exist(): # get freebie price in checkout freebie_price = bsnsCommon.get_freebie_price_in_checkout() if self.total_price >= freebie_price: if subtotal_price != (self.total_price - freebie_price): self.logger.info( "The total_price minus freebie_price is not subtotal_price, subtotal price is wrong." ) result = False else: if int(subtotal_price) != 0: self.logger.info("The subtotal price is wrong.") result = False else: if last_total_price != shipping_price: self.logger.info( "The total price in checkout is wrong.") result = False else: self.logger.info( "Used shein points but it is not be shown in price list, price list is wrong." ) result = False elif self.code_coupon == 1 and self.code_freebie == 1: if Element("checkout", "coupon_code_price").is_exist() and Element( "checkout", "freebie_price").is_exist(): # get coupon code price in checkout coupon_code_price = bsnsCommon.get_coupon_code_price_in_checkout( ) # get freebie price in checkout freebie_price = bsnsCommon.get_freebie_price_in_checkout() if self.total_price > coupon_code_price: subtotal_price_text = self.total_price - coupon_code_price subtotal_price_text2 = subtotal_price_text - freebie_price if subtotal_price_text2 >= float(0): if subtotal_price != subtotal_price_text2: self.logger.info( "Used coupon code and freebie but subtotal price is wrong." ) result = False else: if int(subtotal_price) != 0: self.logger.info( "The subtotal price is wrong.") result = False else: if int(subtotal_price) != 0 or int(freebie_price) != 0: self.logger.info( "The subtotal price and freebie price are wrong." ) result = False else: self.logger.info( "Used coupon code and shein points but they are not be shown in price list, price list is wrong." ) result = False return result