"""
    前置后置类
"""

import pytest
import time
from selenium import webdriver

from TestDatas import global_datas as gd
from PageObjects.login_page import LoginPage


@pytest.fixture(scope="session")
# 打开浏览器，访问登录页面
def init():
    print(1)
    driver = webdriver.Chrome()
    driver.maximize_window()
    driver.get(gd.login_url)
    yield driver
    driver.quit()


@pytest.fixture(scope="class")
# 完成登录操作
def login(init):
    print(2)
    LoginPage(init).login(*gd.user)
    yield init


@pytest.fixture
# 访问 我的客户 页面
def myClient_page(login):
    time.sleep(3)
    login.get(gd.myClient_url)
    yield login
