remove timeout and locale to replace with global timeout
This commit is contained in:
parent
565903f304
commit
636c39d557
3 changed files with 2 additions and 16 deletions
|
|
@ -6,15 +6,12 @@ from playwright.sync_api import BrowserContext, Page
|
||||||
|
|
||||||
from src.dirmanager import DirManager
|
from src.dirmanager import DirManager
|
||||||
|
|
||||||
TIMEOUT = 5000
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def admin_context(context: BrowserContext, DIR: DirManager) -> BrowserContext:
|
def admin_context(context: BrowserContext, DIR: DirManager) -> BrowserContext:
|
||||||
state_file = DIR.STATES / "authentik_admin_state.json"
|
state_file = DIR.STATES / "authentik_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"])
|
||||||
context.set_default_timeout(TIMEOUT)
|
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -33,7 +30,6 @@ def user_context(context: BrowserContext, DIR: DirManager) -> BrowserContext:
|
||||||
state_file = DIR.STATES / "authentik_user_state.json"
|
state_file = DIR.STATES / "authentik_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"])
|
||||||
context.set_default_timeout(TIMEOUT)
|
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,15 +9,12 @@ from src.dirmanager import DirManager
|
||||||
ADMIN_USER = os.environ["ADMIN_USER"]
|
ADMIN_USER = os.environ["ADMIN_USER"]
|
||||||
ADMIN_PASS = os.environ["ADMIN_PASS"]
|
ADMIN_PASS = os.environ["ADMIN_PASS"]
|
||||||
|
|
||||||
LOCALE = {"Accept-Language": "de_DE"}
|
|
||||||
TESTUSER = {"username": "testuser", "name": "Test User", "password": "test123", "email": "test@example.com"}
|
TESTUSER = {"username": "testuser", "name": "Test User", "password": "test123", "email": "test@example.com"}
|
||||||
TIMEOUT = 10000
|
|
||||||
|
|
||||||
|
|
||||||
def test_create_admin_login(context: BrowserContext, dotenv_config: dict[str, str], DIR: DirManager):
|
def test_create_admin_login(context: BrowserContext, dotenv_config: dict[str, str], DIR: DirManager):
|
||||||
# go to page
|
# go to page
|
||||||
context.set_extra_http_headers(LOCALE)
|
|
||||||
context.set_default_timeout(TIMEOUT)
|
|
||||||
page = context.new_page()
|
page = context.new_page()
|
||||||
url = "https://" + dotenv_config["DOMAIN"]
|
url = "https://" + dotenv_config["DOMAIN"]
|
||||||
page.goto(url)
|
page.goto(url)
|
||||||
|
|
@ -103,9 +100,6 @@ def create_user(user_context: BrowserContext, invitelink):
|
||||||
|
|
||||||
|
|
||||||
def test_create_user_session(context: BrowserContext, dotenv_config: dict[str, str], DIR: DirManager):
|
def test_create_user_session(context: BrowserContext, dotenv_config: dict[str, str], DIR: DirManager):
|
||||||
context.set_extra_http_headers(LOCALE)
|
|
||||||
context.set_default_timeout(TIMEOUT)
|
|
||||||
|
|
||||||
# load admin cookies
|
# load admin cookies
|
||||||
state_file = DIR.STATES / "authentik_admin_state.json"
|
state_file = DIR.STATES / "authentik_admin_state.json"
|
||||||
storage_state = json.loads(state_file.read_bytes())
|
storage_state = json.loads(state_file.read_bytes())
|
||||||
|
|
@ -116,8 +110,7 @@ def test_create_user_session(context: BrowserContext, dotenv_config: dict[str, s
|
||||||
pass
|
pass
|
||||||
context.clear_cookies()
|
context.clear_cookies()
|
||||||
else:
|
else:
|
||||||
## create user
|
# get invite_link
|
||||||
# create invite_link
|
|
||||||
invite_link = create_invite_link(context, dotenv_config)
|
invite_link = create_invite_link(context, dotenv_config)
|
||||||
# create user
|
# create user
|
||||||
context.clear_cookies()
|
context.clear_cookies()
|
||||||
|
|
|
||||||
|
|
@ -6,15 +6,12 @@ from playwright.sync_api import BrowserContext, Page
|
||||||
|
|
||||||
from src.dirmanager import DirManager
|
from src.dirmanager import DirManager
|
||||||
|
|
||||||
TIMEOUT = 5000
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def wordpress_admin_context(context: BrowserContext, DIR: DirManager) -> BrowserContext:
|
def wordpress_admin_context(context: BrowserContext, DIR: DirManager) -> BrowserContext:
|
||||||
state_file = DIR.STATES / "wordpress_admin_state.json"
|
state_file = DIR.STATES / "wordpress_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"])
|
||||||
context.set_default_timeout(TIMEOUT)
|
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue