Esempio n. 1
0
 def test_008_license(self):
     u'''电子授权(某些型号可能不支持)'''
     dayA = getAssertText('dayA')
     day2A = getAssertText('day2A')
     SelectFileA = getAssertText('SelectFileA')
     ImportA = getAssertText('ImportA')
     licenseP = getParameter('licenseP')
     Support = getExcelValue(licenseP)
     maintenance = MaintenancePage(self.driver, self.url)
     time.sleep(1)
     if Support == '√':
         try:
             self.driver.implicitly_wait(2)
             maintenance.click_license()
             time.sleep(1)
         except NoSuchElementException:
             CapPic(self.driver)
             logger.info(u'软件不支持电子授权,与参数表不相符')
             raise Exception('软件不支持电子授权,与参数表不相符')
         else:
             try:
                 days1 = maintenance.getText_byXpath(maintenance.days1)
                 self.assertIn(day2A, days1, msg='剩余时间 显示不为永久 ')
             except AssertionError:
                 try:
                     days = maintenance.getText_byXpath(maintenance.days2)
                     self.assertIn(dayA, days, msg='剩余时间 显示不为 天数')
                 except AssertionError:
                     raise Exception('剩余时间不显示')
             chooseFile = str(
                 maintenance.getText_byID(maintenance.chooseFile1))
             innerput = str(maintenance.getText_byID(maintenance.innerput1))
             self.assertEqual(chooseFile, SelectFileA, msg='选择文件 按钮有误')
             self.assertEqual(innerput, ImportA, msg='导入 按钮有误')
     elif Support == '×' or '--':
         try:
             self.driver.implicitly_wait(2)
             maintenance.click_license()
         except NoSuchElementException:
             logger.info('软件不支持电子授权,与参数表相符')
         else:
             CapPic(self.driver)
             logger.info(u'软件支持电子授权,与参数表不符')
             raise Exception(u'软件支持电子授权,与参数表不符')
     else:
         logger.info(u'参数表读取异常')
         logger.info(u'参数表读取值为:', Support)
         raise Exception(u'参数表读取异常')
     self.driver.quit()
     logger.info('test_008_license passed')
Esempio n. 2
0
 def test_003_AppLibrary(self):
     u'''应用特征库升级'''
     AppUpgradeP = getParameter('AppUpgradeP')
     Support = getExcelValue(AppUpgradeP)
     policyVerA = getAssertText('policyVerA')
     priorityTempA = getAssertText('priorityTempA')
     versionsA = getAssertText('versionsA')
     policylib = MaintenancePage(self.driver, self.url)
     if Support == '√':
         logger.info(u'参数支持应用特征库升级')
         try:
             self.driver.implicitly_wait(2)
             policylib.click_policylib()
         except NoSuchElementException:
             CapPic(self.driver)
             logger.info(u'不支持应用特征库升级,与参数表不相符')
             raise Exception('不支持应用特征库升级,与参数表不相符')
         else:
             time.sleep(1)
             self.driver.implicitly_wait(10)
             policyVer1 = str(
                 policylib.getText_byXpath(policylib.policyVer1))
             priorityTemp1 = str(
                 policylib.getText_byXpath(policylib.priorityTemp1))
             versions1 = str(policylib.getText_byXpath(policylib.versions1))
             self.assertEqual(policyVer1, policyVerA, msg='应用策略库版本 按钮有误')
             self.assertEqual(priorityTemp1,
                              priorityTempA,
                              msg='应用优先模板版本 按钮有误')
             self.assertEqual(versions1, versionsA, msg='版本状态 按钮有误')
     elif Support == '×':
         logger.info(u'参数不支持应用特征库升级')
         try:
             self.driver.implicitly_wait(2)
             policylib.click_policylib()
         except AttributeError:
             logger.info('不支持应用特征库升级,与参数表相符')
         else:
             CapPic(self.driver)
             logger.info(u'支持应用特征库升级,与参数表不相符')
             raise Exception('支持应用特征库升级,与参数表不相符')
     else:
         logger.info(u'参数表读取异常')
         logger.info(u'参数表读取值为:', Support)
         raise Exception(u'参数表读取异常')
     self.driver.quit()
     logger.info('test_003_AppLibrary passed')
Esempio n. 3
0
    def test_oldSoftware1(self, oldversion1=getweb('oldversion1')):
        u'''软件升级 - 更新旧版本测试'''
        # oldversion1 = getweb('oldversion1')
        self.oldversion1 = oldversion1
        UploadingTips = getAssertText('UploadingTips')
        WillReboottips = getAssertText('WillReboottips')

        num = 0
        Expect_Version = ''
        oldversioa1 = oldversion1.split(r'-')
        if len(oldversioa1) == 2:  # eg:'nv640Ev1.5.0-130918'
            Expect_Version = oldversioa1[0] + '-' + oldversioa1[1]
        else:  #eg:'nvA655Wv3.0.0-200116-142208' ; 'TL-BWR-21v3.2.1-200304-171146'
            while num < len(oldversioa1) - 1:
                Expect_Version += oldversioa1[num] + '-'
                num += 1
            else:
                Expect_Version = Expect_Version[:-1]
        # print(Expect_Version)

        # if '.bin' in oldversioa1[1]:
        #     oldversioa2 = oldversioa1[0] + '-' + oldversioa1[1]
        #     Expect_Version = oldversioa2[:-4]
        # else:
        #     Expect_Version = oldversioa1[0] + '-' + oldversioa1[1]

        # 版本上传
        oldSoftware = (str(tmppath) + str(oldversion1) + '.bin')

        self.driver.implicitly_wait(10)
        software = MaintenancePage(self.driver, self.url)
        # 选择文件上传
        self.driver.find_element_by_name('updatesoftware').send_keys(
            oldSoftware)
        # software.input_updatesoftware(oldSoftware)
        time.sleep(1)
        software.click_update()
        time.sleep(1)
        software.click_ok()
        time.sleep(3)
        # 小设备 上传时间较长,判断sleep时间
        tips = str(software.getText_byClass(software.u_tim_str))
        if UploadingTips in tips:
            time.sleep(50)
        elif tips == WillReboottips:
            time.sleep(3)
        # 设备重启时间不一致,做个判断
        time.sleep(30)
        i = 0
        while i < 20:
            now_url = str(self.driver.current_url)
            print(now_url, i)
            if '/noAuth/login.html' not in now_url:  # 如果不同
                time.sleep(5)
            else:
                break
            i += 1
        self.driver.quit()

        #判断是否升级成功
        login.loginWeb(self)  # admin账号登录
        self.driver.implicitly_wait(10)
        software = MaintenancePage(self.driver, self.url)
        # 进入系统配置-系统维护-系统升级
        software.click_sysConfig()
        time.sleep(0.5)
        software.click_Maintenance()
        time.sleep(1)
        now_Version = str(software.getText_byXpath(software.version))
        if Expect_Version != now_Version:
            CapPic(self.driver)
            logger.info(u"升级旧版本 升级后版本号与升级版本号不一致")
            raise Exception('升级旧版本 升级后版本号与升级版本号不一致')
        else:
            print('更新 旧型号版本 验证通过')
        self.driver.quit()