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
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
- page.goto(f"{ctx.base_url}login/")
- with ctx.logging_in():
- Type “tester” into #username
- page.fill("#password", ctx.secret("demo_password", "demo-password"))
- Click #login-btn
- Wait until #private-heading appears
- Take a screenshot (“signed-in”)
- Check #who contains “tester”
- ctx.check_protected_page()
- with ctx.logging_out():
- Click #logout-btn
- Wait until #login-btn appears
- 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
| Run | Status | Queued | Duration | Version | Trigger | Batch |
|---|---|---|---|---|---|---|
| #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) |