use new DIR fixture
This commit is contained in:
parent
387d5f1822
commit
f38763d912
1 changed files with 6 additions and 4 deletions
|
|
@ -4,18 +4,20 @@ from pathlib import Path
|
||||||
import pytest
|
import pytest
|
||||||
from playwright.sync_api import BrowserContext
|
from playwright.sync_api import BrowserContext
|
||||||
|
|
||||||
|
from src.dirmanager import DirManager
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def admin_session(context: BrowserContext, STATES: Path) -> BrowserContext:
|
def admin_session(context: BrowserContext, DIR: DirManager) -> BrowserContext:
|
||||||
state_file = STATES / "admin_state.json"
|
state_file = DIR.STATES / "admin_state.json"
|
||||||
storage_state = json.loads(state_file.read_bytes())
|
storage_state = json.loads(state_file.read_bytes())
|
||||||
context.add_cookies(storage_state["cookies"])
|
context.add_cookies(storage_state["cookies"])
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def user_session(context: BrowserContext, STATES: Path) -> BrowserContext:
|
def user_session(context: BrowserContext, DIR: Path) -> BrowserContext:
|
||||||
state_file = STATES / "user_state.json"
|
state_file = DIR.STATES / "user_state.json"
|
||||||
storage_state = json.loads(state_file.read_bytes())
|
storage_state = json.loads(state_file.read_bytes())
|
||||||
context.add_cookies(storage_state["cookies"])
|
context.add_cookies(storage_state["cookies"])
|
||||||
return context
|
return context
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue