Refine audit UI and vault settings placement

This commit is contained in:
Joe Julian
2026-04-01 17:11:34 -07:00
parent 99a798afbd
commit 4d35e7237d
4 changed files with 541 additions and 223 deletions
+64
View File
@@ -636,6 +636,70 @@ func TestUIAPIAuditSectionShowsRecordedEvents(t *testing.T) {
}
}
func TestUIAPIAuditEventsMatchFriendlyQuickFilters(t *testing.T) {
t.Parallel()
u := newUIWithSession("desktop", &session.Manager{})
u.auditLog = apiaudit.New(10)
u.auditLog.Record(apiaudit.Event{
Type: apiaudit.EventApprovalAllowed,
TokenName: "Browser Extension",
Operation: apitokens.OperationCopyPassword,
Message: "approved",
})
u.auditLog.Record(apiaudit.Event{
Type: apiaudit.EventApprovalDenied,
TokenName: "CLI",
Operation: apitokens.OperationListEntries,
Message: "denied",
})
u.showAPIAuditSection()
u.search.SetText("Allowed")
if got := u.apiAuditEvents(); len(got) != 1 || got[0].Type != apiaudit.EventApprovalAllowed {
t.Fatalf("apiAuditEvents() with Allowed = %#v, want allowed event", got)
}
u.search.SetText("copy password")
if got := u.apiAuditEvents(); len(got) != 1 || got[0].Operation != apitokens.OperationCopyPassword {
t.Fatalf("apiAuditEvents() with copy password = %#v, want copy_password event", got)
}
u.search.SetText("CLI")
if got := u.apiAuditEvents(); len(got) != 1 || got[0].TokenName != "CLI" {
t.Fatalf("apiAuditEvents() with CLI = %#v, want CLI token event", got)
}
}
func TestUIAPIAuditMessagesGuideQuickFilters(t *testing.T) {
t.Parallel()
u := newUIWithSession("desktop", &session.Manager{})
u.showAPIAuditSection()
if got := u.listEmptyMessage(); got != "No API audit events yet. Connect a trusted client, respond to approval prompts, or issue a token to start recording activity." {
t.Fatalf("listEmptyMessage() = %q, want updated API audit guidance", got)
}
if got := u.detailPlaceholderMessage(); got != "Select an audit event to inspect it, or use Search vault or the quick filters above." {
t.Fatalf("detailPlaceholderMessage() = %q, want quick-filter guidance", got)
}
u.search.SetText("allowed")
if got := u.listEmptyMessage(); got != `No audit events match "allowed". Clear the search or try a different quick filter.` {
t.Fatalf("listEmptyMessage() with search = %q, want quick-filter empty-state guidance", got)
}
}
func TestUILifecycleSecuritySettingsSummaryMovesAdvancedFieldsOutOfOpenFlow(t *testing.T) {
t.Parallel()
u := newUIWithSession("desktop", &session.Manager{})
if got := u.lifecycleSecuritySettingsSummary(); got != "Cipher and KDF now live in Vault Settings so opening and creating a vault stays focused on the file, key material, and sync choices." {
t.Fatalf("lifecycleSecuritySettingsSummary() = %q, want focused lifecycle guidance", got)
}
}
func TestUISelectedEntryFollowsApplicationStateSelection(t *testing.T) {
t.Parallel()