Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 88 additions & 21 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
description: Run Contract tests
required: false
default: true
EndToEnd:
type: boolean
description: Run End-to-End flaky tests
required: false
default: false

jobs:
Functional_Tests:
Expand All @@ -48,10 +53,9 @@
python-version: 3.x
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r requirements.txt
pip install -r functional-tests/requirements.txt
pip install -e .
python -m pip install --upgrade pip
# Install core + functional extras from pyproject
pip install -e ".[functional-tests]"
- name: Run functional tests
if: always()
continue-on-error: true
Expand Down Expand Up @@ -148,10 +152,8 @@
python-version: 3.x
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r requirements.txt
pip install -r bdd-tests/requirements.txt
pip install -e .
python -m pip install --upgrade pip
pip install -e ".[bdd-tests]"
- name: Run BDD tests
if: always()
continue-on-error: true
Expand Down Expand Up @@ -248,13 +250,12 @@
python-version: 3.x
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r requirements.txt
pip install playwright
pip install pytest-playwright
python -m pip install --upgrade pip
pip install -e ".[ux-tests]"
# Playwright still needs browsers installed
pip install playwright pytest-playwright
playwright install-deps
playwright install
pip install -e .
- name: Run UX tests
if: always()
continue-on-error: true
Expand Down Expand Up @@ -350,10 +351,9 @@
python-version: 3.x
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r requirements.txt
pip install -r performance-tests/requirements.txt
pip install -e .
python -m pip install --upgrade pip
# If your performance tests need Python deps (eg. locust), add them to pyproject extras.
pip install -e ".[performance-tests]" || true
- name: Run Performance tests
if: always()
continue-on-error: true
Expand Down Expand Up @@ -415,10 +415,8 @@
python-version: 3.x
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r requirements.txt
pip install -r contract-tests/requirements.txt
pip install -e .
python -m pip install --upgrade pip
pip install -e ".[contract-tests]"
- name: Run contract tests
if: always()
continue-on-error: true
Expand Down Expand Up @@ -566,3 +564,72 @@
with:
THRESHOLD: 20
secrets: inherit

EndToEnd_Tests:
runs-on: ubuntu-latest
environment: uat
name: End-to-End
if: always() && (github.event.inputs.EndToEnd == 'true' || !github.event.inputs.EndToEnd)
needs: Contract_Tests
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- name: Setup Python
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3
with:
python-version: 3.x
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[end-to-end-tests]"
- name: Run end-to-end tests
if: always()
continue-on-error: true
env:
DEBTOR_SERVICE_PROVIDER_CLIENT_ID: ${{ vars.DEBTOR_SERVICE_PROVIDER_CLIENT_ID }}
DEBTOR_SERVICE_PROVIDER_ID: ${{ vars.DEBTOR_SERVICE_PROVIDER_ID }}
DEBTOR_SERVICE_PROVIDER_CLIENT_SECRET: ${{ secrets.DEBTOR_SERVICE_PROVIDER_CLIENT_SECRET }}

DEBTOR_SERVICE_PROVIDER_B_CLIENT_ID: ${{ vars.DEBTOR_SERVICE_PROVIDER_B_CLIENT_ID }}
DEBTOR_SERVICE_PROVIDER_B_ID: ${{ vars.DEBTOR_SERVICE_PROVIDER_B_ID }}
DEBTOR_SERVICE_PROVIDER_B_CLIENT_SECRET: ${{ secrets.DEBTOR_SERVICE_PROVIDER_B_CLIENT_SECRET }}

CREDITOR_SERVICE_PROVIDER_CLIENT_ID: ${{ vars.CREDITOR_SERVICE_PROVIDER_CLIENT_ID }}
CREDITOR_SERVICE_PROVIDER_ID: ${{ vars.CREDITOR_SERVICE_PROVIDER_ID }}
CREDITOR_SERVICE_PROVIDER_CLIENT_SECRET: ${{ secrets.CREDITOR_SERVICE_PROVIDER_CLIENT_SECRET }}

PAGOPA_INTEGRATION_PAYEE_REGISTRY_CLIENT_ID: ${{ vars.PAGOPA_INTEGRATION_PAYEE_REGISTRY_CLIENT_ID }}
PAGOPA_INTEGRATION_PAYEE_REGISTRY_CLIENT_SECRET: ${{ secrets.PAGOPA_INTEGRATION_PAYEE_REGISTRY_CLIENT_SECRET }}
PAGOPA_INTEGRATION_SERVICE_REGISTRY_CLIENT_ID: ${{ vars.PAGOPA_INTEGRATION_SERVICE_REGISTRY_CLIENT_ID }}
PAGOPA_INTEGRATION_SERVICE_REGISTRY_CLIENT_SECRET: ${{ secrets.PAGOPA_INTEGRATION_SERVICE_REGISTRY_CLIENT_SECRET }}

RTP_READER_CLIENT_ID: ${{ vars.RTP_READER_CLIENT_ID }}
RTP_READER_CLIENT_SECRET: ${{ secrets.RTP_READER_CLIENT_SECRET }}

WEBPAGE_USERNAME: ${{ vars.WEBPAGE_USERNAME }}
WEBPAGE_PASSWORD: ${{ secrets.WEBPAGE_PASSWORD }}

CBI_CLIENT_ID: ${{ vars.CBI_CLIENT_ID }}
CBI_CLIENT_SECRET: ${{ secrets.CBI_CLIENT_SECRET }}
CBI_CLIENT_PFX_BASE64: ${{ secrets.CBI_CLIENT_PFX_BASE64 }}
CBI_CLIENT_PFX_PASSWORD_BASE64: ${{ secrets.CBI_CLIENT_PFX_PASSWORD_BASE64 }}

DEBTOR_SERVICE_PROVIDER_MOCK_PFX_BASE64: ${{ secrets.DEBTOR_SERVICE_PROVIDER_MOCK_PFX_BASE64 }}
DEBTOR_SERVICE_PROVIDER_MOCK_PFX_PASSWORD_BASE64: ${{ secrets.DEBTOR_SERVICE_PROVIDER_MOCK_PFX_PASSWORD_BASE64 }}

CBI_ACTIVATED_FISCAL_CODE: ${{ vars.CBI_ACTIVATED_FISCAL_CODE }}
CBI_PAYEE_ID: ${{ vars.CBI_PAYEE_ID }}
CREDITOR_AGENT_ID: ${{ vars.CREDITOR_AGENT_ID }}
POSTE_ACTIVATED_FISCAL_CODE: ${{ vars.POSTE_ACTIVATED_FISCAL_CODE }}
ICCREA_ACTIVATED_FISCAL_CODE: ${{ vars.ICCREA_ACTIVATED_FISCAL_CODE }}
DEBT_POSITIONS_SUBSCRIPTION_KEY: ${{ secrets.DEBT_POSITIONS_SUBSCRIPTION_KEY }}
DEBT_POSITIONS_ORGANIZATION_ID: ${{ vars.DEPT_POSITIONS_ORGANIZATION_ID }}
DEBT_POSITIONS_DEV_SUBSCRIPTION_KEY: ${{ secrets.DEPT_POSITIONS_DEV_SUBSCRIPTION_KEY }}
DEBT_POSITIONS_DEV_ORGANIZATION_ID: ${{ vars.DEPT_POSITIONS_DEV_ORGANIZATION_ID }}
run: |
make test-end-to-end
- name: Save end-to-end test results
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882
id: upload_endtoend_test_results
with:
name: allure-results-endtoend
path: allure-results
67 changes: 67 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
.PHONY: help install install-dev install-functional install-bdd install-ux install-performance install-contract \
test-functional test-bdd test-ux test-contract precommit

help:
@echo "Targets:"
@echo " install Install core"
@echo " install-dev Install dev tools"
@echo " install-functional Install functional test deps"
@echo " install-bdd Install BDD test deps"
@echo " install-ux Install UX test deps"
@echo " install-performance Install performance test deps"
@echo " install-contract Install contract test deps"
@echo " test-functional Run functional tests"
@echo " test-bdd Run BDD tests (behave)"
@echo " test-ux Run UX tests (pytest + Playwright)"
@echo " test-contract Run contract tests"
@echo " precommit Run pre-commit on all files"

install:
python -m pip install -U pip
pip install -e .

install-dev:
pip install -e .[dev]

install-functional:
pip install -e .[functional-tests]

install-bdd:
pip install -e .[bdd-tests]

install-ux:
pip install -e .[ux-tests]
python -m playwright install

install-performance:
pip install -e .[performance-tests]

install-contract:
pip install -e .[contract-tests]

install-end-to-end:
@echo "Installing end-to-end test extras..."
pip install -e .[end-to-end-tests] || true

test-functional:
pytest functional-tests/tests/ -q

test-bdd:
behave bdd-tests/features/

test-ux:
pytest ux-tests/tests/ -q

test-contract:
pytest contract-tests/ -q

test-end-to-end:
@# ensure .env present if required
@make check-env || true
pytest end-to-end-test/tests/ -q --maxfail=1

precommit:
pre-commit run --all-files

check-env:
@test -f .env || (echo ".env not found. Copy .env.example to .env and fill values." && exit 1)
2 changes: 0 additions & 2 deletions bdd-tests/requirements.txt

This file was deleted.

22 changes: 0 additions & 22 deletions functional-tests/pytest.ini

This file was deleted.

3 changes: 0 additions & 3 deletions functional-tests/requirements.txt

This file was deleted.

29 changes: 29 additions & 0 deletions install-requirements.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash
set -euo pipefail

repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$repo_root"

if [ -z "${VIRTUAL_ENV:-}" ]; then
if [ -d ".venv" ]; then
source .venv/bin/activate
else
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
fi
fi

echo "Running installations via Makefile..."

make install

make install-dev || true

make install-functional || true
make install-bdd || true
make install-ux || true
make install-performance || true
make install-contract || true

echo "Installations completed."
104 changes: 104 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
[build-system]
requires = ["hatchling>=1.25"]
build-backend = "hatchling.build"

[project]
name = "rtp-platform-qa"
version = "0.1.0"
description = "RTP Platform Quality Assurance Repository"
readme = "README.md"
requires-python = ">=3.11"
authors = [{ name = "PagoPA" }]
dependencies = [
"requests>=2.31",
"dynaconf>=3.2",
"python-dotenv>=1.0",
"faker==22.5.1",
"certifi==2025.7.14",
"pyperclip==1.9.0",
"schwifty==2025.1.0",
]

[project.optional-dependencies]
functional-tests = [
"pytest==8.4.1",
"pytest-timeout>=2.2",
"allure-pytest>=2.13",
"allure-python-commons==2.13.5",
"cryptography==44.0.2",
"urllib3==2.5.0",
]
bdd-tests = [
"behave>=1.2.6",
"allure-behave==2.13.5",
]
ux-tests = [
"pytest==8.4.1",
"pytest-playwright>=0.5.0",
"playwright>=1.47.0",
]
performance-tests = [
"aiokafka==0.12.0",
"locust==2.31.8",
]
contract-tests = [
"schemathesis>=3.23",
]
dev = [
"pre-commit>=3.7",
"azure-core==1.35.0",
"azure-identity==1.16.1",
"azure-keyvault-secrets==4.10.0",
"fastapi==0.116.1",
"pydantic==2.11.7",
"python-multipart==0.0.20",
"uvicorn[standard]",
]

end-to-end-tests = [
"pytest==8.4.1",
"pytest-timeout>=2.2",
"requests>=2.31",
"faker==22.5.1",
"allure-pytest>=2.13",
]

[tool.pytest.ini_options]
addopts = "-ra"
testpaths = [
"functional-tests/tests",
"contract-tests",
"ux-tests/tests",
"end-to-end-test/tests",
]
pythonpath = [
".",
]
markers = [
"use_case: ID of the use case",
"happy_path: Tests when things goes right",
"unhappy_path: Tests when things goes wrong",
"need_fix: tests that fails and need a fix",
"landing_page: tests on dummy landing page",
"auth: tests on authentication service",
"activation: tests on activation service",
"send: Tests for RTP send",
"cbi: CBI specific tests",
"poste: Poste specific tests",
"get: mark tests that exercise GET endpoints",
"callback: mark tests that exercise callback endpoints",
"real_integration: mark tests that are real integration tests",
"iccrea: tests on ICCREA service",
"cancel: mark tests that exercise cancel endpoints",
"deactivation: mark tests that exercise deactivation endpoints",
"mock: mark tests that use mock services",
"debt_positions: mark tests that exercise debt positions endpoints",
"producer_gpd_message: mark tests that exercise GPD message producer endpoints",
"timeout: Tests with timeouts",
"use_case: ID of the use case",
"need_fix: tests that fails and need a fix",
"landing_page: tests on dummy landing page",
]

[tool.hatch.build.targets.wheel]
packages = ["api", "config", "utils"]
Loading
Loading