예제 #1
0
    def checkPoint(self, caseName, logTest, devices):

        result = False
        if self.isOperate:
            time.sleep(2)  # 进入详情后,页面即使没有加载完成默认也会现实次标签,默认值为博客详情,等待2秒,尽量让页面加载完成后,加载后台数据
            # result = self.operateElement.findElement(self.testcheck)  # 检查点
            self.operateElement.switchToWebview() # 切换到webview
            temp = self.operateElement.operate(self.testcheck, self.testInfo, logTest)
            if not temp:
                print("查找元素" + self.testcheck["element_info"] + "失败")
                self.isOperate = False
                self.testInfo[0]["msg"] = "请检查元素" + self.testcheck["element_info"] + "是否存在"
                result = False
            elif temp == self.getValue: # 对比列表中到一条数据和详情页数据是否相同
                result = True
            else:
                result = False
                self.testInfo[0]["msg"] = "详情页值为="+temp+";列表获取到值为:"+self.getValue + "。两者值不相等"

        self.driver.switch_to.context("NATIVE_APP")  # 切换到native,还原
        self.swipeToUp()
        countSum(result)
        countInfo(result=result, testInfo=self.testInfo, caseName=caseName, driver=self.driver, logTest=logTest, devices=devices, testCase=self.testCase, testCheck=self.testcheck)

        return result
예제 #2
0
    def checkPoint(self, **kwargs):
        result = True
        if self.isOperate:
            for item in self.testcheck:
                resp = self.operateElement.operate(item, self.testInfo,
                                                   kwargs["logTest"])

                if resp in self.get_value:  # 删除后数据对比
                    msg = "删除数据失败,删除前数据为:" + str(
                        self.get_value) + "当前获取的数据为:" + resp
                    print(msg)
                    self.testInfo[0]["msg"] = msg
                    break
        else:
            result = False

        countSum(result)
        countInfo(result=result,
                  testInfo=self.testInfo,
                  caseName=kwargs["caseName"],
                  driver=self.driver,
                  logTest=kwargs["logTest"],
                  devices=kwargs["devices"],
                  testCase=self.testCase,
                  testCheck=self.testcheck)
        return result
예제 #3
0
def statistics_result(**kwargs):
    countSum(kwargs["result"])
    get_phone = getPhoneInfo(kwargs["devices"])
    phone_name = get_phone["brand"] + "_" + get_phone["model"] + "_" + "android" + "_" + get_phone["release"]

    countInfo(result=kwargs["result"], testInfo=kwargs["testInfo"], caseName=kwargs["caseName"], phoneName=phone_name,
              driver=kwargs["driver"], logTest=kwargs["logTest"], devices=kwargs["devices"], testCase=kwargs["testCase"],
              testCheck=kwargs["testCheck"])
    countSumDevices(kwargs["devices"], kwargs["result"], phone_name=phone_name)
예제 #4
0
def statistics_result(**kwargs):
    countInfo(result=kwargs["result"],
              testInfo=kwargs["testInfo"],
              caseName=kwargs["caseName"],
              name="chrome",
              driver=kwargs["driver"],
              logTest=kwargs["logTest"],
              testCase=kwargs["testCase"],
              testCheck=kwargs["testCheck"])
    countSum(kwargs["result"])
예제 #5
0
    def checkPoint(self, caseName, logTest, devices):
        result = False
        if not self.isOperate:
            print("操作失败,检查点失败")
        else:
            check = getYam(self.path)["check"]
            result = self.operateElement.findElement(check)  # 检查点

        countSum(result)
        countInfo(result=result, testInfo=self.testInfo, caseName=caseName, driver=self.driver, logTest=logTest,
                  devices=devices)
        return result
예제 #6
0
def statistics_result(**kwargs):
    countSum(kwargs["result"])
    get_phone = getPhoneInfo(kwargs["devices"])
    phone_name = get_phone["brand"] + "_" + get_phone[
        "model"] + "_" + "android" + "_" + get_phone["release"]

    countInfo(result=kwargs["result"],
              testInfo=kwargs["testInfo"],
              caseName=kwargs["caseName"],
              phoneName=phone_name,
              driver=kwargs["driver"],
              logTest=kwargs["logTest"],
              devices=kwargs["devices"],
              testCase=kwargs["testCase"],
              testCheck=kwargs["testCheck"])
    countSumDevices(kwargs["devices"], kwargs["result"], phone_name=phone_name)
예제 #7
0
 def checkPoint(self, **kwargs):
     result = self.check(**kwargs)
     if result is not True and be.RE_CONNECT:
         self.msg = "用例失败重连过一次,失败原因:" + self.testInfo[0]["msg"]
         kwargs["logTest"].buildStartLine(kwargs["caseName"] + "_失败重连")  # 记录日志
         # self.operateElement.switchToNative()
         self.driver.launch_app()
         self.isOperate = True
         self.get_value = []
         self.operate(kwargs["logTest"])
         result = self.check(**kwargs)
         self.testInfo[0]["msg"] = self.msg
     self.operateElement.switchToNative()
     countSum(result)
     countInfo(result=result, testInfo=self.testInfo, caseName=kwargs["caseName"],
               driver=self.driver, logTest=kwargs["logTest"], devices=kwargs["devices"], testCase=self.testCase,
               testCheck=self.testcheck)
     return result
예제 #8
0
def statistics_result(**kwargs):
    countSum(kwargs["result"])

    print('Platform:', kwargs["platformName"])
    if kwargs["platformName"] == 'android':
        print('Device:', kwargs["devices"])
        get_phone = getPhoneInfo(kwargs["devices"])
        phone_name = get_phone["brand"] + "_" + get_phone[
            "model"] + "_" + "android" + "_" + get_phone["release"]

        countInfo(result=kwargs["result"],
                  testInfo=kwargs["testInfo"],
                  caseName=kwargs["caseName"],
                  phoneName=phone_name,
                  driver=kwargs["driver"],
                  logTest=kwargs["logTest"],
                  devices=kwargs["devices"],
                  testCase=kwargs["testCase"],
                  testCheck=kwargs["testCheck"])
        countSumDevices(kwargs["devices"],
                        kwargs["result"],
                        phone_name=phone_name)
    elif kwargs["platformName"] == 'iOS':
        print('Device:', kwargs["devices"])
        get_phone = get_ios_PhoneInfo(kwargs["devices"])
        phone_name = get_phone["device"] + "_" + get_phone[
            "release"] + "_" + "iOS" + "_" + get_phone["udid"]

        countInfo(result=kwargs["result"],
                  testInfo=kwargs["testInfo"],
                  caseName=kwargs["caseName"],
                  phoneName=phone_name,
                  driver=kwargs["driver"],
                  logTest=kwargs["logTest"],
                  devices=kwargs["devices"],
                  testCase=kwargs["testCase"],
                  testCheck=kwargs["testCheck"])
        countSumDevices(kwargs["devices"],
                        kwargs["result"],
                        phone_name=phone_name)
예제 #9
0
    def checkPoint(self, caseName, logTest, devices):

        time.sleep(2)  #  从详情页返回到列表后,列表数据需要时间更新
        self.swipeToUp()

        result = False
        if self.isOperate:
            for item in self.testcheck:
                temp = self.operateElement.operate(item, self.testInfo,
                                                   logTest)

                if not temp:
                    print("查找元素" + item["element_info"] + "失败")
                    self.isOperate = False
                    self.testInfo[0][
                        "msg"] = "请检查元素" + item["element_info"] + "是否存在"
                    result = False
                    break
                elif temp in self.getValue:
                    result = True
                # if self.driver.find_element_by_xpath(item["element_info"]).get_attribute("text") in self.getValue: # 对比列表中的三条数据是否等于详情的三条数据
                else:
                    result = False  # 只要有一条数据不匹配,用例就失败
                    self.testInfo[0][
                        "msg"] = "首页到知识专区到列表三条数据和详情页到三条数据对不上。详情页三条数据为:" + str(
                            self.getValue) + "。首页当前匹配数据为:" + temp
                    break

        countSum(result)
        countInfo(result=result,
                  testInfo=self.testInfo,
                  caseName=caseName,
                  driver=self.driver,
                  logTest=logTest,
                  devices=devices,
                  testCase=self.testCase,
                  testCheck=self.testcheck)
        return result
