various fixes
This commit is contained in:
@@ -20,15 +20,18 @@ Per role, the VISIBLE inventory:
|
||||
|
||||
* admin: brand + nav [Chat, #nav-sources, #nav-git-sources, #nav-tuning]
|
||||
(four links, that order — the Git sources link joined in phase 35,
|
||||
owner permission 2026-08-26) + #steering-toggle + #sync-btn +
|
||||
#new-chat-btn + #sign-out-btn (with #sign-in-link hidden) — on all
|
||||
five pages, same id+class inventory, same DOM order;
|
||||
owner permission 2026-08-26) + #sync-btn + #new-chat-btn +
|
||||
#sign-out-btn (with #sign-in-link hidden) — on all five pages, same
|
||||
id+class inventory, same DOM order. The #steering-toggle was removed
|
||||
from the navbar at owner request (2026-08-28); note management lives
|
||||
on /tuning.html;
|
||||
* anonymous: brand + nav [Chat] (#nav-sources / #nav-git-sources /
|
||||
#nav-tuning hidden — locked A10 UI revision) + #new-chat-btn +
|
||||
#sign-in-link (with #sync-btn hidden, #sign-out-btn hidden) on all
|
||||
five pages — and the steering toggle + panel are ABSENT from the DOM
|
||||
(phase 16 "absent, not hidden" treatment, carried into phase 34 task
|
||||
01; test_admin_auth pins it).
|
||||
five pages — and the steering toggle (removed at owner request,
|
||||
2026-08-28) + panel are ABSENT from the DOM (the panel via the phase
|
||||
16 "absent, not hidden" treatment, carried into phase 34 task 01;
|
||||
test_admin_auth pins it).
|
||||
|
||||
Normalization for the inventory comparison: the current-page ``is-active``
|
||||
nav marker and the sign-in ``?next=`` value legitimately differ per page,
|
||||
@@ -40,26 +43,28 @@ page's bar (64px / 58px) and row 2 (``.doc-titlebar``) is present with
|
||||
(phase 13) is honored — ``back=`` accepted for same-origin relative
|
||||
URLs, rejected (→ /sources.html) otherwise.
|
||||
|
||||
Steering works off-chat: on /tuning.html (admin, zero notes) the toggle
|
||||
opens/closes #steering-panel with the empty state and a 0 count badge —
|
||||
no chat needed. Sync is present, not triggered: #sync-btn is visible on
|
||||
/tuning.html but is never clicked here (a real sync clones real repos —
|
||||
the full state machine is test_sync_button.py's job).
|
||||
Steering off-chat: on /tuning.html (admin, zero notes) the navbar
|
||||
carries no steering toggle (removed at owner request, 2026-08-28) — the
|
||||
header #steering-panel section still ships hidden and the Tuning
|
||||
page's own note list shows the empty state — no chat needed. Sync is
|
||||
present, not triggered: #sync-btn is visible on /tuning.html but is
|
||||
never clicked here (a real sync clones real repos — the full state
|
||||
machine is test_sync_button.py's job).
|
||||
|
||||
Determinism note: every assertion is settled-state — each page visit
|
||||
first waits for the whoami toggle to land (exactly one of Sign in /
|
||||
Sign out visible; the anonymous removal of the steering toggle happens
|
||||
Sign out visible; the anonymous removal of the steering panel happens
|
||||
in the SAME initSharedHeader pass) and, on the viewer, for the document
|
||||
title to render. The seed truncates steering_notes, so the count badge is
|
||||
0 on every admin page. No chat turn is ever submitted; #sync-btn is
|
||||
never clicked.
|
||||
title to render. The seed truncates steering_notes, so the Tuning page
|
||||
shows the empty state on every admin page. No chat turn is ever
|
||||
submitted; #sync-btn is never clicked.
|
||||
|
||||
Test → story mapping (Playwright Mapping Rule):
|
||||
1. ``test_admin_inventory_identical_on_all_five_pages``
|
||||
2. ``test_anonymous_inventory_identical_on_all_five_pages``
|
||||
3. ``test_viewer_row1_height_matches_chat_and_titlebar_present``
|
||||
4. ``test_viewer_back_link_honors_back_param``
|
||||
5. ``test_steering_panel_works_off_chat_on_tuning_page``
|
||||
5. ``test_steering_surface_off_chat_on_tuning_page``
|
||||
6. ``test_sync_button_present_on_tuning_page_without_triggering``
|
||||
"""
|
||||
from __future__ import annotations
|
||||
@@ -152,7 +157,6 @@ _INVENTORY_JS = """() => {
|
||||
const sel = [
|
||||
".brand",
|
||||
".app-nav > a.nav-link",
|
||||
"#steering-toggle",
|
||||
"#sync-btn",
|
||||
"#new-chat-btn",
|
||||
"#sign-in-link",
|
||||
@@ -180,8 +184,8 @@ def _header_inventory(page: Page) -> list[str]:
|
||||
def _wait_settled(page: Page, admin: bool) -> None:
|
||||
"""Wait for initSharedHeader's whoami toggle to land: exactly one of
|
||||
Sign in / Sign out is visible (both ship hidden in the HTML). For
|
||||
anonymous visitors the steering toggle + panel removal happens in
|
||||
the SAME pass, so they are already gone when this returns."""
|
||||
anonymous visitors the steering panel removal happens in the SAME
|
||||
pass, so it is already gone when this returns."""
|
||||
if admin:
|
||||
expect(page.locator("#sign-out-btn")).to_be_visible(timeout=15_000)
|
||||
expect(page.locator("#sign-in-link")).to_be_hidden()
|
||||
@@ -220,7 +224,11 @@ def _visit(page: Page, app_url: str, name: str, url: str, admin: bool) -> list[s
|
||||
# revealed on every page, between Sources and Tuning.
|
||||
expect(page.locator("#nav-git-sources")).to_be_visible()
|
||||
expect(page.locator("#nav-tuning")).to_be_visible()
|
||||
expect(page.locator("#steering-toggle")).to_be_visible()
|
||||
# The steering toggle was removed from the navbar at owner
|
||||
# request (2026-08-28) — absent on every page, admin included.
|
||||
assert page.locator("#steering-toggle").count() == 0, (
|
||||
f"{name}: the steering toggle was removed from the navbar"
|
||||
)
|
||||
expect(page.locator("#sync-btn")).to_be_visible()
|
||||
expect(page.locator("#sign-out-btn")).to_be_visible()
|
||||
expect(page.locator("#sign-in-link")).to_be_hidden()
|
||||
@@ -233,9 +241,11 @@ def _visit(page: Page, app_url: str, name: str, url: str, admin: bool) -> list[s
|
||||
expect(page.locator("#sync-btn")).to_be_hidden()
|
||||
expect(page.locator("#sign-out-btn")).to_be_hidden()
|
||||
expect(page.locator("#sign-in-link")).to_be_visible()
|
||||
# …and the steering surface is ABSENT (phase 16 "absent, not
|
||||
# hidden", carried into the shared module by phase 34 task 01
|
||||
# — test_admin_auth pins the same contract).
|
||||
# …and the steering surface is ABSENT (the toggle was removed
|
||||
# from the navbar at owner request, 2026-08-28; the panel via
|
||||
# phase 16 "absent, not hidden", carried into the shared module
|
||||
# by phase 34 task 01 — test_admin_auth pins the same
|
||||
# contract).
|
||||
assert page.locator("#steering-toggle").count() == 0, (
|
||||
f"{name}: the steering toggle must be absent for anonymous"
|
||||
)
|
||||
@@ -289,7 +299,9 @@ def _admin_login_page_inventory(page: Page, app_url: str) -> list[str]:
|
||||
expect(page.locator("#nav-sources")).to_be_visible()
|
||||
expect(page.locator("#nav-git-sources")).to_be_visible()
|
||||
expect(page.locator("#nav-tuning")).to_be_visible()
|
||||
expect(page.locator("#steering-toggle")).to_be_visible()
|
||||
assert page.locator("#steering-toggle").count() == 0, (
|
||||
"login: the steering toggle was removed from the navbar"
|
||||
)
|
||||
expect(page.locator("#sync-btn")).to_be_visible()
|
||||
expect(page.locator("#sign-out-btn")).to_be_visible()
|
||||
expect(page.locator("#sign-in-link")).to_be_hidden()
|
||||
@@ -434,13 +446,14 @@ def test_viewer_back_link_honors_back_param(
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# 5. Steering works off-chat: on /tuning.html (admin, zero notes) the
|
||||
# header toggle drives the panel — open/close cycle, empty state,
|
||||
# count badge 0. No chat turn is needed.
|
||||
# 5. Steering off-chat: on /tuning.html (admin, zero notes) the navbar
|
||||
# carries no steering toggle (removed at owner request, 2026-08-28)
|
||||
# — the header panel section still ships hidden and the Tuning
|
||||
# page's own note list shows the empty state. No chat turn needed.
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
def test_steering_panel_works_off_chat_on_tuning_page(
|
||||
def test_steering_surface_off_chat_on_tuning_page(
|
||||
page: Page, app_url: str, mock_llm: int, db_ready: None
|
||||
) -> None:
|
||||
page.set_viewport_size({"width": 1280, "height": 800})
|
||||
@@ -450,26 +463,16 @@ def test_steering_panel_works_off_chat_on_tuning_page(
|
||||
expect(page).to_have_url(app_url + TUNING_URL, timeout=30_000)
|
||||
expect(page.locator("#sign-out-btn")).to_be_visible(timeout=15_000)
|
||||
|
||||
# Settled admin state: the toggle is on the bar, the panel ships
|
||||
# hidden, and the count badge reads 0 (zero seeded notes).
|
||||
expect(page.locator("#steering-toggle")).to_be_visible()
|
||||
# Settled admin state: the navbar toggle is GONE (removed at owner
|
||||
# request, 2026-08-28), the header panel section still ships
|
||||
# hidden, and the Tuning page's own note list shows the empty
|
||||
# state (zero seeded notes).
|
||||
assert page.locator("#steering-toggle").count() == 0, (
|
||||
"the steering toggle was removed from the navbar"
|
||||
)
|
||||
expect(page.locator("#steering-panel")).to_be_hidden()
|
||||
expect(page.locator("#steering-count")).to_have_text("0")
|
||||
|
||||
# Open: the panel shows, the toggle's aria-expanded follows, and
|
||||
# the empty state is visible (the re-open refresh fetched 0 notes).
|
||||
page.click("#steering-toggle")
|
||||
expect(page.locator("#steering-panel")).to_be_visible()
|
||||
expect(page.locator("#steering-toggle")).to_have_attribute("aria-expanded", "true")
|
||||
expect(page.locator("#steering-empty")).to_be_visible()
|
||||
expect(page.locator("#steering-list .steering-note")).to_have_count(0)
|
||||
expect(page.locator("#steering-count")).to_have_text("0")
|
||||
|
||||
# Close: the cycle completes, the count badge still reads 0.
|
||||
page.click("#steering-toggle")
|
||||
expect(page.locator("#steering-panel")).to_be_hidden()
|
||||
expect(page.locator("#steering-toggle")).to_have_attribute("aria-expanded", "false")
|
||||
expect(page.locator("#steering-count")).to_have_text("0")
|
||||
expect(page.locator("#tune-list .tuning-note")).to_have_count(0)
|
||||
expect(page.locator("#tune-empty")).to_be_visible()
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user