move credentials to environment variables, defined in main
This commit is contained in:
parent
305f485a23
commit
76a79c11b2
2 changed files with 13 additions and 9 deletions
8
main.py
8
main.py
|
|
@ -1,3 +1,4 @@
|
|||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
|
|
@ -17,6 +18,13 @@ TESTS_DIR = Path("./tests").resolve()
|
|||
# os.environ["PWDEBUG"] = "1"
|
||||
os.environ["TESTS_DIR"] = str(TESTS_DIR)
|
||||
|
||||
cred_file = Path("credentials.json")
|
||||
with open(cred_file, "r") as f:
|
||||
CREDENTIALS = json.load(f)
|
||||
|
||||
os.environ["ADMIN_USER"] = CREDENTIALS["admin_user"]
|
||||
os.environ["ADMIN_PASS"] = CREDENTIALS["admin_pass"]
|
||||
|
||||
|
||||
session_id = get_session_id()
|
||||
wrapper = Wrapper(ENV_FILES, session_id=session_id)
|
||||
|
|
|
|||
|
|
@ -1,15 +1,11 @@
|
|||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
from icecream import ic
|
||||
from playwright.sync_api import BrowserContext, expect
|
||||
|
||||
cred_file = Path("credentials.json")
|
||||
with open(cred_file, "r") as f:
|
||||
CREDENTIALS = json.load(f)
|
||||
|
||||
ic("RUNNING SETUP")
|
||||
ic(CREDENTIALS)
|
||||
ADMIN_USER = os.environ["ADMIN_USER"]
|
||||
ADMIN_PASS = os.environ["ADMIN_PASS"]
|
||||
|
||||
TESTUSER = {"username": "testuser", "name": "Test User", "password": "test123", "email": "test@example.com"}
|
||||
TIMEOUT = 5000
|
||||
|
|
@ -27,8 +23,8 @@ def test_create_admin_login(context: BrowserContext, dotenv_config: dict[str, st
|
|||
expect(page.get_by_text(welcome_message)).to_be_visible(timeout=TIMEOUT)
|
||||
|
||||
# login
|
||||
page.locator('input[name="uidField"]').fill(CREDENTIALS["admin"])
|
||||
page.locator('ak-stage-identification input[name="password"]').fill(CREDENTIALS["admin_pw"])
|
||||
page.locator('input[name="uidField"]').fill(ADMIN_USER)
|
||||
page.locator('ak-stage-identification input[name="password"]').fill(ADMIN_USER)
|
||||
page.get_by_role("button", name="Log In").click()
|
||||
expect(page.locator("ak-library")).to_be_visible(timeout=TIMEOUT)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue