def test_detectpaper_wordnum_among10to15W_run23(self):
     '''检测大于10W字少于15W字的论文,验证扣除篇数是否为3'''
     self.login()
     bd = BatchDetection(self.driver)
     remainnum_befdetect = int(bd.getRemainArticleNum())
     bd.clickMyTes()
     bd.batchDetectProcess()
     bd.clickAddPaperBtn()
     bd.uploadFile("detect_file_among10-15w.docx")
     bd.clickBeginUploadBtn()
     try:
         is_upload_over = bd.isBeginDetectBtnExist()
         self.assertTrue(is_upload_over, '-----上传失败-----')
         bd.clickBeginDetectBtn()
         is_detect_over = bd.isCheckResultBtnExist()
         self.assertTrue(is_detect_over, "------检测未完成--------")
         succeed = bd.getDetectSimilarity()
         self.assertIn('%', succeed, "-------检测未成功--------")
         remainnum_aftdetect = int(bd.getRemainArticleNum())
         self.assertEqual(remainnum_befdetect - remainnum_aftdetect,
                          int('3'), '-----扣除篇数错误,10w-15w字应扣除3篇-----')
     finally:
         imagetest = getResultImage()
         imagetest.insert_image(self.driver,
                                "detectpaper_wordnum_among10to15W.jpg")
         sleep(3)
 def test_uploadfile_size0kb_run24(self):
     '''上传文件大小为0kb的文件'''
     self.login()
     bd = BatchDetection(self.driver)
     bd.clickMyTes()
     bd.batchDetectProcess()
     bd.clickAddPaperBtn()
     bd.uploadFile("uploadfile_blank.docx")
     try:
         is_alert = bd.is_alert_exist()
         self.assertTrue(is_alert, '-----上传0kb的文件时,未做相应提示-----')
     finally:
         imagetest = getResultImage()
         imagetest.insert_image(self.driver, "uploadfile_size0kb.jpg")
         sleep(3)
 def test_uploadfile_wrongtype_xls_run17(self):
     '''上传不符合上传文件类型的文件'''
     self.login()
     bd = BatchDetection(self.driver)
     bd.clickMyTes()
     bd.batchDetectProcess()
     bd.clickAddPaperBtn()
     bd.uploadFile("excel_file_fail")
     try:
         is_alert = bd.is_alert_exist()
         self.assertTrue(is_alert, '-----上传不符合要求的文件类型时,未做提示-----')
     finally:
         imagetest = getResultImage()
         imagetest.insert_image(self.driver, "uploadfile_wrongtype_xls.jpg")
         sleep(3)
 def test_uploadfile_oversize_run18(self):
     '''上传超过30M的文件'''
     self.login()
     bd = BatchDetection(self.driver)
     bd.clickMyTes()
     bd.batchDetectProcess()
     bd.clickAddPaperBtn()
     bd.uploadFile("uploadfile_over30m")
     try:
         is_alert = bd.is_alert_exist()
         self.assertTrue(is_alert, '-----上传不符合要求的文件类型时,未做提示-----')
         sleep(5)
         alert_info = bd.getAlertInfo()
         self.assertIn("文件过大,上传失败!", alert_info, "-----文件超过30M,未做提示-----")
     finally:
         imagetest = getResultImage()
         imagetest.insert_image(self.driver, "uploadfile_oversize.jpg")
         sleep(3)
 def test_uploadfile_name2_run20(self):
     '''上传名称为a+b格式的文件,点击开始检测按钮,验证是否提取成功'''
     self.login()
     bd = BatchDetection(self.driver)
     bd.clickMyTes()
     bd.batchDetectProcess()
     bd.clickAddPaperBtn()
     title = "相似性检测本科生论文+李硕"
     bd.uploadFile(title)
     try:
         extract_papername = bd.getExtractPaperName()
         papername = title.split("+")[0]
         self.assertEqual(extract_papername, papername,
                          "-----论文名称提取失败-----")
         extract_authorname = bd.getExtractAuthorName()
         authorname = title.split("+")[1]
         self.assertEqual(extract_authorname, authorname,
                          "-----作者名称提取失败-----")
     finally:
         imagetest = getResultImage()
         imagetest.insert_image(self.driver, "uploadfile_name2.jpg")
         sleep(3)
 def test_uploadfile_rtf_detectsucceed_run16(self):
     '''上传rtf文件,点击开始检测按钮'''
     self.login()
     bd = BatchDetection(self.driver)
     bd.clickMyTes()
     bd.batchDetectProcess()
     bd.clickAddPaperBtn()
     bd.uploadFile("detect_file_rtf")
     bd.clickBeginUploadBtn()
     try:
         is_upload_over = bd.isBeginDetectBtnExist()
         self.assertTrue(is_upload_over, '-----上传失败-----')
         bd.clickBeginDetectBtn()
         is_detect_over = bd.isCheckResultBtnExist()
         self.assertTrue(is_detect_over, "------检测未完成--------")
         succeed = bd.getDetectSimilarity()
         self.assertIn('%', succeed, "-------检测未成功--------")
     finally:
         imagetest = getResultImage()
         imagetest.insert_image(self.driver,
                                "uploadfile_rtf_detectsucceed.jpg")
         sleep(3)
 def test_toReCreat_run26(self):
     '''检测成功后跳转至创建任务页面'''
     self.login()
     bd = BatchDetection(self.driver)
     bd.clickMyTes()
     bd.batchDetectProcess()
     bd.clickAddPaperBtn()
     bd.uploadFile("detect_file_docx.docx")
     bd.clickBeginUploadBtn()
     try:
         is_upload_over = bd.isBeginDetectBtnExist()
         self.assertTrue(is_upload_over, '-----上传失败-----')
         bd.clickBeginDetectBtn()
         is_detect_over = bd.isCheckResultBtnExist()
         self.assertTrue(is_detect_over, "------检测未完成--------")
         succeed = bd.getDetectSimilarity()
         self.assertIn('%', succeed, "-------检测未成功--------")
         bd.clickReCreatBtn()
         confirm_exist = bd.isConfirmTaskBtnExist()
         self.assertTrue(confirm_exist, "-----未跳转至新建任务或选择已有任务页面-----")
     finally:
         imagetest = getResultImage()
         imagetest.insert_image(self.driver, "toCheckResult.jpg")
         sleep(3)
 def test_toCheckResult_run25(self):
     '''检测成功后跳转至查看检测结果页面'''
     self.login()
     bd = BatchDetection(self.driver)
     bd.clickMyTes()
     task_name = bd.batchDetectProcess()
     bd.clickAddPaperBtn()
     bd.uploadFile("detect_file_docx.docx")
     bd.clickBeginUploadBtn()
     try:
         is_upload_over = bd.isBeginDetectBtnExist()
         self.assertTrue(is_upload_over, '-----上传失败-----')
         bd.clickBeginDetectBtn()
         is_detect_over = bd.isCheckResultBtnExist()
         self.assertTrue(is_detect_over, "------检测未完成--------")
         succeed = bd.getDetectSimilarity()
         self.assertIn('%', succeed, "-------检测未成功--------")
         bd.clickCheckResultBtn()
         vertify_name = bd.getTaskName()
         self.assertEqual(vertify_name, task_name, "-----未跳转至检测结果页-----")
     finally:
         imagetest = getResultImage()
         imagetest.insert_image(self.driver, "toCheckResult.jpg")
         sleep(3)