Skip to content

beginning of testing framework - #54

Open
mpatrikios wants to merge 1 commit into
mainfrom
FET-76-unit-testing
Open

beginning of testing framework#54
mpatrikios wants to merge 1 commit into
mainfrom
FET-76-unit-testing

Conversation

@mpatrikios

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 thread backend/tests/conftest.py
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
Comment thread backend/pytest.ini
@@ -0,0 +1,3 @@
[pytest]
testpaths = tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants