Example #1
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 #2
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运行完毕-------------------"
        )