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
|
||||
from playwright.sync_api import BrowserContext
|
||||
|
||||
from src.dirmanager import DirManager
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def admin_session(context: BrowserContext, STATES: Path) -> BrowserContext:
|
||||
state_file = STATES / "admin_state.json"
|
||||
def admin_session(context: BrowserContext, DIR: DirManager) -> BrowserContext:
|
||||
state_file = DIR.STATES / "admin_state.json"
|
||||
storage_state = json.loads(state_file.read_bytes())
|
||||
context.add_cookies(storage_state["cookies"])
|
||||
return context
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def user_session(context: BrowserContext, STATES: Path) -> BrowserContext:
|
||||
state_file = STATES / "user_state.json"
|
||||
def user_session(context: BrowserContext, DIR: Path) -> BrowserContext:
|
||||
state_file = DIR.STATES / "user_state.json"
|
||||
storage_state = json.loads(state_file.read_bytes())
|
||||
context.add_cookies(storage_state["cookies"])
|
||||
return context
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue