예제 #1
0
def before_device_common(login):

    # before_name = {"floor_group_name": f"FGN-{get_current_time()}"}
    # 将相关联的前置数据,写在同一个地方
    before_name = {
        "floor_group_name": f"FGN-{get_current_time()}",
        "device_group_name": f"DGN-{get_current_time()}",
        "device_name": f"DN-{get_current_time()}",
        "task_name": f"TN-{get_current_time()}"
    }

    # 进入地图模块,创建地图分组,上传地图
    time.sleep(0.5)
    MenuBarPage(login).click_nav_item("配置", "地图管理")
    time.sleep(1)
    GroupTreePage(login).create_peer_or_next_group(
        group_name=before_name["floor_group_name"])
    MapPage(login).upload_map(
        file_name=r"{}/map_data/company_4th_floor.jpg".format(
            SharePath.DATA_FOLDER),
        group_name=before_name["floor_group_name"])
    yield before_name
    # 删除地图分组
    time.sleep(0.5)
    MenuBarPage(login).click_nav_item("配置", "地图管理")
    time.sleep(0.2)
    GroupTreePage(login).delete_peer_or_next_group_by_name(
        module_val="map", parent_name=before_name["floor_group_name"])
예제 #2
0
def back_ped_task_page(login):
    # 批量操作之后返回到人体区域入侵页面的默认状态
    MenuBarPage(login).click_nav_item("记录")
    time.sleep(2)
    yield
    time.sleep(0.5)
    MenuBarPage(login).click_nav_item("配置", "任务管理")
    TaskPage(login).click_left_menu(menu_name="人体-区域闯入检测任务")
예제 #3
0
def back_car_task_page(login):
    # 批量操作之后返回到车辆违停检测页面的默认状态
    MenuBarPage(login).click_nav_item("记录")
    time.sleep(2)
    yield
    time.sleep(0.5)
    MenuBarPage(login).click_nav_item("配置", "任务管理")
    TaskPage(login).click_left_menu(menu_name="车辆-违停检测任务")
예제 #4
0
def timezone(login):
    # 进入时间条件模块
    MenuBarPage(login).click_nav_item("配置", "时间条件")
    before_name = {
        "timezone": f"TIME-{get_current_time()}",
        "holiday_name": f"H-{get_current_time()}",
        "workday_name": f"W-{get_current_time()}"
    }
    yield login, before_name
예제 #5
0
def before_structuring_task_common(login, before_device_common):
    # 进入设备模块,创建设备分组和对应对应类型的设备
    time.sleep(0.5)
    MenuBarPage(login).click_nav_item("配置", "设备管理")
    before_name = uuid4_data()
    rtsp_para = Rtsp(device_name=before_device_common["device_name"],
                     device_id=before_name,
                     group_name=before_device_common["device_group_name"],
                     floor_name=before_device_common["floor_group_name"],
                     rtsp_address="rtsp://10.151.3.119:7554/IMG_0322.264")
    # 创建设备 - 网络摄像机 - RTSP
    time.sleep(1)
    GroupTreePage(login).create_peer_or_next_group(
        group_name=before_device_common["device_group_name"])
    time.sleep(2)
    DevicePage(login).add_device_by_type(rtsp_para, device_type="网络摄像机")
    yield before_device_common
    MenuBarPage(login).click_nav_item("配置", "设备管理")
    # 删除相对于Default分组的同级设备分组
    GroupTreePage(login).delete_peer_or_next_group_by_name(
        module_val="device",
        parent_name=before_device_common["device_group_name"])
예제 #6
0
def test_negative_face_property(login, data):
    """ 测试上传不同属性的人脸照片检测出对应的人脸属性 """
    MenuBarPage(login).click_nav_item("工具", "人脸属性检测")
    ToolPage(login).detect_facial_attribute(f'{SharePath.DATA_FOLDER}/tool_data/img_face_property/{data["img_path"]}')
    # 断言
    result = {
        "sex": ToolPage(login).get_facial_attribute_by_name("性别"),
        "age": ToolPage(login).get_facial_attribute_by_name("年龄"),
        "phiz": ToolPage(login).get_facial_attribute_by_name("表情"),
        "mustache": ToolPage(login).get_facial_attribute_by_name("胡子"),
        "glasse": ToolPage(login).get_facial_attribute_by_name("眼镜"),
        "mask": ToolPage(login).get_facial_attribute_by_name("口罩"),
        "helmet": ToolPage(login).get_facial_attribute_by_name("安全帽"),
        "hat": ToolPage(login).get_facial_attribute_by_name("帽子")
    }
    assert (data["sex"] in result["sex"]) and (data["age"] in result["age"]) and (data["phiz"] in result["phiz"]) and (
            data["mustache"] in result["mustache"]) and (data["glasse"] in result["glasse"]) and (
            data["mask"] in result["mask"]) and (data["helmet"] in result["helmet"]) and (data["hat"] in result["hat"])
예제 #7
0
def test_face_property(login):
    """ 测试人脸属性输出的属性字段 """
    MenuBarPage(login).click_nav_item("工具", "人脸属性检测")
    ToolPage(login).detect_facial_attribute(r'{}/tool_data/img_face_property/normal.jpg'.format(SharePath.DATA_FOLDER))
    # 断言
    result = {
        "sex": ToolPage(login).get_facial_attribute_by_name("性别"),
        "age": ToolPage(login).get_facial_attribute_by_name("年龄"),
        "phiz": ToolPage(login).get_facial_attribute_by_name("表情"),
        "mustache": ToolPage(login).get_facial_attribute_by_name("胡子"),
        "glasse": ToolPage(login).get_facial_attribute_by_name("眼镜"),
        "mask": ToolPage(login).get_facial_attribute_by_name("口罩"),
        "helmet": ToolPage(login).get_facial_attribute_by_name("安全帽"),
        "hat": ToolPage(login).get_facial_attribute_by_name("帽子")
    }
    assert ("性别" in result["sex"]) and ("年龄" in result["age"]) and ("表情" in result["phiz"]) and (
                "胡子" in result["mustache"]) and ("眼镜" in result["glasse"]) and ("口罩" in result["mask"]) and (
                "安全帽" in result["helmet"]) and ("帽子" in result["hat"])
예제 #8
0
def user(login):
    # 进入用户管理模块
    MenuBarPage(login).click_nav_item("配置", "用户管理")
    sole_name = f"UDN-{uuid4_data()}"
    yield login, sole_name
예제 #9
0
def map_module(login):
    # 进入地图管理模块
    MenuBarPage(login).click_nav_item("配置", "地图管理")
    required_parameters = {"map_group_name": f"FGN-{uuid4_data()}"}
    yield login, required_parameters
예제 #10
0
def device(login, before_device_common):
    # 进入设备模块
    MenuBarPage(login).click_nav_item("配置", "设备管理")
    yield login, before_device_common
예제 #11
0
def test_one_to_one_face_compare(login):
    """ 测试1:1人脸验证功能 """
    MenuBarPage(login).click_nav_item("工具", "1:1人脸验证")
    ToolPage(login).verify_one_to_one_face(r"{}/tool_data/img_one_to_one/img1.jpg".format(SharePath.DATA_FOLDER), r"{}/tool_data/img_one_to_one/img2.jpg".format(SharePath.DATA_FOLDER))
    result = ToolPage(login).get_one_to_one_face_result()
    assert '评分参考' == result
예제 #12
0
def task_no_setup(login):
    MenuBarPage(login).click_nav_item("配置", "任务管理")
    yield login
    DialogPage(login).close_dialog()
예제 #13
0
        # 进入任务详情页
        TableListPage(self.driver).operations_table_list(task_name,
                                                         flag="view")
        INPUT_PARK_TIME = (
            By.XPATH,
            '//label[contains(text(), "违停时限")]/following-sibling::div')
        result = BasePage(self.driver).get_text(INPUT_PARK_TIME)
        print(f'获取修改后的违停时限为:{result}')
        return result


