diff --git a/.circleci/config.yml b/.circleci/config.yml index cda8c93a9..5cec8175d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -87,6 +87,12 @@ workflows: use-random-user: false platforms: linux/arm64 machine-type: ubuntu2204arm64 + - docker-test: + name: "Docker test - Dynamic Grid Standalone" + test-strategy: test_standalone_docker + use-random-user: false + platforms: linux/arm64 + machine-type: ubuntu2204arm64 - docker-test: name: "Docker test - Parallel execution" test-strategy: test_parallel diff --git a/.github/workflows/docker-test.yml b/.github/workflows/docker-test.yml index ee7d7c6c6..55f01c802 100644 --- a/.github/workflows/docker-test.yml +++ b/.github/workflows/docker-test.yml @@ -54,6 +54,10 @@ jobs: use-random-user: false test-video: true build-all: false + - test-strategy: test_standalone_docker + use-random-user: false + test-video: true + build-all: false - test-strategy: test_parallel use-random-user: false test-video: false diff --git a/Makefile b/Makefile index 9ce7233d6..f47d474f8 100644 --- a/Makefile +++ b/Makefile @@ -728,6 +728,52 @@ test_node_docker: hub standalone_docker standalone_chrome standalone_firefox sta done make test_video_integrity +test_standalone_docker: standalone_docker standalone_chrome standalone_firefox standalone_edge standalone_chromium video + sudo rm -rf ./tests/tests + sudo rm -rf ./tests/videos; mkdir -p ./tests/videos/Downloads + sudo chmod -R 777 ./tests/videos + if [ "$(PLATFORMS)" = "linux/amd64" ]; then \ + list_nodes="DeploymentAutoscaling" ; \ + else \ + list_nodes="NodeChromium NodeFirefox" ; \ + fi; \ + for node in $${list_nodes} ; do \ + cd tests || true ; \ + DOWNLOADS_DIR="./videos/Downloads" ; \ + sudo rm -rf $$DOWNLOADS_DIR/* ; \ + echo NAMESPACE=$(NAME) > .env ; \ + echo TAG=$(TAG_VERSION) >> .env ; \ + echo VIDEO_TAG=$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) >> .env ; \ + echo TEST_DRAIN_AFTER_SESSION_COUNT=$(or $(TEST_DRAIN_AFTER_SESSION_COUNT), 0) >> .env ; \ + echo TEST_PARALLEL_HARDENING=$(or $(TEST_PARALLEL_HARDENING), "true") >> .env ; \ + echo LOG_LEVEL=$(or $(LOG_LEVEL), "INFO") >> .env ; \ + echo REQUEST_TIMEOUT=$(or $(REQUEST_TIMEOUT), 300) >> .env ; \ + echo SELENIUM_ENABLE_MANAGED_DOWNLOADS=$(or $(SELENIUM_ENABLE_MANAGED_DOWNLOADS), "true") >> .env ; \ + echo TEST_DELAY_AFTER_TEST=$(or $(TEST_DELAY_AFTER_TEST), 0) >> .env ; \ + echo NODE=$$node >> .env ; \ + echo UID=$$(id -u) >> .env ; \ + echo BINDING_VERSION=$(BINDING_VERSION) >> .env ; \ + echo HOST_IP=$$(hostname -I | awk '{print $$1}') >> .env ; \ + if [ "$(PLATFORMS)" = "linux/amd64" ]; then \ + echo NODE_EDGE=edge >> .env ; \ + else \ + echo NODE_EDGE=chromium >> .env ; \ + fi; \ + if [ $$node = "NodeChrome" ] ; then \ + echo NODE_CHROME=chrome >> .env ; \ + fi ; \ + if [ $$node = "NodeChromium" ] ; then \ + echo NODE_CHROME=chromium >> .env ; \ + else \ + echo NODE_CHROME=chromium >> .env ; \ + fi ; \ + export $$(cat .env | xargs) ; \ + envsubst < standalone_docker_config.toml > ./videos/config.toml ; \ + DOCKER_DEFAULT_PLATFORM=$(PLATFORMS) docker compose -f docker-compose-v3-test-standalone-docker.yaml up --no-log-prefix --build --exit-code-from tests ; \ + if [ $$? -ne 0 ]; then exit 1; fi ; \ + done + make test_video_integrity + test_custom_ca_cert: VERSION=$(TAG_VERSION) NAMESPACE=$(NAMESPACE) ./tests/customCACert/bootstrap.sh diff --git a/tests/docker-compose-v3-test-node-docker.yaml b/tests/docker-compose-v3-test-node-docker.yaml index a06a3afed..f93fb592d 100644 --- a/tests/docker-compose-v3-test-node-docker.yaml +++ b/tests/docker-compose-v3-test-node-docker.yaml @@ -21,6 +21,7 @@ services: - SE_EVENT_BUS_PUBLISH_PORT=4442 - SE_EVENT_BUS_SUBSCRIBE_PORT=4443 - SE_NODE_ENABLE_MANAGED_DOWNLOADS=${SELENIUM_ENABLE_MANAGED_DOWNLOADS} + - SE_OPTS=--enable-managed-downloads ${SELENIUM_ENABLE_MANAGED_DOWNLOADS} - SE_BROWSER_ARGS_DISABLE_DSHM=--disable-dev-shm-usage - SE_LOG_LEVEL=${LOG_LEVEL} diff --git a/tests/docker-compose-v3-test-node-relay.yml b/tests/docker-compose-v3-test-node-relay.yml index 0df6cc6c3..0e736a23e 100644 --- a/tests/docker-compose-v3-test-node-relay.yml +++ b/tests/docker-compose-v3-test-node-relay.yml @@ -17,6 +17,9 @@ services: standalone: image: ${NAMESPACE}/standalone-${BROWSER}:${TAG} shm_size: 2gb + environment: + - SE_OPTS=--enable-cdp true + - SE_NODE_ENABLE_CDP=true selenium-hub: image: ${NAMESPACE}/hub:${TAG} diff --git a/tests/docker-compose-v3-test-standalone-docker.yaml b/tests/docker-compose-v3-test-standalone-docker.yaml new file mode 100644 index 000000000..81661babe --- /dev/null +++ b/tests/docker-compose-v3-test-standalone-docker.yaml @@ -0,0 +1,39 @@ +version: "3" +services: + standalone-docker: + image: ${NAMESPACE}/standalone-docker:${TAG} + volumes: + - ./videos:/opt/selenium/assets + - ./videos/config.toml:/opt/selenium/config.toml + - /var/run/docker.sock:/var/run/docker.sock + environment: + - SE_VNC_NO_PASSWORD=true + - SE_START_VNC=true + - SE_LOG_LEVEL=${LOG_LEVEL} + - SE_NODE_ENABLE_MANAGED_DOWNLOADS=${SELENIUM_ENABLE_MANAGED_DOWNLOADS} + - SE_NODE_GRID_URL=http://0.0.0.0:4444 + - SE_OPTS=--log-level ${LOG_LEVEL} --enable-managed-downloads ${SELENIUM_ENABLE_MANAGED_DOWNLOADS} + container_name: selenium-hub + ports: + - "4444:4444" + healthcheck: + test: "/opt/bin/check-grid.sh --host 0.0.0.0 --port 4444" + interval: 15s + timeout: 30s + retries: 5 + + tests: + image: docker-selenium-tests:latest + build: + context: ./ + dockerfile: ./Dockerfile + depends_on: + - standalone-docker + environment: + - RUN_IN_DOCKER_COMPOSE=true + - SELENIUM_GRID_HOST=selenium-hub + - BINDING_VERSION=${BINDING_VERSION} + - SELENIUM_ENABLE_MANAGED_DOWNLOADS=${SELENIUM_ENABLE_MANAGED_DOWNLOADS} + - TEST_PARALLEL_HARDENING=${TEST_PARALLEL_HARDENING} + - TEST_DELAY_AFTER_TEST=${TEST_DELAY_AFTER_TEST} + command: ["/bin/bash", "-c", "./bootstrap.sh ${NODE}"] diff --git a/tests/standalone_docker_config.toml b/tests/standalone_docker_config.toml new file mode 100755 index 000000000..f768a7574 --- /dev/null +++ b/tests/standalone_docker_config.toml @@ -0,0 +1,24 @@ +[docker] +configs = [ + "${NAMESPACE}/standalone-firefox:${TAG}", '{"browserName": "firefox", "platformName": "linux"}', + "${NAMESPACE}/standalone-${NODE_CHROME}:${TAG}", '{"browserName": "chrome", "platformName": "linux"}', + "${NAMESPACE}/standalone-${NODE_EDGE}:${TAG}", '{"browserName": "MicrosoftEdge", "platformName": "linux"}' + ] + +url = "http://127.0.0.1:2375" + +video-image = "${NAMESPACE}/video:${VIDEO_TAG}" + +[node] +enable-managed-downloads = "${SELENIUM_ENABLE_MANAGED_DOWNLOADS}" +override-max-sessions = true +max-sessions = 10 +session-timeout = 1000 +enable-cdp = true +selenium-manager = true + +[sessionqueue] +session-request-timeout = "${REQUEST_TIMEOUT}" + +[router] +disable-ui = false