def add_staff_station(self):
        add_btn_bys, add_btn_val = self.childConfigXML('岗位管理', '新建岗位')
        input_box_bys, input_box_val = self.childConfigXML('岗位管理', '输入岗位名称')

        bussiness_line_bys, bussiness_line_val = self.childConfigXML(
            '岗位管理', '筛选业务线')
        click_line_bys, click_line_val = self.childConfigXML('岗位管理', '选中业务线')

        department_bys, department_val = self.childConfigXML('岗位管理', '选择所属部门')
        click_department_bys, click_department_val = self.childConfigXML(
            '岗位管理', '点击所属部门')
        weight_off_line_bys, weight_off_line_val = self.childConfigXML(
            '岗位管理', '岗位权重范围_off')
        weight_on_line_bys, weight_on_line_val = self.childConfigXML(
            '岗位管理', '岗位权重范围_on')
        standard_weight_bys, standard_weight_val = self.childConfigXML(
            '岗位管理', '岗位标准权重')
        compilation_quantity_bys, compilation_quantity_val = self.childConfigXML(
            '岗位管理', '编制数量')
        role_bys, role_val = self.childConfigXML('岗位管理', '选择角色')
        role_click_bys, role_click_val = self.childConfigXML('岗位管理', '点击角色')
        save_btn_bys, save_btn_values = self.childConfigXML('岗位管理', '保存')

        nc = NCLoing(self.driver)
        try:
            test_nctree_kids(self.driver).get_link_Post_management()  # 点击岗位管理
            nc.input_click(add_btn_bys, add_btn_val)  # 点击新建岗位
            radom_num = TestRamdom().RandomTestInt(999, 0)
            global station_name
            station_name = 'autotest_岗位' + str(radom_num)
            nc.Input_z(station_name, input_box_bys, input_box_val)  # 输入岗位名称
            nc.Input_o(business_line, bussiness_line_bys,
                       bussiness_line_val)  # 输入业务线
            click_line_val = click_line_val % (
                business_line)  # 获取add_Business_line方法里面的业务线名称,并取对应的xpath值
            nc.input_click(click_line_bys, click_line_val)  # 点击业务线
            nc.Input_t(department_name, department_bys, department_val)  # 输入部门
            click_department_val = click_department_val % (business_line
                                                           )  # 获取部门名称对应的xpath值
            nc.input_click(click_department_bys,
                           click_department_val)  # 点击所属部门
            nc.Input_z('1', weight_off_line_bys,
                       weight_off_line_val)  # 输入权重范围-最小值
            nc.Input_o('10', weight_on_line_bys,
                       weight_on_line_val)  # 输入权重范围-最大值
            nc.Input_t('5', standard_weight_bys, standard_weight_val)  # 输入标准权重
            nc.Input_z('10', compilation_quantity_bys,
                       compilation_quantity_val)  # 输入编制数量
            nc.Input_th('业务人员', role_bys, role_val)  # 角色选择“业务人员”
            nc.input_click(role_click_bys, role_click_val)  # 点击业务人员
            nc.input_click(save_btn_bys, save_btn_values)

        except Exception:
            img_path = self.childConfigImgPath()
            BasePage(self.driver).save_img(
                img_path, str(int(TestDateTime().time_stamp())))
            print(traceback.format_exc())
    def add_area(self):
        add_btn_bys, add_btn_values = self.childConfigXML('片区管理', '新增')
        input_area_bys, input_area_values = self.childConfigXML(
            '片区管理', '输入片区名称')
        input_part_bys, input_part_values = self.childConfigXML(
            '片区管理', '选择归属区域')
        select_part_bys, select_part_values = self.childConfigXML(
            '片区管理', '归属区域下拉选项')
        select_province_bys, select_province_values = self.childConfigXML(
            '片区管理', '关联省份')
        select_city_bys, select_city_values = self.childConfigXML(
            '片区管理', '关联城市')
        select_county_bys, select_county_values = self.childConfigXML(
            '片区管理', '关联区县')
        save_btn_bys, save_btn_values = self.childConfigXML('片区管理', '保存')
        nc = NCLoing(self.driver)
        try:
            test_nctree_master(self.driver).get_link_config_center()  # 点击配置中心
            test_nctree_master(self.driver).get_link_Basic_data()  # 点击基础数据
            test_nctree_kids(self.driver).get_link_Area_management()  # 点击片区管理
            nc.input_click(add_btn_bys, add_btn_values)  # 点击新增片区
            radom_num = TestRamdom().RandomTestInt(500, 0)
            area_name = 'xw_AutoTest_片区' + str(radom_num)

            nc.Input_z(area_name, input_area_bys, input_area_values)  # 输入片区名称
            nc.input_click(input_part_bys, input_part_values)  # 点击展开归属区域下拉选项
            nc.input_click(select_part_bys, select_part_values)  # 选择归属区域
            time.sleep(6)
            nc.input_click_z(select_province_bys,
                             select_province_values)  # 选择省份
            time.sleep(2)
            nc.input_click_o(select_city_bys, select_city_values)  # 选择城市
            nc.input_click_t(select_county_bys, select_county_values)  # 选择区县
            time.sleep(2)
            nc.input_click(save_btn_bys, save_btn_values)  # 保存
            time.sleep(2)

            return area_name

            # # 连接测试数据库,获取最新创建的部门名称(获取的名称没有按顺序排列,放弃此方法)
            # my = MysqlDB()
            # my.getCursor(sqltable="easylife_commallot")
            # sql = "SELECT department_name FROM commallot_staff_department"
            # department = my.queryOperation(sql)
            # print(department)
            # return department

        except Exception:
            img_path = self.childConfigImgPath()
            BasePage(self.driver).save_img(
                img_path, str(int(TestDateTime().time_stamp())))
            print(traceback.format_exc())
    def add_Department(self):
        add_btn_bys, add_btn_values = self.childConfigXML('部门管理', '新建部门')
        input_box_bys, input_box_values = self.childConfigXML('部门管理', '输入部门名称')
        save_btn_bys, save_btn_values = self.childConfigXML('部门管理', '保存')
        popup_bys, popup_values = self.childConfigXML('部门管理', '新建部门弹窗')
        nc = NCLoing(self.driver)
        try:
            test_nctree_master(
                self.driver).get_link_Employee_settlement()  # 点击员工结算
            test_nctree_master(
                self.driver).get_link_Staff_management()  # 点击员工管理
            test_nctree_kids(
                self.driver).get_link_Departmental_management()  # 点击部门管理
            nc.input_click(add_btn_bys, add_btn_values)  # 点击新建部门
            radom_num = TestRamdom().RandomTestInt(999, 0)
            global department_name
            department_name = 'autotest_部门' + str(radom_num)
            #            self.department_name = 'autotest_部门'+ str(radom_num)
            nc.Input_o(department_name, input_box_bys,
                       input_box_values)  # 输入部门名称
            nc.input_click(save_btn_bys, save_btn_values)

            for i in range(0, 10):  # 判断标题名称是否重复
                cont = self.driver.page_source
                if u'部门名称已存在' in cont:
                    nc.Clear_o(input_box_bys, input_box_values)
                    radom_num = TestRamdom().RandomTestInt(999, 0)
                    department_name = 'autotest_部门' + str(radom_num)
                    nc.Input_o(department_name, input_box_bys,
                               input_box_values)  # 再次输入部门名称
                elif i == 9:
                    print('部门太多啦,新建不了啦')
                    break
                else:
                    break

            #
            # # 连接测试数据库,获取最新创建的部门名称
            # my = MysqlDB()
            # my.getCursor(sqltable="easylife_commallot")
            # sql = "SELECT department_name FROM commallot_staff_department "
            # department = my.queryOperation(sql)
            # print(department)
            # return department

        except Exception:
            img_path = self.childConfigImgPath()
            BasePage(self.driver).save_img(
                img_path, str(int(TestDateTime().time_stamp())))
            print(traceback.format_exc())
예제 #4
0
    def add_reject_category(self):
        add_btn_bys, add_btn_values = self.childConfigXML('驳回类目管理_增', '新增')
        input_rjmdl_bys, input_rjmdl_values = self.childConfigXML(
            '驳回类目管理_增', '驳回模块选择')
        select_rjmdl_bys, select_rjmdl_values = self.childConfigXML(
            '驳回类目管理_增', '驳回模块下拉选项')
        input_rjctgr_bys, input_rjctgr_values = self.childConfigXML(
            '驳回类目管理_增', '输入驳回分类')
        save_btn_bys, save_btn_values = self.childConfigXML('驳回类目管理_增', '保存')
        confirm_btn_bys, confirm_btn_values = self.childConfigXML(
            '驳回类目管理_增', '保存成功确认弹窗')

        nc = NCLoing(self.driver)
        try:
            test_nctree_master(self.driver).get_link_config_center()  # 点击配置中心
            test_nctree_master(
                self.driver).get_link_Reject_settings()  # 点击驳回设置
            test_nctree_kids(
                self.driver).get_link_Reject_Category_Management()  # 点击驳回类目管理
            nc.input_click(add_btn_bys, add_btn_values)  # 点击新增驳回分类
            radom_num = TestRamdom().RandomTestInt(500, 0)
            reject_category_name = 'xw_AutoTest_驳回分类' + str(radom_num)

            nc.input_click_t(input_rjmdl_bys,
                             input_rjmdl_values)  # 点击展开驳回模块下拉选项
            nc.input_click(select_rjmdl_bys, select_rjmdl_values)  # 选择驳回模块
            nc.Input(reject_category_name, input_rjctgr_bys,
                     input_rjctgr_values)  # 输入驳回分类名称
            nc.input_click(save_btn_bys, save_btn_values)  # 保存
            time.sleep(2)
            nc.input_click_o(confirm_btn_bys, confirm_btn_values)  # 关闭保存成功弹窗
            time.sleep(3)

            return reject_category_name

        except Exception:
            img_path = self.childConfigImgPath()
            BasePage(self.driver).save_img(
                img_path, str(int(TestDateTime().time_stamp())))
            print(traceback.format_exc())
    def add_Business_line(self):
        add_btn_bys, add_btn_values = self.childConfigXML('业务线管理', '新建业务线')
        input_box_bys, input_box_values = self.childConfigXML(
            '业务线管理', '请输入业务线名称')
        save_btn_bys, save_btn_values = self.childConfigXML('业务线管理', '保存')
        popup_bys, popup_values = self.childConfigXML('业务线管理', '新建业务线弹窗')
        nc = NCLoing(self.driver)
        try:
            test_nctree_kids(
                self.driver).get_link_Business_Line_Management()  # 点击业务线管理
            nc.input_click(add_btn_bys, add_btn_values)  # 点击新建业务线
            radom_num = TestRamdom().RandomTestInt(999, 0)

            global business_line
            business_line = 'autotest_业务线' + str(radom_num)
            nc.Input_o(business_line, input_box_bys,
                       input_box_values)  # 输入业务线名称
            nc.input_click(save_btn_bys, save_btn_values)

            for i in range(0, 10):  # 判断标题名称是否重复
                cont = self.driver.page_source
                if u'业务线名称已存在' in cont:
                    nc.Clear_o(input_box_bys, input_box_values)
                    radom_num = TestRamdom().RandomTestInt(999, 0)
                    business_line = 'autotest_业务线' + str(radom_num)
                    nc.Input_o(business_line, input_box_bys,
                               input_box_values)  # 再次输入部门名称
                elif i == 9:
                    print('业务线太多啦,新建不了啦')
                    break
                else:
                    break

        except Exception:
            img_path = self.childConfigImgPath()
            BasePage(self.driver).save_img(
                img_path, str(int(TestDateTime().time_stamp())))
            print(traceback.format_exc())