use new DIR fixture
This commit is contained in:
parent
9494f8fd44
commit
d1fbc403c0
1 changed files with 7 additions and 6 deletions
|
|
@ -1,10 +1,11 @@
|
|||
import json
|
||||
import os
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
from playwright.sync_api import BrowserContext, expect
|
||||
|
||||
from src.dirmanager import DirManager
|
||||
|
||||
ADMIN_USER = os.environ["ADMIN_USER"]
|
||||
ADMIN_PASS = os.environ["ADMIN_PASS"]
|
||||
|
||||
|
|
@ -13,7 +14,7 @@ TESTUSER = {"username": "testuser", "name": "Test User", "password": "test123",
|
|||
TIMEOUT = 10000
|
||||
|
||||
|
||||
def test_create_admin_login(context: BrowserContext, dotenv_config: dict[str, str], STATES: Path):
|
||||
def test_create_admin_login(context: BrowserContext, dotenv_config: dict[str, str], DIR: DirManager):
|
||||
# go to page
|
||||
page = context.new_page()
|
||||
url = "https://" + dotenv_config["DOMAIN"]
|
||||
|
|
@ -31,7 +32,7 @@ def test_create_admin_login(context: BrowserContext, dotenv_config: dict[str, st
|
|||
expect(page.locator("ak-library")).to_be_visible()
|
||||
|
||||
# save state
|
||||
context.storage_state(path=f"{STATES}/admin_state.json")
|
||||
context.storage_state(path=f"{DIR.STATES}/admin_state.json")
|
||||
|
||||
|
||||
def create_invite_link(admin_context: BrowserContext, dotenv_config: dict[str, str]):
|
||||
|
|
@ -93,11 +94,11 @@ def create_user(user_context: BrowserContext, invitelink):
|
|||
expect(page.locator("ak-library")).to_be_visible()
|
||||
|
||||
|
||||
def test_create_user_session(context: BrowserContext, dotenv_config: dict[str, str], STATES: Path):
|
||||
def test_create_user_session(context: BrowserContext, dotenv_config: dict[str, str], DIR: DirManager):
|
||||
context.set_default_timeout(TIMEOUT)
|
||||
|
||||
# load admin cookies
|
||||
state_file = STATES / "admin_state.json"
|
||||
state_file = DIR.STATES / "admin_state.json"
|
||||
storage_state = json.loads(state_file.read_bytes())
|
||||
context.add_cookies(storage_state["cookies"])
|
||||
|
||||
|
|
@ -107,4 +108,4 @@ def test_create_user_session(context: BrowserContext, dotenv_config: dict[str, s
|
|||
# create user
|
||||
context.clear_cookies()
|
||||
create_user(context, invite_link)
|
||||
context.storage_state(path=f"{STATES}/user_state.json")
|
||||
context.storage_state(path=f"{DIR.STATES}/user_state.json")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue