Example #1
0
    def test01_create(self, data):
        """系统账号新增"""
        if data["skip"] == 'True':
            self.skipTest("跳过示例")
        driver = self.driver
        XZ = OperationMethod(driver)
        new_clocking_in = SystemAccountList(driver)
        add = Add(driver)

        name = data['用例描述']
        code = data['用户名'].split('-')
        cn_name = data['中文名'].split('-')
        password = data['密码'].split('-')
        email = data['email'].split('-')
        user_group = data['用户组'].split('-')

        trigger_btn = data['触发按钮']
        handle = data['操作']
        expect = data['预期结果']
        # 新增按钮
        new_clocking_in.operation_btn(trigger_btn)

        # 用户名输入
        XZ.input_(code[0], code[1])

        # 中文描述
        XZ.input_(cn_name[0], cn_name[1])
        # 密码
        XZ.input_(password[0], password[1])
        # 邮箱
        XZ.input_(email[0], email[1])
        # 用户组
        XZ.input_select(user_group[0], user_group[1])

        # 将滚动条拉到最底层
        js1 = "window.scrollTo(0,100)"
        driver.execute_script(js1)
        #
        # # 考勤年度开始日期
        # XZ.input_(start_date[0], start_date[1])
        # # 考勤体系生效日期
        # XZ.input_(take_effect_date[0], take_effect_date[1])
        # 保存
        add.save_btn(handle)
        sleep(0.5)

        # 断言
        texts = XZ.data_list()
        try:
            # 使用断言
            self.assertIn(expect, texts)
            new_clocking_in.capture_screen(name + '成功')
            print(name + '成功')

        except AssertionError as e:
            new_clocking_in.error_screen(name + '失败')
            print(name + '失败')
            raise e
        print("-------------------系统账号test_create运行完毕-------------------")
Example #2
0
    def test04_other_setting(self, data):
        """其他设置"""
        if data["skip"] == 'True':
            self.skipTest("跳过示例")
        driver = self.driver
        control = OperationMethod(driver)
        basic = BasicInfo(driver)

        name = data['用例描述']
        operand = data['操作对象']
        take_out = data['年假抵充方式']
        month_man_hour = data['每月标准工时']
        enabled_shift = data['启用班次']
        gps_scope = data['优先使用休假类型']
        rest_indate = data['调休有效期最多']
        bargain_expire = data['合同到期提前']
        probation_expire = data['试用期到期提前']
        health_expire = data['健康证到期提前']
        expect = data['预期结果']

        # 其他设置
        basic.title_btn(operand)

        # 年假抵充方式
        control.checkbox(take_out)
        # 每月标准工时
        control.input_number('每月标准工时', month_man_hour)
        # 启用班次
        control.input_number('启用班次', enabled_shift)
        # 调休结余配置
        control.checkbox('可用调休假只统计历史数据')
        control.input_number('调休有效期最多', rest_indate)
        # 证件管理
        control.input_number('合同到期提前', bargain_expire)
        control.input_number('试用期到期提前', probation_expire)
        control.input_number('健康证到期提前', health_expire)

        # 保存
        driver.find_element_by_xpath(
            "//*[@id='pane-7']/div/section/footer/div/button/span").click()
        sleep(0.4)
        # 获取每月标准工时
        data2 = basic.modified_data('标准工时')
        print("后标准工时aria-valuenow的值是:", data2)
        # 断言
        try:
            self.assertEqual(data2, expect)

            print('基本信息设置成功')

        except AssertionError as e:

            print('基本信息设置失败')
            raise e

        print(
            "-------------------其他设置test04_other_setting运行完毕-------------------"
        )
    def test01_create(self, data):
        """用户组管理新增"""
        if data["skip"] == 'True':
            self.skipTest("跳过示例")
        driver = self.driver
        XZ = OperationMethod(driver)
        new_clocking_in = UserGroupManagementList(driver)
        add = Add(driver)

        name = data['用例描述']
        code = data['编码'].split('-')
        Chinese = data['中文描述'].split('-')
        district = data['地区选择'].split('-')
        start_date = data['考勤年度开始日期'].split('-')
        take_effect_date = data['考勤体系生效日期'].split('-')

        trigger_btn = data['触发按钮']
        handle = data['操作']
        expect = data['预期结果']
        # 新增按钮
        new_clocking_in.operation_btn('')
        driver.find_element_by_xpath(
            "/html/body/ul/li[contains(text(),'{0}')]".format(
                '超级管理员')).click()

        # 编码输入
        XZ.input_(code[0], code[1])

        # 中文描述
        XZ.input_(Chinese[0], Chinese[1])

        # 将滚动条拉到最底层
        js1 = "window.scrollTo(0,100)"
        driver.execute_script(js1)
        #
        # # 考勤年度开始日期
        # XZ.input_(start_date[0], start_date[1])
        # # 考勤体系生效日期
        # XZ.input_(take_effect_date[0], take_effect_date[1])
        # 保存
        add.save_btn(handle)
        sleep(0.5)

        # 断言
        texts = XZ.data_list()
        try:
            # 使用断言
            self.assertIn(expect, texts)
            new_clocking_in.capture_screen(name + '成功')
            print(name + '成功')

        except AssertionError as e:
            new_clocking_in.error_screen(name + '失败')
            print(name + '失败')
            raise e
        print("-------------------用户组管理test_create运行完毕-------------------")
Example #4
0
    def test01_create(self, data):
        """公告管理新增"""
        if data["skip"] == 'True':
            self.skipTest("跳过示例")
        driver = self.driver
        XZ = OperationMethod(driver)
        announce_ments = AnnouncementsList(driver)
        add = Add(driver)

        name = data['用例描述']
        code = data['标题'].split('-')
        operant = data['生效日'].split('=')
        content = data['内容']
        trigger_btn = data['触发按钮']
        handle = data['操作']
        expect = data['预期结果']

        # 筛选出所有编码元素
        if code[1] not in XZ.data_list():

            # 新增按钮
            announce_ments.operation_btn(trigger_btn)

            # 标题
            XZ.input_(code[0], code[1])
            # 内容
            add.mtext(content)
            # # 发送所有人
            XZ.checkbox1('发送所有人')
            # 封面
            add.upload(
                '封面',
                r"F:\wfm_flow\unit\up_picture.exe F:\wfm_flow\unit\tu.png")
            # 生效日
            XZ.input_(operant[0], operant[1])
            # 保存并发布
            add.save_btn(handle)
            # 获取标题列表
            account_list2 = XZ.data_list()
            # 断言

            try:
                # 使用断言 判断上面添加的编码是否在编码元素列表中
                self.assertIn(expect, account_list2)
                announce_ments.capture_screen(name + '成功')
                print(name + '成功')

            except AssertionError as e:
                announce_ments.error_screen(name + '失败')
                print(name + '失败')
                raise e
        else:
            print("该账户已经存在")
        print("-------------------公告管理test01_create运行完毕-------------------")
Example #5
0
    def test01_create(self, data):
        """考勤体系新增"""
        if data["skip"] == 'True':
            self.skipTest("跳过示例")
        driver = self.driver
        XZ = OperationMethod(driver)
        new_clocking_in = NewClockingInSystemList(driver)
        add = Add(driver)

        name = data['用例描述']
        code = data['编码'].split('-')
        Chinese = data['中文描述'].split('-')
        district = data['地区选择'].split('-')
        start_date = data['考勤年度开始日期'].split('-')
        take_effect_date = data['考勤体系生效日期'].split('-')

        trigger_btn = data['触发按钮']
        handle = data['操作']
        expect = data['预期结果']
        # 新增按钮
        new_clocking_in.operation_btn(trigger_btn)
        # 编码输入
        XZ.input_(code[0], code[1])

        # 中文描述
        XZ.input_(Chinese[0], Chinese[1])

        # 地区选择(大陆))
        XZ.input_select(district[0], district[1])
        # 将滚动条拉到最底层
        js1 = "window.scrollTo(0,100)"
        driver.execute_script(js1)

        # 考勤年度开始日期
        XZ.input_(start_date[0], start_date[1])
        # 考勤体系生效日期
        XZ.input_(take_effect_date[0], take_effect_date[1])
        # 保存
        add.save_btn(handle)
        sleep(0.5)

        # 断言
        texts = XZ.data_list()
        try:
            # 使用断言
            self.assertIn(expect, texts)
            new_clocking_in.capture_screen(name + '成功')
            print(name + '成功')

        except AssertionError as e:
            new_clocking_in.error_screen(name + '失败')
            print(name + '失败')
            raise e
        print("-------------------新建考勤体系test_create运行完毕-------------------")
Example #6
0
    def test01_create(self, data):
        """工时设置新增"""
        if data["skip"] == 'True':
            self.skipTest("跳过示例")
        driver = self.driver
        timeset = TimeSetList(driver)
        XZ = OperationMethod(driver)
        add = Add(driver)

        name = data['用例描述']
        code = data['编码'].split('-')
        Chinese = data['中文描述'].split('-')
        shift_type = data['轮班类型'].split('-')
        trigger_btn = data['触发按钮']
        st = data['工作开始时间'].split('-')
        en = data['工作结束时间'].split('-')
        handle = data['操作']
        expect = data['预期结果']

        # 新增按钮
        timeset.operation_btn(trigger_btn)
        # 编码输入
        XZ.input_(code[0], code[1])
        # 中文描述
        XZ.input_(Chinese[0], Chinese[1])
        # 轮班类型-中班
        XZ.input_select(shift_type[0], shift_type[1])
        # 切换到详细信息
        driver.find_element_by_xpath(".//*[@id='tab-second']").click()
        # 工作开始时间
        XZ.input_(st[0], st[1])

        # 工作结束时间
        # 手动录入
        XZ.input_(en[0], en[1])

        # 确定
        add.save_btn(handle)
        sleep(0.2)
        # 断言
        texts = XZ.data_list()

        try:
            # 使用断言
            self.assertIn(expect, texts)
            timeset.capture_screen(name + '成功')
            print(name + '成功')

        except AssertionError as e:
            timeset.error_screen(name + '失败')
            print(name + '失败')
            raise e
        print("-------------------工时设置test_create运行完毕-------------------")
Example #7
0
    def test01_create_correct(self, data):
        """休假类型新增"""
        if data["skip"] == 'True':
            self.skipTest("跳过示例")
        driver = self.driver
        XZ = OperationMethod(driver)
        leave_type = LeaveTypeList(driver)
        add = Add(driver)
        name = data['用例描述']
        code = data['编码'].split('-')
        Chinese = data['中文描述'].split('-')
        trigger_btn = data['触发按钮']
        unit = data['单位'].split('-')
        handle = data['操作']
        use_vacation_types_first = data['优先使用休假类型'].split('-')
        expect = data['预期结果']

        # 新增按钮
        leave_type.operation_btn(trigger_btn)
        # 编码输入
        XZ.input_(code[0], code[1])
        # 中文描述
        XZ.input_(Chinese[0], Chinese[1])

        # 单位选取(天)
        XZ.input_select(unit[0], unit[1])
        # # 将滚动条拉到最底层
        # js1 = "window.scrollTo(0,1000)"
        # driver.execute_script(js1)
        self.scroll_page_to_buttom()
        # 优先使用休假类型(年假)
        XZ.input_select(use_vacation_types_first[0],
                        use_vacation_types_first[1])
        sleep(1)
        # 保存
        add.save_btn(handle)
        sleep(1)
        texts = XZ.data_list()
        print(texts)
        try:
            # 使用断言
            self.assertIn(expect, texts)
            leave_type.capture_screen(name + '成功')
            print(name + '成功')

        except AssertionError as e:
            leave_type.error_screen(name + '失败')
            print(name + '失败')
            raise e
        print(
            "-------------------休假类型test_xinzeng_correct运行完毕-------------------"
        )
Example #8
0
    def test02_alter(self, data):
        """公告管理修改"""
        if data["skip"] == 'True':
            self.skipTest("跳过示例")
        driver = self.driver
        XG = OperationMethod(driver)
        announce_ments = AnnouncementsList(driver)
        alter = Alter(driver)

        name = data['用例描述']
        code = data['标题'].split('-')
        edit = data['修改项']
        trigger_btn = data['触发按钮']
        handle = data['操作']
        expect = data['预期结果']

        # 筛选出所有编码元素
        # 标题路径
        for text in XG.data_list():
            if text == code[1]:
                # 选中要操作的行
                announce_ments.select_data(code[1])
                sleep(0.3)
                break
        # 获取选中行置顶一栏信息
        # 点击修改按钮
        announce_ments.operation_btn(trigger_btn)

        # 置顶
        XG.checkbox1(edit)
        # 保存并发布
        alter.save_btn(handle)
        sleep(0.3)
        # 再次获取选中行置顶一栏信息
        stick2 = announce_ments.unit_data(code[1])
        print(stick2)

        # 断言
        try:
            self.assertEqual(stick2, expect)
            announce_ments.capture_screen(name + '成功')
            print(name + '成功')
        except AssertionError as e:
            announce_ments.error_screen(name + '失败')
            print(name + '失败')
            raise e

        print(
            "-------------------加班政策test02_alter_correct运行完毕-------------------"
        )
Example #9
0
    def test03_copy(self, data):
        """公告管理复制"""
        if data["skip"] == 'True':
            self.skipTest("跳过示例")
        driver = self.driver
        FZ = OperationMethod(driver)
        announce_ments = AnnouncementsList(driver)
        cp = Copy(driver)

        name = data['用例描述']
        code = data['标题'].split('-')
        operant = data['生效日'].split('=')

        trigger_btn = data['触发按钮']
        handle = data['操作']
        # 筛选出所有编码元素
        elements1 = FZ.data_list()
        print(elements1)

        # 标题路径
        for element in FZ.data_list():
            if element == code[1]:
                # 选中要操作的行
                announce_ments.select_data(code[1])
                sleep(0.2)
                break
        # 点击修改按钮
        announce_ments.operation_btn(trigger_btn)
        # 标题
        FZ.input_(code[0], code[1] + '1')

        # 生效日期
        FZ.input_(operant[0], operant[1])

        # 选择提示框里的确定按钮
        cp.save_btn(handle)
        sleep(0.3)
        # 编码列表
        elements2 = FZ.data_list()
        print(elements2)

        try:
            # 断言
            self.assertNotEqual(elements2, elements1)
            announce_ments.capture_screen(name + '成功')
            print(name + '成功')
        except AssertionError as e:
            announce_ments.error_screen(name + '失败')
            print(name + '失败')
            raise e
Example #10
0
    def test02_alter_correct(self, data):
        """系统账号修改"""
        if data["skip"] == 'True':
            self.skipTest("跳过示例")
        driver = self.driver
        XG = OperationMethod(driver)
        new_clocking_in = SystemAccountList(driver)
        alter = Alter(driver)

        name = data['用例描述']
        code = data['用户名'].split('-')
        cn_name = data['中文名'].split('-')
        password = data['密码'].split('-')
        email = data['email'].split('-')
        user_group = data['用户组'].split('-')

        trigger_btn = data['触发按钮']
        handle = data['操作']
        expect = data['预期结果']
        # 筛选出所有编码元素
        elements = XG.data_list()
        for element in elements:
            if element == code[1]:
                new_clocking_in.select_data(element)
                sleep(0.2)
                break

        # 点击修改按钮
        new_clocking_in.operation_btn(trigger_btn)
        sleep(1)
        # 中文名
        XG.input_(cn_name[0], cn_name[1])
        # 保存
        alter.save_btn(handle)
        sleep(0.5)
        text = new_clocking_in.unit_data(code[1])
        print(text)
        try:
            # 使用断言 判断上面添加的编码是否在编码元素列表中
            self.assertEqual(text, expect)
            new_clocking_in.capture_screen(name + '成功')
            print(name + '成功')
        except AssertionError as e:
            new_clocking_in.error_screen(name + '失败')
            print(name + '失败')
            raise e
        print(
            "-------------------系统账号test02_alter_correct运行完毕-------------------"
        )
Example #11
0
    def test02_alter_correct(self, data):
        """轮班类型的修改"""
        if data["skip"] == 'True':
            self.skipTest("跳过示例")
        driver = self.driver
        XG = OperationMethod(driver)
        shift_type = ShiftTypeList(driver)
        alter = Alter(driver)
        name = data['用例描述']
        code = data['编码'].split('-')
        trigger_btn = data['触发按钮']
        Chinese = data['中文描述'].split('-')
        zh_hk = data['繁体描述'].split('-')
        handle = data['操作']
        expect = data['预期结果']

        # 筛选出所有编码元素
        elements = XG.data_list()
        for element in elements:
            if element == code[1]:
                shift_type.select_data(element)
                sleep(1)
                break

        # 点击修改按钮
        # driver.find_element_by_xpath('//footer/div/button[2]').click()
        shift_type.operation_btn(trigger_btn)
        # 中文描述
        XG.input_(Chinese[0], Chinese[1])

        # 繁体描述
        XG.input_(zh_hk[0], zh_hk[1])
        # 保存
        alter.save_btn(handle)
        # 获取描述信息
        text = shift_type.unit_data(code[1])
        try:
            # 使用断言
            self.assertEqual(text, expect)
            shift_type.capture_screen(name + '成功')
            print(name + '成功')
        except AssertionError as e:
            shift_type.error_screen(name + '失败')
            print(name + '失败')
            raise e

        print(
            '---------------------轮班类型test_xiugai_correct运行完毕---------------------'
        )
Example #12
0
    def test04_del(self, data):
        if data["skip"] == 'True':
            self.skipTest("跳过示例")
        """公告管理删除"""
        driver = self.driver
        SC = OperationMethod(driver)
        announce_ments = AnnouncementsList(driver)
        alter = Alter(driver)
        dele = Del(driver)

        name = data['用例描述']
        code = data['标题'].split('-')
        trigger_btn = data['触发按钮']
        handle = data['操作']
        expect = data['预期结果']
        # 筛选出所有编码元素
        # 标题路径
        for element in SC.data_list():
            if element == code[1]:
                # 选中要操作的行
                announce_ments.select_data(code[1])
                sleep(0.2)
                break
        # 点击修改按钮
        announce_ments.operation_btn('修改')

        # 点击删除按钮
        alter.del_btn(trigger_btn)

        # 选择提示框里的确定按钮
        dele.save_btn(handle)
        sleep(0.3)
        # 编码列表
        elements1 = SC.data_list()

        try:
            # 断言
            self.assertNotIn(expect, elements1)
            announce_ments.capture_screen(name + '成功')
            print(name + '成功')
        except AssertionError as e:
            announce_ments.error_screen(name + '失败')
            print(name + '失败')
            raise e
        print(
            "-------------------用户组管理test03_del_correct运行完毕-------------------"
        )
    def test02_alter_correct(self, data):
        """考勤体系修改"""
        if data["skip"] == 'True':
            self.skipTest("跳过示例")
        driver = self.driver
        XG = OperationMethod(driver)
        new_clocking_in = UserGroupManagementList(driver)
        alter = Alter(driver)

        name = data['用例描述']
        code = data['编码'].split('-')
        trigger_btn = data['触发按钮']
        handle = data['操作']
        Chinese = data['中文描述'].split('-')
        Chinese_traditional = data['繁体描述'].split('-')
        expect = data['预期结果']
        # 筛选出所有编码元素
        elements = XG.data_list()
        for element in elements:
            if element == code[1]:
                new_clocking_in.select_data(element)
                sleep(0.2)
                break

        # 点击修改按钮
        new_clocking_in.operation_btn(trigger_btn)
        sleep(1)
        # 中文描述
        XG.input_(Chinese[0], Chinese[1])
        # 繁体描述
        XG.input_(Chinese_traditional[0], Chinese_traditional[1])
        # 保存
        alter.save_btn(handle)
        sleep(1)
        text = new_clocking_in.unit_data(code[1])
        try:
            # 使用断言 判断上面添加的编码是否在编码元素列表中
            self.assertEqual(text, expect)
            new_clocking_in.capture_screen(name + '成功')
            print(name + '成功')
        except AssertionError as e:
            new_clocking_in.error_screen(name + '失败')
            print(name + '失败')
            raise e
        print(
            "-------------------用户组管理test02_alter_correct运行完毕-------------------"
        )
Example #14
0
    def test01_create_correct(self, data):
        """审查自定义新增"""
        if data["skip"] == 'True':
            self.skipTest("跳过示例")
        driver = self.driver
        examine_custom = ExamineCustomList(driver)
        XZ = OperationMethod(driver)
        add = Add(driver)
        name = data['用例描述']
        code = data['编码'].split('-')
        Chinese = data['中文描述'].split('-')
        field = data['字段类型'].split('-')
        monad = data['单位'].split('-')
        trigger_btn = data['触发按钮']
        handle = data['操作']
        expect = data['预期结果']

        # 新增按钮
        examine_custom.operation_btn(trigger_btn)
        # 编码输入
        XZ.input_(code[0], code[1])
        # 字段类型
        XZ.input_select(field[0], field[1])
        # 单位(次)
        XZ.input_select(monad[0], monad[1])
        # 保存
        add.save_btn(handle)
        sleep(0.5)
        texts = XZ.data_list()

        print(texts)

        # 断言
        try:
            # 使用断言
            self.assertIn(expect, texts)
            examine_custom.capture_screen(name + '成功')
            print(name + '成功')

        except AssertionError as e:
            examine_custom.error_screen(name + '失败')
            print(name + '失败')

            raise e

        print("-------------------审查自定义项test_xinzeng_correct运行完毕-------------------")
Example #15
0
    def test02_xiugai_correct(self, data):
        """加班政策修改"""
        if data["skip"] == 'True':
            self.skipTest("跳过示例")
        driver = self.driver
        XG = OperationMethod(driver)
        leave_policy = LeavePolicyList(driver)
        alter = Alter(driver)

        name = data['用例描述']
        code = data['编码'].split('-')
        trigger_btn = data['触发按钮']
        handle = data['操作']
        Chinese = data['中文描述'].split('-')
        Chinese_traditional = data['繁体描述'].split('-')
        expect = data['预期结果']

        # 筛选出所有编码元素
        elements = XG.data_list()
        for element in elements:
            if element == code[1]:
                leave_policy.select_data(element)
                sleep(0.2)
                break

        # 点击修改按钮
        leave_policy.operation_btn(trigger_btn)
        # 中文描述
        XG.input_(Chinese[0], Chinese[1])
        # 繁体描述
        XG.input_(Chinese_traditional[0], Chinese_traditional[1])
        # 确认
        alter.save_btn(handle)
        text = leave_policy.unit_data(code[1])
        try:
            # 使用断言 判断上面添加的编码是否在编码元素列表中
            self.assertEqual(text, expect)
            leave_policy.capture_screen(name + '成功')
            print(name + '成功')
        except AssertionError as e:
            leave_policy.error_screen(name + '失败')
            print(name + '失败')
            raise e
        print(
            "-------------------加班政策test_xiugai_correct运行完毕-------------------"
        )
Example #16
0
    def test04_del_correct(self, data):
        """考勤体系删除"""
        if data["skip"] == 'True':
            self.skipTest("跳过示例")
        driver = self.driver
        SC = OperationMethod(driver)
        new_clocking_in = NewClockingInSystemList(driver)
        alter = Alter(driver)
        dele = Del(driver)

        name = data['用例描述']
        code = data['编码'].split('-')
        trigger_btn = data['触发按钮']
        handle = data['操作']
        # 筛选出所有编码元素
        elements = SC.data_list()
        print(elements)
        for element in elements:
            if element == code[1]:
                # 选中要操作的元素
                new_clocking_in.select_data(element)
                break

        # 点击修改按钮
        new_clocking_in.operation_btn('修改')
        # 点击删除按钮
        alter.del_btn(trigger_btn)
        # 选择提示框里的确定按钮
        dele.save_btn(handle)
        # 编码列表
        elements1 = SC.data_list()
        try:
            # 断言
            self.assertNotIn(code[1], elements1)
            new_clocking_in.capture_screen(name + '成功')
            print(name + '成功')

        except AssertionError as e:
            new_clocking_in.error_screen(name + '失败')
            print(name + '失败')
            raise e

        print(
            "-------------------新建考勤体系test_del_correct运行完毕-------------------")
Example #17
0
    def test02_alter(self, data):
        """工时设置修改"""
        if data["skip"] == 'True':
            self.skipTest("跳过示例")
        driver = self.driver
        timeset = TimeSetList(driver)
        XG = OperationMethod(driver)
        alter = Alter(driver)

        name = data['用例描述']
        code = data['编码'].split('-')
        trigger_btn = data['触发按钮']
        Chinese = data['中文描述'].split('-')
        handle = data['操作']
        expect = data['预期结果']

        # 筛选出所有编码元素
        elements = XG.data_list()
        for element in elements:
            if element == code[1]:
                timeset.select_data(element)
                sleep(0.3)
                break
        # 点击修改按钮
        # driver.find_element_by_xpath('//section/footer/div/div/div/button[2]').click()
        timeset.operation_btn(trigger_btn)
        # 中文描述
        XG.input_(Chinese[0], Chinese[1])
        # 确定
        alter.save_btn(handle)
        # 断言依据获取
        text = timeset.unit_data(code[1])

        try:
            # 使用断言 判断上面添加的编码是否在编码元素列表中
            self.assertEqual(text, expect)
            timeset.capture_screen(name + '成功')
            print(name + '成功')
        except AssertionError as e:
            timeset.error_screen(name + '失败')
            print(name + '失败')
            raise e
        print("-------------------工时设置test_alter运行完毕-------------------")
Example #18
0
    def test03_del(self, data):
        """工时设置删除"""
        if data["skip"] == 'True':
            self.skipTest("跳过示例")
        driver = self.driver
        time_set = TimeSetList(driver)
        SC = OperationMethod(driver)
        alter = Alter(driver)
        dele = Del(driver)

        name = data['用例描述']
        code = data['编码'].split('-')
        trigger_btn = data['触发按钮']
        handle = data['操作']

        # 筛选出所有编码元素
        # elements = driver.find_elements_by_xpath('//table/tbody/tr[*]/td[1]/div')
        elements = SC.data_list()
        print(elements)
        for element in elements:
            if element == code[1]:
                # 选中要操作的元素
                time_set.select_data(element)
                break
        # 点击修改按钮
        time_set.operation_btn('修改')
        # 删除
        alter.save_btn(trigger_btn)
        # 选择提示框里的确定按钮
        dele.save_btn(handle)
        # 编码列表
        elements1 = SC.data_list()
        try:
            # 断言
            self.assertNotIn(code[1], elements1)
            time_set.capture_screen(name + '成功')
            print(name + '成功')

        except AssertionError as e:
            time_set.error_screen(name + '失败')
            print(name + '失败')
            raise e
        print("-------------------工时设置test03_del运行完毕-------------------")
Example #19
0
    def test01_create_correct(self, data):
        """加班类型新增"""
        if data["skip"] == 'True':
            self.skipTest("跳过示例")
        driver = self.driver
        overtime_type = OvertimeTypeList(driver)
        XZ = OperationMethod(driver)
        add = Add(driver)

        name = data['用例描述']
        code = data['编码'].split('-')
        Chinese = data['中文描述'].split('-')
        trigger_btn = data['触发按钮']
        handle = data['操作']
        expect = data['预期结果']
        # 新增按钮
        overtime_type.operation_btn(trigger_btn)
        # 编码输入
        XZ.input_(code[0], code[1])
        # 中文描述
        XZ.input_(Chinese[0], Chinese[1])
        # 将滚动条拉到最底层
        js1 = "window.scrollTo(0,100)"
        driver.execute_script(js1)
        # 备注允许为空
        add.checked('附件允许为空')
        # 保存
        add.save_btn(handle)
        sleep(3)
        # 断言
        texts = XZ.data_list()
        try:
            # 使用断言
            self.assertIn(expect, texts)
            overtime_type.capture_screen(name + '成功')
            print(name + '成功')

        except AssertionError as e:
            overtime_type.error_screen(name + '失败')
            print(name + '失败')
            raise e
        print('-------------------加班类型test_xinzeng_correct运行完毕-------------------')
Example #20
0
    def test01_xinzeng_correct(self, data):
        """加班政策新增"""
        if data["skip"] == 'True':
            self.skipTest("跳过示例")
        driver = self.driver
        XZ = OperationMethod(driver)
        leave_policy = LeavePolicyList(driver)
        add = Add(driver)

        name = data['用例描述']
        code = data['编码'].split('-')
        Chinese = data['中文描述'].split('-')
        trigger_btn = data['触发按钮']
        handle = data['操作']
        expect = data['预期结果']

        # 新增按钮
        leave_policy.operation_btn(trigger_btn)
        # 编码输入
        XZ.input_(code[0], code[1])
        # 中文描述
        XZ.input_(Chinese[0], Chinese[1])
        # 确认
        add.save_btn(handle)
        sleep(0.2)
        # 断言
        texts = XZ.data_list()

        try:
            # 使用断言
            self.assertIn(expect, texts)
            leave_policy.capture_screen(name + '成功')
            print(name + '成功')

        except AssertionError as e:
            leave_policy.error_screen(name + '失败')
            print(name + '失败')
            raise e
        print(
            "-------------------休假政策test_xinzeng_correct运行完毕-------------------"
        )
Example #21
0
    def test03_del_correct(self, data):
        """轮班类型的删除"""
        if data["skip"] == 'True':
            self.skipTest("跳过示例")
        driver = self.driver
        shift_type = ShiftTypeList(driver)
        SC = OperationMethod(driver)
        dele = Del(driver)
        name = data['用例描述']
        code = data['编码'].split('-')
        trigger_btn = data['触发按钮']
        handle = data['操作']
        # 筛选出所有编码元素
        elements = SC.data_list()
        print(elements)
        for element in elements:
            if element == code[1]:
                # 选中要操作的元素
                shift_type.select_data(element)
                break

        # 点击删除按钮
        shift_type.operation_btn(trigger_btn)
        # 选择提示框里的确认按钮
        dele.save_btn(handle)
        # 编码列表
        elements1 = SC.data_list()

        try:
            # 断言
            self.assertNotIn(code[1], elements1)
            shift_type.capture_screen(name + '成功')
            print(name + '成功')

        except AssertionError as e:
            shift_type.error_screen(name + '失败')
            print(name + '失败')
            raise e
        print(
            '---------------------轮班类型test_del_correct运行完毕---------------------'
        )
Example #22
0
    def test03_del_correct(self, data):
        """审查自定义项删除"""
        if data["skip"] == 'True':
            self.skipTest("跳过示例")
        driver = self.driver
        examine_custom = ExamineCustomList(driver)
        XG = OperationMethod(driver)
        alter = Alter(driver)
        dele = Del(driver)
        name = data['用例描述']
        code = data['编码'].split('-')
        trigger_btn = data['触发按钮']
        handle = data['操作']
        # 筛选出所有编码元素
        elements = XG.data_list()
        print(elements)
        for element in elements:
            if element == code[1]:
                # 选中要操作的元素
                examine_custom.select_data(element)
                break
        # 点击修改按钮
        examine_custom.operation_btn(trigger_btn)
        # 点击删除按钮
        alter.del_btn()
        # 选择提示框里的确定按钮
        dele.operation_btn(handle)
        sleep(0.5)
        # 编码列表
        elements1 = XG.data_list()
        try:
            # 断言
            self.assertNotIn(code[1], elements1)
            examine_custom.capture_screen(name + '成功')
            print(name + '成功')

        except AssertionError as e:
            examine_custom.error_screen(name + '失败')
            print(name + '失败')
            raise e
        print("-------------------审查自定义项test_del_correct运行完毕-------------------")
Example #23
0
    def test02_alter_correct(self, data):
        """休假类型修改"""
        if data["skip"] == 'True':
            self.skipTest("跳过示例")
        driver = self.driver
        XG = OperationMethod(driver)
        leave_type = LeaveTypeList(driver)
        alter = Alter(driver)
        name = data['用例描述']
        code = data['编码'].split('-')
        trigger_btn = data['触发按钮']
        handle = data['操作']
        unit = data['单位'].split('-')
        expect = data['预期结果']
        # 筛选出所有编码元素
        elements = XG.data_list()
        for element in elements:
            if element == code[1]:
                leave_type.select_data(element)
                sleep(1)
                break
        # 点击修改按钮
        leave_type.operation_btn(trigger_btn)
        # 单位选取(小时)
        XG.input_select(unit[0], unit[1])
        # 保存
        alter.save_btn(handle)
        text = leave_type.unit_data(code[1])
        try:
            # 使用断言 判断上面添加的编码是否在编码元素列表中
            self.assertEqual(text, expect)
            leave_type.capture_screen(name + '成功')
            print(name + '成功')
        except AssertionError as e:
            leave_type.error_screen(name + '失败')
            print(name + '失败')
            raise e

        print(
            "-------------------休假类型test_xiugai_correct运行完毕-------------------"
        )
Example #24
0
    def test02_alter_correct(self, data):
        """审查自定义项修改"""
        if data["skip"] == 'True':
            self.skipTest("跳过示例")
        driver = self.driver
        XG = OperationMethod(driver)
        examine_custom = ExamineCustomList(driver)
        alter = Alter(driver)

        name = data['用例描述']
        code = data['编码'].split('-')
        trigger_btn = data['触发按钮']
        Chinese = data['中文描述'].split('-')
        handle = data['操作']
        expect = data['预期结果']

        # 筛选出所有编码元素
        elements = XG.data_list()
        for element in elements:
            if element == code[1]:
                examine_custom.select_data(element)
                break
        # 点击修改按钮
        examine_custom.operation_btn(trigger_btn)
        # 中文描述
        XG.input_(Chinese[0], Chinese[1])
        # 保存
        alter.save_btn(handle)
        # 获取描述信息
        text = examine_custom.unit_data(code[1])
        try:
            # 使用断言
            self.assertEqual(text, expect)
            examine_custom.capture_screen(name + '成功')
            print(name + '成功')
        except AssertionError as e:
            examine_custom.error_screen(name + '失败')
            print(name + '失败')
            raise e
        print("-------------------审查自定义项test_xiugai_correct运行完毕-------------------")
    def test01_alter(self, data):
        """考勤期段管理修改"""
        name = data['用例描述']
        st_date = data['开始时间']
        en_date = data['结束时间']
        trigger_btn = data['触发按钮']
        handle = data['操作']
        remark = data['备注'].split('-')
        expect = data['预期结果']
        if data["skip"] == 'True':
            self.skipTest("跳过示例{0}".format(name))
        driver = self.driver
        attendance_period = AttendancePeriodManagementList(driver)
        alter = Alter(driver)
        XG = OperationMethod(driver)

        # 选中要操作的开始时间
        attendance_period.select_data(st_date, en_date)
        # 点击修改按钮
        attendance_period.operation_btn(trigger_btn)
        # 备注
        XG.input_(remark[0], remark[1])
        # 保存
        alter.save_btn(handle)
        sleep(0.2)
        text = attendance_period.unit_data(st_date)
        print(text)
        try:
            # 使用断言
            self.assertEqual(text, expect)
            attendance_period.capture_screen(name + '成功')
            print(name + '成功')
        except AssertionError as e:
            attendance_period.error_screen(name + '失败')
            print(name + '失败')
            raise e

        print(
            "-------------------考勤期段管理test_xiugai_correct运行完毕-------------------"
        )
Example #26
0
    def test01_create_correct(self, data):
        """轮班类型的新增"""
        if data["skip"] == 'True':
            self.skipTest("跳过示例")
        driver = self.driver
        XZ = OperationMethod(driver)
        shift_type = ShiftTypeList(driver)
        add = Add(driver)
        name = data['用例描述']
        code = data['编码'].split('-')
        Chinese = data['中文描述'].split('-')
        trigger_btn = data['触发按钮']
        handle = data['操作']
        expect = data['预期结果']
        # 新增按钮
        shift_type.operation_btn(trigger_btn)
        # 编码输入
        XZ.input_(code[0], code[1])
        # 中文描述
        XZ.input_(Chinese[0], Chinese[1])
        # 保存
        add.save_btn(handle)
        texts = XZ.data_list()
        print(texts)
        # 断言
        try:
            # 使用断言
            self.assertIn(expect, texts)
            shift_type.capture_screen(name + '成功')
            print(name + '成功')

        except AssertionError as e:
            shift_type.error_screen(name + '失败')
            print(name + '失败')
            raise e
        print(
            '---------------------轮班类型test_xinzeng_correct运行完毕---------------------'
        )
Example #27
0
    def test01_new(self):
        """新建宏(考勤审查前)macro"""
        driver = self.driver
        macros = MacroList(driver)
        method = OperationMethod(driver)
        add = AddMacro(driver)
        # 获取所有宏名
        names1 = macros.macro_list()
        print(macros.macro_list())
        # print(names1)

        # 点击考勤审查前 +
        macros.add_btn('考勤审查后')
        # 填写新建宏弹窗
        # 名称
        method.input_('名称', 'peter宏')
        # 执行存储过程
        method.input_('执行存储过程', '213432')
        # 保存
        add.save_btn('保存')
        sleep(0.5)
        # 再次获取所有宏名
        names2 = macros.macro_list()
        print(names2)

        # 断言
        try:
            self.assertNotEqual(names2, names1)

        except AssertionError:
            print('新建宏失败')
        else:
            print("新建宏成功")

        finally:
            print(
                "-------------------宏设置test01_xinjian运行完毕-------------------")
    def test01_new(self):
        """新建预处理规则"""
        driver = self.driver
        rule = RuleList(driver)
        method = OperationMethod(driver)
        add = AddMacro(driver)
        # 获取所有宏名
        names1 = rule.macro_list()
        print(rule.macro_list())
        # print(names1)

        # 点击排班规则 +
        rule.add_btn('排班规则')
        # 填写新建规则弹窗
        # 名称
        method.input_('名称', 'peter排班规则')
        # 执行存储过程
        method.input_('执行存储过程', '213432')
        # 保存
        add.save_btn('保存')
        sleep(0.5)
        # 再次获取所有宏名
        names2 = rule.macro_list()
        print(names2)

        # 断言
        try:
            self.assertNotEqual(names2, names1)

        except AssertionError:
            print('新建规则失败')
        else:
            print("新建规则成功")

        finally:
            print("-------------------预处理规则test01_new运行完毕-------------------")
Example #29
0
    def test01_basic_info(self, data):
        """基本设置-基本信息"""
        if data["skip"] == 'True':
            self.skipTest("跳过示例")
        driver = self.driver
        control = OperationMethod(driver)
        basic = BasicInfo(driver)

        name = data['用例描述']
        operand = data['操作对象']
        identity_card = data['身份证']
        passport = data['护照']
        contains_characters = data['密码机制自定义包含字符'].split('-')
        password_mini = data['密码最小长度']
        lock_screen = data['未操作锁屏时长']
        gesture_password = data['手势密码']
        gps_scope = data['GPS定位有效范围']
        default_language = data['系统默认语言']
        week_st = data['每周开始时间']
        notice_max = data['公告最大附件']

        expect = data['预期结果']

        # 基本信息
        basic.title_btn(operand)
        # 初始密码
        control.input_number('身份证', identity_card)

        control.input_number('护照', passport)
        # control.checkbox("强制修改初始化密码")

        # 密码机制
        control.checkbox(contains_characters[0])
        control.checkbox(contains_characters[1])
        control.input_number('密码最小长度', password_mini)
        control.input_number('设置未操作', lock_screen)

        # 手势密码
        control.checkbox(gesture_password)

        # GPS
        control.input_number('GPS定位有效范围', gps_scope)

        # 域启用
        # control.checkbox('是否启用域')

        # 系统默认语言
        control.checkbox(default_language)

        # 每周开始日期
        control.checkbox(week_st)

        # 附件限制大小
        control.input_number('公告最大附件为', notice_max)

        # 保存
        basic.save_btn()
        sleep(0.4)
        # 获取初始密码身份证位数
        data2 = basic.modified_data('身份证')
        print("身份后aria-valuenow的值是:", expect)
        # 断言
        try:
            self.assertEqual(data2, expect)

            print('基本信息设置成功')

        except AssertionError as e:

            print('基本信息设置失败')
            raise e

        print(
            "-------------------基本信息test01_basic_Info运行完毕-------------------")
Example #30
0
    def test01_set(self, data):
        """设置考勤地点"""
        if data["skip"] == 'True':
            self.skipTest("跳过示例")
        driver = self.driver
        attendance_site = AttendanceSiteList(driver)
        SZ = OperationMethod(driver)
        name = data['用例描述']
        store = data['店名'].split('-')
        am_st = data['考勤上午开始时间'].split('-')
        am_en = data['考勤上午结束时间'].split('-')
        pm_st = data['考勤下午开始时间'].split('-')
        pm_en = data['考勤下午结束时间'].split('-')
        Chinese = data['中文描述'].split('-')
        remark = data['备注'].split('-')
        trigger_btn = data['触发按钮']
        handle = data['操作']
        expect = data['预期结果']

        # 选取相应店
        attendance_site.select_data(store[1])

        def function_():
            # 基本信息
            # 中文描述
            SZ.input_(Chinese[0], Chinese[1])

            # 考勤上午开始时间
            SZ.input_(am_st[0], am_st[1])
            # 考勤上午结束时间
            SZ.input_(am_en[0], am_en[1])
            # 考勤下午开始时间
            SZ.input_(pm_st[0], pm_st[1])
            # 考勤下午结束时间
            SZ.input_(pm_en[0], pm_en[1])
            # # 备注
            SZ.textarea_(remark[0], remark[1])
            # driver.find_element_by_xpath('//form/div/div[6]/div[2]/div/div/div/textarea').clear()
            # driver.find_element_by_xpath('//form/div/div[6]/div[2]/div/div/div/textarea').send_keys('这是一条备注测试信息')
            sleep(5)
            # 保存
            attendance_site.save_btn(handle)
            sleep(5)

        if attendance_site.visibility():
            function_()

        else:
            # 点击设置考勤地点
            attendance_site.touch_btn(trigger_btn)
            # 提示框确定
            attendance_site.operation_btn('确定')
            function_()

        # 断言
        # 调用isElementExist方法,判断元素是否存在
        vis = attendance_site.visibility()
        try:
            # 使用断言 判断上面添加的编码是否在编码元素列表中
            self.assertEqual(vis, expect, msg=None)
            attendance_site.capture_screen(name + '成功')
            print(name + '成功')
        except Exception as e:
            attendance_site.error_screen(name + '失败')
            print(name + '失败')
            raise e
        print("-------------------考勤地点test_set运行完毕-------------------")