Upload 18 files
Browse files
tests/test_custom_ui_shell.py
CHANGED
|
@@ -95,6 +95,6 @@ def test_css_contains_one_page_responsive_layout():
|
|
| 95 |
".space-test-grid{display:grid;grid-template-columns:minmax(0,1.15fr) 360px",
|
| 96 |
"word-break:normal",
|
| 97 |
".run-row.selected",
|
| 98 |
-
"@media (max-width:
|
| 99 |
]:
|
| 100 |
assert snippet in css.replace(" ", "") if "word-break:normal" == snippet else snippet in css
|
|
|
|
| 95 |
".space-test-grid{display:grid;grid-template-columns:minmax(0,1.15fr) 360px",
|
| 96 |
"word-break:normal",
|
| 97 |
".run-row.selected",
|
| 98 |
+
"@media (max-width: 720px)",
|
| 99 |
]:
|
| 100 |
assert snippet in css.replace(" ", "") if "word-break:normal" == snippet else snippet in css
|
tests/test_pass46_ui_regressions.py
CHANGED
|
@@ -11,5 +11,5 @@ def test_selecting_run_still_does_not_force_hidden_navigation():
|
|
| 11 |
def test_mobile_css_prevents_letter_by_letter_wrapping_in_one_page_layout():
|
| 12 |
css = Path("web/static/app.css").read_text(encoding="utf-8")
|
| 13 |
assert "word-break:normal" in css.replace(" ", "")
|
| 14 |
-
assert "@media (max-width:
|
| 15 |
assert ".workspace-grid,.space-test-grid,.editor-grid,.two-cols,.summary-meta-grid,.diagnostic-list,.bottom-split,.three-way,.run-storage,.test-top-row{grid-template-columns:1fr}".replace(" ", "") in css.replace(" ", "")
|
|
|
|
| 11 |
def test_mobile_css_prevents_letter_by_letter_wrapping_in_one_page_layout():
|
| 12 |
css = Path("web/static/app.css").read_text(encoding="utf-8")
|
| 13 |
assert "word-break:normal" in css.replace(" ", "")
|
| 14 |
+
assert "@media (max-width: 720px)" in css
|
| 15 |
assert ".workspace-grid,.space-test-grid,.editor-grid,.two-cols,.summary-meta-grid,.diagnostic-list,.bottom-split,.three-way,.run-storage,.test-top-row{grid-template-columns:1fr}".replace(" ", "") in css.replace(" ", "")
|
tests/test_v50_job_links_responsive.py
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pathlib import Path
|
| 2 |
+
|
| 3 |
+
from src.bucket import summarize_run_bundle
|
| 4 |
+
from src.view_models import build_run_view_model
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def test_summary_reconstructs_job_url_from_summary_job_id_and_bucket_owner():
|
| 8 |
+
bundle = {
|
| 9 |
+
"summary_file": {"job_id": "abc123", "status": "running", "target_space": "fffiloni/demo"},
|
| 10 |
+
"launch": {},
|
| 11 |
+
"state": {},
|
| 12 |
+
"inference_gate": {},
|
| 13 |
+
"generation_smoke": {},
|
| 14 |
+
"hardware_strategy": {},
|
| 15 |
+
}
|
| 16 |
+
summary = summarize_run_bundle("run-1", bundle, bucket_source="fffiloni/space-factory-runs")
|
| 17 |
+
assert summary["job_url"] == "https://huggingface.co/jobs/fffiloni/abc123"
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
def test_view_model_reconstructs_job_url_from_job_id_and_bucket_owner():
|
| 21 |
+
bundle = {
|
| 22 |
+
"summary": {
|
| 23 |
+
"run_id": "run-1",
|
| 24 |
+
"job_id": "job789",
|
| 25 |
+
"status": "running",
|
| 26 |
+
"target_space": "fffiloni/demo",
|
| 27 |
+
"target_space_url": "https://huggingface.co/spaces/fffiloni/demo",
|
| 28 |
+
"artifacts_url": "https://huggingface.co/buckets/fffiloni/space-factory-runs/tree/runs/run-1",
|
| 29 |
+
},
|
| 30 |
+
"state": {},
|
| 31 |
+
"launch": {},
|
| 32 |
+
"events": [],
|
| 33 |
+
"generation_smoke": {},
|
| 34 |
+
"inference_gate": {},
|
| 35 |
+
"hardware_strategy": {},
|
| 36 |
+
"technical_blockers": {},
|
| 37 |
+
}
|
| 38 |
+
view = build_run_view_model("run-1", bundle, bucket_source="fffiloni/space-factory-runs")
|
| 39 |
+
assert view["links"]["job_url"] == "https://huggingface.co/jobs/fffiloni/job789"
|
| 40 |
+
assert view["status_model"]["has_job_url"] is True
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
def test_frontend_job_fallback_uses_bucket_owner_and_created_by():
|
| 44 |
+
app_js = Path("web/static/app.js").read_text(encoding="utf-8")
|
| 45 |
+
runs_js = Path("web/static/runs.js").read_text(encoding="utf-8")
|
| 46 |
+
assert "ownerFromBucketSource" in app_js
|
| 47 |
+
assert "out.created_by" in app_js
|
| 48 |
+
assert "inferredOwnerFromBucket" in runs_js
|
| 49 |
+
assert "summary.created_by" in runs_js
|
| 50 |
+
assert "detail.bucket_source" in runs_js
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
def test_responsive_breakpoints_are_less_aggressive():
|
| 54 |
+
css = Path("web/static/app.css").read_text(encoding="utf-8")
|
| 55 |
+
assert "@media (max-width: 1120px)" in css
|
| 56 |
+
assert "@media (max-width: 720px)" in css
|
| 57 |
+
assert "@media (max-width: 1260px)" not in css
|
| 58 |
+
assert "@media (max-width: 860px)" not in css
|