import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..')))
from 运维集控.项目测试.运维标准版.lib.base import *


class Userquery001:
    name = 'user_query_001'
    def teststeps(self):
        wd = GSTORE['wd']

        STEP(1, '点击搜索框')
        user_query = WebDriverWait(wd, 10).until(
            EC.element_to_be_clickable((By.XPATH, "//input[@placeholder='请输入用户名称']"))
        )
        user_query.click()
        sleep(2)

        STEP(2, '填写登录名')
        account_input = WebDriverWait(wd, 10).until(
            EC.presence_of_element_located((By.XPATH, "//input[@placeholder='请输入用户名称']"))
        )
        account_input.clear()
        account_input.send_keys("admin@test1")

        STEP(3, '校验是否成功检索用户')
        get_user = WebDriverWait(wd, 10).until(
            EC.presence_of_element_located((By.XPATH, "//div[normalize-space()='admin@test1']"))
        )
        get_username = get_user.text
        CHECK_POINT('校验是否成功检索用户', get_username == "admin@test1")
        sleep(2)


        # 调用钉钉输出测试报告
        # get_reportfile_send_dingding("123213_测试报告", "http://192.168.1.251")