def renameFileName1(self,newTitle,suffix):
     ab_path = GetPath().getAbsoluteFilePath(newTitle,r"downloadFiles\%s" % newTitle)
     ab_path_rename = GetPath().getAbsoluteFilePath("%s" % newTitle,r"downloadFiles")
     #获取当前时间
     name=time.strftime("%Y-%m-%d %H_%M_%S")
     if os.path.exists(ab_path):
         os.rename(ab_path,ab_path_rename+"\%s%s"%(name,suffix))
         print("文件夹不为空")
     else:
         #pass
         print("文件夹为空")
Пример #2
0
 def renameFileName(self):
     ab_path = GetPath().getAbsoluteFilePath(
         "ncy(V1.0简明版报告).zip", r"downloadFiles\ncy(V1.0简明版报告).zip")
     ab_path_rename = GetPath().getAbsoluteFilePath("ncy(V1.0简明版报告).zip",
                                                    r"downloadFiles")
     name = time.strftime("%Y-%m-%d %H_%M_%S")
     if os.path.exists(ab_path):
         os.rename(ab_path, ab_path_rename + "\%s.zip" % (name))
         print("文件夹不为空")
     else:
         #pass
         print("文件夹为空")
Пример #3
0
 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 setUp(self):
     s = setBrowser()
     download_dir = GetPath().getAbsoluteDirPath("downloadFiles")
     self.driver = s.startFirefox(download_dir)
     self.driver.maximize_window()
     self.verificationErrors = []
     self.accept_next_alert = True
Пример #6
0
 def setUp(self):
     s = setBrowser()
     download_dir = GetPath().getAbsoluteDirPath("downloadFiles")
     self.driver = s.startChrome("../browserDriver/chromedriver.exe",
                                 download_dir)
     self.driver.maximize_window()
     self.verificationErrors = []
     self.accept_next_alert = True
Пример #7
0
 def startChrome (self, driverPath,downloadPath):
     #设置chrome自动下载到指定路径
     download_dir=GetPath().getAbsoluteDirPath(downloadPath)
     options = webdriver.ChromeOptions()
     prefs = {'profile.default_content_settings.popups': 0, 'download.default_directory': downloadPath}
     options.add_experimental_option('prefs', prefs)
     driver = webdriver.Chrome (driverPath, chrome_options=options)  # 调用chrome浏览器
     return driver
Пример #8
0
 def renameFileName(self):
     name = time.strftime("%Y-%m-%d %H_%M_%S")
     dir_path = GetPath().getAbsoluteDirPath("downloadFiles")
     if os.listdir(dir_path):
         #text=self.paperName()
         os.rename(dir_path + "/李硕.doc", dir_path + r"\%s.doc" % (name))
     else:
         pass
Пример #9
0
 def uploadFile_para(self, browserName, filePath):
     #注意路径中不能存在空格并且文件夹名称不能过长
     ab_path = GetPath().getAbsoluteFilePath("testvb.exe",
                                             r"uploadApp\testvb.exe")
     #os.system("./../testData/massProduceUploadApps/testvb.exe"+ " "+browserName+" "+filePath)
     #print(ab_path+ " "+browserName+" "+filePath)
     #print('''"%s" "%s" "%s"''' % (ab_path,browserName,filePath))
     #os.system('''"%s" "%s" "%s"'''% (ab_path,browserName,filePath))
     os.system(ab_path + " " + browserName + " " + filePath)
Пример #10
0
    def renameFileName(self):
        name = time.strftime("%Y-%m-%d %H_%M_%S")
        dir_path = GetPath().getAbsoluteDirPath("downloadFiles")
        if os.listdir(dir_path):
            os.rename(dir_path + "\学生账户信息模板.xlsx",
                      dir_path + r"\%s.xlsx" % (name))

        else:
            pass
 def renameFileName(self):
     name = time.strftime("%Y-%m-%d %H_%M_%S")
     dir_path = GetPath().getAbsoluteDirPath("downloadFiles")
     if os.listdir(dir_path):
         os.rename(dir_path + "\账户管理统计表.xls",
                   dir_path + r"\%s.xls" % (name))
         # os.rename(r"E:\PyCharm_Workspace\simily_shuobo\testData\downloadFiles\子账户列表导出.xls",r"E:\PyCharm_Workspace\simily_shuobo\testData\downloadFiles\%s.xls"%(name))
         #print("文件夹不为空")
     else:
         pass
