Пример #1
0
    def test_score_detection(self, login_web, data):
        """ 测试人脸质量分数检测功能 """
        MenubarPage(login_web).click_nav_item("工具", "质量分数检测")
        ToolPage(login_web).check_one_img_quality(
            r'{}/tool/img_score_detection/{}'.format(SharePath.DATA_FOLDER,
                                                     data["img_path"]))

        result = ToolPage(login_web).get_face_score_detection_result()
        assert re.match(r'\d+ .\d+%', result)
Пример #2
0
    def test_one_to_one_face_compare(self, login_web):
        """ 测试1:1人脸验证功能 """
        MenubarPage(login_web).click_nav_item("工具", "1:1人脸验证")
        ToolPage(login_web).one_to_one_face_compare(
            r"{}/tool/img_one_to_one/img1.jpg".format(SharePath.DATA_FOLDER),
            r"{}/tool/img_one_to_one/img2.jpg".format(SharePath.DATA_FOLDER))

        result = ToolPage(login_web).get_face_compare_result()
        assert '评分参考' == result
Пример #3
0
    def test_negative_score_detection(self, login_web):
        """ 测试上传大于16M的图片 - 系统支持上传小于16M的图片 """
        MenubarPage(login_web).click_nav_item("工具", "质量分数检测")
        time.sleep(3)
        ToolPage(login_web).check_one_img_quality(
            f"{SharePath.DATA_FOLDER}/tool/img_score_detection/size_greater_16M.jpg"
        )

        result = GlobalDialog(login_web).judge_alert_info()
        assert "上传图片大小不能超过 16MB!" in result
Пример #4
0
    def test_face_property(self, login_web):
        """ 测试人脸属性输出的属性字段 """
        MenubarPage(login_web).click_nav_item("工具", "人脸属性检测")
        ToolPage(login_web).check_face_property(
            f'{SharePath.DATA_FOLDER}/tool/img_face_property/normal.jpg')

        face_sex = ToolPage(login_web).get_facial_attribute_by_name("性别")
        face_age = ToolPage(login_web).get_facial_attribute_by_name("年龄")
        face_phiz = ToolPage(login_web).get_facial_attribute_by_name("表情")
        face_mustache = ToolPage(login_web).get_facial_attribute_by_name("胡子")
        face_glasse = ToolPage(login_web).get_facial_attribute_by_name("眼镜")
        face_mask = ToolPage(login_web).get_facial_attribute_by_name("口罩")
        face_helmet = ToolPage(login_web).get_facial_attribute_by_name("安全帽")
        face_hat = ToolPage(login_web).get_facial_attribute_by_name("帽子")

        assert ("性别" in face_sex) and ("年龄" in face_age) and (
            "表情" in face_phiz) and ("胡子" in face_mustache) and (
                "眼镜" in face_glasse) and ("口罩" in face_mask) and (
                    "安全帽" in face_helmet) and ("帽子" in face_hat)
Пример #5
0
    def test_negative_face_property(self, login_web, data):
        """ 测试上传不同属性的人脸照片检测出对应的人脸属性 """
        MenubarPage(login_web).click_nav_item("工具", "人脸属性检测")
        ToolPage(login_web).check_face_property(
            f'{SharePath.DATA_FOLDER}/tool/img_face_property/{data["img_path"]}'
        )

        face_sex = ToolPage(login_web).get_facial_attribute_by_name("性别")
        face_age = ToolPage(login_web).get_facial_attribute_by_name("年龄")
        face_phiz = ToolPage(login_web).get_facial_attribute_by_name("表情")
        face_mustache = ToolPage(login_web).get_facial_attribute_by_name("胡子")
        face_glasse = ToolPage(login_web).get_facial_attribute_by_name("眼镜")
        face_mask = ToolPage(login_web).get_facial_attribute_by_name("口罩")
        face_helmet = ToolPage(login_web).get_facial_attribute_by_name("安全帽")
        face_hat = ToolPage(login_web).get_facial_attribute_by_name("帽子")

        assert (data["sex"] in face_sex) and (data["age"] in face_age) and (
            data["phiz"]
            in face_phiz) and (data["mustache"] in face_mustache) and (
                data["glasse"]
                in face_glasse) and (data["mask"] in face_mask) and (
                    data["helmet"] in face_helmet) and (data["hat"]
                                                        in face_hat)
Пример #6
0
def timezone_web(login_web):
    # 进入时间条件模块
    MenubarPage(login_web).click_nav_item("配置", "时间条件")
    yield login_web
Пример #7
0
def user_web(login_web):
    # 进入用户管理模块
    MenubarPage(login_web).click_nav_item("配置", "用户管理")
    yield login_web
Пример #8
0
# -*- coding:utf-8 -*-
# @Time: 2020/3/30 18:52
# @Author: wenqin_zhu
# @File: user_page.py
# @Software: PyCharm

from guard.pages.classes.basepage import BasePage


class UserPage(BasePage):
    def add_user(self):
        # 添加用户
        pass


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.get("http://10.151.3.96/login")
    LoginPage(driver).login("zhuwenqin", "888888", login_way="ssh")
    MenubarPage(driver).click_nav_item("配置", "用户管理")
Пример #9
0
            TIME_END = (
                By.XPATH,
                f'//div[contains(@class, "el-date-range-picker") and contains(@style, "position")]//div[contains(@class,"is-left")]//td//span[contains(text(),{today_text})]'
            )
        BasePage(self.driver).mouse_move_ele_and_click(TIME_CONTROL, TIME_END)

    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 import LoginPage
    driver = webdriver.Chrome()
    driver.get("http://10.151.3.96/login")
    LoginPage(driver).login("zhuwenqin", "888888")
    MenubarPage(driver).click_nav_item("配置", "时间条件")
    TimezonePage(driver).add_timezone_name("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("timezone2", "删除")
Пример #10
0
    #
    # def get_face_result_glasse(self):
    #     # 获取人脸属性 - 眼镜
    #     CHECK_CONTENT_GLASSE = (By.XPATH, '//div[@class="app-tools-content-detection-right"]//li[5]')
    #     return BasePage(self.driver).get_text(CHECK_CONTENT_GLASSE, "小工具")
    #
    # def get_face_result_mask(self):
    #     # 获取人脸属性 - 口罩
    #     CHECK_CONTENT_MASK = (By.XPATH, '//div[@class="app-tools-content-detection-right"]//li[6]')
    #     return BasePage(self.driver).get_text(CHECK_CONTENT_MASK, "小工具")
    #
    # def get_face_result_helmet(self):
    #     # 获取人脸属性 - 安全帽
    #     CHECK_CONTENT_HELMET = (By.XPATH, '//div[@class="app-tools-content-detection-right"]//li[7]')
    #     return BasePage(self.driver).get_text(CHECK_CONTENT_HELMET, "小工具")
    #
    # def get_face_result_hat(self):
    #     # 获取人脸属性 - 帽子
    #     CHECK_CONTENT_HAT = (By.XPATH, '//div[@class="app-tools-content-detection-right"]//li[8]')
    #     return BasePage(self.driver).get_text(CHECK_CONTENT_HAT, "小工具")


if __name__ == '__main__':
    from selenium import webdriver
    from guard.pages.components.menubar import MenubarPage
    from guard.pages.login import LoginPage
    driver = webdriver.Chrome()
    driver.get("http://10.151.3.96/login")
    LoginPage(driver).login("zhuwenqin", "888888")
    MenubarPage(driver).click_nav_item("工具", "1:1人脸验证")