def test_002(self):
     """优惠券,满减活动,满50减10"""
     #满减活动 #全局活动
     #更改达豆数量
     preConditionForTest().UpdateTestUserDadou()
     #清空购物车
     preConditionForTest().clean_redis()
     self.openUrl('http://192.168.1.251:30011/login')
     time.sleep(3)
     if not getLoginStatus(self.driver.page_source):
         elementLocate(self.driver, ".//*[@id='uid']").sendKeysElementByXpath(self.store_username)
         elementLocate(self.driver, ".//*[@id='pwd']").sendKeysElementByXpath('123456')
         elementLocate(self.driver, ".//*[@id='login_submit']").clickElementByXpath()
     self.openUrl('http://192.168.1.251:30011/detail?gid={0}'.format(self.manJianGoodId))
     elementLocate(self.driver,".//div[2]/div/div[2]/div[1]/div/div[5]/div[2]/button").clickElementByXpath()
     elementLocate(self.driver,".//*[@id='link_cart']").clickElementByXpath()
     elementLocate(self.driver,".//*[@id='total']/div[2]/button").clickElementByXpath()
     elementLocate(self.driver,".//*[@id='cash_toggle_button']").clickElementByXpath()
     if elementLocate(self.driver,".//*[@id='cash_amount']").findElementByXpath().text!='无可用红包':
         elementLocate(self.driver,".//*[@id='cash_list']/div/div[1]/div/input").clickElementByXpath()
     self.driver.execute_script("window.scrollBy(0,500)")
     elementLocate(self.driver,".//*[@id='dadou_toggle_button']").clickElementByXpath()
     if elementLocate(self.driver,".//*[@id='dadou_no']").findElementByXpath().text!='0':
         elementLocate(self.driver,".//*[@id='dadou_check']").clickElementByXpath()
     self.driver.execute_script("window.scrollBy(0,500)")
     # current_money=getFinalMoney(self.driver.page_source)
     # print u"购物车,物品价格100,1件,减10元"
     # print self._testMethodName,current_money
     # # TODO 需要加入金额断言
     # if current_money != 85.0:
     #     self.screenShot(getPath(self._testMethodName))
     #
     # self.assertTrue(current_money == 85.0)
     elementLocate(self.driver, ".//*[@id='cart_preview']/div[7]/div/div[1]").clickElementByXpath()
     elementLocate(self.driver, ".//*[@id='checkout_button']/button").clickElementByXpath()
     time.sleep(2)
     # 取消订单
     
     
     time.sleep(2)
    def test_009(self):
        """满减商品(满50减10),优惠券,红包,达豆,满折(满200打8折)活动"""
        # 满减商品 所有活动
        #更改达豆数量
        preConditionForTest().UpdateTestUserDadou()
        #清空购物车
        preConditionForTest().clean_redis()
        self.openUrl('http://192.168.1.251:30011/login')
        time.sleep(3)
        if not getLoginStatus(self.driver.page_source):
            elementLocate(self.driver, ".//*[@id='uid']").sendKeysElementByXpath(self.store_username)
            elementLocate(self.driver, ".//*[@id='pwd']").sendKeysElementByXpath('123456')
            elementLocate(self.driver, ".//*[@id='login_submit']").clickElementByXpath()
        self.openUrl('http://192.168.1.251:30011/detail?gid={0}'.format(self.manJianGoodId))
        elementLocate(self.driver, ".//div[2]/div/div[2]/div[1]/div/div[5]/div[2]/button").clickElementByXpath()
        elementLocate(self.driver, ".//div[2]/div/div[2]/div[1]/div/div[5]/div[2]/button").clickElementByXpath()
        elementLocate(self.driver, ".//div[2]/div/div[2]/div[1]/div/div[5]/div[2]/button").clickElementByXpath()
        elementLocate(self.driver, ".//*[@id='link_cart']").clickElementByXpath()
        elementLocate(self.driver, ".//*[@id='total']/div[2]/button").clickElementByXpath()

        # current_money=getFinalMoney(self.driver.page_source)
        # print u"购物车,物品价格100,3件,各活动满减后打8折"
        # print self._testMethodName,current_money
        # # TODO 需要加入金额断言
        # if current_money != 207.0:
        #     self.screenShot(getPath(self._testMethodName))
        # self.assertTrue(current_money == 207.0)
        elementLocate(self.driver, ".//*[@id='cart_preview']/div[7]/div/div[1]").clickElementByXpath()
        elementLocate(self.driver, ".//*[@id='checkout_button']/button").clickElementByXpath()
        time.sleep(2)
        # 取消订单
        
        
        time.sleep(2)
