コード例 #1
0
 def test_login_1(self):
     '''case01 admin  admin 测试能否登录'''
     login.login(self.driver, 'admin', 'idontKNOW666')
     self.assertTrue(
         EC.text_to_be_present_in_element(
             (By.XPATH, '//span[@class="user-name"]'), 'admin'),
         'test_login用例执行失败')
コード例 #2
0
 def setUp(self) -> None:
     login(self.driver,'http://106.53.50.202:8999/zentao4/www/user-login-L3plbnRhbzYvd3d3Lw==.html',
           'admin','admin@123')
     #跳转到用户页面
     organization_page = OrganizationPage(self.driver)
     organization_page.click_organization_link()  # 点击一级菜单组织链接
     organization_page.click_user_link()  # 点击二级菜单用户链接
コード例 #3
0
 def test_depts_name(self):
     """存在部门名称为部门1的部门"""
     login.login(config_value.config.user_name, config_value.config.password, self.driver)
     self.assertTrue(EC.text_to_be_present_in_element(By.XPATH, '//span[@class="user-name"]'), '测试人员1') # 方法二
     self.driver.find_element(By.XPATH, '//li[@data-id="company"]').click()
     self.assertTrue(WebDriverWait(self.driver, 10).until(EC.text_to_be_present_in_element
                                                         ((By.XPATH, '//a[@id="dept1"]'), '部门1')))
コード例 #4
0
ファイル: test_home.py プロジェクト: lamcox/appium
 def setUpClass(cls):
     desired_caps = common.get_desiredCaps()
     url = common.url()
     global driver
     driver = webdriver.Remote(url, desired_caps)
     print("running test:首页")
     login.login(driver)
     time.sleep(2)
コード例 #5
0
 def test_001_Stockpledge(self):
     '''页面跳转到大黄押'''
     self.driver.get("http://ibdata.cn/#!/stockpledge")
     login.login(self)
     self.driver.find_element_by_link_text("大黄押").click()
     handles = self.driver.window_handles
     self.driver.switch_to.window(self.driver.window_handles[len(handles) - 1])
     logTest.log("页面跳转到大黄押")
コード例 #6
0
 def test_login(self):
     """使用test01登录禅道"""
     login.login(config_value.config.user_name,
                 config_value.config.password, self.driver)
     self.assertTrue(
         EC.text_to_be_present_in_element(By.XPATH,
                                          '//span[@class="user-name"]'),
         '测试人员1')  # 方法二
コード例 #7
0
 def test_link1_succes(self):
     self.assertGreater(4, 1)
     self.driver.get(config.get_url)
     time.sleep(2)
     login.login(self.driver, config.get_user_name, config.get_password)
     self.assertTrue(
         EC.text_to_be_present_in_element(
             (By.XPATH, '//div[@class="panel-title"]'), '最新动态'))
コード例 #8
0
 def test_login(self):
     '''case03 admin  admin 测试能否登录'''
     login.login(self.driver, 'admin', 'idontKNOW666')
     self.assertTrue(
         EC.text_to_be_present_in_element(
             (By.XPATH, '//span[@class="user-name"]'), 'admin'),
         'test_login用例执行失败')
     self.assertTrue(
         WebDriverWait(self.driver, 10).until(EC.alert_is_present()))
コード例 #9
0
 def setUp(self) -> None:
     login(
         self.driver,
         'http://106.53.50.202:8999/zentao4/www/user-login-L3plbnRhbzYvd3d3Lw==.html',
         'admin', 'admin@123')
     # 进入到权限页面
     organization_page = OrganizationPage(self.driver)
     organization_page.click_organization_link()
     organization_page.click_authority_link()
コード例 #10
0
 def test_001_securities(self):
     '''切换到我的证券页面'''
     self.driver.get("http://ibdata.cn/#!/login")
     login.login(self)
     self.driver.find_element_by_link_text("我的证券").click()
     handles = self.driver.window_handles
     global old_handle
     old_handle = self.driver.current_window_handle
     self.driver.switch_to.window(self.driver.window_handles[len(handles) -
                                                             1])
コード例 #11
0
 def test_001_Chart(self):
     '''打开图谱页面'''
     # self.driver.implicitly_wait(60)
     self.driver.get("http://www.ibdata.cn/#!/chart")
     login.login(self)
     # self.driver.find_element_by_link_text("图谱").click()
     # time.sleep(15)
     self.assertEqual(self.driver.current_url,
                      "http://www.ibdata.cn/#!/chart")
     logTest.log("当前是图谱页面")
