#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
@File    :   conftest.py
@Time    :   2024/11/06 16:24:10
@Author  :   dulip3ng 
@Version :   1.0
@Desc    :   None
'''
import pytest
from playwright.sync_api import sync_playwright, expect

expect.set_options(timeout=15_000)

@pytest.fixture(scope="session")
def browser():
    with sync_playwright() as p:
        # 启动有头浏览器
        browser = p.chromium.launch(headless=False)  # 设置headless=False来启用有头模式
        yield browser
        browser.close()

@pytest.fixture(scope="module")
def page(browser):
    # 为每个测试用例提供一个新的页面实例
    page = browser.new_page()
    yield page
    page.close()