Skip to content

Commit

Permalink
Merge pull request #173 from jdi-testing/use-selenoid
Browse files Browse the repository at this point in the history
use selenoid
  • Loading branch information
Ekaterina-Zykova authored Nov 29, 2023
2 parents 45b457a + 6e8cc04 commit e3e7395
Show file tree
Hide file tree
Showing 9 changed files with 127 additions and 17 deletions.
13 changes: 0 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,6 @@ RUN apt-get update -y && \

RUN apt install -y curl wget mc gcc make

RUN apt-get update && \
apt-get install -y --no-install-recommends gnupg wget curl unzip && \
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list && \
apt-get update -y && \
apt-get install -y --no-install-recommends google-chrome-stable && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /var/cache/apt/* && \
CHROME_VERSION=$(google-chrome --product-version) && \
wget -q --continue -P /chromedriver "https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/$CHROME_VERSION/linux64/chromedriver-linux64.zip" && \
unzip /chromedriver/chromedriver* -d /usr/local/bin/ && \
rm -rf /chromedriver

ENV APP_HOME=/jdi-qasp-ml
WORKDIR ${APP_HOME}

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ clean:
.PHONY: lint
lint:
@echo "Linting ..."
@flake8 Angular_model app BS_model ds_methods generators HTML5_model MUI_model tests utils vars
@flake8 --exclude kombu-redis-priority .

.PHONY: unittest
unittest: clean lint
Expand Down
15 changes: 12 additions & 3 deletions app/selenium_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,18 @@ def get_element_id_to_is_displayed_mapping(page_content_str):
chrome_options = Options()
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("--headless")
chrome_options.add_argument('--disable-dev-shm-usage')
driver = webdriver.Chrome(
executable_path="/usr/local/bin/chromedriver-linux64/chromedriver", options=chrome_options)

capabilities = {
"browserName": "chrome",
"browserVersion": "118.0",
"selenoid:options": {
"enableVideo": False
}
}

driver = webdriver.Remote(
command_executor="http://jdi-qasp-ml-selenoid:4444/wd/hub",
desired_capabilities=capabilities, options=chrome_options)

driver.execute_script("document.body.insertAdjacentHTML('beforeend', arguments[0]);", dom)
wait = WebDriverWait(driver, 10)
Expand Down
19 changes: 19 additions & 0 deletions docker-compose-rc.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
version: '3.9'

name: jdi-qasp-ml
services:
chrome:
image: selenoid/vnc_chrome:118.0
attach: false

selenoid:
container_name: "jdi-qasp-ml-selenoid"
image: "aerokube/selenoid:latest"
ports:
- "4445:4444"
volumes:
- ".:/etc/selenoid"
- "./target:/output"
- "/var/run/docker.sock:/var/run/docker.sock"
- "./target:/opt/selenoid/video"
environment:
- "OVERRIDE_VIDEO_OUTPUT_DIR=$PWD/target"
command: [ "-conf", "/etc/selenoid/browsers.json", "-video-output-dir", "/opt/selenoid/video", "-container-network", "jdi-qasp-ml_default" ]

api:
image: "ghcr.io/jdi-testing/jdi-qasp-ml:rc"
container_name: jdi-qasp-ml-api
Expand Down
19 changes: 19 additions & 0 deletions docker-compose-stable.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
version: '3'

name: jdi-qasp-ml
services:
chrome:
image: selenoid/vnc_chrome:118.0
attach: false

selenoid:
container_name: "jdi-qasp-ml-selenoid"
image: "aerokube/selenoid:latest"
ports:
- "4445:4444"
volumes:
- ".:/etc/selenoid"
- "./target:/output"
- "/var/run/docker.sock:/var/run/docker.sock"
- "./target:/opt/selenoid/video"
environment:
- "OVERRIDE_VIDEO_OUTPUT_DIR=$PWD/target"
command: [ "-conf", "/etc/selenoid/browsers.json", "-video-output-dir", "/opt/selenoid/video", "-container-network", "jdi-qasp-ml_default" ]

api:
image: "ghcr.io/jdi-testing/jdi-qasp-ml:stable"
container_name: jdi-qasp-ml-api
Expand Down
19 changes: 19 additions & 0 deletions docker-compose.dev.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
version: '3'

name: jdi-qasp-ml
services:
chrome:
image: selenoid/vnc_chrome:118.0
attach: false

selenoid:
container_name: "jdi-qasp-ml-selenoid"
image: "aerokube/selenoid:latest"
ports:
- "4445:4444"
volumes:
- ".:/etc/selenoid"
- "./target:/output"
- "/var/run/docker.sock:/var/run/docker.sock"
- "./target:/opt/selenoid/video"
environment:
- "OVERRIDE_VIDEO_OUTPUT_DIR=$PWD/target"
command: [ "-conf", "/etc/selenoid/browsers.json", "-video-output-dir", "/opt/selenoid/video", "-container-network", "jdi-qasp-ml_default" ]

api:
container_name: jdi-qasp-ml-api
command: uvicorn app.main:api --host 0.0.0.0 --port 5050
Expand Down
19 changes: 19 additions & 0 deletions docker-compose.remote_server.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
version: '3'

name: jdi-qasp-ml
services:
chrome:
image: selenoid/vnc_chrome:118.0
attach: false

selenoid:
container_name: "jdi-qasp-ml-selenoid"
image: "aerokube/selenoid:latest"
ports:
- "4445:4444"
volumes:
- ".:/etc/selenoid"
- "./target:/output"
- "/var/run/docker.sock:/var/run/docker.sock"
- "./target:/opt/selenoid/video"
environment:
- "OVERRIDE_VIDEO_OUTPUT_DIR=$PWD/target"
command: [ "-conf", "/etc/selenoid/browsers.json", "-video-output-dir", "/opt/selenoid/video", "-container-network", "jdi-qasp-ml_default" ]

api:
container_name: jdi-qasp-ml-api
command: uvicorn app.main:api --host 0.0.0.0 --port 80
Expand Down
19 changes: 19 additions & 0 deletions docker-compose.remote_server_dev.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
version: '3'

name: jdi-qasp-ml
services:
chrome:
image: selenoid/vnc_chrome:118.0
attach: false

selenoid:
container_name: "jdi-qasp-ml-selenoid"
image: "aerokube/selenoid:latest"
ports:
- "4445:4444"
volumes:
- ".:/etc/selenoid"
- "./target:/output"
- "/var/run/docker.sock:/var/run/docker.sock"
- "./target:/opt/selenoid/video"
environment:
- "OVERRIDE_VIDEO_OUTPUT_DIR=$PWD/target"
command: [ "-conf", "/etc/selenoid/browsers.json", "-video-output-dir", "/opt/selenoid/video", "-container-network", "jdi-qasp-ml_default" ]

api-dev:
container_name: jdi-qasp-ml-api-dev
command: uvicorn app.main:api --host 0.0.0.0 --port 80
Expand Down
19 changes: 19 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
version: '3.9'

name: jdi-qasp-ml
services:
chrome:
image: selenoid/vnc_chrome:118.0
attach: false

selenoid:
container_name: "jdi-qasp-ml-selenoid"
image: "aerokube/selenoid:latest"
ports:
- "4445:4444"
volumes:
- ".:/etc/selenoid"
- "./target:/output"
- "/var/run/docker.sock:/var/run/docker.sock"
- "./target:/opt/selenoid/video"
environment:
- "OVERRIDE_VIDEO_OUTPUT_DIR=$PWD/target"
command: [ "-conf", "/etc/selenoid/browsers.json", "-video-output-dir", "/opt/selenoid/video", "-container-network", "jdi-qasp-ml_default" ]

api:
image: "ghcr.io/jdi-testing/jdi-qasp-ml:latest"
container_name: jdi-qasp-ml-api
Expand Down

0 comments on commit e3e7395

Please sign in to comment.