Repository navigation
initial e2e tests #35
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
Changes from 1 commit
88eea78
561f167
bd7d7aa
dac8b10
f1fde0b
8f53825
d20f88e
6f07b18
71057dc
dee3132
b529581
86e8201
73ef0a5
f71c20e
3e1eaf6
50a9909
a74ba46
cf88817
42e6a13
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| name: E2E Tests | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main, develop ] | ||
| pull_request: | ||
| branches: [ main, develop ] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| e2e-tests: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| services: | ||
| falkordb: | ||
| image: falkordb/falkordb:latest | ||
| ports: | ||
| - 6379:6379 | ||
| options: >- | ||
| --health-cmd "redis-cli ping" | ||
| --health-interval 10s | ||
| --health-timeout 5s | ||
| --health-retries 5 | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: '3.12' | ||
|
|
||
| - name: Install pipenv | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install pipenv | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| pipenv sync --dev | ||
|
|
||
| - name: Install Playwright browsers | ||
| run: | | ||
| pipenv run playwright install chromium | ||
| pipenv run playwright install-deps | ||
|
|
||
| - name: Create test environment file | ||
| run: | | ||
| cp .env.example .env | ||
| echo "FALKORDB_HOST=localhost" >> .env | ||
| echo "FALKORDB_PORT=6379" >> .env | ||
| echo "FLASK_SECRET_KEY=test-secret-key-for-ci" >> .env | ||
| echo "FLASK_DEBUG=False" >> .env | ||
|
|
||
| - name: Wait for FalkorDB | ||
| run: | | ||
| until docker exec $(docker ps -q --filter ancestor=falkordb/falkordb:latest) redis-cli ping; do | ||
| echo "Waiting for FalkorDB..." | ||
| sleep 2 | ||
| done | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| - name: Run E2E tests | ||
| run: | | ||
| pipenv run pytest tests/e2e/ --browser chromium --headed=false --video=on --screenshot=on | ||
| env: | ||
| CI: true | ||
|
|
||
| - name: Upload test artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| if: failure() | ||
| with: | ||
| name: playwright-report | ||
| path: | | ||
| test-results/ | ||
| playwright-report/ | ||
| retention-days: 30 | ||
|
|
||
| - name: Upload screenshots | ||
| uses: actions/upload-artifact@v4 | ||
| if: failure() | ||
| with: | ||
| name: screenshots | ||
| path: tests/e2e/screenshots/ | ||
| retention-days: 30 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| name: Tests | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main, develop ] | ||
| pull_request: | ||
| branches: [ main, develop ] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| unit-tests: | ||
| runs-on: ubuntu-latest | ||
|
|
||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: '3.12' | ||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
|
|
||
| - name: Install pipenv | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install pipenv | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| pipenv sync --dev | ||
|
|
||
| - name: Create test environment file | ||
| run: | | ||
| cp .env.example .env | ||
| echo "FLASK_SECRET_KEY=test-secret-key" >> .env | ||
| echo "FLASK_DEBUG=False" >> .env | ||
|
|
||
| - name: Run unit tests | ||
| run: | | ||
| pipenv run pytest tests/ -k "not e2e" --verbose | ||
|
|
||
| - name: Run pylint | ||
| run: | | ||
| pipenv run pylint $(git ls-files '*.py') || true | ||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
|
|
||
| e2e-tests: | ||
| runs-on: ubuntu-latest | ||
| needs: unit-tests | ||
|
|
||
| services: | ||
| falkordb: | ||
| image: falkordb/falkordb:latest | ||
| ports: | ||
| - 6379:6379 | ||
| options: >- | ||
| --health-cmd "redis-cli ping" | ||
| --health-interval 10s | ||
| --health-timeout 5s | ||
| --health-retries 5 | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: '3.12' | ||
|
|
||
| - name: Install pipenv | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install pipenv | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| pipenv sync --dev | ||
|
|
||
| - name: Install Playwright browsers | ||
| run: | | ||
| pipenv run playwright install chromium | ||
| pipenv run playwright install-deps | ||
|
|
||
| - name: Create test environment file | ||
| run: | | ||
| cp .env.example .env | ||
| echo "FALKORDB_HOST=localhost" >> .env | ||
| echo "FALKORDB_PORT=6379" >> .env | ||
| echo "FLASK_SECRET_KEY=test-secret-key-for-ci" >> .env | ||
| echo "FLASK_DEBUG=False" >> .env | ||
|
|
||
| - name: Wait for FalkorDB | ||
| run: | | ||
| timeout 60 bash -c 'until docker exec $(docker ps -q --filter ancestor=falkordb/falkordb:latest) redis-cli ping; do sleep 2; done' | ||
|
|
||
| - name: Run E2E tests | ||
| run: | | ||
| pipenv run pytest tests/e2e/ --browser chromium --headed=false | ||
| env: | ||
| CI: true | ||
|
|
||
| - name: Upload test artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| if: failure() | ||
| with: | ||
| name: playwright-report | ||
| path: | | ||
| test-results/ | ||
| playwright-report/ | ||
| retention-days: 30 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| .PHONY: help install test test-unit test-e2e test-e2e-headed lint format clean setup-dev | ||
|
|
||
|
Comment on lines
+1
to
+2
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Declare a default GNU Make expects an -.PHONY: help install test test-unit test-e2e test-e2e-headed lint format clean setup-dev
+.PHONY: all help install test test-unit test-e2e test-e2e-headed lint format clean \
+ setup-dev run-dev run-prod docker-falkordb docker-stop
+
+all: test ## Default target: run the full test suite🧰 Tools🪛 checkmake (0.2.2)[warning] 1-1: Missing required phony target "all" (minphony) 🤖 Prompt for AI Agents |
||
| help: ## Show this help message | ||
| @echo 'Usage: make [target]' | ||
| @echo '' | ||
| @echo 'Targets:' | ||
| @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " %-15s %s\n", $$1, $$2}' $(MAKEFILE_LIST) | ||
|
|
||
| install: ## Install dependencies | ||
| pipenv sync --dev | ||
|
|
||
| setup-dev: install ## Set up development environment | ||
| pipenv run playwright install chromium | ||
| pipenv run playwright install-deps | ||
| @echo "Development environment setup complete!" | ||
| @echo "Don't forget to copy .env.example to .env and configure your settings" | ||
|
|
||
| test: test-unit test-e2e ## Run all tests | ||
|
|
||
| test-unit: ## Run unit tests only | ||
| pipenv run pytest tests/ -k "not e2e" --verbose | ||
|
|
||
| test-e2e: ## Run E2E tests headless | ||
| pipenv run pytest tests/e2e/ --browser chromium --headed=false | ||
|
|
||
| test-e2e-headed: ## Run E2E tests with browser visible | ||
| pipenv run pytest tests/e2e/ --browser chromium --headed=true | ||
|
|
||
| test-e2e-debug: ## Run E2E tests with debugging enabled | ||
| pipenv run pytest tests/e2e/ --browser chromium --headed=true --slowmo=1000 | ||
|
|
||
| lint: ## Run linting | ||
| pipenv run pylint $(shell git ls-files '*.py') | ||
|
|
||
| format: ## Format code (placeholder - add black/autopep8 if needed) | ||
| @echo "Add code formatting tool like black here" | ||
|
|
||
| clean: ## Clean up test artifacts | ||
| rm -rf test-results/ | ||
| rm -rf playwright-report/ | ||
| rm -rf tests/e2e/screenshots/ | ||
| rm -rf __pycache__/ | ||
| find . -name "*.pyc" -delete | ||
| find . -name "*.pyo" -delete | ||
|
|
||
| run-dev: ## Run development server | ||
| pipenv run flask --app api.index run --debug | ||
|
|
||
| run-prod: ## Run production server | ||
| pipenv run flask --app api.index run | ||
|
|
||
| docker-falkordb: ## Start FalkorDB in Docker for testing | ||
| docker run -d --name falkordb-test -p 6379:6379 falkordb/falkordb:latest | ||
|
|
||
| docker-stop: ## Stop test containers | ||
| docker stop falkordb-test || true | ||
| docker rm falkordb-test || true | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| [tool:pytest] | ||
| testpaths = tests | ||
| python_files = test_*.py | ||
| python_classes = Test* | ||
| python_functions = test_* | ||
| addopts = | ||
| --verbose | ||
| --tb=short | ||
| --strict-markers | ||
| --disable-warnings | ||
| --browser chromium | ||
| --headed | ||
| markers = | ||
| e2e: End-to-end tests using Playwright | ||
| slow: Tests that take a long time to run | ||
| auth: Tests that require authentication | ||
| integration: Integration tests | ||
| unit: Unit tests | ||
| filterwarnings = | ||
| ignore::DeprecationWarning | ||
| ignore::PendingDeprecationWarning |
Uh oh!
There was an error while loading. Please reload this page.