Using Selenium Hub to support different browsers

This commit is contained in:
Alexey Pustovalov 2024-06-10 16:32:50 +09:00
parent 1ba43e5924
commit 4ac13431b3
19 changed files with 357 additions and 141 deletions

8
.env
View File

@ -32,8 +32,12 @@ POSTGRESQL_IMAGE_TAG=16-alpine
ELASTICSEARCH_IMAGE=elasticsearch ELASTICSEARCH_IMAGE=elasticsearch
ELASTICSEARCH_IMAGE_TAG=latest ELASTICSEARCH_IMAGE_TAG=latest
WEBDRIVER_IMAGE=selenium/standalone-chrome WEBDRIVER_IMAGE=selenium/hub
WEBDRIVER_IMAGE_TAG=latest WEBDRIVER_IMAGE_TAG=4.21.0
WEBDRIVER_CHROME_IMAGE=selenium/node-chrome
WEBDRIVER_CHROME_IMAGE_TAG=125.0
WEBDRIVER_FIREFOX_IMAGE=selenium/node-firefox
WEBDRIVER_FIREFOX_IMAGE_TAG=126.0
# Expose ports per service # Expose ports per service
ZABBIX_SERVER_PORT=10051 ZABBIX_SERVER_PORT=10051

View File

@ -1,18 +1,55 @@
services: services:
selenium: selenium:
image: "${WEBDRIVER_IMAGE}:${WEBDRIVER_IMAGE_TAG}" image: "${WEBDRIVER_IMAGE}:${WEBDRIVER_IMAGE_TAG}"
restart: "${RESTART_POLICY}"
attach: false
scale: 4
profiles: profiles:
- full - selenium
- all - selenium-chrome
shm_size: "2gb" - selenium-firefox
env_file:
- path: ${ENV_VARS_DIRECTORY}/.env_selenium
required: false
networks: networks:
tools_frontend: tools_frontend:
aliases: aliases:
- webdriver - webdriver
- selenium-hub
- selenium - selenium
selenium-chrome:
image: "${WEBDRIVER_CHROME_IMAGE}:${WEBDRIVER_CHROME_IMAGE_TAG}"
restart: "${RESTART_POLICY}"
attach: false
scale: 2
depends_on:
- selenium
profiles:
- selenium
- selenium-chrome
shm_size: "2gb"
env_file:
- path: ${ENV_VARS_DIRECTORY}/.env_selenium_chrome
required: false
environment:
- SE_EVENT_BUS_HOST=selenium
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
networks:
tools_frontend:
selenium-firefox:
image: "${WEBDRIVER_FIREFOX_IMAGE}:${WEBDRIVER_FIREFOX_IMAGE_TAG}"
restart: "${RESTART_POLICY}"
attach: false
scale: 2
depends_on:
- selenium
profiles:
- selenium
- selenium-firefox
shm_size: "2gb"
env_file:
- path: ${ENV_VARS_DIRECTORY}/.env_selenium_firefox
required: false
environment:
- SE_EVENT_BUS_HOST=selenium
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
networks:
tools_frontend:

View File

@ -77,8 +77,7 @@ services:
restart: "${RESTART_POLICY}" restart: "${RESTART_POLICY}"
attach: false attach: false
profiles: profiles:
- full - elasticsearch
- all
environment: environment:
- transport.host=0.0.0.0 - transport.host=0.0.0.0
- discovery.zen.minimum_master_nodes=1 - discovery.zen.minimum_master_nodes=1

View File

@ -101,15 +101,26 @@ services:
file: compose_databases.yaml file: compose_databases.yaml
service: db-data-mysql service: db-data-mysql
# elasticsearch: elasticsearch:
# extends: extends:
# file: compose_databases.yaml file: compose_databases.yaml
# service: elasticsearch service: elasticsearch
# selenium: selenium:
# extends: extends:
# file: compose_additional_components.yaml file: compose_additional_components.yaml
# service: selenium service: selenium
selenium-chrome:
platform: linux/amd64
extends:
file: compose_additional_components.yaml
service: selenium-chrome
selenium-firefox:
extends:
file: compose_additional_components.yaml
service: selenium-firefox
networks: networks:
frontend: frontend:

View File

@ -201,15 +201,26 @@ services:
file: compose_databases.yaml file: compose_databases.yaml
service: db-data-mysql service: db-data-mysql
# elasticsearch: elasticsearch:
# extends: extends:
# file: compose_databases.yaml file: compose_databases.yaml
# service: elasticsearch service: elasticsearch
# selenium: selenium:
# extends: extends:
# file: compose_additional_components.yaml file: compose_additional_components.yaml
# service: selenium service: selenium
selenium-chrome:
platform: linux/amd64
extends:
file: compose_additional_components.yaml
service: selenium-chrome
selenium-firefox:
extends:
file: compose_additional_components.yaml
service: selenium-firefox
networks: networks:
frontend: frontend:

View File

