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 tearDown(self): for good_name in self.goods_name_list: bsnsCommon.delete_goods_in_cart(good_name) self.End = self.log.take_shot(self.driver, self.case_name) self.logger.info("Take shot, the picture path is " + self.End) # return the index bsnsCommon.return_index() # test Start self.log.build_end_line(self.case_name)
def tearDown(self): self.End = self.log.take_shot(self.driver, self.case_name) self.logger.info("Take shot, the picture path is " + self.End) self.logger.info("Enter the shopping cart") Element("Shopping_cart", "shopping_cart").click() bsnsCommon.wait_loading() # delete the goods which we add to shopping cart bsnsCommon.delete_goods_in_cart(self.goods_name) # return the index bsnsCommon.return_index() # test Start self.log.build_end_line(self.caseNo)
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))