| from pathlib import Path | |
| def test_bucket_setup_block_is_visible_above_new_build(): | |
| html = Path("web/index.html").read_text(encoding="utf-8") | |
| assert 'id="bucketSetupPanel"' in html | |
| assert html.index('id="bucketSetupPanel"') < html.index('id="newBuildCard"') | |
| assert 'id="checkBucket"' in html | |
| assert 'id="createBucket"' in html | |
| def test_user_chip_is_a_real_sign_in_link(): | |
| html = Path("web/index.html").read_text(encoding="utf-8") | |
| assert 'id="userChip" href="/oauth/huggingface/login"' in html | |
| js = Path("web/static/app.js").read_text(encoding="utf-8") | |
| assert "userChip.href='/oauth/huggingface/login'" in js | |
| assert "userChip.href=`https://huggingface.co/${me.username}`" in js | |
| def test_latest_events_no_longer_has_view_all_button(): | |
| html = Path("web/index.html").read_text(encoding="utf-8") | |
| js = Path("web/static/progress.js").read_text(encoding="utf-8") | |
| assert 'id="viewAllEvents"' not in html | |
| assert "toggleAllEvents" not in js | |
| def test_runs_explorer_is_limited_to_five_rows_with_pagination(): | |
| html = Path("web/index.html").read_text(encoding="utf-8") | |
| runs_js = Path("web/static/runs.js").read_text(encoding="utf-8") | |
| app_js = Path("web/static/app.js").read_text(encoding="utf-8") | |
| assert 'id="runsPagination"' in html | |
| assert "runsPerPage:5" in app_js | |
| assert "renderRunPagination" in runs_js | |
| assert "runs.slice(state.runPage*perPage,state.runPage*perPage+perPage)" in runs_js | |
| def test_progress_endpoint_uses_view_model_links_for_job_url(): | |
| app_py = Path("app.py").read_text(encoding="utf-8") | |
| assert '"version": "v70-progress-resume-events-latency"' in app_py | |
| assert 'view = build_run_view_model(run_id, bundle, bucket_source=bucket_source)' in app_py | |
| assert '"links": view.get("links")' in app_py | |