This page provides guidance for contributors who want to set up a local development environment, build Docker images, run tests, and submit contributions to the docker-selenium project. It covers environment setup, build processes, local testing procedures, and contribution workflows. For information about the testing framework architecture and test suites, see Testing Framework and Test Suites.
Before setting up the development environment, ensure your system meets these requirements:
Requirement | Minimum Version | Recommended | Purpose |
---|---|---|---|
Operating System | Ubuntu 20.04+ | Ubuntu 22.04/24.04 | Development and CI environment |
RAM | 8 GB | 16 GB+ | Building multi-architecture images |
Disk Space | 50 GB | 100 GB+ | Docker images, build cache, test artifacts |
CPU Architecture | AMD64 or ARM64 | AMD64 | Multi-arch support |
Internet Connection | Required | High-speed | Downloading dependencies |
Sources: tests/charts/make/chart_setup_env.sh1-219
The project provides an automated setup script that installs all required dependencies. The setup process configures Docker with multi-architecture support, Kubernetes tools, and testing utilities.
Diagram: Development Environment Setup Flow
Sources: tests/charts/make/chart_setup_env.sh1-219
The setup script is located at tests/charts/make/chart_setup_env.sh and can be invoked via the Makefile:
The script installs the following components:
DOCKER_VERSION
)Sources: tests/charts/make/chart_setup_env.sh48-91
Cross-compilation tools and QEMU emulation for building ARM64 images on AMD64 hosts:
Sources: tests/charts/make/chart_setup_env.sh60-77
The script supports two cluster types via the CLUSTER
environment variable:
Kind (Kubernetes in Docker)
Minikube (Default)
Sources: tests/charts/make/chart_setup_env.sh93-161
Tool | Purpose | Installation Source |
---|---|---|
kubectl | Kubernetes CLI | Official Kubernetes releases |
Helm | Kubernetes package manager | Helm GitHub releases |
chart-testing (ct) | Helm chart linting and testing | helm/chart-testing |
helm-docs | Generate Helm documentation | norwoodj/helm-docs |
envsubst | Template substitution | a8m/envsubst |
Node.js/npm | JavaScript tooling (via nvm) | nvm-sh/nvm |
Sources: tests/charts/make/chart_setup_env.sh163-218
The project uses Docker's containerd image store feature for improved performance and storage efficiency:
This configuration is automatically applied by make setup_dev_env
and provides:
Sources: .github/workflows/release-chrome-versions.yml75-81
The project uses a Makefile-based build system that orchestrates Docker image builds with multi-architecture support.
Diagram: Image Build Dependency Chain
Sources: Base/Dockerfile1-235 tests/test.py170-221
The build system supports building images for multiple platforms simultaneously using Docker Buildx:
Build Arguments Mapping:
Environment Variable | Build Arg | Default | Purpose |
---|---|---|---|
VERSION | VERSION | (from file) | Image version tag |
BASE_VERSION | BASE_VERSION | (from upstream) | Selenium Grid version |
BASE_RELEASE | RELEASE | selenium-${VERSION} | Selenium JAR release name |
NAMESPACE | AUTHORS | selenium | Docker registry namespace |
BUILD_DATE | BUILD_DATE | Current date | Build timestamp |
Sources: tests/test.py109-114
The project maintains browser version matrices for backward compatibility testing. To build a specific browser version:
The bootstrap.sh
script:
CHROME_VERSION
, FIREFOX_VERSION
, EDGE_VERSION
)Sources: .github/workflows/release-chrome-versions.yml115-126 tests/build-backward-compatible/browser-matrix.yml1-207
Diagram: Docker Image Build Process Flow
The build process in tests/test.py170-221 performs these steps:
SKIP_BUILD
is set to reuse existing imagesdocker.images.build()
with appropriate parametersSources: tests/test.py117-238
The project has two test levels: Docker-level tests that validate individual images, and Kubernetes-level tests that verify Helm chart deployments.
Diagram: Test Execution Pipeline
Sources: tests/bootstrap.sh1-41 tests/test.py1-318
Docker tests validate individual images by launching containers and running Selenium WebDriver tests.
The tests/bootstrap.sh1-41 script performs these steps:
BINDING_VERSION
test.py
or specific unittest classesSources: tests/bootstrap.sh1-41
Diagram: test.py Orchestration Logic
The tests/test.py1-318 orchestrator:
/status
endpoint is readyContainer Launch Configuration:
Sources: tests/test.py170-221 tests/test.py241-318
The test framework includes two main test suite types defined in tests/SeleniumTests/__init__.py1-400:
SeleniumGenericTests Base Class:
test_title()
: Verifies page title loadingtest_with_frames()
: Tests frame switchingtest_select_from_a_dropdown()
: Tests dropdown interactiontest_visit_basic_auth_secured_page()
: Tests HTTP basic authtest_play_video()
: Tests video playbacktest_download_file()
: Tests file downloads (with managed downloads)Browser-Specific Test Classes:
ChromeTests
: Extends SeleniumGenericTests
with Chrome-specific optionsFirefoxTests
: Extends with Firefox profile configuration, language testsEdgeTests
: Extends with Edge-specific optionsAutoscaling Test Classes:
DeploymentAutoscalingTests
: Tests KEDA autoscaling with DeploymentsJobAutoscalingTests
: Tests KEDA autoscaling with JobsSources: tests/SeleniumTests/__init__.py65-400
Helm chart tests validate Kubernetes deployments across multiple dimensions: K8s versions, autoscaling strategies, and configuration scenarios.
The CI system tests against multiple combinations:
Dimension | Values | Source |
---|---|---|
K8s Versions | v1.28.15, v1.29.15, v1.30.14, v1.31.12, v1.32.9, v1.34.1 | .github/workflows/k8s-scaling-test.yml |
Helm Versions | v3.14.3 - v3.19.0 | .github/workflows/k8s-scaling-test.yml |
Docker Versions | 27.5.1, 28.4.0 | .github/workflows/k8s-scaling-test.yml |
Python Versions | 3.9, 3.10, 3.11, 3.12, 3.13 | .github/workflows/k8s-scaling-test.yml |
Test Strategies | deployment_count, job_count, chaos, node_max_sessions | .github/workflows/k8s-scaling-test.yml |
Sources: .github/workflows/k8s-scaling-test.yml66-116
Diagram: Helm Chart Test Pipeline
Sources: .github/workflows/k8s-scaling-test.yml123-213
Tests can be configured using environment variables:
Sources: tests/SeleniumTests/__init__.py17-41
Diagram: Contribution Workflow
Commit Message Guidelines:
When you create a pull request, GitHub Actions automatically runs:
The workflows defined in .github/workflows/build-test.yml execute:
Sources: .github/workflows/release-chrome-versions.yml1-169
Pull requests undergo review by project maintainers who check:
To build and test a legacy browser version for backward compatibility:
Browser Version Matrix Files:
Sources: .github/workflows/release-chrome-versions.yml115-147 tests/build-backward-compatible/browser-matrix.yml1-207
When testing compatibility with older Selenium Grid versions:
Sources: tests/SeleniumTests/__init__.py39-45 tests/build-backward-compatible/selenium-matrix.yml1-206
When tests fail, follow this debugging approach:
Test Environment Variables:
Variable | Purpose | Default |
---|---|---|
SKIP_BUILD | Skip rebuilding images | false |
PLATFORMS | Target architectures | linux/amd64 |
FILESYSTEM_READ_ONLY | Test read-only filesystem | false |
USE_RANDOM_USER_ID | Test non-root user | false |
TEST_DELAY_AFTER_TEST | Delay between tests (seconds) | 0 |
Sources: tests/test.py43-54 tests/SeleniumTests/__init__.py17-41
To add support for a new browser (e.g., Chromium variant):
NodeChromiumCustom/
)Sources: Base/Dockerfile1-235 tests/test.py61-107
When contributing documentation changes:
Documentation sources:
README.md.gotmpl
templateSources: tests/charts/make/chart_setup_env.sh197-200
Sources: Base/Dockerfile89-115
.dockerignore
to exclude unnecessary filesSources: Repository README and community guidelines
Refresh this wiki