def setUp(self):
     # 实例化一个火狐配置文件
     fp = browse_driver.FirefoxProfile()
     # 设置各项参数,参数可以通过在浏览器地址栏中输入about:config查看。
     # 设置成0代表下载到桌面,1代表浏览器默认下载路径;设置成2则可以保存到指定目录
     fp.set_preference("browser.download.folderList", 2)
     # 是否显示开始,(个人实验,不管设成True还是False,都不显示开始,直接下载)
     fp.set_preference("browser.download.manager.showWhenStarting", False)
     # 下载到指定目录
     fp.set_preference("browser.download.dir", test_report_path())  # 路径名称文件夹设置成英文,不然不能下载到指定目录
     # 不询问下载路径;后面的参数为要下载页面的Content-type的值
     fp.set_preference("browser.helperApps.neverAsk.saveToDisk", "application/vnd.ms-excel")
     config = ConfigParser()
     config.read(setting_path())
     self.file_path = r'C:\Users\%s\Desktop\UIAutotest\Page\file\1.jpg' % (str(getpass.getuser()))
     self.driver = browse_driver.Firefox(firefox_profile=fp)
     self.driver.maximize_window()
     self.driver.get(config.get('testUrl', 'url'))
     self.username = config.get('labor', 'Wuhuigang')
     self.password = config.get('operation', 'password')
     ws_url = config.get('testUrl', 'ws_test_url')
     ws = create_connection("ws://%s/wsapi" % ws_url)
     self.ws_driver = BuilderBaseFunc(ws, ws_url)
     self.payroll_name = get_people_name()
     self.mobile = get_mobile()
     self.code = '11111'
     self.people_name = get_people_name()
     # 随机身份证
     self.identity = getDistrictCode()
예제 #2
0
 def setUp(self):
     conf = ConfigParser()
     self.file_path = file_path('1')
     conf.read(setting_path())
     self.username = conf.get('teamLeader', 'Zhenglinlin')
     self.password = conf.get('operation', 'password')
     self.username1 = conf.get('management', 'yangyinghua')
     appPackage = conf.get('android', 'appPackage')
     appActivity = conf.get('android', 'appActivity')
     print(appPackage + '\n' + appActivity)
     self.people = get_people_name()
     self.mobile = get_mobile()
     device_name = get_android_udid()
     stop_android_appium()
     sleep(2)
     start_android_appium(device_name)
     desired_caps = {
         'platformName': 'Android',
         'deviceName': device_name,
         'platformVersion': get_android_version(),
         'appPackage': 'com.zld.zld_face_rec_app',
         'appActivity': '.Login.LaunchActivity',
         # 'appPackage': appPackage,
         # 'appActivity': appActivity,
         'chromeOptions': {
             'androidProcess': 'com.zld.zld_face_rec_app'
         },
         'showChromedriverLog': True,
         'recreateChromeDriverSessions': True,
         # 'automationName':  'Uiautomator2'
     }
     self.driver = android_driver.Remote('http://127.0.0.1:4723/wd/hub',
                                         desired_caps)
     sleep(3)
예제 #3
0
 def test_add_face_worker(self):
     pwd = 123456
     sid = login(self.ws_driver, self.username, pwd)
     i = 0
     while True:
         identity_number = getDistrictCode()
         name = get_people_name()
         sex_str = "男女"
         sex = random.choice(sex_str)
         birthday = get_pass_dates(random.randint(7500, 25550))
         overdue = '2008/08/15-2020/08/15'
         mobile = get_phone_number()
         print(mobile)
         characteristic_value = random_face_eigenvalues()
         user = quick_register(self.ws_driver, sid['data']['sid'],
                               identity_number, name, sex, birthday,
                               overdue, self.file_path, self.file_path,
                               mobile, characteristic_value)
         workflow_process_create(self.ws_driver, sid['data']['sid'],
                                 user['data']['user_id'])
         i += 1
         if i > self.number:
             break
         else:
             pass
