forked from cardosofelipe/fast-next-template
Add support for E2E testing infrastructure and OAuth configurations
- Introduced make commands for E2E tests using Testcontainers and Schemathesis. - Updated `.env.demo` with configurable OAuth settings for Google and GitHub. - Enhanced `README.md` with updated environment setup instructions. - Added E2E testing dependencies and markers in `pyproject.toml` for real PostgreSQL and API contract validation. - Included new libraries (`arrow`, `attrs`, `docker`, etc.) for testing and schema validation workflows.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
.PHONY: help lint lint-fix format format-check type-check test test-cov validate clean install-dev sync
|
||||
.PHONY: help lint lint-fix format format-check type-check test test-cov validate clean install-dev sync check-docker install-e2e test-e2e test-e2e-schema test-all
|
||||
|
||||
# Default target
|
||||
help:
|
||||
@@ -6,6 +6,7 @@ help:
|
||||
@echo ""
|
||||
@echo "Setup:"
|
||||
@echo " make install-dev - Install all dependencies with uv (includes dev)"
|
||||
@echo " make install-e2e - Install E2E test dependencies (requires Docker)"
|
||||
@echo " make sync - Sync dependencies from uv.lock"
|
||||
@echo ""
|
||||
@echo "Quality Checks:"
|
||||
@@ -17,8 +18,12 @@ help:
|
||||
@echo " make validate - Run all checks (lint + format + types)"
|
||||
@echo ""
|
||||
@echo "Testing:"
|
||||
@echo " make test - Run pytest"
|
||||
@echo " make test - Run pytest (unit/integration, SQLite)"
|
||||
@echo " make test-cov - Run pytest with coverage report"
|
||||
@echo " make test-e2e - Run E2E tests (PostgreSQL, requires Docker)"
|
||||
@echo " make test-e2e-schema - Run Schemathesis API schema tests"
|
||||
@echo " make test-all - Run all tests (unit + E2E)"
|
||||
@echo " make check-docker - Check if Docker is available"
|
||||
@echo ""
|
||||
@echo "Cleanup:"
|
||||
@echo " make clean - Remove cache and build artifacts"
|
||||
@@ -77,6 +82,43 @@ test-cov:
|
||||
@IS_TEST=True PYTHONPATH=. uv run pytest --cov=app --cov-report=term-missing --cov-report=html -n 16
|
||||
@echo "📊 Coverage report generated in htmlcov/index.html"
|
||||
|
||||
# ============================================================================
|
||||
# E2E Testing (requires Docker)
|
||||
# ============================================================================
|
||||
|
||||
check-docker:
|
||||
@docker info > /dev/null 2>&1 || (echo ""; \
|
||||
echo "Docker is not running!"; \
|
||||
echo ""; \
|
||||
echo "E2E tests require Docker to be running."; \
|
||||
echo "Please start Docker Desktop or Docker Engine and try again."; \
|
||||
echo ""; \
|
||||
echo "Quick start:"; \
|
||||
echo " macOS/Windows: Open Docker Desktop"; \
|
||||
echo " Linux: sudo systemctl start docker"; \
|
||||
echo ""; \
|
||||
exit 1)
|
||||
@echo "Docker is available"
|
||||
|
||||
install-e2e:
|
||||
@echo "📦 Installing E2E test dependencies..."
|
||||
@uv sync --extra dev --extra e2e
|
||||
@echo "✅ E2E dependencies installed!"
|
||||
|
||||
test-e2e: check-docker
|
||||
@echo "🧪 Running E2E tests with PostgreSQL..."
|
||||
@IS_TEST=True PYTHONPATH=. uv run pytest tests/e2e/ -v --tb=short -n 0
|
||||
@echo "✅ E2E tests complete!"
|
||||
|
||||
test-e2e-schema: check-docker
|
||||
@echo "🧪 Running Schemathesis API schema tests..."
|
||||
@IS_TEST=True PYTHONPATH=. uv run pytest tests/e2e/ -v -m "schemathesis" --tb=short -n 0
|
||||
|
||||
test-all:
|
||||
@echo "🧪 Running ALL tests (unit + E2E)..."
|
||||
@$(MAKE) test
|
||||
@$(MAKE) test-e2e
|
||||
|
||||
# ============================================================================
|
||||
# Cleanup
|
||||
# ============================================================================
|
||||
|
||||
Reference in New Issue
Block a user