# retoor <retoor@molodetz.nl>

import hashlib
import time
from datetime import datetime, timedelta, timezone
from playwright.sync_api import expect
from tests.conftest import BASE_URL
from devplacepy.database import get_table
from devplacepy.utils import hash_password, generate_uid


def test_forgot_password_page_loads(page, app_server):
    page.goto(f"{BASE_URL}/auth/forgot-password", wait_until="domcontentloaded")
    assert page.is_visible("input#email")
    assert page.is_visible("button:has-text('Send Reset Link')")


def test_forgot_password_submit_shows_sent(page, app_server):
    page.goto(f"{BASE_URL}/auth/forgot-password", wait_until="domcontentloaded")
    page.fill("#email", "anybody@example.com")
    page.click("button:has-text('Send Reset Link')")
    page.locator(".auth-success").wait_for(state="visible")