예제 #4
0
def employee_register(ws_driver, company_id, mobile=get_phone_number()):
    code_parameter = {
        "command": {
            "path": "employee.consumer.RegPhoneVerifyCode"
        },
        "parameters": {
            "username": mobile
        }
    }
    ws_driver.web_socket_request(code_parameter)
    real_name = get_people_name()
    phone_code_parameter = {
        "command": {
            "path": "employee.consumer.EmployeeRegister"
        },
        "parameters": {
            "username": mobile,
            "real_name": real_name,
            "password": "******",
            "code": "11111",
            "company_id": company_id['data']['company_id'],
            "captcha_code": "tttt",
        }
    }
    result = ws_driver.web_socket_request(phone_code_parameter)
    assert result['code'] == 1000
    assert result['msg'] == '成功:公司职员注册'
    return result
 def test_05_change_time_of_attendance(self):
     many_people = 2
     # 修改出勤时间工作流
     change_time_of_attendance(self.browser, get_people_name(),
                               self.file_path, many_people)
     logout(self.browser)
     web_login(self.browser, self.username1, self.password)
     approve_workflow(self.browser, '修正工人考勤异常', many_people)
예제 #6
0
 def setUp(self):
     config = ConfigParser()
     config.read(setting_path())
     self.browser = browse_driver.Firefox()
     self.browser.maximize_window()
     url = config.get('testUrl', 'url')
     print(url)
     self.browser.get(config.get('testUrl', 'url'))
     self.username = config.get('projectManager', 'taohui')
     self.password = config.get('operation', 'password')
     self.manager_username = config.get('management', 'Hujinping')
     self.area_name = get_people_name()
     web_login(self.browser, self.username, self.password)
 def setUpClass(cls):
     config = ConfigParser()
     cls.path = setting_path()
     cls.file_path = r'C:\Users\%s\Desktop\UIAutotest\Page\file\1.jpg' % (str(getpass.getuser()))
     config.read(cls.path)
     url = config.get('testUrl', 'url')
     cls.password = config.get('operation', 'password')
     # 随机姓名
     cls.people_name = get_people_name()
     # 随机身份证
     cls.identity = getDistrictCode()
     cls.browser = browse_driver.Firefox()
     cls.browser.maximize_window()
     cls.browser.get(url)
     cls.mobile = get_mobile()
     cls.code = 11111
     web_workman_register(cls.browser, cls.mobile, cls.code, cls.password)
 def setUp(self):
     config = ConfigParser()
     self.path = setting_path()
     self.file_path = file_path('1')
     config.read(self.path)
     url = config.get('testUrl', 'url')
     self.ws_url = config.get('testUrl', 'ws_test_url')
     self.username = config.get('labor', 'Wuhuigang')
     self.username1 = config.get('operation', 'username')
     self.password = config.get('operation', 'password')
     # 随机姓名
     self.people_name = get_people_name()
     # 随机身份证
     # 工件名称
     self.artifact = self.people_name + '的工件'
     self.identity = getDistrictCode()
     self.browser = browse_driver.Firefox()
     self.browser.maximize_window()
     self.browser.get(url)
     self.mobile = get_mobile()
     self.new_password = 654321
     self.code = 11111
예제 #9
0
 def setUp(self):
     config = ConfigParser()
     self.path = setting_path()
     self.file_path = file_path('1')
     config.read(self.path)
     url = config.get('testUrl', 'url')
     ws_url = config.get('testUrl', 'ws_test_url')
     ws = create_connection("ws://%s/wsapi" % ws_url)
     self.ws_driver = BuilderBaseFunc(ws, ws_url)
     self.username = config.get('operation', 'username')
     self.password = config.get('operation', 'password')
     # 随机姓名
     self.people_name = get_people_name()
     # 随机身份证
     self.identity = getDistrictCode()
     self.browser = browse_driver.Firefox()
     self.browser.maximize_window()
     self.browser.get(url)
     self.mobile = get_mobile()
     self.new_password = 654321
     self.code = 11111
     self.get_new_mobile = get_mobile()
예제 #10
0
 def test_05_setting_attendance_machine(self):
     # 等待梁天明解决顺序问题,和选择工程区域与目标区域不一致的问题,有问题
     setting_attendance_machine(self.browser, get_people_name())
 def test_04_request_for_overtime(self):
     # 加班工作流
     request_for_overtime(self.browser, get_people_name(), self.file_path)
     logout(self.browser)
     web_login(self.browser, self.username1, self.password)
     approve_workflow(self.browser, '加班工作流')
 def test_02_batch_add_workman(self):
     # 批量请假工作流
     batch_add_workman(self.browser, self.file_path, get_people_name())
     logout(self.browser)
     web_login(self.browser, self.username1, self.password)
     approve_workflow(self.browser, '请假工作流', 2)
 def test_01_to_apply_for_leave(self):
     # 单人请假工作流
     to_apply_for_leave(self.browser, self.file_path, get_people_name())
     logout(self.browser)
     web_login(self.browser, self.username1, self.password)
     approve_workflow(self.browser, '请假工作流')
def family_information(driver):
    sleep(3)
    try:
        get_element(driver,
                    ('xpath', "//div[@data-target='#mo-home']")).click()
        get_element(
            driver,
            ('xpath', "//input[@data-duplex-changed='show1']")).click()
        get_elements(
            driver,
            ('xpath', "//div[@class='pi-plane-con-text']/input"))[0].clear()
        get_elements(
            driver,
            ('xpath',
             "//div[@class='pi-plane-con-text']/input"))[0].send_keys('2')
        setting_input_time(driver)
        # 结婚日期
        get_elements(driver,
                     ('xpath', "//div[@id='marry']/input"))[0].send_keys(
                         get_pass_dates(100))
        get_elements(
            driver,
            ('xpath', "//div[@class='pi-plane-con-text']/input"))[1].send_keys(
                get_people_name())
        get_elements(
            driver,
            ('xpath', "//div[@class='pi-plane-con-text']/input"))[2].send_keys(
                get_mobile())
        relation_element = "//div[2]/div/div[6]/select/option[%s]" % str(
            random.randint(2, 8))
        get_element(driver, ('xpath', relation_element)).click()
        len_province = len(
            get_elements(driver,
                         ('xpath', "//div[2]/div/div[7]/select/option")))
        province_element = "//div[2]/div/div[7]/select/option[%s]" % str(
            random.randint(2, len_province))
        get_element(driver, ('xpath', province_element)).click()
        sleep(1)
        len_city = len(
            get_elements(driver,
                         ('xpath', "//div[2]/div/div[8]/select/option")))
        city_element = "//div[2]/div/div[8]/select/option[%s]" % str(
            random.randint(2, len_city))
        get_element(driver, ('xpath', city_element)).click()
        sleep(1)
        len_district = len(
            get_elements(driver,
                         ('xpath', "//div[2]/div/div[9]/select/option")))
        district_element = "//div[2]/div/div[9]/select/option[%s]" % str(
            random.randint(1, len_district))
        get_element(driver, ('xpath', district_element)).click()
        get_element(driver,
                    ('xpath', "//div[2]/div/div[10]/input")).send_keys('塔克拉玛干')
        get_element(driver,
                    ('xpath', "//div[2]/div/div[11]/input")).send_keys('厄尔')
        get_elements(driver,
                     ('xpath', "//button[contains(text(),'保存')]"))[1].click()
        assert get_element(driver, ('id', "LAY_demo2")).text == '更新成功'
        a = get_element(driver, ('id', "LAY_demo2")).text
        print(a)
    except Exception as e:
        print(e)
        bug_photo(driver)
        assert False