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运行完毕-------------------")
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运行完毕-------------------")
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运行完毕-------------------")
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运行完毕-------------------" )
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运行完毕-------------------")
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运行完毕-------------------" )