All checks were successful
Deploy Development / deploy (push) Successful in 45s
Test Suite / pytest-backend (push) Successful in 1m13s
Test Suite / lint-backend (push) Successful in 2s
Test Suite / compose-smoke (push) Has been skipped
Test Suite / k6 /api/health Baseline (push) Successful in 18s
Test Suite / playwright-smoke (push) Successful in 15s
Workspace beantwortet die Leitfrage mit prominenten Next-Action- und Heute-Widgets sowie erweitertem Steuerungszustand pro Vorhaben. Co-authored-by: Cursor <cursoragent@cursor.com>
74 lines
2.3 KiB
Python
74 lines
2.3 KiB
Python
"""AP0.10b — Steering UI Minimum tests."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from datetime import datetime, timedelta, timezone
|
|
|
|
from tests.factories import provision_user_in_tenant
|
|
from tests.test_initiatives_actions import (
|
|
_auth,
|
|
_create_action,
|
|
_create_initiative,
|
|
_login,
|
|
)
|
|
|
|
|
|
def test_workspace_next_actions(client):
|
|
user = provision_user_in_tenant(tenant_role="member")
|
|
token = _login(client, user)
|
|
initiative_id = _create_initiative(client, token).json()["id"]
|
|
client.post(
|
|
f"/api/initiatives/{initiative_id}/blockers",
|
|
json={"title": "Blocker für NextAction"},
|
|
headers=_auth(token),
|
|
)
|
|
|
|
res = client.get("/api/workspace/next-actions?limit=5", headers=_auth(token))
|
|
assert res.status_code == 200
|
|
items = res.json()
|
|
assert len(items) >= 1
|
|
assert items[0]["recommended_action"]
|
|
assert items[0]["initiative_id"]
|
|
|
|
|
|
def test_workspace_today_actions(client):
|
|
user = provision_user_in_tenant(tenant_role="member")
|
|
token = _login(client, user)
|
|
initiative_id = _create_initiative(client, token).json()["id"]
|
|
action = _create_action(
|
|
client, token, initiative_id, assigned_actor_ids=[user["actor_id"]]
|
|
).json()
|
|
past = (datetime.now(timezone.utc) - timedelta(hours=1)).isoformat()
|
|
client.patch(
|
|
f"/api/actions/{action['id']}",
|
|
json={"due_at": past},
|
|
headers=_auth(token),
|
|
)
|
|
|
|
res = client.get("/api/workspace/actions/today", headers=_auth(token))
|
|
assert res.status_code == 200
|
|
items = res.json()
|
|
assert len(items) >= 1
|
|
assert items[0]["is_overdue"] is True
|
|
|
|
|
|
def test_steering_snapshot_v2_fields(client):
|
|
user = provision_user_in_tenant(tenant_role="member")
|
|
token = _login(client, user)
|
|
initiative_id = _create_initiative(client, token).json()["id"]
|
|
client.post(
|
|
f"/api/initiatives/{initiative_id}/milestones",
|
|
json={"title": "M1", "status": "planned", "target_date": "2026-12-31"},
|
|
headers=_auth(token),
|
|
)
|
|
|
|
snap = client.get(
|
|
f"/api/initiatives/{initiative_id}/steering-snapshot",
|
|
headers=_auth(token),
|
|
)
|
|
assert snap.status_code == 200
|
|
data = snap.json()
|
|
assert "upcoming_milestones" in data
|
|
assert "next_actions" in data
|
|
assert len(data["upcoming_milestones"]) >= 1
|