예제 #10
0
def statistics_result(**kwargs):
    countSum(kwargs["result"])
    get_phone = getPhoneInfo(kwargs["devices"])
    phone_name = get_phone["device"] + "_" + get_phone[
        "UDID"]  #这里Devices是软件代号,UDID是设备名
    version = get_phone["internal_version"]
    print('********************************************')
    print(version)
    software_ID = get_phone["device"]

    countInfo(result=kwargs["result"],
              testInfo=kwargs["testInfo"],
              caseName=kwargs["caseName"],
              phoneName=phone_name,
              driver=kwargs["driver"],
              logTest=kwargs["logTest"],
              devices=kwargs["devices"],
              testCase=kwargs["testCase"],
              testCheck=kwargs["testCheck"])
    countSumDevices(kwargs["devices"],
                    kwargs["result"],
                    phone_name=phone_name,
                    version=version,
                    software_ID=software_ID)  #这里devices是设备名
예제 #11
0
    def checkPoint(self, **kwargs):
        result = True
        if self.isOperate:
            for item in self.testcheck:
                resp = self.operateElement.operate(item, self.testInfo, kwargs["logTest"])
                if not resp:
                    msg = "请检查元素" + item["element_info"] + "是否存在"
                    print(msg)
                    self.isOperate = False
                    self.testInfo[0]["msg"] = msg
                    result = False
                if resp not in self.get_value:  # 删除后数据对比
                    msg = "卡片排序失败" + str(self.get_value) + "当前首页第一条卡片数据为:" + resp + "排序成功的第一个卡片值为:"+".".join(self.get_value)
                    print(msg)
                    self.testInfo[0]["msg"] = msg
                    break
        else:
            result = False

        countSum(result)
        countInfo(result=result, testInfo=self.testInfo, caseName=kwargs["caseName"],
                  driver=self.driver, logTest=kwargs["logTest"], devices=kwargs["devices"], testCase=self.testCase,
                  testCheck=self.testcheck)
        return result
예제 #12
0
파일: Pages.py 프로젝트: dreamns/git
    def checkPoint(self, func=None, **kwargs):
        result = True
        if self.isOperate:
            for item in self.testcheck:

                if kwargs.get("toast", "0") != "0":
                    resp = self.operateElement.toast(item["element_info"],
                                                     testInfo=self.testInfo,
                                                     logTest=kwargs["logTest"])
                else:
                    resp = self.operateElement.operate(item, self.testInfo,
                                                       kwargs["logTest"])

                if kwargs.get("contrary", "0") != "0" and resp:
                    m = "请检查%s操作是否成功" % item["info"]
                    msg = kwargs["msg"] if kwargs.get("msg", "0") != "0" else m
                    print(msg)
                    self.isOperate = False
                    self.testInfo[0]["msg"] = msg
                    result = False
                    break
                if kwargs.get("contrary", "0") == "0" and not resp:
                    msg = "请检查元素" + item["element_info"] + "是否存在"
                    print(msg)
                    self.isOperate = False
                    self.testInfo[0]["msg"] = msg
                    result = False
                    break

                if kwargs.get(
                        "contrary_getval",
                        "0") != "0" and self.is_get and resp in self.get_value:
                    result = False
                    m = "对比数据失败,当前取到到数据为:%s,历史取到数据为:%s" % resp % self.get_value
                    msg = kwargs["msg"] if kwargs.get("msg", "0") != "0" else m
                    print(msg)
                    self.testInfo[0]["msg"] = msg
                    break

                if kwargs.get(
                        "contrary_getval", "0"
                ) == "0" and self.is_get and resp not in self.get_value:  # 历史数据和实际数据对比
                    result = False
                    msg = "对比数据失败,获取历史数据为:" + ".".join(
                        self.get_value) + "当前获取的数据为:" + resp
                    print(msg)
                    self.testInfo[0]["msg"] = msg
                    break
        else:
            result = False
        self.operateElement.switchToNative()
        countSum(result)
        countInfo(result=result,
                  testInfo=self.testInfo,
                  caseName=kwargs["caseName"],
                  driver=self.driver,
                  logTest=kwargs["logTest"],
                  devices=kwargs["devices"],
                  testCase=self.testCase,
                  testCheck=self.testcheck)
        return result