mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2026-01-20 20:01:25 +00:00
e2e
This commit is contained in:
parent
dfd3f67d3f
commit
2348c356b1
139
.github/workflows/cache-verify.yml
vendored
139
.github/workflows/cache-verify.yml
vendored
@ -158,87 +158,80 @@ jobs:
|
||||
[ -x /opt/cucumber-json-formatter ] || (echo "❌ Formatter fehlt" && exit 1)
|
||||
/opt/cucumber-json-formatter --help || (echo "❌ Formatter nicht ausführbar" && exit 1)
|
||||
|
||||
consolidate-environment:
|
||||
name: Fullstack | tests
|
||||
if: success()
|
||||
needs: [build-images, cache-environment]
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
jobs: 8
|
||||
strategy:
|
||||
matrix:
|
||||
job: [1, 2, 3, 4, 5, 6, 7, 8]
|
||||
consolidate-environment:
|
||||
name: Fullstack | tests
|
||||
if: success()
|
||||
needs: [build-images, cache-environment]
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
jobs: 8
|
||||
strategy:
|
||||
matrix:
|
||||
job: [1, 2, 3, 4, 5, 6, 7, 8]
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: setup .env files
|
||||
run: |
|
||||
cp backend/.env.test_e2e backend/.env
|
||||
cp webapp/.env.template webapp/.env
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Download Docker image artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: /tmp
|
||||
- name: Restore CI cache
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
key: ${{ needs.cache-environment.outputs.cache-key }}
|
||||
path: |
|
||||
node_modules
|
||||
backend/node_modules
|
||||
webapp/node_modules
|
||||
backend/build
|
||||
webapp/.nuxt
|
||||
~/.cache/Cypress
|
||||
/opt/cucumber-json-formatter
|
||||
|
||||
- name: Load Docker images
|
||||
run: |
|
||||
docker load < /tmp/backend-image/backend.tar
|
||||
docker load < /tmp/webapp-image/webapp.tar
|
||||
docker load < /tmp/neo4j-image/neo4j.tar
|
||||
- name: Setup .env files & reports dir
|
||||
run: |
|
||||
cp backend/.env.test_e2e backend/.env
|
||||
cp webapp/.env.template webapp/.env
|
||||
mkdir -p cypress/reports/json_logs
|
||||
|
||||
- name: Restore unified CI cache
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
key: ${{ needs.cache-environment.outputs.cache-key }}
|
||||
path: |
|
||||
node_modules
|
||||
backend/node_modules
|
||||
webapp/node_modules
|
||||
backend/build
|
||||
webapp/.nuxt
|
||||
~/.cache/Cypress
|
||||
/opt/cucumber-json-formatter
|
||||
restore-keys: |
|
||||
ci-unified-cache-${{ runner.os }}-
|
||||
- name: Load Docker images
|
||||
run: |
|
||||
docker load < /tmp/backend-image/backend.tar
|
||||
docker load < /tmp/webapp-image/webapp.tar
|
||||
docker load < /tmp/neo4j-image/neo4j.tar
|
||||
|
||||
- name: Ensure formatter is executable
|
||||
run: |
|
||||
chmod +x /opt/cucumber-json-formatter || true
|
||||
sudo ln -fs /opt/cucumber-json-formatter /usr/bin/cucumber-json-formatter || true
|
||||
- name: Boot system for tests
|
||||
run: |
|
||||
docker compose -f docker-compose.yml -f docker-compose.test.yml up --detach backend mailserver webapp
|
||||
|
||||
- name: Boot system for tests
|
||||
run: |
|
||||
docker compose -f docker-compose.yml -f docker-compose.test.yml up --detach backend mailserver webapp
|
||||
- name: Wait for services
|
||||
run: |
|
||||
for i in {1..30}; do
|
||||
curl -sf http://localhost:3000 && echo "✅ Webapp ready" && break
|
||||
echo "Waiting... ($i/30)"
|
||||
sleep 2
|
||||
done
|
||||
|
||||
- name: Wait for services to be ready
|
||||
run: |
|
||||
for i in {1..30}; do
|
||||
curl -sf http://localhost:3000 && echo "✅ Webapp ready" && break
|
||||
echo "Waiting for webapp... ($i/30)"
|
||||
sleep 2
|
||||
done
|
||||
- name: Run Cypress tests
|
||||
id: e2e-tests
|
||||
run: |
|
||||
npx cypress run \
|
||||
--config-file ./cypress/cypress.config.js \
|
||||
--spec $(cypress/parallel-features.sh ${{ matrix.job }} ${{ env.jobs }})
|
||||
|
||||
- name: Ensure Cypress binary is available
|
||||
run: |
|
||||
echo "📦 Verifying Cypress..."
|
||||
npx cypress --version || (echo "⛔ Cypress fehlt – versuche Installation" && npx cypress install)
|
||||
npx cypress verify
|
||||
- name: Create HTML report (if failed)
|
||||
if: ${{ failure() && steps.e2e-tests.conclusion == 'failure' }}
|
||||
run: |
|
||||
node cypress/create-cucumber-html-report.js
|
||||
|
||||
- name: Full stack tests | run tests
|
||||
id: e2e-tests
|
||||
run: npx cypress run --spec $(cypress/parallel-features.sh ${{ matrix.job }} ${{ env.jobs }})
|
||||
- name: Upload HTML report (if failed)
|
||||
if: ${{ failure() && steps.e2e-tests.conclusion == 'failure' }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: e2e-html-report-${{ matrix.job }}
|
||||
path: cypress/reports/cucumber_html_report
|
||||
|
||||
- name: Full stack tests | if tests failed, compile html report
|
||||
if: ${{ failure() && steps.e2e-tests.conclusion == 'failure' }}
|
||||
run: |
|
||||
cd cypress/
|
||||
node create-cucumber-html-report.js
|
||||
- name: Debug output (always)
|
||||
if: always()
|
||||
run: |
|
||||
echo "📁 Cypress reports"
|
||||
ls -l cypress/reports/json_logs || echo "❌ Missing JSON logs"
|
||||
|
||||
- name: Full stack tests | if tests failed, upload report
|
||||
if: ${{ failure() && steps.e2e-tests.conclusion == 'failure' }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ocelot-e2e-test-report-job${{ matrix.job }}
|
||||
path: cypress/reports/cucumber_html_report
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user