def test_foreign_value_deliver(self): '''测试外键选择传递外键关联字段''' qiqiao.Application(self.driver).clickLeftMenu("外键选择") time.sleep(1) qiqiao.Application(self.driver).clickLeftMenu("外键字段传递") qiqiao.Application(self.driver).clickButtonInTitle("添加") time.sleep(1) qiqiao.ForergnKeySelection(self.driver).normal('外键字段', '测试数据') time.sleep(2) qiqiao.Application(self.driver).clickSubmit() time.sleep(3) html = self.driver.page_source self.assertIn('测试数据', html) self.assertIn('青青子衿悠悠我心', html) self.assertIn('30', html) self.assertIn('40', html) self.assertIn('50.00', html) self.assertIn('50.0%', html) self.assertIn('95', html) self.assertIn('美国', html) self.assertIn('北京', html) self.assertIn('宝马', html) self.assertIn('奔驰s600', html) self.assertIn('2020-10-29', html) self.assertIn('15:23', html) self.assertIn('2020-10-29 00:00', html) self.assertIn('苹果.jpg', html) self.assertIn('孙奥博', html) self.assertIn('孙洁', html) self.assertIn('孙慧颖', html) self.assertIn('系统运维部', html) self.assertIn('创新技术中心', html) self.assertIn('山西省/太原市/小店区 南派12号', html) qiqiao.Application(self.driver).deleteAllData('删除')
def test_required(self): '''测试必填''' qiqiao.Application(self.driver).clickButtonInTitle("添加") qiqiao.Application(self.driver).clickSubmit() error_loc = Operation().readXml('msg', 'requiredmsg') msg = qiqiao.Application(self.driver).getText(error_loc) self.assertEqual("不能为空", msg)
def test_edit_comment(self): '''测试评论编辑页面上传附件''' qiqiao.Application(self.driver).clickButtonInForm("详情", 1) qiqiao.RichText(self.driver).comment("自动化上传图片") filename = time.strftime("%Y-%m-%d_%H-%M_%S", time.localtime(time.time())) + ".png" file_path = UiPath.screenshot_path + "\\" + filename qiqiao.Application(self.driver).getScreenshot(file_path) qiqiao.Application(self.driver).commentAddAnnex(file_path) time.sleep(1) up_time = time.strftime("%Y-%m-%d_%H:%M_%S", time.localtime(time.time())) tt = up_time.split("_") loc_time = tt[0] + " " + tt[1] qiqiao.Application(self.driver).submitComment() qiqiao.Application(self.driver).F5() qiqiao.Application(self.driver).acceptAlert() time.sleep(1) qiqiao.Application(self.driver).clickButtonInForm("详情", 1) qiqiao.Application(self.driver).edit_comment(loc_time) filename1 = time.strftime("%Y-%m-%d-%H_%M_%S", time.localtime(time.time())) + ".png" file_path1 = UiPath.screenshot_path + "\\" + filename1 qiqiao.Application(self.driver).getScreenshot(file_path1) qiqiao.Application(self.driver).editCommentPageAddAnnex(file_path1) time.sleep(1) html = self.driver.page_source self.assertIn(filename1, html)
def test_limit_customer(self): '''测试限制范围用户自定义''' qiqiao.Application(self.driver).clickButtonInTitle("添加") qiqiao.Application(self.driver).clickElement(Operation().readXml("departmentradio","normal").format(name="自定义")) time.sleep(1) html = self.driver.page_source self.assertIn("系统运维部",html) self.assertNotIn("技术委员会",html)
def test_form_only_check(self): '''测试表单唯一校验''' qiqiao.Application(self.driver).clickButtonInTitle("添加") qiqiao.SingleLineText(self.driver).normal("单行文本", "测试数据") qiqiao.Application(self.driver).clickSubmit() msg = qiqiao.Application(self.driver).getText(Operation().readXml( 'msg', 'prompt')) self.assertEqual(msg, "单行文本必须唯一!!!")
def test_aaaaaa(self): '''添加待评论数据''' qiqiao.Application(self.driver).clickLeftMenu("基础表") qiqiao.Application(self.driver).clickButtonInTitle("添加") qiqiao.SingleLineText(self.driver).normal("单行文本", "自动化") qiqiao.Application(self.driver).clickSubmit() html = self.driver.page_source self.assertIn("自动化", html)
def test_comment_requried(self): '''测试表单评论必填''' qiqiao.Application(self.driver).clickButtonInForm("详情", 1) qiqiao.Application(self.driver).submitComment() time.sleep(0.5) msg = qiqiao.Application( self.driver).getText("xpath=>//p[@class='el-message__content']") self.assertEqual(msg, "评论内容为必填")
def test_show_feild(self): '''测试外键附加显示字段''' qiqiao.Application(self.driver).clickButtonInTitle("添加") qiqiao.Application(self.driver).clickElement(Operation().readXml( 'foreignkeyselection', 'normal').format(name='外键选择')) time.sleep(0.5) html = self.driver.page_source self.assertIn('青青子衿悠悠我心', html)
def test_upload_pic(self): '''测试图片上传''' qiqiao.Application(self.driver).clickButtonInTitle("添加") qiqiao.SingleLineText(self.driver).normal("单行文本", "自动化2") qiqiao.UploadPic(self.driver).normal("图片上传", "ceshi.png") time.sleep(1) qiqiao.Application(self.driver).clickSubmit() html = self.driver.page_source self.assertIn("ceshi.png", html)
def test_search_by_editdate(self): '''通过修改日期筛选页面数据''' qiqiao.Application(self.driver).clickExpand() qiqiao.Date(self.driver).search("修改时间", "2020-09-13", "2020-09-14") qiqiao.Application(self.driver).clickSearchBtn() time.sleep(1) title = qiqiao.Application(self.driver).getText(Operation().readXml( 'application', 'totaldata')) self.assertIn("0", title)
def test_search_by_score(self): '''通过评分字段筛选页面数据''' qiqiao.Application(self.driver).clickExpand() qiqiao.Score(self.driver).search("评分", 5) qiqiao.Application(self.driver).clickSearchBtn() time.sleep(1) title = qiqiao.Application(self.driver).getText(Operation().readXml( 'application', 'totaldata')) self.assertIn("1", title)
def test_search_by_number(self): '''通过数字筛选页面数据''' qiqiao.Number(self.driver).search("数字", 15) qiqiao.Application(self.driver).clickSearchBtn() time.sleep(1) title = qiqiao.Application(self.driver).getText(Operation().readXml( 'application', 'totaldata')) self.assertIn("1", title)
def test_upload_file(self): '''测试上传文件''' qiqiao.Application(self.driver).clickButtonInTitle("添加") qiqiao.SingleLineText(self.driver).normal("单行文本", "自动化1") qiqiao.UploadFile(self.driver).normal("文件上传", "动画图片.gif") time.sleep(2) qiqiao.Application(self.driver).clickSubmit() html = self.driver.page_source self.assertIn("动画图片.gif", html)
def test_search_by_multiline_text(self): '''通过多行文本筛选页面数据''' qiqiao.MultilineText(self.driver).search("多行文本", "哈哈哈") qiqiao.Application(self.driver).clickSearchBtn() time.sleep(1) title = qiqiao.Application(self.driver).getText(Operation().readXml( 'application', 'totaldata')) self.assertIn("1", title)
def test_search_by_multiple_choice(self): '''通过多项选择筛选页面数据''' qiqiao.Application(self.driver).clickExpand() qiqiao.MultipleChoices(self.driver).search("多项选择", "奥迪") time.sleep(1) title = qiqiao.Application(self.driver).getText(Operation().readXml( 'application', 'totaldata')) self.assertIn("1", title)
def test_search_by_department(self): '''通过部门选择筛选页面数据''' qiqiao.Application(self.driver).clickExpand() qiqiao.DepartmentRedio(self.driver).search("部门单选", "产", "创新技术中心->产品研发二部") qiqiao.Application(self.driver).clickSearchBtn() time.sleep(1) title = qiqiao.Application(self.driver).getText(Operation().readXml( 'application', 'totaldata')) self.assertIn("1", title)
def test_add_comment(self): '''测试添加评论''' qiqiao.Application(self.driver).clickButtonInForm("详情", 1) now = time.time() value = str(now) + "测试填写表单评论" qiqiao.RichText(self.driver).comment(value) qiqiao.Application(self.driver).submitComment() time.sleep(1) html = self.driver.page_source self.assertIn(value, html)
def test_search_by_address(self): '''通过地址选择筛选页面数据''' qiqiao.Application(self.driver).clickExpand() qiqiao.AddressSelection(self.driver).search("地址选择器", "河南省", "郑州市", "中原区") qiqiao.Application(self.driver).clickSearchBtn() time.sleep(1) title = qiqiao.Application(self.driver).getText(Operation().readXml( 'application', 'totaldata')) self.assertIn("1", title)
def test_search_by_creaperson(self): '''通过创建人筛选页面数据''' qiqiao.Application(self.driver).clickExpand() qiqiao.PersonnelSelection(self.driver).search("创建人", "刁惠云") qiqiao.Application(self.driver).clickSearchBtn() time.sleep(1) title = qiqiao.Application(self.driver).getText(Operation().readXml( 'application', 'totaldata')) self.assertIn("0", title)
def test_search_by_datetime(self): '''通过日期时间筛选页面数据''' qiqiao.Application(self.driver).clickExpand() qiqiao.DateTime(self.driver).search( "日期时间", "2020-09-15 00:00 至 2020-09-16 00:00") qiqiao.Application(self.driver).clickSearchBtn() time.sleep(1) title = qiqiao.Application(self.driver).getText(Operation().readXml( 'application', 'totaldata')) self.assertIn("1", title)
def test_search_by_single_choice(self): '''通过单项选择筛选页面数''' qiqiao.Application(self.driver).clickExpand() qiqiao.SingleChoice(self.driver).search("单项下拉", "东京") qiqiao.Application(self.driver).clickSearchBtn() time.sleep(1) title = qiqiao.Application(self.driver).getText(Operation().readXml( 'application', 'totaldata')) self.assertIn("1", title)
def test_date_limit_more(self): '''测试日期限制逻辑大于''' qiqiao.Application(self.driver).clickButtonInTitle("添加") qiqiao.Date(self.driver).required("必填_提示", '2019-09-20') qiqiao.Tab(self.driver).clickTab("大于920") qiqiao.Date(self.driver).normal("大于920", "2019-09-10") qiqiao.Application(self.driver).clickSubmit() msg = qiqiao.Application(self.driver).getText(Operation().readXml( 'msg', 'prompt')) self.assertEqual(msg, '大于920')
def test_search_by_time(self): '''通过时间筛选页面数据''' qiqiao.Application(self.driver).clickExpand() qiqiao.Time(self.driver).search("时间", "11:30", "12:00") time.sleep(10) qiqiao.Application(self.driver).clickSearchBtn() time.sleep(1) title = qiqiao.Application(self.driver).getText(Operation().readXml( 'application', 'totaldata')) self.assertIn("1", title)
def test_filter_date(self): '''测试日期筛选外键数据''' qiqiao.Application(self.driver).clickLeftMenu("外键选择") qiqiao.Application(self.driver).clickLeftMenu("全局筛选条件") qiqiao.Application(self.driver).clickButtonInTitle("添加") qiqiao.Application(self.driver).clickElement(Operation().readXml( 'foreignkeyselection', 'normal').format(name='日期')) time.sleep(0.5) html = self.driver.page_source self.assertIn('日期应该显示的数据', html) self.assertNotIn('日期不应该显示的数据', html)
def test_comment_insert_pic(self): '''测试评论富文本插入图片''' qiqiao.Application(self.driver).clickButtonInForm("详情", 1) filename = time.strftime("%Y-%m-%d_%H-%M_%S", time.localtime(time.time())) + ".png" file_path = UiPath.screenshot_path + "\\" + filename qiqiao.Application(self.driver).getScreenshot(file_path) qiqiao.Application(self.driver).commentInsertPic(file_path) time.sleep(1) html = self.driver.page_source self.assertIn(filename, html)
def test_filter_singletext(self): '''测试单行文本筛选外键数据''' qiqiao.Application(self.driver).clickLeftMenu("外键选择") qiqiao.Application(self.driver).clickLeftMenu("全局筛选条件") qiqiao.Application(self.driver).clickButtonInTitle("添加") qiqiao.Application(self.driver).clickElement(Operation().readXml( 'foreignkeyselection', 'normal').format(name='单行文本')) time.sleep(0.5) html = self.driver.page_source self.assertIn('筛选单行文本数据', html) self.assertNotIn('筛选单行文本被过滤数据', html)
def test_combination_search(self): '''测试组合筛选页面数据''' qiqiao.Application(self.driver).clickExpand() qiqiao.Date(self.driver).search("修改时间", "2020-10-26", "2020-10-27") qiqiao.PersonnelSelection(self.driver).search("创建人", "刁惠云") qiqiao.DepartmentRedio(self.driver).search("部门单选", "产", "创新技术中心->产品研发二部") qiqiao.Application(self.driver).clickSearchBtn() time.sleep(1) title = qiqiao.Application(self.driver).getText(Operation().readXml( 'application', 'totaldata')) self.assertIn("0", title)
def test_linked_singletext(self): '''测试联动筛选单行文本''' qiqiao.Application(self.driver).clickLeftMenu("外键选择") qiqiao.Application(self.driver).clickLeftMenu("单行文本联动") qiqiao.Application(self.driver).clickButtonInTitle("添加") qiqiao.SingleLineText(self.driver).normal('等于道一', '道一') qiqiao.SingleLineText(self.driver).normal('不等于道一', '哈哈哈') qiqiao.Application(self.driver).clickElement(Operation().readXml( 'foreignkeyselection', 'normal').format(name='外键选择')) time.sleep(1) html = self.driver.page_source self.assertIn('筛选单行文本数据', html) self.assertNotIn('筛选单行文本被过滤数据', html)
def test_upload_annex(self): '''测试表单评论添加附件''' qiqiao.Application(self.driver).clickButtonInForm("详情", 1) qiqiao.RichText(self.driver).comment("自动化上传图片") filename = time.strftime("%Y-%m-%d-%H_%M_%S", time.localtime(time.time())) + ".png" file_path = UiPath.screenshot_path + "\\" + filename qiqiao.Application(self.driver).getScreenshot(file_path) qiqiao.Application(self.driver).commentAddAnnex(file_path) time.sleep(1) qiqiao.Application(self.driver).submitComment() html = self.driver.page_source self.assertIn(filename, html)
def test_filter_date_type_equel_param(self): '''测试日期逻辑等于变量筛选外键数据''' qiqiao.Application(self.driver).clickLeftMenu("字段条件") time.sleep(0.3) qiqiao.Application(self.driver).clickLeftMenu("日期等于变量") qiqiao.Application(self.driver).clickButtonInForm("编辑", 2) now_time = datetime.datetime.now() qiqiao.Date(self.driver).delete('等于今天') qiqiao.Date(self.driver).normal('等于今天', now_time.strftime('%Y-%m-%d')) yesteday = (now_time + datetime.timedelta(days=-1)).strftime('%Y-%m-%d') qiqiao.Date(self.driver).delete('等于昨天') qiqiao.Date(self.driver).normal('等于昨天', yesteday) tomorrow = (now_time + datetime.timedelta(days=+1)).strftime('%Y-%m-%d') qiqiao.Date(self.driver).delete('等于明天') qiqiao.Date(self.driver).normal('等于明天', tomorrow) before_yesteday = (now_time + datetime.timedelta(days=-2)).strftime('%Y-%m-%d') qiqiao.Date(self.driver).delete('等于前天') qiqiao.Date(self.driver).normal('等于前天', before_yesteday) after_tomorrow = (now_time + datetime.timedelta(days=+2)).strftime('%Y-%m-%d') qiqiao.Date(self.driver).delete('等于后天') qiqiao.Date(self.driver).normal('等于后天', after_tomorrow) qiqiao.Application(self.driver).clickSubmit() qiqiao.Application(self.driver).clickLeftMenu("外键选择") qiqiao.Application(self.driver).clickLeftMenu("全局筛选条件") qiqiao.Application(self.driver).clickButtonInTitle("添加") qiqiao.Application(self.driver).clickElement(Operation().readXml( 'foreignkeyselection', 'normal').format(name='日期等于变量')) time.sleep(0.5) html = self.driver.page_source self.assertIn('日期等于变量应该显示数据', html) self.assertNotIn('日期等于变量不应该显示数据', html)