def test_003_WEBUI(self):
     u'''WEB UI超时/登录错误次数/惩罚时间'''
     sessionLifep = getParameter('sessionLifep')
     passwdErrNumP = getParameter('passwdErrNumP')
     loginSpanP = getParameter('loginSpanP')
     print(getExcelValue(sessionLifep))
     sessionLifep = getExcelValue(sessionLifep)[:2]
     passwdErrNumP = str(getExcelValue(passwdErrNumP))[:2]
     loginSpanP = getExcelValue(loginSpanP)[:2]
     accessStrategy = ManagementPolicyPage(self.driver, self.url)
     accessStrategy.click_AccessPolicy()
     time.sleep(1)
     sessionLife = str(
         accessStrategy.getAttribute_byName(accessStrategy.sessionLife1,
                                            'value'))
     passwdErrNum = str(
         accessStrategy.getAttribute_byName(accessStrategy.passwdErrNum1,
                                            'value'))
     loginSpan = str(
         accessStrategy.getAttribute_byName(accessStrategy.loginSpan1,
                                            'value'))
     self.assertEqual(sessionLife, sessionLifep, msg='WEBUI超时默认值与参数不符')
     self.assertEqual(passwdErrNum, passwdErrNumP, msg='登录错误次数值与参数不符')
     self.assertEqual(loginSpan, loginSpanP, msg='惩罚时间默认值与参数不符')
     self.driver.quit()
     logger.info('test_003_WEBUI passed')
Пример #2
0
 def setUp(self):
     logger.info('setUp start')
     login.loginWeb(self)  #admin账号登录
     self.driver.implicitly_wait(10)
     accessStrategy = ManagementPolicyPage(self.driver, self.url)
     #进入系统配置-网管策略-网管访问策略
     accessStrategy.click_sysConfig()
     time.sleep(0.5)
     accessStrategy.click_ManagementPolicy()
     time.sleep(1)
     accessStrategy.click_AccessPolicy()
     time.sleep(1)
 def test_001_WEB_login(self):
     u'''WEB登录:HTTP/HTTPS'''
     accessStrategy = ManagementPolicyPage(self.driver, self.url)
     accessStrategy.click_AccessPolicy()
     time.sleep(1)
     login_mode1 = accessStrategy.getAttribute_byXpath(
         accessStrategy.httpwebEns, 'data-control-src')
     login_mode2 = accessStrategy.getAttribute_byXpath(
         accessStrategy.httpswebEns, 'data-control-src')
     self.assertEqual(login_mode1, 'HTTP', msg='模式不为"HTTP"')
     self.assertEqual(login_mode2, 'HTTPS', msg='模式不为"HTTPs"')
     self.driver.quit()
     logger.info('test_001_WEB_login passed')
Пример #4
0
    def test_001_AccessMode(self):
        u'''https模式登录'''
        host = gettelnet('host')
        RouteUrls = 'https://' + host + '/'

        # 修改网管模式,端口切换到443,https模式下可登录设备
        accessStrategy = ManagementPolicyPage(self.driver, self.url)
        accessStrategy.click_httpswebEn()
        accessStrategy.click_save()
        # 加个判断 某些型号等待时间长(6550G)
        time.sleep(1)
        x = 0
        while x < 15:
            now_url = str(self.driver.current_url)
            print(now_url, x)
            if '/noAuth/login.html' not in now_url:  # 如果不同
                time.sleep(2)
            else:
                break
            x += 1
        self.driver.quit()

        #https模式下验证登录设备
        login.test_enableLoginWeb(self, url=RouteUrls)  #https登录
        accessStrategy = ManagementPolicyPage(self.driver, self.url)
        # 改回http 方式登录
        accessStrategy.click_sysConfig()
        time.sleep(0.5)
        accessStrategy.click_ManagementPolicy()
        time.sleep(1)
        accessStrategy.click_AccessPolicy()
        time.sleep(1)
        accessStrategy.click_httpwebEn()
        accessStrategy.click_save()
        time.sleep(1)
        i = 0
        while i < 30:
            url = self.driver.current_url
            if '/login.html' in url:
                break
            else:
                time.sleep(2)
            i += 1

        self.driver.quit()
        logger.info('test_001_AccessMode passed')
Пример #5
0
    def test_003_WEBtimeout(self, timeout='1'):  #因为字母顺序问题 该项会在最后执行
        u'''修改UI超时时间'''
        #修改UI超时时间
        accessStrategy = ManagementPolicyPage(self.driver, self.url)
        accessStrategy.input_sessionLife(timeout)
        accessStrategy.click_save()
        self.driver.quit()

        login.loginWeb(self)
        #任意点击一个页面,这里点击网络配置-内网配置
        lanconfig = NetworkConfig_LANpage(self.driver, self.url)
        lanconfig.click_NetworkConfig()
        time.sleep(0.5)
        lanconfig.click_LANconfig()
        time.sleep(1)
        print('等待超时时间,在这里等待80s')
        time.sleep(120)
        #等待超时时间后,任意点击其他页面 测试超时(返回登录页面)
        accessStrategy = ManagementPolicyPage(self.driver, self.url)
        accessStrategy.click_sysConfig()
        time.sleep(0.5)
        accessStrategy.click_ManagementPolicy()
        time.sleep(2)
        url = self.driver.current_url
        if '/login.html' not in url:
            CapPic(self.driver)
            logger.info(u"未跳回登录页面")
            raise Exception('未跳回登录页面')
        self.driver.quit()

        # 将超时时间改回默认值
        login.loginWeb(self)  # admin账号登录
        self.driver.implicitly_wait(10)
        accessStrategy = ManagementPolicyPage(self.driver, self.url)
        # 进入系统配置-网管策略-网管访问策略
        accessStrategy.click_sysConfig()
        time.sleep(0.5)
        accessStrategy.click_ManagementPolicy()
        time.sleep(1)
        accessStrategy.click_AccessPolicy()
        time.sleep(1)
        accessStrategy.input_sessionLife('10')
        accessStrategy.click_save()
        self.driver.quit()
        logger.info('test_003_WEBtimeout passed')