xref: /plugin/bpmnio/test/run-tests.sh (revision 43854469855b0d3261173416b47cbad6e62bc444)
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 test pages..."
28for page in test:bpmn-test test:dmn-test; do
29    curl -sf "http://localhost:$PORT/doku.php?id=$page" | grep -q "bpmn\|dmn" \
30        && echo "  $page OK" \
31        || echo "  $page WARNING: may have issues"
32done
33
34echo "Tests passed."
35