コード例 #12
0
 def test_login(self):
     """退出禅道成功"""
     login.login(config_value.config.user_name,
                 config_value.config.password, self.driver)
     self.driver.find_element(By.XPATH,
                              '//a[@class="dropdown-toggle"]').click()
     time.sleep(2)
     self.driver.find_element(
         By.XPATH,
         '//a[contains(@href,"/zentao/www/index.php?m=user&f=logout")]'
     ).click()
     self.assertTrue(EC.title_is(" 用户登录 - 禅道"))
コード例 #13
0
    def test_001_Subscript(self):
        self.driver.get("http://ibdata.cn/#!/login")
        login.login(self)

        # self.driver.get("http://ibdata.cn/#!/my/mysubscribe")
        self.driver.find_element_by_link_text("我的订阅").click()
        time.sleep(5)
        # old_handle = self.driver.current_window_handle
        handles = self.driver.window_handles
        self.driver.switch_to.window(self.driver.window_handles[len(handles) -
                                                                1])
        logTest.log("跳转到我的订阅的页面")
コード例 #14
0
 def test_change_project(self):
     ''' 切换项目'''
     login.login(self.driver, username='******', password='******')
     self.driver.find_element(By.XPATH, '//a[text()="项目"]').click()
     self.driver.find_element(By.XPATH,
                              '//button[@data-toggle="dropdown"]').click()
     time.sleep(1)
     self.driver.find_element(By.XPATH, '//a[text()=" 项目主页"]').click()
     self.driver.find_element(By.XPATH,
                              '//button[@id="currentItem"]').click()
     self.driver.find_element(By.XPATH, '//a[@title="湖南中医药测试实训"]').click()
     time.sleep(1)
     self.assertTrue(EC.title_is("湖南中医药测试实训::任务列表 - 禅道"))
コード例 #15
0
 def test_project_name(self):
     """项目存在【学生成绩管理系统】"""
     login.login(config_value.config.user_name,
                 config_value.config.password, self.driver)
     self.assertTrue(
         EC.text_to_be_present_in_element(By.XPATH,
                                          '//span[@class="user-name"]'),
         '测试人员1')  # 方法二
     self.driver.find_element(By.XPATH, '//li[@data-id="project"]').click()
     self.assertTrue(
         WebDriverWait(self.driver, 10).until(
             EC.text_to_be_present_in_element(
                 (By.XPATH, '//button[@title="学生成绩管理系统"]'), '学生成绩管理系统')))
コード例 #16
0
ファイル: test_09_company.py プロジェクト: huangling0/test1
 def test_001_company(self):
     '''登陆跳转'''
     company_code = code.Acode()
     self.driver.get("http://ibdata.cn/#!/company/?code={}&stype=1".format(
         company_code))
     time.sleep(30)
     self.driver.switch_to.default_content()
     btn_del = self.driver.find_element(By.CSS_SELECTOR,
                                        ".btn.btn-del.right30")
     btn_del.click()
     time.sleep(5)
     login.login(self)
     time.sleep(60)
     logTest.log("登陆成功且成功跳转")
 def setUpClass(cls):
     cls.a = login(cls.s)
     aa = cls.a.outside_consultants_login(cls.uri)
     cls.token = aa['body']['token']
     cls.memberId = aa['body']['memberid']
     country_info = resource_country_list(cls.s, cls.uri, cls.token,
                                          cls.memberId, cls.platform)
     cls.countryId = str(country_info[0][1])
     cls.countryName = country_info[1][1]
     school_info = test_get_school_by_country_id(cls.s, cls.uri,
                                                 cls.countryId)
     cls.schoolId = str(school_info[0][0])
     cls.schoolName = school_info[1][0]
     # major_info = test_get_major_by_school_id(cls.s, cls.uri, cls.token, cls.memberId, cls.platform, cls.schoolId)
     # cls.majorId = major_info[0]
     # cls.majorName = major_info[1]
     studentName = test_student_add_resource(cls.s, cls.uri, cls.token,
                                             cls.memberId, cls.platform)
     resourceId = test_student_list_status_0(cls.s, cls.uri, cls.token,
                                             cls.memberId, cls.platform,
                                             studentName)[0]
     cls.resourceId = str(
         test_student_detail_info_type1(cls.s, cls.uri, cls.token,
                                        cls.memberId, cls.platform,
                                        resourceId)[0])
