Add Playwright E2E tests for SSH Docker integration#41
Conversation
…cally.sh Co-authored-by: gensyn <36128035+gensyn@users.noreply.github.com> Agent-Logs-Url: https://github.com/gensyn/ssh_docker/sessions/0f4e4b80-2cc1-4175-bbb9-9da354de3a19
|
@copilot Pretty good, only one test fails: |
Co-authored-by: gensyn <36128035+gensyn@users.noreply.github.com> Agent-Logs-Url: https://github.com/gensyn/ssh_docker/sessions/902054c8-2463-457e-b786-7e33d81e1cd8
... Fixed in c1ca747. The root cause was that HA's REST service API returns 200 immediately after queuing the service handler, not after it completes — so the fixed |
|
@copilot Still failing: |
Co-authored-by: gensyn <36128035+gensyn@users.noreply.github.com> Agent-Logs-Url: https://github.com/gensyn/ssh_docker/sessions/8d1db0b2-e127-4f97-bdf7-5303ef15f717
... Fixed in 7f188aa. The root cause was a race condition in the The fix replaces the fixed sleep with a polling loop that waits (up to 60 s) until the entity is in a non-transitional state, guaranteeing the initial SSH fetch has fully completed before any test action runs. |
|
@copilot I know that I can run Playwright tests with the provided script, but is there any way to debug the tests in PyCharm? |
…ample Agent-Logs-Url: https://github.com/gensyn/ssh_docker/sessions/2a0a37d4-efbe-4116-9258-a7d14695cb93 Co-authored-by: gensyn <36128035+gensyn@users.noreply.github.com>
Yes — added in 95c972f. The short version:
Set breakpoints anywhere and hit Debug. Full instructions are in the new Debugging in PyCharm section of |
|
@copilot The test |
…restart) Agent-Logs-Url: https://github.com/gensyn/ssh_docker/sessions/1879e6a6-1565-4604-8181-456ca4da6e5f Co-authored-by: gensyn <36128035+gensyn@users.noreply.github.com>
Root cause found and fixed in 7e01234. It's a permissions bug, not a race condition:
Fix:
|
|
@copilot This broke almost every other test: |
…sions Agent-Logs-Url: https://github.com/gensyn/ssh_docker/sessions/06b6e855-0e75-4f8f-a5f0-f412f7f1f21e Co-authored-by: gensyn <36128035+gensyn@users.noreply.github.com>
... Fixed in 511e65d. The Replaced with
The |
|
@copilot How can I tear down the docker containers after manually testing locally? Maybe add description to the Playwright README. |
Agent-Logs-Url: https://github.com/gensyn/ssh_docker/sessions/45562362-8319-4287-8ff5-86fafc70170b Co-authored-by: gensyn <36128035+gensyn@users.noreply.github.com>
Added in e7f3c56. A new "4. Tear down when done" subsection is now in the Debugging in PyCharm section of
|
…k-tracker' into copilot/add-playwright-tests-task-tracker
Adds a
tests/playwright/suite testing the SSH Docker HA component end-to-end against a mock Docker host over SSH, fully encapsulated in Docker — matching the mechanics introduced ingensyn/ssh_command#10.Infrastructure
docker-compose.yaml— orchestrates Home Assistant +docker_host+ Playwright test runnertests/playwright/Dockerfile.dockerhost— Ubuntu 24.04 SSH host with a mock Docker CLI; no DinD or--privilegedrequiredtests/playwright/mock-docker.sh— simulatesdocker inspect/ps/restart/stop/rm/logsvia state files; outputs the;-delimited format the coordinator'sdocker inspect --formatexpectstests/playwright/ssh_command/— functional copy of thessh_commandHA component (required dependency) so HA can load it without internet access at build timetests/playwright/entrypoint.sh— waits for HA, completes onboarding, sets up thessh_commandconfig entry (required before anyssh_dockercoordinator call), then runs pytesttests/playwright/ha-init-wrapper.sh— pre-populates/etc/hostsfor musl/Alpine DNS resolution (same pattern asssh_command)Test coverage (
tests/playwright/)test_integration_setup.pytest_sensor.pytest_services.pyrestart,stop,get_logs,refresh; missing/invalidentity_id; unauthenticated calltest_frontend.py/ssh-docker), integrations page visibilitytest_configuration.pytest_security.pyRunning
docker compose build docker compose run --rm playwright-tests # exits with test suite exit code docker compose down -vOr via the dedicated script:
CI integration
run_workflows_locally.sh— new; runstest.yml,pylint.yml,integration-tests.ymlviaact, then delegates Playwright torun_playwright_tests.sh(same pattern asssh_command).github/workflows/playwright-tests.yml—workflow_dispatchonly; builds images, runs suite, uploadsplaywright-results/as artifact⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.