This page provides a guide for contributors to set up their development environment, run tests locally, and understand the testing framework. The Docker Selenium testing system validates browser automation, container orchestration, autoscaling, and grid readiness across multiple deployment scenarios.
For information about CI/CD workflows and automated releases, see CI/CD and Release Management. For details about the actual test suites executed in CI/CD pipelines, see Testing Framework and Test Suites. For contributing guidelines and development workflows, see Development Setup and Contributing.
Docker-level tests validate individual images and basic grid functionality:
Helm chart tests validate Kubernetes deployments:
Sources: tests/bootstrap.sh1-41 tests/charts/make/chart_test.sh1-571
The Docker Selenium testing framework is built around Python unittest classes that validate browser functionality across different deployment modes and configurations. The framework supports parallel test execution, multiple browser versions, and various platform combinations.
Sources: tests/SeleniumTests/__init__.py65-400
The SeleniumTests
module at tests/SeleniumTests/__init__.py17-41 uses environment variables to control test behavior:
Variable | Purpose | Default Value | Used At |
---|---|---|---|
SELENIUM_GRID_PROTOCOL | Grid protocol (http/https) | http | Line 17 |
SELENIUM_GRID_HOST | Grid hostname | localhost | Line 18 |
SELENIUM_GRID_PORT | Grid port | 4444 | Line 19 |
SELENIUM_GRID_USERNAME | Basic auth username | None | Line 20 |
SELENIUM_GRID_PASSWORD | Basic auth password | None | Line 21 |
CHART_CERT_PATH | TLS certificate path | None | Line 22 |
WEB_DRIVER_WAIT_TIMEOUT | WebDriver wait timeout (seconds) | 60 | Line 25 |
TEST_PARALLEL_HARDENING | Enable parallel test execution | false | Line 26 |
TEST_PARALLEL_COUNT | Number of parallel tests | 5 | Line 27 |
TEST_DELAY_AFTER_TEST | Delay after each test (seconds) | 0 | Line 28 |
TEST_NODE_RELAY | Test external relay nodes | false | Line 29 |
TEST_PLATFORMS | Target platform | linux/amd64 | Line 31 |
TEST_MULTIPLE_VERSIONS | Test multiple browser versions | false | Line 35 |
TEST_MULTIPLE_PLATFORMS | Test multiple platforms | false | Line 36 |
TEST_ADD_CAPS_RECORD_VIDEO | Enable video recording capability | true | Line 33 |
TEST_CUSTOM_SPECIFIC_NAME | Test custom capabilities | false | Line 34 |
The chart_test.sh
script at tests/charts/make/chart_test.sh5-72 provides Kubernetes-specific configuration:
Variable | Purpose | Default Value |
---|---|---|
CLUSTER_NAME | Kubernetes cluster name | chart-testing |
RELEASE_NAME | Helm release name | test |
SELENIUM_NAMESPACE | Target namespace | selenium |
MATRIX_BROWSER | Browser type to test | NodeChrome |
SELENIUM_GRID_AUTOSCALING | Enable autoscaling tests | true |
SCALING_STRATEGY | KEDA scaling strategy | default |
WAIT_TIMEOUT | Kubernetes wait timeout | 90s |
AUTOSCALING_POLL_INTERVAL | KEDA polling interval | 20 |
AUTOSCALING_COOLDOWN_PERIOD | KEDA cooldown period | 1800 |
LIMIT_RESOURCES | Apply resource limits | true |
TEST_UPGRADE_CHART | Test chart upgrade | false |
RENDER_HELM_TEMPLATE_ONLY | Only render templates | false |
Sources: tests/SeleniumTests/__init__.py17-41 tests/charts/make/chart_test.sh5-72
The test.py
script at tests/test.py1-318 manages container lifecycle, network setup, and test orchestration.
Sources: tests/test.py241-318
The test.py
script uses dictionaries to map test arguments to Docker image names and test classes:
IMAGE_NAME_MAP at tests/test.py61-82:
NodeChrome
) to image names (e.g., node-chrome
)TEST_NAME_MAP at tests/test.py84-107:
NodeChrome
/StandaloneChrome
→ ChromeTests
NodeFirefox
/StandaloneFirefox
→ FirefoxTests
NodeEdge
/StandaloneEdge
→ EdgeTests
Sources: tests/test.py61-107
The launch_container()
function at tests/test.py170-221 builds Docker images on-demand and manages container lifecycle:
The function handles:
FROM_IMAGE_ARGS
with NAMESPACE
, VERSION
, BASE_VERSION
at tests/test.py109-114shm_size="2G"
) and read-only filesystem support at tests/test.py214-216Sources: tests/test.py170-221
The chart_test.sh
script at tests/charts/make/chart_test.sh1-571 orchestrates end-to-end Helm chart testing.
Sources: tests/charts/make/chart_test.sh1-571
The script builds complex Helm commands by combining multiple configuration sources:
Base Values Files at tests/charts/make/chart_test.sh421-436:
base-auth-ingress-values.yaml
: Authentication and ingress settingsbase-recorder-values.yaml
: Video recording configurationbase-resources-values.yaml
: Resource limits (if enabled)NodeChrome-values.yaml
)Image Configuration at tests/charts/make/chart_test.sh178-192:
global.seleniumGrid.imageRegistry
, imageTag
Feature Toggles via conditional --set
flags:
Sources: tests/charts/make/chart_test.sh178-504
The Docker-level testing framework uses Python unittest with Selenium bindings to validate browser functionality. The setup process is automated through the bootstrap.sh
script.
The bootstrap.sh
script in tests/bootstrap.sh1-41 handles environment setup, dependency installation, and test execution:
Sources: tests/bootstrap.sh1-41
The testing framework requires the following Python packages (defined in tests/requirements.txt
):
selenium
: WebDriver bindings for browser automationdocker
: Docker SDK for Python to manage container lifecyclerequests
: HTTP library for API calls to Grid endpointsVariable | Purpose | Default | Required |
---|---|---|---|
NAMESPACE | Docker registry namespace | - | Yes |
VERSION | Image tag version | - | Yes |
BINDING_VERSION | Selenium Python bindings version | - | Yes |
SKIP_BUILD | Skip image building (use existing images) | false | No |
PLATFORMS | Target platform for builds | linux/amd64 | No |
USE_RANDOM_USER_ID | Test with random user ID | false | No |
FILESYSTEM_READ_ONLY | Test with read-only filesystem | false | No |
Sources: tests/test.py43-54
The Base/Dockerfile
provides the foundation for all images with development and runtime tools:
/opt/venv
configured at Base/Dockerfile73-82Sources: Base/Dockerfile1-234
The Helm chart testing framework validates Kubernetes deployments across multiple configurations and versions.
The chart_cluster_setup.sh
script at tests/charts/make/chart_cluster_setup.sh1-66 sets up test Kubernetes clusters using either Kind or Minikube:
Sources: tests/charts/make/chart_cluster_setup.sh41-65
The chart_test.sh
script at tests/charts/make/chart_test.sh1-571 orchestrates Helm chart deployment and testing with extensive configuration options:
Configuration | Purpose | Default |
---|---|---|
CLUSTER_NAME | Kubernetes cluster name | chart-testing |
RELEASE_NAME | Helm release name | test |
SELENIUM_NAMESPACE | Target namespace | selenium |
MATRIX_BROWSER | Browser type to test | NodeChrome |
SELENIUM_GRID_AUTOSCALING | Enable autoscaling tests | true |
SCALING_STRATEGY | KEDA scaling strategy | default |
TEST_EXISTING_KEDA | Use existing KEDA installation | false |
TEST_MULTIPLE_VERSIONS | Test multiple browser versions | false |
Sources: tests/charts/make/chart_test.sh5-72
The framework implements comprehensive test coverage across multiple browsers and scenarios:
All browser tests inherit from SeleniumGenericTests
and execute:
test_title()
validates basic page loading and title verificationtest_with_frames()
tests nested frame navigationtest_select_from_a_dropdown()
validates dropdown selectiontest_visit_basic_auth_secured_page()
tests HTTP basic authtest_play_video()
validates video element interactiontest_download_file()
tests download functionality with managed downloadsSources: tests/SeleniumTests/__init__.py67-130
Each browser test class implements a setUp()
method that configures WebDriver options and capabilities:
ChromeTests setUp() at tests/SeleniumTests/__init__.py146-203:
FirefoxTests setUp() at tests/SeleniumTests/__init__.py255-305:
EdgeTests setUp() at tests/SeleniumTests/__init__.py206-251:
EdgeOptions()
instead of ChromeOptions()
All browser tests support:
se:recordVideo
capability controlled by TEST_ADD_CAPS_RECORD_VIDEO
se:name
set to {testMethodName} ({className})
se:screenResolution
set to 1920x1080
TEST_MULTIPLE_VERSIONS=true
TEST_MULTIPLE_PLATFORMS=true
Sources: tests/SeleniumTests/__init__.py145-305
The SmokeTests
module at tests/SmokeTests/__init__.py1-75 provides grid readiness validation before executing Selenium tests.
The GridTest
class at tests/SmokeTests/__init__.py70-75 validates:
Grid Readiness via smoke_test_container()
at tests/SmokeTests/__init__.py26-61:
/status
endpoint with retry logicHUB_CHECKS_MAX_ATTEMPTS
and HUB_CHECKS_INTERVAL
TLS Certificate Validation via client_verify_cert()
at tests/SmokeTests/__init__.py62-68:
REQUESTS_CA_BUNDLE
environment variableCHART_CERT_PATH
Sources: tests/SmokeTests/__init__.py1-75
The framework supports autoscaling validation through concurrent test execution:
Refresh this wiki