if __name__ == '__main__':
    from selenium import webdriver
    from guard.pages.login_page import LoginPage
    from guard.pages.components.menubar import MenuBarPage
    from guard.pages.classes.task import Task

    driver = webdriver.Chrome()
    driver.maximize_window()
    driver.get("http://10.151.3.96/login")
    LoginPage(driver).login("zhuwenqin", "888888", login_way="debug")
    MenuBarPage(driver).click_nav_item("配置", "任务管理")

    task = Task("rtyx", "3210")
    TaskPage(driver).add_task_by_type(task, task_type="人体-越线检测任务")
    # TaskPage(driver).add_task_to_parked_vehicle(task_name="test", device_name="1111", time_minute=1)
    # from guard.pages.components.table_list import TableListPage
    # TaskPage(driver).click_left_menu("车辆-违停检测任务")
    # TableListPage(driver).operations_table_list(name="id-2b244f07-cb55-47e7-87ef-3dca9ca47593", flag="delete")
    # TaskPage(driver).operation_batch_disabled()
예제 #14
0
def test_negative_score_detection(login):
    """ 测试上传大于16M的图片 - 系统支持上传小于16M的图片 """
    MenuBarPage(login).click_nav_item("工具", "质量分数检测")
    ToolPage(login).check_img_size(r"{}/tool_data/img_score_detection/size_greater_16M.jpg".format(SharePath.DATA_FOLDER))
    result = AlertInfoPage(login).get_alert_info()
    assert "上传图片大小不能超过 16MB!" in result
예제 #15
0
def test_score_detection(login, data):
    """ 测试人脸质量分数检测功能 """
    MenuBarPage(login).click_nav_item("工具", "质量分数检测")
    ToolPage(login).evaluate_face_image_quality(r'{}/tool_data/img_score_detection/{}'.format(SharePath.DATA_FOLDER, data["img_path"]))
    result = ToolPage(login).get_face_image_quality_result()
    assert re.match(r'\d+ .\d+%', result)
예제 #16
0
def task(login, before_structuring_task_common):
    time.sleep(0.5)
    MenuBarPage(login).click_nav_item("配置", "任务管理")
    yield login, before_structuring_task_common
예제 #17
0
        except:
            return True
        else:
            return False

    def assert_timezone_section(self):
        # 判断添加时间段是否成功
        CHECK_CON_RESULT = (
            By.XPATH,
            '//div[@class="el-tab-pane" and @style=""]//div[contains(@class, "el-row")]//span[contains(text(), ":")]'
        )
        return BasePage(self.driver).get_text(CHECK_CON_RESULT)


if __name__ == '__main__':
    from selenium import webdriver
    from guard.pages.components.menubar import MenuBarPage
    from guard.pages.login_page import LoginPage
    driver = webdriver.Chrome()
    driver.maximize_window()
    driver.get("http://10.151.3.96/login")
    LoginPage(driver).login("zhuwenqin", "888888", login_way="ssh")
    MenuBarPage(driver).click_nav_item("配置", "时间条件")
    # TimezonePage(driver).add_timezone("test_时间条件")
    # TimezonePage(driver).create_holidays("添加假期", "假期名称1")
    # TimezonePage(driver).create_workday("添加特殊工作日", "工作日名称1")
    # TimezonePage(driver).add_timezone_name("timezone1")
    # TimezonePage(driver).add_timezone_name("timezone2")
    # TimezonePage(driver).delete_or_rename_timezone_name("timezone1", "重命名")
    TimezonePage(driver).delete_or_rename_timezone_name("ttttt")
예제 #18
0
        :param flag: 点击不同的记录tab,默认为车辆记录,有:人体、人群、非机动车、人脸记录
        """
        if flag == "car":
            # 点击车辆记录
            self.click_tab_vehicle_btn()
        elif flag == "ped":
            self.click_tab_ped_btn()
        # 点击筛选按钮
        self.click_filter_btn()
        # 根据设备名称进行筛选过滤
        self.comm_search_result_by_name(device_name)
        time.sleep(1)
        # 点击筛选按钮
        self.click_filter_or_reset_btn()


if __name__ == '__main__':
    from selenium import webdriver
    from guard.pages.login_page import LoginPage
    from guard.pages.components.menubar import MenuBarPage

    driver = webdriver.Chrome()
    driver.maximize_window()
    driver.get("http://10.151.3.96/login")
    LoginPage(driver).login("zhuwenqin", "888888", login_way="debug")
    MenuBarPage(driver).click_nav_item("记录")
    RecordPage(driver).click_tab_list_btn()
    RecordPage(driver).click_filter_btn()
    RecordPage(driver).comm_search_result_by_name(name="3210")
    RecordPage(driver).click_filter_or_reset_btn()