-
Notifications
You must be signed in to change notification settings - Fork 0
Harden app stability and expand end-to-end coverage #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
a01bb1b
Harden empty-path, API errors, and settings, then lock them with E2E.
cursoragent 23a5018
Keep workspaces when saving settings, and stop stale UI errors.
cursoragent ced4736
Assert the full workspace list when settings saves omit or empty it.
cursoragent File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| from __future__ import annotations | ||
|
|
||
| import shutil | ||
| import socket | ||
| import threading | ||
| from collections.abc import Iterator | ||
| from pathlib import Path | ||
|
|
||
| import pytest | ||
| import uvicorn | ||
|
|
||
| from loadpath.server.app import create_app | ||
| from tests.conftest import prepare_review_repo | ||
|
|
||
|
|
||
| def _free_port() -> int: | ||
| sock = socket.socket() | ||
| sock.bind(("127.0.0.1", 0)) | ||
| port = sock.getsockname()[1] | ||
| sock.close() | ||
| return port | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def live_app(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> Iterator[tuple[str, Path]]: | ||
| original_home = Path.home() | ||
| monkeypatch.setenv("PLAYWRIGHT_BROWSERS_PATH", str(original_home / ".cache" / "ms-playwright")) | ||
| monkeypatch.setenv("HOME", str(tmp_path / "home")) | ||
| (tmp_path / "home").mkdir() | ||
| repo = prepare_review_repo(tmp_path) | ||
| pretty = tmp_path / "acme-billing" | ||
| shutil.copytree(repo, pretty) | ||
| port = _free_port() | ||
| server = uvicorn.Server( | ||
| uvicorn.Config(create_app(), host="127.0.0.1", port=port, log_level="warning") | ||
| ) | ||
| thread = threading.Thread(target=server.run, daemon=True) | ||
| thread.start() | ||
| for _ in range(200): | ||
| if server.started: | ||
| break | ||
| thread.join(0.05) | ||
| if not server.started: | ||
| pytest.skip("uvicorn failed to start") | ||
| try: | ||
| yield f"http://127.0.0.1:{port}", pretty | ||
| finally: | ||
| server.should_exit = True | ||
| thread.join(timeout=5) | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def browser_page(): | ||
| pytest.importorskip("playwright") | ||
| from playwright.sync_api import sync_playwright | ||
|
|
||
| try: | ||
| pw = sync_playwright().start() | ||
| browser = pw.chromium.launch(headless=True) | ||
| except Exception as exc: # noqa: BLE001 | ||
| pytest.skip(f"Chromium not available: {exc}") | ||
| context = browser.new_context(viewport={"width": 1440, "height": 900}) | ||
| context.grant_permissions(["clipboard-read", "clipboard-write"]) | ||
| page = context.new_page() | ||
| try: | ||
| yield page | ||
| finally: | ||
| browser.close() | ||
| pw.stop() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.