🧪 Test Hub
testing: Demo target v3.0.0 · built-in demo site

DEMO-008 Authenticated flow + session checks

Edit Load test Duplicate

Logs in to the demo target and verifies session regeneration, access control on a private page, and that logout really invalidates the session.

authdemosecurity version: 1.0 DEMO-008__authenticated_checks.py

Runs
3
Pass rate
100%
3 passed / 0 failed
Avg duration
2s
p95 2s
Estimate
2s
avg of last 10 judged runs
Flakiness
0.00
0 stable · 1 alternates
Current streak
3
passed

Last 3 results newest on the right — click a square to open that run

Duration per run point color = outcome; dashed = 7-run average; click a point to open the run

Step timing trends the same step compared across the last 3 runs — slowest steps first, one line each

How long it takes distribution of 3 runs — two humps mean two different behaviours hiding behind one average

fastest 1s · slowest 2s

Why this test failed grouped by message, last 90 days

No failures recorded. 👍

Outcomes by target version

What this test does plain language, derived from the code

  1. page.goto(f"{ctx.base_url}login/")
  2. with ctx.logging_in():
  3. Type “tester” into #username
  4. page.fill("#password", ctx.secret("demo_password", "demo-password"))
  5. Click #login-btn
  6. Wait until #private-heading appears
  7. Take a screenshot (“signed-in”)
  8. Check #who contains “tester”
  9. ctx.check_protected_page()
  10. with ctx.logging_out():
  11. Click #logout-btn
  12. Wait until #login-btn appears
  13. Note in the log: “signed out”
Show the code
"""Log in, and let the security checks watch the session while you do.

Three things get verified along the way, none of which attack anything —
they observe a flow the application performs anyway:

  ctx.logging_in()          the session id must CHANGE when you authenticate.
                            If it does not, whoever knew the earlier value
                            now holds a logged-in session (session fixation).

  ctx.check_protected_page() the same page is fetched in a brand new browser
                            with no cookies. It must NOT come back 200.

  ctx.logging_out()         the old session cookie is replayed after logout.
                            It must no longer work.

The password comes from this machine's credential store, never from this
file — see Settings -> Credentials. Set one called `demo_password`, or the
test falls back to the demo default.
"""


def run(page, ctx):
    page.goto(f"{ctx.base_url}login/")

    with ctx.logging_in():
        page.fill("#username", "tester")
        page.fill("#password", ctx.secret("demo_password", "demo-password"))
        page.click("#login-btn")
        page.wait_for_selector("#private-heading")

    ctx.screenshot("signed-in")
    assert "tester" in page.inner_text("#who")

    # Does the private page actually require the session?
    ctx.check_protected_page()

    with ctx.logging_out():
        page.click("#logout-btn")
        page.wait_for_selector("#login-btn")

    ctx.log("signed out")

All runs

RunStatusQueuedDuration VersionTriggerBatch
#457 passed 2026-09-25 00:25:05 1s 3.0.0 cli-adopted 8 tests (terminal)
#449 passed 2026-09-25 00:24:35 2s 3.0.0 cli-adopted 8 tests (terminal)
#441 passed 2026-09-25 00:24:06 2s 3.0.0 cli-adopted 8 tests (terminal)