feat(test): comprehensive pre-deploy test suite as single entry point
CI Pipeline with Test Management / 🧪 Run Tests & Generate Reports (push) Waiting to run
CI Pipeline with Test Management / 🐳 Docker Integration Tests (push) Blocked by required conditions
CI Pipeline with Test Management / 🏗️ Build Docker Image (push) Blocked by required conditions
CI Pipeline with Test Management / 📊 Generate Test Summary (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / 🧪 Run Tests & Generate Reports (push) Waiting to run
Test Reporting & Gherkin Analysis / 📊 Analyze Test Coverage (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / 🔄 Sync with Linear (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / ⚡ Performance Monitoring (push) Blocked by required conditions

scripts/pre-deploy-tests.sh runs every local test group before a deploy:
proto unit (jest), content schema validation, all CMS integration suites
(security, serializer, save, optimistic lock, versions, logo, login, logout,
guide, bottom bar), publish command/integration and plane sync unit tests.
Per-group PASS/FAIL summary; non-zero exit on any failure.

deploy_to_stage_on_local.sh now runs the full suite as step 1 — a failing
group aborts the release before push. Deploy workflow docs updated.

Closes MITHOME-70
This commit is contained in:
Do Siki
2026-08-19 14:15:33 +02:00
parent 067b15c50e
commit 5db71998eb
3 changed files with 58 additions and 5 deletions
+2 -2
View File
@@ -13,7 +13,7 @@ description: Deployment munkafolyamata — lokális teszttől a stagingen át a
## Előfeltételek ## Előfeltételek
- Unit tesztek zöldek: `cd proto && npm test` - **Teljes pre-deploy tesztkészlet zöld**: `scripts/pre-deploy-tests.sh` (proto unit, content séma, mind a CMS/infra tesztcsoport; hiba esetén nem-nulla exit — a deploy-script 1. lépésként futtatja, és megszakítja a kiadást)
- Lint: `cd proto && npm run lint` (nincs új hiba) - Lint: `cd proto && npm run lint` (nincs új hiba)
- `TODO.md` és Plane szinkronban - `TODO.md` és Plane szinkronban
@@ -28,7 +28,7 @@ description: Deployment munkafolyamata — lokális teszttől a stagingen át a
A script (részletek: `docs/helyi-staging-deploy.md`): A script (részletek: `docs/helyi-staging-deploy.md`):
1. Ellenőrzi, hogy a helyi `main` ág tiszta-e és a munkakönyvtár megfelelő-e. 1. Ellenőrzi, hogy a helyi `main` ág tiszta-e és a munkakönyvtár megfelelő-e.
2. `proto/`-ban `npm ci` + `npm run test:unit` — sikertelen teszt esetén **nincs push**. 2. `npm ci` + `scripts/pre-deploy-tests.sh` (teljes készlet) — sikertelen teszt esetén **nincs push**.
3. Push a Gitea `origin/main`-re. 3. Push a Gitea `origin/main`-re.
4. SSH a staging hostra (`sadmin@llmdev.mozdit.hu`, `/home/sadmin/websitedev`): `git pull --ff-only` + `./deploy.sh staging`. 4. SSH a staging hostra (`sadmin@llmdev.mozdit.hu`, `/home/sadmin/websitedev`): `git pull --ff-only` + `./deploy.sh staging`.
5. Playwright smoke tesztek a `https://stage.mozdit.hu` ellen (`npm run test:smoke:staging`). 5. Playwright smoke tesztek a `https://stage.mozdit.hu` ellen (`npm run test:smoke:staging`).
+3 -3
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Helyi, kézi staging kiadás: unit teszt -> push -> szerveroldali deploy -> staging smoke teszt. # Helyi, kézi staging kiadás: teljes pre-deploy tesztkészlet -> push -> szerveroldali deploy -> staging smoke teszt.
set -Eeuo pipefail set -Eeuo pipefail
@@ -31,12 +31,12 @@ cd "${PROJECT_ROOT}"
[[ "$(git branch --show-current)" == "${DEPLOY_BRANCH}" ]] || fail "A kiadás csak a ${DEPLOY_BRANCH} ágról engedélyezett." [[ "$(git branch --show-current)" == "${DEPLOY_BRANCH}" ]] || fail "A kiadás csak a ${DEPLOY_BRANCH} ágról engedélyezett."
ensure_clean_worktree ensure_clean_worktree
printf '1/4 Függőségek és unit tesztek…\n' printf '1/4 Függőségek és teljes pre-deploy tesztkészlet…\n'
( (
cd "${APP_ROOT}" cd "${APP_ROOT}"
npm ci npm ci
npm run test:unit
) )
"${PROJECT_ROOT}/scripts/pre-deploy-tests.sh"
# A tesztek nem módosíthatják a kiadandó commitot. # A tesztek nem módosíthatják a kiadandó commitot.
ensure_clean_worktree ensure_clean_worktree
+53
View File
@@ -0,0 +1,53 @@
#!/usr/bin/env bash
# Teljeskörű pre-deploy tesztkészlet — minden deploy előtt futtatandó.
# Összefogja a proto (weboldal) és a gyökér (CMS/infra) lokális tesztjeit;
# csoportonkénti PASS/FAIL összegzéssel, hiba esetén nem-nulla exit kód.
#
# Használat: scripts/pre-deploy-tests.sh
# A deploy_to_stage_on_local.sh 1. lépésként futtatja.
set -uo pipefail
readonly ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
FAILED=()
run() {
local name="$1"; shift
printf '\n── %s\n' "$name"
if "$@"; then
printf '✅ %s\n' "$name"
else
printf '❌ %s\n' "$name"
FAILED+=("$name")
fi
}
# ── Weboldal (proto) ─────────────────────────────────────────────────────────
run "proto: unit tesztek (jest, 60+)" bash -c "cd '${ROOT}/proto' && npm test --silent"
# ── Tartalom ─────────────────────────────────────────────────────────────────
run "content: séma-validáció (minden JSON)" node "${ROOT}/scripts/test-content-schema.js"
# ── CMS (content-editor) ─────────────────────────────────────────────────────
run "cms: security guard (auth, CSRF, XFF)" node "${ROOT}/scripts/test-content-editor-security.js"
run "cms: serializer regresszió (collect/reindex)" node "${ROOT}/scripts/test-content-editor-serializer.js"
run "cms: atomikus mentés + backup" node "${ROOT}/scripts/test-content-editor-save.js"
run "cms: optimista zárolás (409, hash-frissítés)" node "${ROOT}/scripts/test-content-editor-conflict.js"
run "cms: verziók panel (diff, restore)" node "${ROOT}/scripts/test-content-editor-versions.js"
run "cms: logó feltöltés (PNG, backup, audit)" node "${ROOT}/scripts/test-content-editor-logo.js"
run "cms: login flow (session, Safari-scenariok)" node "${ROOT}/scripts/test-content-editor-login.js"
run "cms: logout + rate-limit" node "${ROOT}/scripts/test-content-editor-logout.js"
run "cms: guide endpoint + renderer" node "${ROOT}/scripts/test-content-editor-guide.js"
run "cms: alsó sáv layout guard" node "${ROOT}/scripts/test-content-editor-bottombar.js"
run "cms: publish parancs + integráció" node "${ROOT}/scripts/test-cms-publish.js"
# ── Infra ────────────────────────────────────────────────────────────────────
run "plane: sync unit tesztek" node --test "${ROOT}/scripts/plane/plane-sync.test.js"
# ── Összegzés ────────────────────────────────────────────────────────────────
printf '\n────────────────────────────────────────\n'
if [ "${#FAILED[@]}" -gt 0 ]; then
printf '❌ %d tesztcsoport HIBÁS: %s\n' "${#FAILED[@]}" "${FAILED[*]}"
exit 1
fi
printf '✅ Minden pre-deploy teszt zöld.\n'