fix: show technical timestamps in tooltips
This commit is contained in:
@@ -48,6 +48,8 @@ def _panel_client():
|
||||
},
|
||||
installation_id=installation.id,
|
||||
)
|
||||
blocker.first_seen_at = now - timedelta(days=1, seconds=11)
|
||||
blocker.last_seen_at = now.replace(second=37)
|
||||
record_event(
|
||||
session,
|
||||
tenant_id=installation.tenant_id,
|
||||
@@ -92,7 +94,7 @@ def test_dashboard_lists_bounded_failed_job_rows_with_identity_error_age_and_emp
|
||||
factory = client._session_factory
|
||||
with factory() as session:
|
||||
for index in range(12):
|
||||
session.add(Job(agent_id=agent_id, kind="REPROCESS_PRODUCTS", status="FAILED", error=f"erro curto {index}", created_at=datetime(2026, 9, 22, 18, 0, tzinfo=timezone.utc)))
|
||||
session.add(Job(agent_id=agent_id, kind="REPROCESS_PRODUCTS", status="FAILED", error=f"erro curto {index}", created_at=datetime(2026, 9, 22, 18, 0, index, tzinfo=timezone.utc), finished_at=datetime(2026, 9, 22, 18, 5, index, tzinfo=timezone.utc)))
|
||||
session.commit()
|
||||
response = client.get("/")
|
||||
assert response.status_code == 200
|
||||
@@ -100,6 +102,10 @@ def test_dashboard_lists_bounded_failed_job_rows_with_identity_error_age_and_emp
|
||||
assert "erro curto" in response.text and "Job ID" in response.text and "Criado" in response.text
|
||||
assert 'href="/jobs?job_id=' in response.text
|
||||
assert response.text.count("erro curto") == 10
|
||||
assert 'title="2026-09-22T18:00:11+00:00"' in response.text
|
||||
assert 'title="2026-09-22T18:05:11+00:00"' in response.text
|
||||
assert ">22/09/2026 15:00<" in response.text
|
||||
assert ">22/09/2026 15:05<" in response.text
|
||||
with factory() as session:
|
||||
session.query(Job).filter(Job.status == "FAILED").delete()
|
||||
session.commit()
|
||||
@@ -153,6 +159,26 @@ def test_agents_render_separate_health_and_fiscal_status_with_server_sort():
|
||||
assert 'value="worst_coverage"' in response.text
|
||||
|
||||
|
||||
def test_agent_list_and_detail_show_localized_last_seen_with_iso_tooltip():
|
||||
client, agent_id, _ = _panel_client()
|
||||
expected_iso = '2026-09-22T19:11:37+00:00'
|
||||
expected_display = '22/09/2026 16:11'
|
||||
with client._session_factory() as session:
|
||||
installation = session.scalar(select(Installation).where(Installation.agent_id == agent_id))
|
||||
installation.last_seen_at = datetime(2026, 9, 22, 19, 11, 37, tzinfo=timezone.utc)
|
||||
session.commit()
|
||||
|
||||
agents = client.get("/agents")
|
||||
detail = client.get(f"/agents/{agent_id}")
|
||||
|
||||
assert agents.status_code == 200
|
||||
assert f'title="{expected_iso}"' in agents.text
|
||||
assert f'>{expected_display}<' in agents.text
|
||||
assert detail.status_code == 200
|
||||
assert f'title="{expected_iso}"' in detail.text
|
||||
assert f'>{expected_display} ·' in detail.text
|
||||
|
||||
|
||||
def test_jobs_render_client_identity_duration_and_preserve_filters():
|
||||
client, _, _ = _panel_client()
|
||||
|
||||
@@ -169,6 +195,36 @@ def test_jobs_render_client_identity_duration_and_preserve_filters():
|
||||
assert "Agent 1" not in response.text
|
||||
|
||||
|
||||
def test_jobs_show_localized_created_and_finished_with_iso_tooltips():
|
||||
client, agent_id, _ = _panel_client()
|
||||
with client._session_factory() as session:
|
||||
session.add(Job(agent_id=agent_id, kind="REPROCESS_PRODUCTS", status="COMPLETED", created_at=datetime(2026, 9, 22, 19, 8, tzinfo=timezone.utc), started_at=datetime(2026, 9, 22, 19, 9, tzinfo=timezone.utc), finished_at=datetime(2026, 9, 22, 19, 10, tzinfo=timezone.utc)))
|
||||
session.commit()
|
||||
|
||||
response = client.get("/jobs")
|
||||
|
||||
assert response.status_code == 200
|
||||
assert 'title="2026-09-22T19:08:00+00:00"' in response.text
|
||||
assert 'title="2026-09-22T19:10:00+00:00"' in response.text
|
||||
assert ">22/09/2026 16:08<" in response.text
|
||||
assert ">22/09/2026 16:10<" in response.text
|
||||
|
||||
|
||||
def test_blocker_list_and_detail_show_localized_seen_times_with_iso_tooltips():
|
||||
client, _, blocker_id = _panel_client()
|
||||
|
||||
listing = client.get("/blockers")
|
||||
detail = client.get(f"/blockers/{blocker_id}")
|
||||
|
||||
assert listing.status_code == 200
|
||||
assert 'title="2026-09-22T19:11:37+00:00"' in listing.text
|
||||
assert ">22/09/2026 16:11<" in listing.text
|
||||
assert detail.status_code == 200
|
||||
assert 'title="2026-09-21T19:10:49+00:00"' in detail.text
|
||||
assert 'title="2026-09-22T19:11:37+00:00"' in detail.text
|
||||
assert ">22/09/2026 16:11<" in detail.text
|
||||
|
||||
|
||||
def test_blockers_render_visible_filters_summary_priority_and_detail_link():
|
||||
client, _, blocker_id = _panel_client()
|
||||
|
||||
@@ -203,7 +259,7 @@ def test_agent_and_blocker_details_keep_safe_forms_and_human_event_rows():
|
||||
assert ">ST</span><b>0</b>" in agent_response.text
|
||||
agent_blockers = client.get(f"/blockers?agent_id={agent_id}")
|
||||
assert "Produto de teste" in agent_blockers.text and "LEGACY" not in agent_blockers.text
|
||||
assert not re.search(r"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}", agent_response.text)
|
||||
assert not re.search(r"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}", re.sub(r' title="[^"]*"', "", agent_response.text))
|
||||
assert 'value="WARNING" selected' in agent_response.text
|
||||
assert 'value="PRODUCT_BLOCKED"' in agent_response.text
|
||||
|
||||
@@ -212,7 +268,7 @@ def test_agent_and_blocker_details_keep_safe_forms_and_human_event_rows():
|
||||
assert label in blocker_response.text
|
||||
assert 'name="context"' not in blocker_response.text
|
||||
assert "data-confirm" not in blocker_response.text
|
||||
assert not re.search(r"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}", blocker_response.text)
|
||||
assert not re.search(r"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}", re.sub(r' title="[^"]*"', "", blocker_response.text))
|
||||
|
||||
|
||||
def test_agent_detail_resolves_agent_after_first_hundred_installations():
|
||||
|
||||
Reference in New Issue
Block a user