示例#1
0
    def test_leave(self, user):

        # 把已读取的数据信息赋值给变量
        name = user['name']
        username = user['username']
        reason = str(user['reason'])
        start_time = str(user['start_time'])
        end_time = str(user['end_time'])

        # 初始化
        login_test = LoginPage(self.driver)
        apply_test = TodoApplyPage(self.driver)
        # 标志位,判断走申请流程还是审批流程
        flag = 0
        for n in range(0, 7):
            login_test.open()
            login_test.login(username[n])
            # 申请流程
            if not flag:
                print("申请人:", username[n], name[n])
                apply_test.shadow_click()
                apply_test.apply_leave(start_time, end_time, reason)
                apply_test.next_processer(name[n + 1])
                apply_test.logout()
                flag += 1
                sleep(1)
                # 审批流程
            else:
                print("审批人" + str(n) + ":", username[n], name[n])
                apply_test.process()
                # 判断是否需要下一审批(是否有下一审批选择界面)
                result = apply_test.is_need_next_process(name[n + 1])
                self.assertTrue(result != -1, "测试不通过")
                if result:
                    return 0
示例#2
0
    def test_all(self, user):

        name = user["name"]
        username = user["username"]
        value1 = user["value1"]
        value2 = user["value2"]
        value3 = user["value3"]
        value4 = user["value4"]

        login_test = LoginPage(self.driver)
        apply_test = TodoApplyPage(self.driver)
        flag = 0

        for n in range(0, 7):
            login_test.open()
            login_test.login(username[n])
            if not flag:
                apply_test.shadow_click()
                if t == "1":
                    apply_test.apply_leave(value2, value3, value1)
                elif t == "2":
                    apply_test.apply_overtime(value2, value3, value1)
                elif t == "3":
                    apply_test.apply_sign(value2, value1)
                elif t == "4":
                    apply_test.apply_business(value2, value3, value4, value1)
                elif t == "5":
                    apply_test.apply_business_need_plane(
                        value2, value3, value4, value1)
                elif t == "6":
                    apply_test.apply_dismission(value2)
                elif t == "7":
                    apply_test.apply_dismissionCheckout(value1)
                elif t == "8":
                    apply_test.apply_full(value1, value2, value3)
                else:
                    print("找不到该类型编号")
                    return 0
                print("申请人:", username[n], name[n])
                apply_test.next_processer(name[n + 1])
                apply_test.logout()
                flag += 1
                sleep(1)
            else:
                print("审批人" + str(n) + ":", username[n], name[n])
                if t == "6" or t == "7":
                    apply_test.dismission_process(value2)
                else:
                    apply_test.process()
                result = apply_test.is_need_next_process(name[n + 1])
                self.assertTrue(result != -1, "测试不通过")
                if result:
                    return 0
