chore: remove pre-locust test stubs and add daily topic, follow router, password reset, image upload, and badge awarding features

This commit is contained in:
2026-05-10 22:41:41 +00:00
parent f4343c3d05
commit d8ef8ebef2
31 changed files with 598 additions and 473 deletions
+19 -10
View File
@@ -47,12 +47,16 @@ def app_server(test_db_path):
env = os.environ.copy()
env["DEVPLACE_DATABASE_URL"] = f"sqlite:///{test_db_path}"
env["SECRET_KEY"] = "test-secret-key"
proc = subprocess.Popen(
[sys.executable, "-m", "uvicorn", "devplacepy.main:app",
"--host", "127.0.0.1", "--port", "10501"],
cwd=str(PROJECT_ROOT), env=env,
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL,
)
err_path = Path("/tmp/devplace_test_server_err.log")
with open(err_path, "w") as err_f:
proc = subprocess.Popen(
[sys.executable, "-m", "uvicorn", "devplacepy.main:app",
"--host", "127.0.0.1", "--port", "10501"],
cwd=str(PROJECT_ROOT),
env=env,
stdout=subprocess.DEVNULL,
stderr=err_f,
)
deadline = time.time() + 20
while time.time() < deadline:
try:
@@ -83,7 +87,7 @@ def browser(playwright_instance):
yield b
b.close()
@pytest.fixture
@pytest.fixture(scope="module")
def browser_context(browser):
ctx = browser.new_context(viewport={"width": 1400, "height": 900})
yield ctx
@@ -92,6 +96,7 @@ def browser_context(browser):
@pytest.fixture
def page(browser_context):
browser_context.clear_cookies()
p = browser_context.new_page()
p.set_default_timeout(10000)
p.bring_to_front()
@@ -100,7 +105,7 @@ def page(browser_context):
def signup_user(page, user):
page.bring_to_front()
page.goto(f"{BASE_URL}/auth/signup")
page.goto(f"{BASE_URL}/auth/signup", wait_until="domcontentloaded")
page.fill("#username", user["username"])
page.fill("#email", user["email"])
page.fill("#password", user["password"])
@@ -111,11 +116,15 @@ def signup_user(page, user):
def login_user(page, user):
page.bring_to_front()
page.goto(f"{BASE_URL}/auth/login")
page.goto(f"{BASE_URL}/auth/login", wait_until="domcontentloaded")
page.fill("#email", user["email"])
page.fill("#password", user["password"])
page.click("button:has-text('Sign in')")
page.wait_for_url("**/feed", timeout=10000)
try:
page.wait_for_url("**/feed", timeout=10000, wait_until="domcontentloaded")
except Exception as e:
print(f"\n[LOGIN FAIL] URL: {page.url}, title: {page.title()}, err: {e}")
raise
@pytest.fixture(scope="session")