Пример #12
0
 def getFilePath(self, dirname, filename):
     '''
     文件上传测试
     :param dirname: testData目录下各个模块数据文件夹的名称
     :param filename: 需要获得绝对路径文件的名称
     :return:
     '''
     file_path = GetPath().getAbsoluteFilePath(
         "%s" % filename, r"%s\%s" % (dirname, filename))
     return file_path
Пример #13
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")
 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")
Пример #15
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")
Пример #16
0
 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)
Пример #17
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")
Пример #18
0
 def test_other_login_1(self):
     self.user_login()
     po = PayOption(self.driver)
     titleInfo = "其他用户登录"
     authorInfo = "nxy_1"
     filename = GetPath().getAbsoluteFilePath(
         "200Words.txt", "pDeteSingleUpload\\200Words.txt")
     po.detection_input(titleInfo, authorInfo, filename)
     time.sleep(5)
     po.other_user_login()
     time.sleep(1)
     divFlag = po.login_div()
     print(divFlag)
     imagetest = getResultImage()
     imagetest.insert_image(self.driver, "other_user_ok.jpg")
Пример #19
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")
Пример #20
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")
Пример #21
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")
Пример #22
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")
Пример #23
0
 def test_mywallet_pay_1(self):
     self.user_login()
     po = PayOption(self.driver)
     username = "******"
     titleInfo = "我的钱包支付"
     authorInfo = "nxy_1"
     filename = GetPath().getAbsoluteFilePath(
         "200Words.txt", "pDeteSingleUpload\\200Words.txt")
     po.user_mywallet_pay(username, titleInfo, authorInfo, filename)
     print("支付完成进入查看 报告页面")
     time.sleep(5)
     altertxt = self.close_alert_and_get_its_text()
     time.sleep(5)
     self.assertEqual("检测结束,是否查看检测结果", altertxt)
     imagetest = getResultImage()
     imagetest.insert_image(self.driver, "mywallet_pay_ok.jpg")
Пример #24
0
 def uploadFile_para(self, browserName, filePath):
     ab_path = GetPath().getAbsoluteFilePath(
         "testvb.exe", r"uploadApp\testvb_allfile.exe")
     #os.system("./../testData/massProduceUploadApps/testvb.exe"+ " "+browserName+" "+filePath)
     os.system(ab_path + " " + browserName + " " + filePath)
Пример #25
0
 def downVerify(self):
     ab_path = GetPath().getAbsoluteFilePath(
         "ncy(V1.0简明版报告).zip", r"downloadFiles\ncy(V1.0简明版报告).zip")
     flag = os.path.exists(ab_path)
     return flag
Пример #26
0
 def getFilePath(self, filename):
     file_path = GetPath().getAbsoluteFilePath(
         "%s" % filename, r"studentsAccountUploadTestData\%s" % filename)
     return file_path
Пример #27
0
 def verifyExist(self, fileName, filePath):
     ab_path = GetPath().getAbsoluteFilePath(fileName, filePath)
     flag = os.path.exists(ab_path)
     return flag
 def downVerify1(self,newTitle):
     ab_path = GetPath().getAbsoluteFilePath(newTitle,r"downloadFiles\%s" % newTitle)
     flag = os.path.exists(ab_path)
     return flag
 def verifyExist(self):
     #判断是否下载到本地,返回bool类型的True或False
     #判断文件是否存在
     dir_path = GetPath().getAbsoluteDirPath("downloadFiles")
     flag = os.path.exists(dir_path + "\账户管理统计表.xls")
     return flag