示例#3
0
    def test_overtime(self, user):

        # 读取账号/密码/日期/原因信息
        username = user['username']
        password = user['password']
        # 密码字符串化
        if not isinstance(password, (str)):
            password = str(int(password))
        # 日期字符串化
        start_time = str(user['start_time'])
        end_time = str(user['end_time'])

        reason = user['reason']
        processer1_name = str(user['processer1_name'])

        # 登录流程
        login_test = LoginPage(self.driver)
        login_test.open()
        login_test.login(username, password)
        sleep(2)
        apply_test = TodoApplyPage(self.driver)
        apply_test.shadow_click()
        # sleep(2)
        # apply_test.logout()
        # sleep(2)

        # 开始申请加班
        apply_test.apply_overtime(start_time, end_time, reason)
        # 选择下一个审批人
        apply_test.next_processer(processer1_name)
        sleep(1)
        # 退出登录
        apply_test.logout()
        sleep(1)

        # 审批人1 登录同意操作流程
        processer1_username = user['processer1_username']
        processer2_name = user['processer2_name']
        password = user['password']
        # login_test = LoginPage(self.driver)
        login_test.open()
        login_test.login(processer1_username, password)
        check_test = TodoApplyPage(self.driver)
        check_test.process()
        # 判断是否需要进行下一审批
        if check_test.does_have_next_processer():
            check_test.next_processer(processer2_name)
            sleep(1)
            # 登出系统
            apply_test.logout()
            sleep(1)
        else:
            return 0

        # 审批人2登录同意签卡操作流程
        password = user['password']
        processer3_name = user['processer3_name']
        processer2_username = user['processer2_username']
        if processer2_username:
            login_test = LoginPage(self.driver)
            login_test.open()
            login_test.login(processer2_username, password)
            check_test = TodoApplyPage(self.driver)
            check_test.process()
            if check_test.does_have_next_processer():
                check_test.next_processer(processer3_name)
                sleep(1)
                apply_test.logout()
                sleep(1)
        else:
            return 0

        # 审批人3登录同意签卡操作流程
        password = user['password']
        processer4_name = user['processer4_name']
        processer3_username = user['processer3_username']
        if processer3_username:
            login_test = LoginPage(self.driver)
            login_test.open()
            login_test.login(processer3_username, password)
            check_test = TodoApplyPage(self.driver)
            check_test.process()
            if check_test.does_have_next_processer():
                check_test.next_processer(processer4_name)
                sleep(1)
                apply_test.logout()
                sleep(1)
        else:
            return 0

            # 审批人4登录同意签卡操作流程
            password = user['password']
            processer5_name = user['processer5_name']
            processer4_username = user['processer4_username']
            if processer4_username:
                login_test = LoginPage(self.driver)
                login_test.open()
                login_test.login(processer4_username, password)
                check_test = TodoApplyPage(self.driver)
                check_test.process()
                if check_test.does_have_next_processer():
                    check_test.next_processer(processer5_name)
                    sleep(1)
                    apply_test.logout()
                    sleep(1)
            else:
                return 0

            # 审批人5登录同意签卡操作流程
            password = user['password']
            processer6_name = user['processer6_name']
            processer5_username = user['processer5_username']
            if processer5_username:
                login_test = LoginPage(self.driver)
                login_test.open()
                login_test.login(processer5_username, password)
                check_test = TodoApplyPage(self.driver)
                check_test.process()
                if check_test.does_have_next_processer():
                    check_test.next_processer(processer6_name)
                    sleep(1)
                    apply_test.logout()
                    sleep(1)
            else:
                return 0
示例#4
0
    def test_all(self, user):

        name = user["name"]
        username = user["username"]
        reason = user["reason"]
        start_time = user["start_time"]
        end_time = user["end_time"]
        place = user["place"]

        login_test = LoginPage(self.driver)
        apply_test = TodoApplyPage(self.driver)
        flag = 0

        for n in range(0, 7):
            login_test.open()
            login_test.login(username[n])
            if not flag:
                apply_test.shadow_click()
                if t == "1":
                    apply_test.apply_leave(start_time, end_time, reason)
                elif t == "2":
                    apply_test.apply_overtime(start_time, end_time, reason)
                elif t == "3":
                    apply_test.apply_sign(start_time, reason)
                elif t == "4":
                    apply_test.apply_business(start_time, end_time, place,
                                              reason)
                elif t == "5":
                    apply_test.apply_business_need_plane(
                        start_time, end_time, place, reason)
                elif t == "6":
                    apply_test.apply_dismission(start_time)
                elif t == "7":
                    apply_test.apply_dismissionCheckout(reason)
                else:
                    print("找不到该类型编号")
                    return 0
                print("申请人:", username[n], name[n])
                apply_test.next_processer(name[n + 1])
                apply_test.logout()
                flag += 1
                sleep(1)
            else:
                print("审批人" + str(n) + ":", username[n], name[n])
                if t == "6" or t == "7":
                    apply_test.dismission_process(start_time)
                else:
                    apply_test.process()
                result = apply_test.is_need_next_process(name[n + 1])
                self.assertTrue(result != -1, "测试不通过")
                if result:
                    return 0
示例#5
0
    def test_overtime(self, user):
        # 把已读取的数据信息赋值给变量
        username = str(user['username'])
        password = str(user['password'])
        start_time = str(user['start_time'])
        end_time = str(user['end_time'])
        reason = str(user['reason'])
        processer_name = user['processer_name']
        processer_username = user['processer_username']

        # 初始化
        login_test = LoginPage(self.driver)
        apply_test = TodoApplyPage(self.driver)
        # 标志位,判断走申请流程还是审批流程
        flag = 0
        for n in range(0, 6):
            login_test.open()
            # 申请流程
            if not flag:
                login_test.login(username, password)
                apply_test.shadow_click()
                apply_test.apply_overtime(start_time, end_time, reason)
                apply_test.next_processer(processer_name[n])
                apply_test.logout()
                flag += 1
                sleep(1)
            # 审批流程
            else:
                login_test.login(processer_username[n], password)
                apply_test.process()
                # 判断是否需要下一审批(是否有下一审批选择界面)
                result = apply_test.is_need_next_process(processer_name[n + 1])
                self.assertTrue(result != -1, "测试不通过")
                if result:
                    return 0
示例#6
0
    def test_overtime(self, user):
        # 读取账号/密码/日期/原因等信息
        username = str(user['username'])
        password = str(user['password'])
        start_time = str(user['start_time'])
        end_time = str(user['end_time'])
        place = str(user['place'])
        reason = str(user['reason'])
        processer1_name = str(user['processer1_name'])
        processer1_username = user['processer1_username']
        processer2_name = user['processer2_name']
        processer2_username = user['processer2_username']
        processer3_name = user['processer3_name']
        processer3_username = user['processer3_username']
        processer4_name = user['processer4_name']
        processer4_username = user['processer4_username']
        processer5_name = user['processer5_name']
        processer5_username = user['processer5_username']
        processer6_name = user['processer6_name']



        # 登录流程
        login_test = LoginPage(self.driver)
        login_test.open()
        login_test.login(username, password)
        # sleep(1)
        # apply_test.logout()
        # sleep(2)
        # 开始申请出差
        apply_test = TodoApplyPage(self.driver)
        apply_test.shadow_click()
        apply_test.apply_business(start_time, end_time, place, reason)
        # 选择下一个审批人
        apply_test.next_processer(processer1_name)
        # 退出登录
        apply_test.logout()
        sleep(1)

        # 审批人1 登录同意操作流程
        login_test.open()
        login_test.login(processer1_username, password)
        apply_test.process()
        # 判断是否需要下一审批(是否有下一审批选择界面)
        result = apply_test.is_need_next_process(processer2_name)
        self.assertTrue(result != -1, "测试不通过")
        if result:
            return 0

        # 审批人2登录同意签卡操作流程
        login_test.open()
        login_test.login(processer2_username, password)
        apply_test.process()
        result = apply_test.is_need_next_process(processer3_name)
        self.assertTrue(result != -1, "测试不通过")
        if result:
            return 0

        # 审批人3登录同意签卡操作流程
        login_test.open()
        login_test.login(processer3_username, password)
        apply_test.process()
        result = apply_test.is_need_next_process(processer4_name)
        self.assertTrue(result != -1, "测试不通过")
        if result:
            return 0

        # 审批人4登录同意签卡操作流程
        login_test.open()
        login_test.login(processer4_username, password)
        apply_test.process()
        result = apply_test.is_need_next_process(processer5_name)
        self.assertTrue(result != -1, "测试不通过")
        if result:
            return 0

        # 审批人5登录同意签卡操作流程
        login_test.open()
        login_test.login(processer5_username, password)
        apply_test.process()
        result = apply_test.is_need_next_process(processer6_name)
        self.assertTrue(result != -1, "测试不通过")
        if result:
            return 0