示例#1
0
def get_freebie_price_in_checkout():
    """
    get the freebie price in checkout
    :return:freebie_price
    """
    freebie_price_text = Element("checkout", "freebie_price").get_attribute("text")
    freebie_price = freebie_price_text[freebie_price_text.find("$")+1:]
    return float(freebie_price)
示例#2
0
def get_shipping_price_in_checkout():
    """
    get the shipping price in checkout
    :return: shipping_price
    """
    shipping_price_text = Element("checkout", "shipping_price").get_attribute("text")
    shipping_price = shipping_price_text[shipping_price_text.find("$")+1:]
    return float(shipping_price)
示例#3
0
def get_subtotal_price_in_checkout():
    """
    get the subtotal price in checkout
    :return:subtotal_price
    """
    subtotal_price_text = Element("checkout", "subtotal").get_attribute("text")
    subtotal_price = subtotal_price_text[subtotal_price_text.find("$")+1:]
    return float(subtotal_price)
示例#4
0
def get_coupon_code_price_in_checkout():
    """
    get the coupon code price in checkout
    :return:coupon_code_price
    """
    coupon_code_price_text = Element("checkout", "coupon_code_price").get_attribute("text")
    coupon_code_price = coupon_code_price_text[coupon_code_price_text.find("$")+1:]
    return float(coupon_code_price)
示例#5
0
def get_total_price_in_checkout():
    """
    get the total price in checkout
    :return:total_price
    """
    total_price_text = Element("checkout", "total").get_attribute("text")
    total_price = total_price_text[total_price_text.find("$")+1:]
    return float(total_price)
示例#6
0
    def check_result(self, price):

        self.CheckPoint = self.log.take_shot(self.driver, self.case_name)

        result = Element("Shopping_cart", "total_price").get_attribute("text")

        total_price = result[result.find("$")+1:]

        self.assertEqual(total_price, price)
示例#7
0
    def check_result(self):

        result = Element("Shopping_cart", "total_price").get_attribute("text")

        total_price = result[result.find("$"):]

        while float(total_price) < 100:
            # change qty_add
            Element("Shopping_cart", "plus_qty").clicks(0)
        else:
            if Element("Shopping_cart", "shipping").is_exist():
                self.assertEqual("1", "1")
            else:
                self.assertEqual("1", "")
示例#8
0
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)
示例#9
0
    def check_result(self):

        result = Element("Shopping_cart", "total_price").get_attribute("text")

        total_price = result[result.find("$"):]

        while float(total_price) < 100:
            # change qty_add
            Element("Shopping_cart", "plus_qty").clicks(0)
        else:
            if Element("Shopping_cart", "shipping").is_exist():
                self.assertEqual("1", "1")
            else:
                self.assertEqual("1", "")
示例#10
0
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)