| name | test-server |
| description | E2E testing workflow for the RDoc live-reload server (rdoc --server) |
Test Server
End-to-end testing workflow for the RDoc live-reload server. Use after modifying server code, templates, generators, or routing.
Steps
1. Start the server
bundle exec rdoc --server &
SERVER_PID=$!
sleep 2
Or on a custom port:
bundle exec rdoc --server=8080 &
Default port is 4000.
2. Verify core endpoints
Run these curl checks against the running server:
curl -s -o /dev/null -w '%{http_code}' http://localhost:4000/
curl -s http://localhost:4000/__status
curl -s http://localhost:4000/RDoc.html | head -5
curl -s -o /dev/null -w '%{http_code}' http://localhost:4000/css/rdoc.css
curl -s -o /dev/null -w '%{http_code}' http://localhost:4000/js/search_data.js
curl -s -w '\n%{http_code}' http://localhost:4000/Missing.html | tail -1
curl -s -o /dev/null -w '%{http_code}' 'http://localhost:4000/css/../../etc/passwd'
3. Verify live-reload
HTML pages should contain the live-reload polling script:
curl -s http://localhost:4000/RDoc.html | grep 'var lastChange'
curl -s http://localhost:4000/Missing.html | grep 'var lastChange'
The script polls /__status and reloads when data.last_change > lastChange.
4. Verify file change detection
Confirm the server detects source file changes and invalidates its cache:
BEFORE=$(curl -s http://localhost:4000/__status | grep -o '"last_change":[0-9.]*' | cut -d: -f2)
touch lib/rdoc.rb
sleep 2
AFTER=$(curl -s http://localhost:4000/__status | grep -o '"last_change":[0-9.]*' | cut -d: -f2)
echo "before=$BEFORE after=$AFTER"
5. (Optional) Visual testing with Playwright CLI
For visual inspection of rendered pages, use Playwright CLI commands directly:
npx playwright install chromium
npx playwright screenshot http://localhost:4000/ /tmp/rdoc-index.png
npx playwright screenshot http://localhost:4000/RDoc.html /tmp/rdoc-class.png
npx playwright screenshot --full-page http://localhost:4000/RDoc.html /tmp/rdoc-full.png
Review the screenshots to verify layout, styling, and content rendering.
6. Stop the server
kill $SERVER_PID 2>/dev/null