Skip to content

End 2 End tests for OctoPi using qemu#879

Open
guysoft wants to merge 13 commits intodevelfrom
feature/e2e
Open

End 2 End tests for OctoPi using qemu#879
guysoft wants to merge 13 commits intodevelfrom
feature/e2e

Conversation

@guysoft
Copy link
Copy Markdown
Owner

@guysoft guysoft commented Feb 22, 2026

This adds automated end2end tests that confirm that OctoPi loads octoprint and boots in a virtual qemu environment. Currently it tests that OctoPrint starts and that ssh is working and captures a screenshot of the install wizard.

It could be extended to include other tests. It runs on github actions and locally:

cd testing/
./run-test.sh

- Update build.yml to build both armhf and arm64 using CustomPiOS v2
  board system (BASE_BOARD matrix) with base_image_downloader
- Add testing/ directory with Docker+QEMU-based E2E test harness that
  boots an OctoPi arm64 image, verifies SSH access, and checks
  OctoPrint web server availability
- Add e2e-test.yml workflow triggered by build completion that runs E2E
  tests on the arm64 artifact and uploads screenshot + logs
- Add e2e-test job to build.yml with needs: build, downloads the
  octopi-arm64 artifact and runs the QEMU test + screenshot
- Change e2e-test.yml to trigger on push to feature/e2e and devel
  using a stable arm64 image (workflow_run doesn't work from
  non-default branches)
E2E testing lives in build.yml as a job that tests the built arm64
image. No need for a separate workflow against a stable image.
The previous screenshot captured OctoPrint's "starting up" loading
screen instead of the actual UI. Now both the CI workflow and the
E2E test wait for OctoPrint to fully finish its startup phase by
checking for CONFIG_WIZARD in the page HTML, and puppeteer waits
for the #wizard_dialog to become visible before capturing.
Replace standalone testing scripts with the shared framework from
CustomPiOS/src/distro_testing/. The CI workflow now checks out CustomPiOS
and copies the shared scripts into the build context. OctoPi-specific logic
moves into hooks/ (haproxy IPv4 patching, headless browser screenshot).

Removes run-test.sh and testing/scripts/ (now provided by the framework).
guysoft added 7 commits March 12, 2026 14:05
The puppeteer-based screenshot was from the pre-framework approach and
fails because the container stops the QEMU port forward after tests
complete. Screenshots are now handled inside the container via the
hooks/screenshot.sh mechanism. Also remove KEEP_ALIVE and increase
the wait timeout to 25 minutes.
The test and screenshot hook both matched "OctoPrint" in the
starting page title instead of waiting for the actual wizard.
Now both poll specifically for CONFIG_WIZARD in the response.
The test saves HTML from the matching response (not a second curl).
Add chromium to the Docker container for headless screenshots.
Increase poll timeout to 600s for slower CI runners.
The headless screenshot silently failed (2>/dev/null hid the error).
Now show stderr, use --headless=new, --disable-dev-shm-usage, and
add missing shared libraries (libnss3, libgbm1, etc.) needed for
Chromium headless in the container environment.
The base image has /usr/bin/chromium-browser as a snap wrapper stub
that prints "requires the chromium snap". Now search for the actual
chromium binary at /usr/lib/chromium/chromium first, skipping any
snap stubs. Add diagnostic output if no working binary is found.
The Ubuntu-based ptrsr/pi-ci image only has a snap stub for chromium.
Install google-chrome-stable from Google's apt repo instead, which
provides a real headless browser binary. The test now takes a
screenshot right when CONFIG_WIZARD is confirmed and validates the
PNG is >10KB (a real rendered page, not blank). The screenshot hook
also uses google-chrome-stable as a redundant capture.
Chrome headless can hang indefinitely if the page doesn't load.
Wrap all Chrome calls with `timeout 30` to kill after 30 seconds.
Increase the workflow wait loop from 25 to 35 min and job timeout
from 30 to 45 min, since OctoPrint can take 10+ min to start on
slower CI runners.
Install chromium in the Docker container alongside google-chrome-stable.
Update screenshot.sh to try google-chrome-stable, chromium, and
chromium-browser in order, with screenshot size validation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant