Esempio n. 1
0
 def test_title_null_run_2(self):
     '''标题信息为空,无法上传论文'''
     sut = SingleUpload(self.driver)
     self.singleUploadOption("", "测试")
     self.assertEqual(sut.title_null_mind(), "请输入题名")
     imagetest = getResultImage()
     imagetest.insert_image(self.driver, "single_title_null.jpg")
Esempio n. 2
0
 def test_author_null_run_3(self):
     '''作者信息为空,无法上传论文'''
     sut = SingleUpload(self.driver)
     self.singleUploadOption("测试信息", "")
     self.assertEqual(sut.author_null_mind(), "请输入作者")
     imagetest = getResultImage()
     imagetest.insert_image(self.driver, "single_author_null.jpg")
Esempio n. 3
0
 def test_file_txt_ok_run_16(self):
     '''txt文档上传成功'''
     sut = SingleUpload(self.driver)
     self.singleUploadOption("txt上传成功", "测试")
     filePath = GetPath().getAbsoluteFilePath(
         "200Words.txt", "pDeteSingleUpload\\200Words.txt")
     time.sleep(1)
     sut.file_upload(filePath)
     time.sleep(4)
     imagetest = getResultImage()
     imagetest.insert_image(self.driver, "single_text_ok.jpg")
Esempio n. 4
0
 def detection_input(self, titleInfo, authorInfo, filename):
     su = SingleUpload(self.driver)
     su.select_single_upload()
     self.driver.get(self.base_url + "/Check")
     su.input_title_info(titleInfo)
     sleep(3)
     su.input_author_info(authorInfo)
     print("信息已输入完毕")
     su.file_upload_button()
     upload = UpLoad()
     upload.uploadFile_para("chrome", filename)
Esempio n. 5
0
 def test_file_empty_run_6(self):
     '''空文件,无法上传论文'''
     sut = SingleUpload(self.driver)
     self.singleUploadOption("空文件", "测试")
     filePath = GetPath().getAbsoluteFilePath("0kb.txt",
                                              "pDeteSingleUpload\\0kb.txt")
     time.sleep(1)
     sut.file_upload(filePath)
     time.sleep(2)
     altertxt = self.close_alert_and_get_its_text()
     time.sleep(2)
     self.assertEqual("上传失败,文件为空!", altertxt)
     imagetest = getResultImage()
     imagetest.insert_image(self.driver, "single_text_empty.jpg")
Esempio n. 6
0
 def test_file_type_wrong_run_7(self):
     '''文件格式不支持,无法上传论文'''
     sut = SingleUpload(self.driver)
     self.singleUploadOption("文件格式不是规定范围内", "测试")
     filePath = GetPath().getAbsoluteFilePath("1.jpg",
                                              "pDeteSingleUpload\\1.jpg")
     time.sleep(1)
     sut.file_upload(filePath)
     # sut.buffer_prompt()
     time.sleep(2)
     altertxt = self.close_alert_and_get_its_text()
     time.sleep(2)
     self.assertEqual("上传失败,文件为空!", altertxt)
     imagetest = getResultImage()
     imagetest.insert_image(self.driver, "single_filetype_wrong.jpg")
Esempio n. 7
0
 def test_author_long_run_5(self):
     '''作者信息超过规定的50,无法上传论文'''
     sut = SingleUpload(self.driver)
     authorInfo = "123456789测试信息测试信息测试信息测试信息测试信测试信息测试信息测试信息测试信息测试信息测试信息息"
     self.singleUploadOption("测试信息", authorInfo)
     time.sleep(2)
     altertxt = self.close_alert_and_get_its_text()
     time.sleep(2)
     self.assertEqual(altertxt, "作者长度不得大于50")
     imagetest = getResultImage()
     imagetest.insert_image(self.driver, "single_author_null.jpg")
Esempio n. 8
0
 def test_title_long_run_4(self):
     '''标题信息超过规定的50,无法上传论文'''
     sut = SingleUpload(self.driver)
     titleInfo = "123456789测试信息测试信息测试信息测试信息测试信测试信息测试信息测试信息测试信息测试信息测试信息息"
     self.singleUploadOption(titleInfo, "测试")
     time.sleep(3)
     altertxt = self.close_alert_and_get_its_text()
     time.sleep(2)
     self.assertEqual("题名长度不得大于50", altertxt)
     imagetest = getResultImage()
     imagetest.insert_image(self.driver, "single_title_long.jpg")
Esempio n. 9
0
 def test_file_rtf_ok_run_15(self):
     '''上传合格的rtf文件,上传成功'''
     sut = SingleUpload(self.driver)
     self.singleUploadOption("rtf文件", "测试")
     filePath = GetPath().getAbsoluteFilePath(
         "general_RTF_OK.rtf", "pDeteSingleUpload\\general_RTF_OK.rtf")
     time.sleep(1)
     sut.file_upload(filePath)
     sut.buffer_prompt()
     time.sleep(10)
     imagetest = getResultImage()
     imagetest.insert_image(self.driver, "single_rtf_ok.jpg")
Esempio n. 10
0
 def test_file_content_wrong_run_11(self):
     '''不是纯文字信息,抽取失败'''
     sut = SingleUpload(self.driver)
     self.singleUploadOption("带图片及表格文件", "测试")
     filePath = GetPath().getAbsoluteFilePath(
         "content_wrong.doc", "pDeteSingleUpload\\content_wrong.doc")
     time.sleep(1)
     sut.file_upload(filePath)
     sut.buffer_prompt()
     time.sleep(10)
     altertxt = self.close_alert_and_get_its_text()
     time.sleep(2)
     self.assertEqual("文本抽取失败,请重新上传", altertxt)
     imagetest = getResultImage()
     imagetest.insert_image(self.driver, "single_content_fail.jpg")
Esempio n. 11
0
 def test_filesize_big_run_10(self):
     '''文件超过规定的30M,无法上传论文'''
     sut = SingleUpload(self.driver)
     self.singleUploadOption("文件超过30M", "测试")
     filePath = GetPath().getAbsoluteFilePath(
         "BIG30M.pdf", "pDeteSingleUpload\\BIG30M.pdf")
     time.sleep(1)
     sut.file_upload(filePath)
     sut.buffer_prompt()
     time.sleep(5)
     altertxt = self.close_alert_and_get_its_text()
     time.sleep(2)
     self.assertEqual("上传失败,文件过大!", altertxt)
     imagetest = getResultImage()
     imagetest.insert_image(self.driver, "single_size_big.jpg")
Esempio n. 12
0
 def test_file_big_run_9(self):
     '''文档字数受限,文档字数为200至1000000,无法上传论文'''
     sut = SingleUpload(self.driver)
     self.singleUploadOption("文本信息字数过多", "测试")
     filePath = GetPath().getAbsoluteFilePath(
         "big_text.txt", "pDeteSingleUpload\\big_text.txt")
     time.sleep(1)
     sut.file_upload(filePath)
     sut.buffer_prompt()
     time.sleep(10)
     altertxt = self.close_alert_and_get_its_text()
     time.sleep(2)
     self.assertEqual("文档字数受限,文档字数为200至1000000", altertxt)
     imagetest = getResultImage()
     imagetest.insert_image(self.driver, "single_text_big.jpg")
Esempio n. 13
0
 def singleUploadOption(self, titleInfo, authorInfo):
     self.user_login()
     sut = SingleUpload(self.driver)
     sut.singleUpload(titleInfo, authorInfo)