def readAndInputContent(self, filename): f = FilesOption() g = GetPath() manu = ManualEntry(self.driver) filePath = g.getAbsoluteFilePath(filename, r"detectPaper\%s" % filename) print(filePath) Flist = f.readFileContent(filePath) #self.ManualNoText("文本信息正确开始检测","作者") for i in range(0, len(Flist)): con = Flist[i].decode('gbk') con = con.replace("\t", "") manu.inputPaperContent(con) sleep(2)
def test_manual_Info_ok_9(self): '''信息输入正确,检测成功''' f = FilesOption() g = GetPath() manu = ManualEntry(self.driver) filePath =g.getAbsoluteFilePath("success_text.txt",r"paperDetectionManu\\success_text.txt") Flist = f.readFileContent(filePath) self.ManualNoText("文本信息正确开始检测","作者") for i in range(0,len(Flist)): con = Flist[i].decode('utf8').replace('\t', ' ').rstrip() manu.input_text_info_noclear(con) time.sleep(5) manu.paper_check_button() time.sleep(1) imagetest = getResultImage() imagetest.insert_image(self.driver,"manual_info_ok.jpg")
def test_manual_text_long_8(self): '''文本信息超过100万长度,无法检测''' f = FilesOption() g = GetPath() manu = ManualEntry(self.driver) filePath =g.getAbsoluteFilePath("big_text.txt",r"paperDetectionManu\\big_text.txt") Flist = f.readFileContent(filePath) self.ManualNoText("文本信息超过100万","作者") for i in range(0,len(Flist)): con = Flist[i].decode('utf8').replace('\t', ' ').rstrip() print(i,"文件写入次数") manu.input_text_info_noclear(con) time.sleep(10) manu.paper_check_button() time.sleep(1) altertext= self.close_alert_and_get_its_text() time.sleep(1) self.assertEqual(altertext,"字数不得少于200,不得大于100000") imagetest = getResultImage() imagetest.insert_image(self.driver,"manual_text_long.jpg")
def readAndInputBigData(self, filename, fieldname): f = FilesOption() g = GetPath() manu = ManualEntry(self.driver) filePath = g.getAbsoluteFilePath(filename, r"detectPaper\%s" % filename) print(filePath) Flist = f.readFileContent(filePath) #self.ManualNoText("文本信息正确开始检测","作者") for i in range(0, len(Flist)): con = Flist[i].decode('gbk') con = con.replace("\t", "") if fieldname == "paperName": manu.inputPaperName(con) elif fieldname == "authorName": manu.inputAuthorName(con) elif fieldname == "authorCompany": manu.inputAuthorCompany(con) elif fieldname == "majority": manu.inputMajority(con) elif fieldname == "tutor": manu.inputTutor(con) sleep(2)