Add Playwright E2E tests for SSH Command integration#10
Draft
Add Playwright E2E tests for SSH Command integration#10
Conversation
Co-authored-by: gensyn <36128035+gensyn@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add comprehensive Playwright end-to-end tests for SSH Command
Add Playwright E2E tests for SSH Command integration
Mar 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
tests/playwright/suite covering the full SSH Command integration lifecycle against real SSH test servers provided by the docker-compose environment.Structure
Key fixture design (
conftest.py)ha_token— session-scoped; fetches a real HA access token via the login flow with retry logic (wait_for_ha)context— authenticated Playwright browser context; token injected intolocalStorageviajson.dumps-escaped JS to avoid injectionensure_integration— function-scoped; sets up the SSH Command config entry before each test, tears it down after; keeps tests idempotent and independentha_api—requests.Sessionwith ****** for direct REST API calls (faster than browser for non-UI assertions)ssh_server_1/ssh_server_2— driven bySSH_HOST,SSH_PORT_1/2,SSH_USER,SSH_PASSWORDenv vars (defaults match the docker-compose setup)Coverage highlights
single_instance_allowed)ssh_command.executeresponse shape:output,error,exit_statusknown_hostswithcheck_known_hosts=False, nonexistent key file) all return HTTP 400sleep 60withtimeout=2returns 400Original prompt
Goal
Add comprehensive Playwright end-to-end tests for the SSH Command Home Assistant custom component.
Background
SSH Command is a Home Assistant custom component that allows executing SSH commands on remote servers. This integration needs thorough E2E testing using Playwright to ensure all functionality works correctly with SSH test servers.
Test Environment
Tests should connect to SSH test servers provided by the docker-compose setup:
ssh_docker_test:2222(user: foo, password: pass)ssh_docker_test:2223(user: foo, password: pass)Requirements
Create Playwright tests in the
tests/playwrightdirectory that cover:Integration Setup Tests (
test_integration_setup.py):Command Execution Tests (
test_command_execution.py):echo,pwd)Service Tests (
test_services.py):ssh_command.sendserviceFrontend Tests (
test_frontend.py):Configuration Tests (
test_configuration.py):Security Tests (
test_security.py):Technical Details
conftest.pywith fixtures for:HOMEASSISTANT_URL(default: http://homeassistant:8123)SSH_HOST(default: ssh_docker_test)SSH_PORT_1(default: 2222)SSH_PORT_2(default: 2223)SSH_USER(default: foo)SSH_PASSWORD(default: pass)File Structure
Additional Files
Create:
tests/playwright/README.md- Documentation on how to run the teststests/playwright/requirements.txt- Python dependencies for testsNotes
The following is the prior conversation context from the user's chat exploration (may be truncated):
User: I have mutliple repositories containing Home Assistant custom components (@gensyn/task_tracker, @gensyn/ssh_command, @gensyn/ssh_docker) that I want to thorougly test using Playwright. For that I plan to spin up a Home Assistant instance in a Docker container solely for testing purposes, but I need a target for testing SSH servers and Docker hosts as well. For that I want to create a Docker container, that uses Docker-in-Docker to spin up two instances of @billchurch/ssh_test. This way, the outer Docker container can be the target of SSH Docker, and the contained SSH servers can be used for testing SSH Command. Task Tracker does not have outside dependencies.
Create a
Dockerfilefile and adocker-compose.yamlfile that serve my described purpose and provide them here.After that, create Playwright tests for each of my mentioned repositories. Put them in their respective repository in a new branch under "tests/playwright" and create a pull request for each repository.
Assistant: I'll help you set up the testing infrastructure and create Playwright tests for your Home Assistant custom components. Let me start by gathering information about your repositories and then provide the Docker configuration files and create th...
This pull request was created from Copilot chat.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.