def test_001_FreeAuthgroup(self): u'''免认证 - 组织成员''' self.driver.quit() organization_group.import_empty_template(self) # 判断组织架构是否有其他组 有则清空 login.loginWeb(self) # admin账号登录 self.driver.implicitly_wait(10) freeauth = Organization_userAuthPage(self.driver, self.url) # 打开用户管理 - 用户认证 freeauth.click_UserManage() time.sleep(0.5) freeauth.click_userAuth() time.sleep(1) #免认证选择组织架构 freeauth.click_noConfig() time.sleep(1) freeauth.click_usergroup() time.sleep(1) # 组织架构,这里选择的是ROOT 所有 freeauth.click_Root() time.sleep(0.5) freeauth.click_save() time.sleep(1) self.driver.quit() # 新增用户组及普通IP用户 organization_group.add_user(self) #打开网页验证 断言 self.driver = webdriver.Chrome() self.driver.implicitly_wait(10) self.driver.get('http://www.baidu.com') time.sleep(2) title1 = self.driver.title # print(title1) self.assertEqual(title1, '百度一下,你就知道', msg='免认证-组织架构 出错') self.driver.quit() print('免认证 - 组织成员 验证成功') #导入空组织架构 以 清空 organization_group.import_empty_template(self) logger.info('test_001_FreeAuthgroup passed')
def test_002_remoteAuth_FreeAuth(self): u'''认证弹窗测试&&免认证测试''' if Support == '√': logger.info(u'参数支持远程认证') saveSucess = getAssertText('saveSucess') self.driver = webdriver.Chrome() # self.driver.maximize_window() self.driver.implicitly_wait(10) #打开网页测试 self.driver.get('http://www.utt.com.cn') time.sleep(2) title1 = self.driver.title now_url = self.driver.current_url print(title1, now_url) # self.assertEqual(title1, '艾泰科技', msg='认证页面跳转不正常') 如 self.assertIn('http://auth.greenwifi.com.cn', now_url, msg='认证页面跳转不正常') self.driver.quit() print('远程认证 弹窗验证成功') #打开组织架构的免认证 login.loginWeb(self) # admin账号登录 self.driver.implicitly_wait(10) remoteauth = Organization_userAuthPage(self.driver, self.url) remoteauth.click_UserManage() time.sleep(0.3) remoteauth.click_userAuth() time.sleep(1) # 免认证选择组织架构 remoteauth.click_noConfig() time.sleep(1) remoteauth.click_usergroup() time.sleep(1) # 组织架构,这里选择的是ROOT 所有 remoteauth.click_Root() time.sleep(0.5) remoteauth.click_save() time.sleep(1) # 开启免认证 remoteauth.click_FreeAuthEn() time.sleep(2) # 断言 提示信息是否有误 pageTip = str(remoteauth.getText_byClass(remoteauth.pageTip)) time.sleep(1) self.assertEqual(pageTip, saveSucess, msg='免认证开启出错') self.driver.quit() print('免认证开启') # 打开网页测试 time.sleep(5) self.driver = webdriver.Chrome() # self.driver.maximize_window() self.driver.implicitly_wait(10) self.driver.get('http://www.baidu.com') time.sleep(2) title3 = self.driver.title print(title3) self.assertEqual(title3, '百度一下,你就知道', msg='开启免认证后 不能直接打开网页') self.driver.quit() elif Support == '×': logger.info(u'参数不支持远程认证') logger.info('test_002_remoteAuth_FreeAuth passed')