def test_discript_case(self): '''图片上传控件描述校验''' comp = FileUploadPage(self.driver) name = '图片上传控件描述校验' compname = '图片上传_描述' comp.scroll_to_pic_upload_btn(compname) text = comp.getcompatrr(compname, 'discript') self.assertEqual('图片上传_描述测试', text, msg=name + '检验不通过')
def test_discript_case(self): '''文件上传控件描述校验''' name = '文件上传_描述' compname = '文件上传_描述' comp = FileUploadPage(self.driver) self.scroll_to('1200') text = comp.getcompatrr(compname, 'discript') self.assertEqual('文件上传_描述', text, msg=name + '检验不通过')
def test_readonly_case(self): '''图片上传_只读''' comp = FileUploadPage(self.driver) name = '图片上传_只读' compname = '图片上传_只读' comp.scroll_to_pic_upload_btn(compname) bool = comp.find_elem('span[name="' + compname + '"]').is_displayed() self.assertFalse(bool, msg=name + '检验不通过') text = comp.getcompatrr(compname, 'disabled') self.assertEqual('true', text, msg=name + '检验不通过')
def test_readonly_case(self): '''文件上传控件只读''' self.scroll_to('1200') comp = FileUploadPage(self.driver) name = '文件上传_条件只读' compname = '文件上传_条件只读' bool = comp.find_elem('span[name="' + compname + '"]').is_displayed() self.assertFalse(bool, msg=name + '检验不通过') text = comp.getcompatrr(compname, 'disabled') self.assertEqual('true', text, msg=name + '检验不通过')
def test_uploadnum_case(self): '''文件上传控件上传数量''' comp = FileUploadPage(self.driver) name = '文件上传控件上传数量' compname = '文件上传_限数量1个' file_path = comp.get_file_path("大于100kb.doc") file_path2 = comp.get_file_path("小于100KB.txt") attr = comp.getcompatrr(compname, 'limitnumber') self.assertEqual('1', attr, msg=name + '检验不通过') comp.wait_loading_hide() comp.file_upload(compname, file_path2) comp.click_fileupload_btn(compname) #點擊上傳按鈕 text = comp.adjustalertexistence() self.assertEqual("文件上传超出数量限制。", text, msg=name + '检验不通过')
def test_uploadnum_case(self): '''图片上传控件上传数量''' comp = FileUploadPage(self.driver) name = '图片上传控件上传数量' compname = '图片上传控件_最大上传数量' comp.scroll_to_pic_upload_btn(compname) comp.hide_activity_box() #隐藏操作按钮栏 file_path = comp.get_file_path("大于50KB.jpg") file_path2 = comp.get_file_path("小于50KB.jpg") attr = comp.getcompatrr(compname, 'limitnumber') self.assertEqual('1', attr, msg=name + '检验不通过') comp.picture_upload(compname, file_path2) #上传图片 comp.click_pictureupload_btn(compname) text = comp.adjustalertexistence() self.assertEqual("文件上传超出数量限制。", text, msg=name + '检验不通过')
def test_uploadtype_case(self): '''文件上传控件上传类型''' comp = FileUploadPage(self.driver) name = '文件上传控件上传类型' compname = '文件上传_格式' file_path = comp.get_file_path("大于100kb.doc") file_path2 = comp.get_file_path("小于100KB.txt") attr = comp.getcompatrr(compname, 'customizetype') self.assertEqual('doc;xls', attr, msg=name + '检验不通过') comp.wait_loading_hide() result = comp.file_upload(compname, file_path2) self.assertIn("文件类型(仅支持'doc,xls'格式)或大小错误", result, msg=name + '检验不通过') #time.sleep(0.5) comp.wait_loading_hide() result2 = comp.file_upload(compname, file_path) self.assertIn("上传完成", result2, msg=name + '检验不通过')