Skip to content

Commit 0a2f537

Browse files
committed
updated
1 parent 3fe99ab commit 0a2f537

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

pytest.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
[pytest]
33
markers =
44
sample: quick setup verification test
5+
bootstrap: one-time signup & session save
6+
addopts = -m "not bootstrap"
Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,29 @@
11
# tests/test_signup_and_save_session.py
22
import os
3-
import time
43
from pathlib import Path
4+
import time
55
import pytest
66
from playwright.sync_api import Page, BrowserContext
77
from pages.signup_page import SignupPage
88

99
STORAGE_PATH = os.getenv("STORAGE_STATE", "auth/storage_state.json")
1010

11-
@pytest.mark.sample
11+
@pytest.mark.bootstrap
1212
def test_signup_and_save_session(page: Page, context: BrowserContext):
13+
# If storage already exists, don't run the bootstrap again
14+
if Path(STORAGE_PATH).exists():
15+
pytest.skip(f"Storage state already exists at {STORAGE_PATH}; bootstrap not needed.")
16+
1317
sp = SignupPage(page)
1418
sp.goto()
1519

1620
epoch = int(time.time())
17-
full_name = f"Test User {epoch}"
21+
username = f"TestUser{epoch}"
1822
email = f"playwright_user_{epoch}@example.com"
1923
password = f"P@ssw0rd{epoch}!"
2024

21-
sp.sign_up(full_name, email, password)
25+
sp.sign_up(username, email, password)
26+
2227
Path("auth").mkdir(parents=True, exist_ok=True)
2328
context.storage_state(path=STORAGE_PATH)
24-
2529
assert Path(STORAGE_PATH).exists(), f"Expected storage state at {STORAGE_PATH}"

0 commit comments

Comments
 (0)