chore: wire tests into check.sh and document test suites
This commit is contained in:
@@ -37,4 +37,9 @@ uploads/*
|
|||||||
# vendor/
|
# vendor/
|
||||||
# node_modules/
|
# node_modules/
|
||||||
|
|
||||||
|
# Artefacts de tests locaux
|
||||||
|
.pytest_cache/
|
||||||
|
__pycache__/
|
||||||
|
*.pyc
|
||||||
|
|
||||||
img/movement_presentation.png
|
img/movement_presentation.png
|
||||||
|
|||||||
+46
@@ -944,6 +944,29 @@ Les validations AsciiDoc, JSON, XML et shellcheck ne sont plus exécutées dans
|
|||||||
|
|
||||||
La mise en place complète du serveur de production (clone, fichiers d'instance, clés SSH, secrets Gitea) est documentée dans link:DEPLOY.adoc[DEPLOY.adoc].
|
La mise en place complète du serveur de production (clone, fichiers d'instance, clés SSH, secrets Gitea) est documentée dans link:DEPLOY.adoc[DEPLOY.adoc].
|
||||||
|
|
||||||
|
==== 🧪 Tests
|
||||||
|
|
||||||
|
Le projet dispose de trois niveaux de tests, tous *sans framework lourd* (aucune dépendance commitée dans le repo) :
|
||||||
|
|
||||||
|
- *Tests unitaires PHP* (`tests/php/`) : script PHP natif (`php tests/php/run.php`). Couvre les validateurs (`security.php`), le cache (`simple-cache.php`), les formateurs (`config.php`) et le rendu Markdown.
|
||||||
|
- *Tests unitaires JS* (`tests/js/`) : `node:test` natif (`node tests/js/run.js`). Couvre `CountdownTimer` et l'adaptateur Pleroma → Mastodon.
|
||||||
|
- *Tests E2E* (`tests/e2e/`) : Playwright (Python), installé en local uniquement. Couvre la homepage, la page vidéo et l'endpoint AJAX « Voir plus ».
|
||||||
|
|
||||||
|
[source,bash]
|
||||||
|
----
|
||||||
|
# Tests unitaires PHP et JS (aussi lancés par scripts/check.sh)
|
||||||
|
php tests/php/run.php
|
||||||
|
node tests/js/run.js
|
||||||
|
|
||||||
|
# Tests E2E (nécessite Playwright installé hors repo)
|
||||||
|
python3 -m venv /tmp/test-venv
|
||||||
|
/tmp/test-venv/bin/pip install playwright pytest
|
||||||
|
/tmp/test-venv/bin/playwright install chromium
|
||||||
|
/tmp/test-venv/bin/python -m pytest tests/e2e/
|
||||||
|
----
|
||||||
|
|
||||||
|
NOTE: Les tests E2E démarrent un serveur PHP local (`php -S`) et s'appuient sur la configuration par défaut. Les appels réseau vers PeerTube sont sautés proprement si l'instance est injoignable.
|
||||||
|
|
||||||
=== 📜 Licence
|
=== 📜 Licence
|
||||||
|
|
||||||
Copyright (C) 2025 Cédric Famibelle-Pronzola & *ORGANISATION KA INTERNATIONALE*
|
Copyright (C) 2025 Cédric Famibelle-Pronzola & *ORGANISATION KA INTERNATIONALE*
|
||||||
@@ -1891,6 +1914,29 @@ AsciDoc, JSON, XML and shellcheck validation are no longer run in CI: they must
|
|||||||
|
|
||||||
The full production server setup (clone, instance files, SSH keys, Gitea secrets) is documented in link:DEPLOY.adoc[DEPLOY.adoc].
|
The full production server setup (clone, instance files, SSH keys, Gitea secrets) is documented in link:DEPLOY.adoc[DEPLOY.adoc].
|
||||||
|
|
||||||
|
==== 🧪 Tests
|
||||||
|
|
||||||
|
The project has three levels of tests, all *without heavy frameworks* (no dependencies committed to the repo):
|
||||||
|
|
||||||
|
- *PHP unit tests* (`tests/php/`): native PHP script (`php tests/php/run.php`). Covers validators (`security.php`), cache (`simple-cache.php`), formatters (`config.php`) and Markdown rendering.
|
||||||
|
- *JS unit tests* (`tests/js/`): native `node:test` (`node tests/js/run.js`). Covers `CountdownTimer` and the Pleroma → Mastodon adapter.
|
||||||
|
- *E2E tests* (`tests/e2e/`): Playwright (Python), installed locally only. Covers the homepage, video page and the "Load more" AJAX endpoint.
|
||||||
|
|
||||||
|
[source,bash]
|
||||||
|
----
|
||||||
|
# PHP and JS unit tests (also run by scripts/check.sh)
|
||||||
|
php tests/php/run.php
|
||||||
|
node tests/js/run.js
|
||||||
|
|
||||||
|
# E2E tests (requires Playwright installed outside the repo)
|
||||||
|
python3 -m venv /tmp/test-venv
|
||||||
|
/tmp/test-venv/bin/pip install playwright pytest
|
||||||
|
/tmp/test-venv/bin/playwright install chromium
|
||||||
|
/tmp/test-venv/bin/python -m pytest tests/e2e/
|
||||||
|
----
|
||||||
|
|
||||||
|
NOTE: E2E tests start a local PHP server (`php -S`) and rely on the default configuration. Network calls to PeerTube are skipped gracefully if the instance is unreachable.
|
||||||
|
|
||||||
=== 📜 License
|
=== 📜 License
|
||||||
|
|
||||||
Copyright (C) 2025 Cédric Famibelle-Pronzola & *ORGANISATION KA INTERNATIONALE*
|
Copyright (C) 2025 Cédric Famibelle-Pronzola & *ORGANISATION KA INTERNATIONALE*
|
||||||
|
|||||||
@@ -98,6 +98,24 @@ if need shellcheck shellcheck; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
step "Tests unitaires PHP (tests/php/)"
|
||||||
|
if need php php-cli; then
|
||||||
|
if php tests/php/run.php; then
|
||||||
|
echo "✅ Tests PHP OK"
|
||||||
|
else
|
||||||
|
fail=1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
step "Tests unitaires JS (tests/js/)"
|
||||||
|
if need node nodejs; then
|
||||||
|
if node tests/js/run.js; then
|
||||||
|
echo "✅ Tests JS OK"
|
||||||
|
else
|
||||||
|
fail=1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
if [ "$fail" -ne 0 ]; then
|
if [ "$fail" -ne 0 ]; then
|
||||||
echo "❌ Des vérifications ont échoué — corrigez avant de pousser."
|
echo "❌ Des vérifications ont échoué — corrigez avant de pousser."
|
||||||
|
|||||||
Reference in New Issue
Block a user