Skip to content
Merged
Show file tree
Hide file tree
Changes from 15 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
120 changes: 97 additions & 23 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- main
schedule:
- cron: '0 7 * * *' # Scheduled every day at 01:00 UTC
- cron: '0 6 * * *' # Scheduled every day at 08:00 UTC
workflow_dispatch: # Allows manual run
inputs:
Functional:
Expand Down Expand Up @@ -33,6 +33,11 @@ on:
description: Run Contract tests
required: false
default: true
EndToEnd:
type: boolean
description: Run End-to-End flaky tests
required: false
default: true

jobs:
Functional_Tests:
Expand All @@ -48,10 +53,9 @@ jobs:
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 @@ jobs:
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,11 @@ jobs:
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]"
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 +350,9 @@ jobs:
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 +414,8 @@ jobs:
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 @@ -503,7 +500,7 @@ jobs:
Aggregate_Results:
runs-on: ubuntu-latest
environment: uat
needs: Contract_Tests
needs: EndToEnd_Tests
if: always() && github.ref == 'refs/heads/main'
steps:
- name: Copy functional results
Expand All @@ -530,6 +527,12 @@ jobs:
path: allure-results
merge-multiple: true
run-id: upload_contract_test_results
- name: Copy end-to-end results
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
with:
path: allure-results
merge-multiple: true
run-id: upload_endtoend_test_results
- name: Load test report history
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 #v4.2.0
if: always()
Expand Down Expand Up @@ -566,3 +569,74 @@ jobs:
with:
THRESHOLD: 20
secrets: inherit

EndToEnd_Tests:
permissions:
contents: read
runs-on: ubuntu-latest
environment: uat
name: End-to-End
if: always()
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)
Loading