beginning of testing framework - #54
Open
mpatrikios wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces an initial automated testing setup for both the frontend (Playwright E2E) and backend (pytest unit/API tests), along with documentation to run them locally.
Changes:
- Add Playwright configuration, E2E helper(s), and initial E2E specs for health/auth/matching.
- Add pytest + pytest-asyncio, pytest configuration, shared backend test fixtures, and initial unit/API tests.
- Document how to run backend tests and frontend E2E tests in the project README.
Reviewed changes
Copilot reviewed 13 out of 16 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/playwright.config.js | Adds Playwright test runner configuration (testDir, baseURL, chromium project). |
| frontend/package.json | Adds Playwright dependency and npm scripts to run E2E tests. |
| frontend/package-lock.json | Locks Playwright and its transitive dependencies. |
| frontend/e2e/health.spec.js | Adds a basic “app loads” smoke test. |
| frontend/e2e/auth.spec.js | Adds basic login page + login failure/skip-on-missing-env coverage. |
| frontend/e2e/matching.spec.js | Adds a matching E2E test that navigates and asserts a candidate item is visible. |
| frontend/e2e/helpers/auth.js | Centralizes login helper and shared selectors/env var handling. |
| backend/tests/conftest.py | Adds session env patching and a shared FastAPI TestClient fixture. |
| backend/tests/api/test_main.py | Adds API smoke tests for / and /health. |
| backend/tests/api/init.py | Initializes backend API test package. |
| backend/tests/unit/test_location_matching.py | Adds unit tests for location commutability/haversine helpers. |
| backend/tests/unit/test_cosine_similarity.py | Adds unit tests for cosine similarity helpers + explanation builder. |
| backend/tests/unit/init.py | Initializes backend unit test package. |
| backend/requirements.txt | Adds pytest and pytest-asyncio to backend dependencies. |
| backend/pytest.ini | Configures pytest discovery and asyncio mode. |
| README.md | Documents commands to run backend tests and frontend E2E tests. |
Files not reviewed (1)
- frontend/package-lock.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+13
to
+17
| await page.goto('/matches'); | ||
|
|
||
| // Wait for at least one candidate card to appear | ||
| const candidateCard = page.locator(SELECTORS.candidateCard).first(); | ||
| await expect(candidateCard).toBeVisible({ timeout: 15000 }); |
| passwordInput: 'input[type="password"]', | ||
| submitButton: 'button[type="submit"]', | ||
| errorAlert: '[role="alert"], .error, [data-testid="error"]', | ||
| candidateCard: '[data-testid="candidate-card"], .candidate-card', |
Comment on lines
+34
to
+40
| mock_mongo = MagicMock() | ||
| mock_mongo.client.server_info.return_value = {"version": "6.0"} | ||
|
|
||
| with patch("src.database.connection.mongo_connection", mock_mongo): | ||
| from src.api.main import app | ||
| with TestClient(app) as c: | ||
| yield c |
| @@ -0,0 +1,3 @@ | |||
| [pytest] | |||
| testpaths = tests | |||
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.