@ -111,15 +111,26 @@ services:
file: compose_databases.yaml file: compose_databases.yaml
service: db-data-pgsql service: db-data-pgsql
# elasticsearch: elasticsearch:
# extends: extends:
# file: compose_databases.yaml file: compose_databases.yaml
# service: elasticsearch service: elasticsearch
# selenium: selenium:
# extends: extends:
# file: compose_additional_components.yaml file: compose_additional_components.yaml
# service: selenium service: selenium
selenium-chrome:
platform: linux/amd64
extends:
file: compose_additional_components.yaml
service: selenium-chrome
selenium-firefox:
extends:
file: compose_additional_components.yaml
service: selenium-firefox
networks: networks:
frontend: frontend:

View File

@ -225,15 +225,26 @@ services:
file: compose_databases.yaml file: compose_databases.yaml
service: db-data-pgsql service: db-data-pgsql
# elasticsearch: elasticsearch:
# extends: extends:
# file: compose_databases.yaml file: compose_databases.yaml
# service: elasticsearch service: elasticsearch
# selenium: selenium:
# extends: extends:
# file: compose_additional_components.yaml file: compose_additional_components.yaml
# service: selenium service: selenium
selenium-chrome:
platform: linux/amd64
extends:
file: compose_additional_components.yaml
service: selenium-chrome
selenium-firefox:
extends:
file: compose_additional_components.yaml
service: selenium-firefox
networks: networks:
frontend: frontend:

View File

@ -101,15 +101,26 @@ services:
file: compose_databases.yaml file: compose_databases.yaml
service: db-data-mysql service: db-data-mysql
# elasticsearch: elasticsearch:
# extends: extends:
# file: compose_databases.yaml file: compose_databases.yaml
# service: elasticsearch service: elasticsearch
# selenium: selenium:
# extends: extends:
# file: compose_additional_components.yaml file: compose_additional_components.yaml
# service: selenium service: selenium
selenium-chrome:
platform: linux/amd64
extends:
file: compose_additional_components.yaml
service: selenium-chrome
selenium-firefox:
extends:
file: compose_additional_components.yaml
service: selenium-firefox
networks: networks:
frontend: frontend:

View File

@ -202,15 +202,26 @@ services:
file: compose_databases.yaml file: compose_databases.yaml
service: db-data-mysql service: db-data-mysql
# elasticsearch: elasticsearch:
# extends: extends:
# file: compose_databases.yaml file: compose_databases.yaml
# service: elasticsearch service: elasticsearch
# selenium: selenium:
# extends: extends:
# file: compose_additional_components.yaml file: compose_additional_components.yaml
# service: selenium service: selenium
selenium-chrome:
platform: linux/amd64
extends:
file: compose_additional_components.yaml
service: selenium-chrome
selenium-firefox:
extends:
file: compose_additional_components.yaml
service: selenium-firefox
networks: networks:
frontend: frontend:

View File

@ -111,15 +111,26 @@ services:
file: compose_databases.yaml file: compose_databases.yaml
service: db-data-pgsql service: db-data-pgsql
# elasticsearch: elasticsearch:
# extends: extends:
# file: compose_databases.yaml file: compose_databases.yaml
# service: elasticsearch service: elasticsearch
# selenium: selenium:
# extends: extends:
# file: compose_additional_components.yaml file: compose_additional_components.yaml
# service: selenium service: selenium
selenium-chrome:
platform: linux/amd64
extends:
file: compose_additional_components.yaml
service: selenium-chrome
selenium-firefox:
extends:
file: compose_additional_components.yaml
service: selenium-firefox
networks: networks:
frontend: frontend:

View File

@ -225,15 +225,26 @@ services:
file: compose_databases.yaml file: compose_databases.yaml
service: db-data-pgsql service: db-data-pgsql
# elasticsearch: elasticsearch:
# extends: extends:
# file: compose_databases.yaml file: compose_databases.yaml
# service: elasticsearch service: elasticsearch
# selenium: selenium:
# extends: extends:
# file: compose_additional_components.yaml file: compose_additional_components.yaml
# service: selenium service: selenium
selenium-chrome:
platform: linux/amd64
extends:
file: compose_additional_components.yaml
service: selenium-chrome
selenium-firefox:
extends:
file: compose_additional_components.yaml
service: selenium-firefox
networks: networks:
frontend: frontend:

View File

@ -101,15 +101,26 @@ services:
file: compose_databases.yaml file: compose_databases.yaml
service: db-data-mysql service: db-data-mysql
# elasticsearch: elasticsearch:
# extends: extends:
# file: compose_databases.yaml file: compose_databases.yaml
# service: elasticsearch service: elasticsearch
# selenium: selenium:
# extends: extends:
# file: compose_additional_components.yaml file: compose_additional_components.yaml
# service: selenium service: selenium
selenium-chrome:
platform: linux/amd64
extends:
file: compose_additional_components.yaml
service: selenium-chrome
selenium-firefox:
extends:
file: compose_additional_components.yaml
service: selenium-firefox
networks: networks:
frontend: frontend:

View File

@ -202,15 +202,26 @@ services:
file: compose_databases.yaml file: compose_databases.yaml
service: db-data-mysql service: db-data-mysql
# elasticsearch: elasticsearch:
# extends: extends:
# file: compose_databases.yaml file: compose_databases.yaml
# service: elasticsearch service: elasticsearch
# selenium: selenium:
# extends: extends:
# file: compose_additional_components.yaml file: compose_additional_components.yaml
# service: selenium service: selenium
selenium-chrome:
platform: linux/amd64
extends:
file: compose_additional_components.yaml
service: selenium-chrome
selenium-firefox:
extends:
file: compose_additional_components.yaml
service: selenium-firefox
networks: networks:
frontend: frontend:

View File

@ -111,15 +111,26 @@ services:
file: compose_databases.yaml file: compose_databases.yaml
service: db-data-pgsql service: db-data-pgsql
# elasticsearch: elasticsearch:
# extends: extends:
# file: compose_databases.yaml file: compose_databases.yaml
# service: elasticsearch service: elasticsearch
# selenium: selenium:
# extends: extends:
# file: compose_additional_components.yaml file: compose_additional_components.yaml
# service: selenium service: selenium
selenium-chrome:
platform: linux/amd64
extends:
file: compose_additional_components.yaml
service: selenium-chrome
selenium-firefox:
extends:
file: compose_additional_components.yaml
service: selenium-firefox
networks: networks:
frontend: frontend:

View File

@ -225,15 +225,26 @@ services:
file: compose_databases.yaml file: compose_databases.yaml
service: db-data-pgsql service: db-data-pgsql
# elasticsearch: elasticsearch:
# extends: extends:
# file: compose_databases.yaml file: compose_databases.yaml
# service: elasticsearch service: elasticsearch
# selenium: selenium:
# extends: extends:
# file: compose_additional_components.yaml file: compose_additional_components.yaml
# service: selenium service: selenium
selenium-chrome:
platform: linux/amd64
extends:
file: compose_additional_components.yaml
service: selenium-chrome
selenium-firefox:
extends:
file: compose_additional_components.yaml
service: selenium-firefox
networks: networks:
frontend: frontend:

View File

@ -89,15 +89,26 @@ services:
file: compose_databases.yaml file: compose_databases.yaml
service: db-data-mysql service: db-data-mysql
# elasticsearch: elasticsearch:
# extends: extends:
# file: compose_databases.yaml file: compose_databases.yaml
# service: elasticsearch service: elasticsearch
# selenium: selenium:
# extends: extends:
# file: compose_additional_components.yaml file: compose_additional_components.yaml
# service: selenium service: selenium
selenium-chrome:
platform: linux/amd64
extends:
file: compose_additional_components.yaml
service: selenium-chrome
selenium-firefox:
extends:
file: compose_additional_components.yaml
service: selenium-firefox
networks: networks:
frontend: frontend:

View File

@ -190,15 +190,26 @@ services:
file: compose_databases.yaml file: compose_databases.yaml
service: db-data-mysql service: db-data-mysql
# elasticsearch: elasticsearch:
# extends: extends:
# file: compose_databases.yaml file: compose_databases.yaml
# service: elasticsearch service: elasticsearch
# selenium: selenium:
# extends: extends:
# file: compose_additional_components.yaml file: compose_additional_components.yaml
# service: selenium service: selenium
selenium-chrome:
platform: linux/amd64
extends:
file: compose_additional_components.yaml
service: selenium-chrome
selenium-firefox:
extends:
file: compose_additional_components.yaml
service: selenium-firefox
networks: networks:
frontend: frontend:

View File

@ -99,15 +99,26 @@ services:
file: compose_databases.yaml file: compose_databases.yaml
service: db-data-pgsql service: db-data-pgsql
# elasticsearch: elasticsearch:
# extends: extends:
# file: compose_databases.yaml file: compose_databases.yaml
# service: elasticsearch service: elasticsearch
# selenium: selenium:
# extends: extends:
# file: compose_additional_components.yaml file: compose_additional_components.yaml
# service: selenium service: selenium
selenium-chrome:
platform: linux/amd64
extends:
file: compose_additional_components.yaml
service: selenium-chrome
selenium-firefox:
extends:
file: compose_additional_components.yaml
service: selenium-firefox
networks: networks:
frontend: frontend:

View File

@ -213,15 +213,26 @@ services:
file: compose_databases.yaml file: compose_databases.yaml
service: db-data-pgsql service: db-data-pgsql
# elasticsearch: elasticsearch:
# extends: extends:
# file: compose_databases.yaml file: compose_databases.yaml
# service: elasticsearch service: elasticsearch
# selenium: selenium:
# extends: extends:
# file: compose_additional_components.yaml file: compose_additional_components.yaml
# service: selenium service: selenium
selenium-chrome:
platform: linux/amd64
extends:
file: compose_additional_components.yaml
service: selenium-chrome
selenium-firefox:
extends:
file: compose_additional_components.yaml
service: selenium-firefox
networks: networks:
frontend: frontend: