xref: /plugin/bpmnio/test/run-tests.sh (revision 033061be24b61e2ca1dcf4d5ade55358f0bb0818)
1#!/bin/bash
2# Run basic tests against the DokuWiki test environment
3set -e
4
5CONTAINER="dokuwiki-bpmnio-test"
6PORT=8080
7PLUGIN_DIR="/config/dokuwiki/lib/plugins/bpmnio"
8
9if ! docker ps --format '{{.Names}}' | grep -q "^${CONTAINER}$"; then
10    echo "ERROR: Container $CONTAINER is not running. Run './start-test-env.sh' first."
11    exit 1
12fi
13
14echo "Waiting for DokuWiki to respond..."
15for i in {1..30}; do
16    curl -sf "http://localhost:$PORT/" > /dev/null && break
17    [ "$i" -eq 30 ] && { echo "ERROR: Timeout"; exit 1; }
18    sleep 2
19done
20
21echo "Checking plugin files..."
22for file in plugin.info.txt syntax/bpmnio.php script/bpmnio_render.js vendor/bpmn-js/package.json vendor/dmn-js/package.json; do
23    docker exec "$CONTAINER" test -f "$PLUGIN_DIR/$file" || { echo "MISSING: $file"; exit 1; }
24done
25echo "  All plugin files present"
26
27echo "Checking media fixtures..."
28for file in /config/dokuwiki/data/media/test/bpmn-test.bpmn /config/dokuwiki/data/media/test/dmn-test.dmn; do
29    docker exec "$CONTAINER" test -f "$file" || { echo "MISSING: $file"; exit 1; }
30done
31echo "  Shared media fixtures present"
32
33echo "Checking test pages..."
34for page in test:bpmn-test test:dmn-test; do
35    curl -sf "http://localhost:$PORT/doku.php?id=$page" | grep -q "bpmn\|dmn" \
36        && echo "  $page OK" \
37        || echo "  $page WARNING: may have issues"
38done
39
40echo "Tests passed."
41