コード例 #3
0
 def test_001(self):
     """黑卡商品活动(总价超过满折活动)"""
     #更改达豆数量
     preConditionForTest().UpdateTestUserDadou()
     #清空购物车
     preConditionForTest().clean_redis()
     self.openUrl('http://192.168.1.251:30011/login')
     time.sleep(3)
     if not getLoginStatus(self.driver.page_source):
         elementLocate(self.driver,
                       ".//*[@id='uid']").sendKeysElementByXpath(
                           self.store_username)
         elementLocate(self.driver,
                       ".//*[@id='pwd']").sendKeysElementByXpath('123456')
         elementLocate(self.driver,
                       ".//*[@id='login_submit']").clickElementByXpath()
     self.openUrl('http://192.168.1.251:30011/detail?gid={0}'.format(
         self.heikaGoodId))
     elementLocate(self.driver,
                   ".//div[2]/div/div[2]/div[1]/div/div[5]/div[2]/button"
                   ).clickElementByXpath()
     elementLocate(self.driver,
                   ".//div[2]/div/div[2]/div[1]/div/div[5]/div[2]/button"
                   ).clickElementByXpath()
     elementLocate(self.driver,
                   ".//div[2]/div/div[2]/div[1]/div/div[5]/div[2]/button"
                   ).clickElementByXpath()
     elementLocate(self.driver,
                   ".//*[@id='link_cart']").clickElementByXpath()
     elementLocate(self.driver,
                   ".//*[@id='total']/div[2]/button").clickElementByXpath()
     elementLocate(self.driver,
                   ".//*[@id='dadou_toggle_button']").clickElementByXpath()
     if elementLocate(
             self.driver,
             ".//*[@id='dadou_no']").findElementByXpath().text != '0':
         elementLocate(self.driver,
                       ".//*[@id='dadou_check']").clickElementByXpath()
     # current_money=getFinalMoney(self.driver.page_source)
     # print u"购物车,黑卡商品价格100,3件"
     # print self._testMethodName,current_money
     # # TODO 需要加入金额断言
     # if current_money != 300.0:
     #     self.screenShot(getPath(self._testMethodName))
     # self.assertTrue(current_money == 300.0)
     elementLocate(self.driver, ".//*[@id='cart_preview']/div[7]/div/div[1]"
                   ).clickElementByXpath()
     elementLocate(
         self.driver,
         ".//*[@id='checkout_button']/button").clickElementByXpath()
     time.sleep(2)
     # 取消订单
     time.sleep(2)
コード例 #4
0
    def test_008(self):
        """满赠商品,优惠券,红包,达豆,满折(满200打8折)活动"""
        #满赠商品 所有活动
        #更改达豆数量
        preConditionForTest().UpdateTestUserDadou()
        #清空购物车
        preConditionForTest().clean_redis()
        self.openUrl('http://192.168.1.251:30011/login')
        time.sleep(3)
        if not getLoginStatus(self.driver.page_source):
            elementLocate(self.driver,
                          ".//*[@id='uid']").sendKeysElementByXpath(
                              self.store_username)
            elementLocate(self.driver,
                          ".//*[@id='pwd']").sendKeysElementByXpath('123456')
            elementLocate(self.driver,
                          ".//*[@id='login_submit']").clickElementByXpath()
        self.openUrl('http://192.168.1.251:30011/detail?gid={0}'.format(
            self.manZengGoodId))
        elementLocate(self.driver,
                      ".//div[2]/div/div[2]/div[1]/div/div[5]/div[2]/button"
                      ).clickElementByXpath()
        elementLocate(self.driver,
                      ".//div[2]/div/div[2]/div[1]/div/div[5]/div[2]/button"
                      ).clickElementByXpath()
        elementLocate(self.driver,
                      ".//div[2]/div/div[2]/div[1]/div/div[5]/div[2]/button"
                      ).clickElementByXpath()
        elementLocate(self.driver,
                      ".//*[@id='link_cart']").clickElementByXpath()
        elementLocate(self.driver,
                      ".//*[@id='total']/div[2]/button").clickElementByXpath()
        self.driver.execute_script("window.scrollBy(0,700)")
        # getZGoodId,getZGoodIdCount=getZengId(self.driver.page_source)
        # print getZGoodId,getZGoodIdCount
        #
        # current_money=getFinalMoney(self.driver.page_source)
        # print u"购物车,物品价格150,3件,各活动赠物品后打8折"
        # print self._testMethodName,current_money
        # # TODO 需要加入金额断言
        # if current_money != 335.0:
        #     self.screenShot(getPath(self._testMethodName))
        # self.assertTrue(current_money == 335.0)
        # self.assertTrue(self.ZGoodId==getZGoodId)
        # self.assertTrue(self.ZGoodIdCount==getZGoodIdCount)
        elementLocate(self.driver, ".//*[@id='cart_preview']/div[7]/div/div[1]"
                      ).clickElementByXpath()
        elementLocate(
            self.driver,
            ".//*[@id='checkout_button']/button").clickElementByXpath()
        time.sleep(2)
        # 取消订单

        time.sleep(2)
コード例 #5
0
    def test_002(self):
        """第三方满减商品活动_无梯度(满50减10)活动"""

        #清空购物车
        preConditionForTest().clean_redis()
        self.openUrl('http://192.168.1.251:30011/login')
        time.sleep(3)
        if not getLoginStatus(self.driver.page_source):
            elementLocate(self.driver,
                          ".//*[@id='uid']").sendKeysElementByXpath(
                              self.store_username)
            elementLocate(self.driver,
                          ".//*[@id='pwd']").sendKeysElementByXpath('123456')
            elementLocate(self.driver,
                          ".//*[@id='login_submit']").clickElementByXpath()
        self.openUrl('http://192.168.1.251:30011/activity/third?id=')
        if elementLocate(self.driver,
                         ".//div[4]/div/div[2]/ul/div/div[1]/div/div[3]"
                         ).findElementByXpath().text != '已领取':
            elementLocate(self.driver,
                          ".//div[4]/div/div[2]/ul/div/div[1]/div/div[3]"
                          ).clickElementByXpath()
        self.openUrl('http://192.168.1.251:30011/detail?gid={0}'.format(
            self.manJianThirdGoodId))
        elementLocate(self.driver,
                      ".//div[2]/div/div[2]/div[1]/div/div[6]/div[2]/button"
                      ).clickElementByXpath()
        elementLocate(self.driver,
                      ".//*[@id='link_cart']").clickElementByXpath()
        elementLocate(self.driver,
                      ".//*[@id='total']/div[2]/button").clickElementByXpath()
        elementLocate(self.driver,
                      ".//*[@id='cash_toggle_button']").clickElementByXpath()
        if elementLocate(self.driver, ".//*[@id='list_info']/div/div[2]"
                         ).findElementByXpath().text != '0':
            elementLocate(self.driver,
                          ".//*[@id='cash_list']/div/div[1]/div/input"
                          ).clickElementByXpath()
        self.driver.execute_script("window.scrollBy(0,500)")
        # current_money=getFinalMoney(self.driver.page_source)
        # print u"购物车,第三方满减商品价格80,1件"
        # print self._testMethodName,current_money
        # # TODO 需要加入金额断言
        # if current_money != 69.0:
        #     self.screenShot(getPath(self._testMethodName))
        # self.assertTrue(current_money == 69.0)
        elementLocate(self.driver, ".//*[@id='cart_preview']/div[7]/div/div[1]"
                      ).clickElementByXpath()
        elementLocate(
            self.driver,
            ".//*[@id='checkout_button']/button").clickElementByXpath()
        time.sleep(2)
コード例 #6
0
    def test_008(self):
        """第三方满赠商品活动(满250赠),红包组合活动"""

        #清空购物车
        preConditionForTest().clean_redis()
        self.openUrl('http://192.168.1.251:30011/login')
        time.sleep(3)
        if not getLoginStatus(self.driver.page_source):
            elementLocate(self.driver,
                          ".//*[@id='uid']").sendKeysElementByXpath(
                              self.store_username)
            elementLocate(self.driver,
                          ".//*[@id='pwd']").sendKeysElementByXpath('123456')
            elementLocate(self.driver,
                          ".//*[@id='login_submit']").clickElementByXpath()
        self.openUrl('http://192.168.1.251:30011/activity/third?id=')
        if elementLocate(self.driver,
                         ".//div[4]/div/div[2]/ul/div/div[1]/div/div[3]"
                         ).findElementByXpath().text != '已领取':
            elementLocate(self.driver,
                          ".//div[4]/div/div[2]/ul/div/div[1]/div/div[3]"
                          ).clickElementByXpath()
        self.openUrl('http://192.168.1.251:30011/detail?gid={0}'.format(
            self.manZengThirdGoodId))
        elementLocate(self.driver,
                      ".//div[2]/div/div[2]/div[1]/div/div[6]/div[2]/button"
                      ).clickElementByXpath()
        elementLocate(self.driver,
                      ".//div[2]/div/div[2]/div[1]/div/div[6]/div[2]/button"
                      ).clickElementByXpath()
        elementLocate(self.driver,
                      ".//*[@id='link_cart']").clickElementByXpath()
        elementLocate(self.driver,
                      ".//*[@id='total']/div[2]/button").clickElementByXpath()

        # current_money=getFinalMoney(self.driver.page_source)
        # print u"购物车,黑卡商品价格100,3件"
        # print self._testMethodName,current_money
        # # TODO 需要加入金额断言
        # if current_money != 293.0:
        #     self.screenShot(getPath(self._testMethodName))
        # self.assertTrue(current_money == 293.0)
        elementLocate(self.driver, ".//*[@id='cart_preview']/div[7]/div/div[1]"
                      ).clickElementByXpath()
        elementLocate(
            self.driver,
            ".//*[@id='checkout_button']/button").clickElementByXpath()
        time.sleep(2)