コード例 #18
0
 def setUpClass(cls):
     cls.a = login(cls.s)
     aa = cls.a.outside_consultants_login(cls.uri)
     cls.token = aa['body']['token']
     cls.memberId = aa['body']['memberid']
     cls.studentName = test_student_add_resource(cls.s, cls.uri, cls.token,
                                                 cls.memberId, cls.platform)
コード例 #19
0
    def open_home_page(self):
        # 进入home页
        login(self.driver)

        time.sleep(2)
        # 刷新页面
        self.driver.refresh()

        # 定位展开侧边元素
        expand_sidebar = self.ele.getElement(self.driver, 'home', 'expandSidebar')

        # 点击展开侧边
        expand_sidebar.click()

        # 获取价格设置
        self.price_manger_btn = self.ele.getElement(self.driver, 'home', 'priceManger')
コード例 #20
0
 def test_submit_Bug(self):
     '''提交bug'''
     login.login(self.driver, 'test01', 'newdream123')
     time.sleep(2)
     self.driver.find_element(
         By.XPATH,
         '//a[contains(@href,"/zentao/www/index.php?m=qa&f")]').click()
     self.driver.find_element(
         By.XPATH,
         '//a[contains(@href,"/zentao/www/index.php?m=bug")]').click()
     self.driver.find_element(
         By.XPATH,
         '//a[contains(@href,"/zentao/www/index.php?m=bug&f=create")]'
     ).click()
     submit_bug.submit_bug(self.driver, '2020-4-14', '2020-4-14提交的bug',
                           '步骤:。。。')
コード例 #21
0
    def loginByPasswordSuc(self,dict,assert_it):
        '''正确的手机号和密码'''
        self.driver=login().LoginByPassword(dict)

        try:
            closeMarketing(self.driver)
        except Exception as e:
            pass
        try:
            closeCarSetting(self.driver)
        except:
            pass
        WebDriverWait(self.driver, 30, 0.5).until(EC.presence_of_element_located((By.ID, 'com.vcolco.undunion:id/tvMoreTask')))
        result=self.driver.find_element_by_id("com.vcolco.undunion:id/tvMoreTask").text #查看任务列表
        #print result
        nowTime=time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()))
        if result in assert_it:
            write_log('\n' + nowTime + " login sucessful" + '\n')
            #write_log(colored(('\n' + nowTime + " login sucessful" + '\n'), "red"))
            print  colored(('\n' + nowTime + " login sucessful" + '\n'), "green")
        else:
            write_log(colored(('\n' + nowTime + " login fail" + '\n'), "red"))
            print colored(('\n' + nowTime + " login fail" + '\n'), "red")


        self.driver.quit()
コード例 #22
0
ファイル: orchestrator.py プロジェクト: flexibleir/pentest
def TriggerScan(target,userName,password):
    loginVar = login.login(target,userName,password)
    id = str(uuid.uuid1())
    penContent = connector.pen.Run(loginVar)
    WriteToFile(id,"pen",penContent)
    pciContent = connector.pci.Run(loginVar)
    WriteToFile(id,"pci",pciContent)
    connector.cis.Run(loginVar)
コード例 #23
0
 def setUpClass(cls):
     cls.a = login(cls.s)
     aa = cls.a.outside_consultants_login(cls.uri)
     cls.token = aa['body']['token']
     cls.memberid = aa['body']['memberid']
     countryIds = resource_country_list(cls.s, cls.uri, cls.token,
                                        cls.memberid, cls.platform)[0]
     cls.countryId = str(countryIds[1])
コード例 #24
0
def get_managed_policy(profile_name, policy_arn):
    """Given a valid policy ARN, get a customer managed policy or an AWS managed policy"""
    iam_client = login(profile_name, 'iam')

    response = iam_client.get_policy(PolicyArn=policy_arn)
    default_version_id = response['Policy']['DefaultVersionId']
    response = iam_client.get_policy_version(PolicyArn=policy_arn,
                                             VersionId=default_version_id)
    return response['PolicyVersion']['Document']
コード例 #25
0
ファイル: conftest.py プロジェクト: xiaolangjianke/autotest
def driver(request):
    '''定义全局driver参数'''
    global _driver
    if _driver is None:
        name = request.config.getoption("--browser")
        if name == "firefox":
            _driver = webdriver.Firefox()
        elif name == "chrome":
            _driver = webdriver.Chrome()
        else:
            _driver = webdriver.Chrome()
        logger.info("正在启动浏览器,名称为:%s" % name)
        login(_driver)
    def fn():
        logger.info("\n当前功能所有case执行完毕,即将关闭浏览器!")
        _driver.quit()
    request.addfinalizer(fn)
    return _driver
コード例 #26
0
    def setUpClass(cls):
        cls.a = login(cls.s)
        aa = cls.a.outside_consultants_login(cls.uri)
        cls.token = aa['body']['token']
        cls.memberid = aa['body']['memberid']

        studentInfo = test_student_list_status_0(cls.s, cls.uri, cls.token,
                                                 cls.memberid, cls.platform)

        cls.resourceId = studentInfo[0]
コード例 #27
0
    def setUpClass(cls):
        cls.a = login(cls.s)
        aa = cls.a.outside_consultants_login(cls.uri)
        cls.token = aa['body']['token']
        cls.memberid = aa['body']['memberid']
        countryIds = resource_country_list(cls.s, cls.uri, cls.token,
                                           cls.memberid, cls.platform)[0]
        cls.countryId = str(countryIds[1])

        # cls.taskType = [0, 1, 2, 3, 4]  # 任务类型 0-全部,1-接单任务,2-定期回访任务,3-留学规划任务,4-定校任务
        # cls.taskStatus = [1, 2, 3]      # 任务状态 1-待办,2-未处理(过期),3-完成
        # cls.endType = [0, 1, 2, 3]      # 截止时间类型 0-全部,1-3小时内,2-今天,3-3天内
        '''
コード例 #28
0
ファイル: Test_Versioning.py プロジェクト: socialpercon/Iuxta
    def test_ND00409_1(self):
        driver = self.driver
        self.assertTrue(login.login(driver, users.root, users.password))

        driver.find_element_by_tag_name("html").click()
        
        testFolder = "http://google.com"

        driver.get(testFolder)
        
        driver.find_element_by_tag_name("html").click()

        login.logout(driver)
コード例 #29
0
ファイル: Test_HomePage.py プロジェクト: socialpercon/Iuxta
    def test_HomePage(self):
        driver = self.driver
        self.assertTrue(login.login(driver, "bvandemerwea", users.password))

        driver.get(urls.home)
        
        a = driver.find_element_by_link_text("Customize Layout")
        a.click()
                
        time.sleep(2)
        a = driver.find_element_by_link_text("Cancel")
        a.click()
                
        self.assertTrue(login.logout(driver))
コード例 #30
0
def create_public_privileged_instances_report(profile, output_dir, audit_all_regions):
    ec2_findings = EC2Findings()
    sts_session = login(profile, 'sts', 'us-east-1')
    account_alias = profile.replace(' ', '')
    try:
        account_id = get_aws_account_id(sts_session)
        ec2_findings.add_account(account_id)
        all_regions = get_all_regions(audit_all_regions)
        print("Looking for Public EC2 Instances with Instance Profiles...")
        print(f"Account: {account_id}")
        for region in all_regions:
            print(f"Region: {region}")
            find_public_instances_with_iam_profiles(profile, account_id, region, ec2_findings)
        with open(output_dir + '/' + account_alias + '.json', 'w') as json_file:
            all_findings = ec2_findings.get_all_accounts()
            json.dump(all_findings, json_file, indent=2)
        print(f"Report for Account ID {account_id} saved to {output_dir}/{account_alias}.json")
    except AttributeError as a_e:
        print(a_e)
コード例 #31
0
ファイル: zz_TestTemplate.py プロジェクト: socialpercon/Iuxta
 def test_Template(self): #Change
     driver = self.driver
     self.assertTrue(login.login(driver, users.root, users.password))
     self.assertTrue(login.logout(driver))
コード例 #32
0
 def test_login_2(self):
     '''使用case02 newdream123 测试能否登录'''
     login.login(self.driver, 'test02', 'newdream123')
     actual_result = self.driver.find_element(By.XPATH, '//span[@class="user-name"]').text
     self.assertEqual(actual_result, '测试人员2', 'test_login用例执行失败')
コード例 #33
0
 def setUp(self):
     self.driver = set_driver.set_driver()
     login.login(self.driver, config.username(), config.password())  #登录
コード例 #34
0
ファイル: Test_Login.py プロジェクト: socialpercon/Iuxta
 def test_LoginLogout(self):
     driver = self.driver
     self.assertTrue(login.login(driver, users.root, users.password))
     self.assertTrue(login.logout(driver))