Refine runs table state layout

This commit is contained in:
Abel Luck 2026-03-31 12:25:46 +02:00
parent db1d9b44b7
commit ba33491479
6 changed files with 241 additions and 31 deletions

View file

@ -145,6 +145,48 @@ def test_runs_page_renders_completed_execution_end_time_as_relative_hoverable_ti
assert ">2 hours ago<" in body
def test_runs_page_renders_completed_execution_state_cell_with_duration_and_end_time() -> (
None
):
ended_at = "2026-01-15T10:00:00+00:00"
body = str(
runs_page(
completed_executions=(
{
"source": "Completed source",
"slug": "completed-source",
"job_id": 7,
"execution_id": 42,
"ended_at": "2 hours ago",
"ended_at_iso": ended_at,
"duration": "00:00:48",
"status": "Succeeded",
"status_tone": "done",
"stats": "1 requests • 1 items • 1 bytes",
"summary": "Worker exited successfully",
"log_href": "/job/7/execution/42/logs",
},
)
)
)
assert re.search(
r"<th[^>]*>State</th>\s*<th[^>]*>Source</th>\s*<th[^>]*>Summary</th>",
body,
)
assert not re.search(
r"<th[^>]*>#</th>\s*<th[^>]*>State</th>\s*<th[^>]*>Source</th>\s*<th[^>]*>Summary</th>",
body,
)
assert ">#42<" in body
assert ">Ended<" not in body
assert ">00:00:48<" in body
assert 'data-ended-at="2026-01-15T10:00:00+00:00"' in body
assert "M12 6v6h4.5" in body
assert "M6.75 3v2.25M17.25 3v2.25" in body
assert "Succeeded" in body
def test_runs_page_renders_combined_running_jobs_table() -> None:
body = str(
runs_page(
@ -178,6 +220,40 @@ def test_runs_page_renders_combined_running_jobs_table() -> None:
assert "/actions/queued-executions/42/cancel" in body
def test_runs_page_moves_scheduled_jobs_state_column_to_second_position() -> None:
body = str(
runs_page(
upcoming_jobs=(
{
"source": "Parity source",
"slug": "parity-source",
"job_id": 7,
"next_run": "in 5 minutes",
"next_run_at": "2026-03-30T12:35:00+00:00",
"schedule": "*/5 * * * *",
"enabled_label": "Enabled",
"enabled_tone": "scheduled",
"run_disabled": False,
"run_reason": "Ready",
"toggle_label": "Disable",
"toggle_post_path": "/actions/jobs/7/toggle-enabled",
"run_post_path": "/actions/jobs/7/run-now",
"delete_post_path": "/actions/jobs/7/delete",
},
)
)
)
assert re.search(
r"<th[^>]*>Source</th>\s*<th[^>]*>State</th>\s*<th[^>]*>Next run</th>",
body,
)
assert re.search(
r"Parity source.*?>Enabled<.*?>in 5 minutes<.*?>\*/5 \* \* \* \*<",
body,
)
def test_sources_page_removes_view_runs_action_and_last_run_caption() -> None:
body = str(
sources_page(