def test_uploadnum_case(self): '''文件上传控件上传数量''' comp = FileUploadPhonePage(self.driver) name = '文件上传控件上传数量' compname = '文件上传_限数量1个' file_path = comp.get_file_path("大于100kb.doc") file_path2 = comp.get_file_path("小于100KB.txt") comp.file_upload(compname, file_path2) comp.click_fileupload_btn(compname) # 點擊上傳按鈕 text = comp.adjustalertexistence() self.assertEqual("文件上传超出数量限制。", text, msg=name + '检验不通过')
def test_uploadtype_case(self): '''文件上传控件上传类型''' comp = FileUploadPhonePage(self.driver) name = '文件上传控件上传类型' compname = '文件上传_格式' file_path = comp.get_file_path("大于100kb.doc") file_path2 = comp.get_file_path("小于100KB.txt") result = comp.file_upload(compname, file_path2) self.assertIn("文件类型(仅支持'doc,xls'格式)或大小错误", result, msg=name + '检验不通过') #time.sleep(0.5) result2 = comp.file_upload(compname, file_path) self.assertIn("上传完成", result2, msg=name + '检验不通过')
def test_uploadsize_case(self): '''文件上传控件上传大小限制''' comp = FileUploadPhonePage(self.driver) name = '文件上传_限大小' compname = '文件上传_限大小' file_path = comp.get_file_path("大于100kb.doc") file_path2 = comp.get_file_path("小于100KB.txt") result = comp.file_upload(compname, file_path) self.assertIn("上传文件大小超出限制", result, msg=name + '检验不通过') #time.sleep(0.5) result2 = comp.file_upload(compname, file_path2) self.assertIn("上传完成", result2, msg=name + '检验不通过')
def test_recalculation_case(self): '''文件上传控件刷新重计算''' comp = FileUploadPhonePage(self.driver) name = '文件上传控件重计算' compname = '文件上传_重计算' compname2 = '文件上传_刷新' target = comp.getcomp(compname2) comp.scroll_to_target_element(target) file_path = comp.get_file_path("大于100kb.doc") bool1 = comp.check_existence(compname) self.assertTrue(bool1, msg=name + '检验不通过') comp.file_upload(compname2, file_path) #time.sleep(0.5) bool2 = comp.check_existence(compname) self.assertFalse(bool2, msg=name + '检验不通过')