Initial setup of test suite containers, basic Selenium test script added.
parent
e51076300a
commit
c7dae0bdb3
@ -0,0 +1,5 @@
|
||||
#/bin/bash
|
||||
|
||||
cd tests/
|
||||
docker compose build --no-cache --pull && docker compose up --remove-orphans --abort-on-container-exit --exit-code-from selenium-node
|
||||
docker compose rm -sf
|
@ -0,0 +1,5 @@
|
||||
FROM python:alpine
|
||||
|
||||
USER root
|
||||
RUN python3 -m pip install selenium
|
||||
WORKDIR /
|
@ -0,0 +1,30 @@
|
||||
---
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
selenium-hub:
|
||||
image: selenium/standalone-chrome:108.0
|
||||
shm_size: '2gb'
|
||||
ports:
|
||||
- "4444:4444"
|
||||
- "7900:7900"
|
||||
environment:
|
||||
- SE_OPTS:"--allow-cors true"
|
||||
healthcheck:
|
||||
test: curl --fail http://localhost:4444/
|
||||
interval: 5s
|
||||
retries: 5
|
||||
start_period: 10s
|
||||
timeout: 30s
|
||||
|
||||
selenium-node:
|
||||
image: selenium-node:latest
|
||||
build: .
|
||||
depends_on:
|
||||
selenium-hub:
|
||||
condition: service_healthy
|
||||
volumes:
|
||||
- ./test_suite:/tests:ro
|
||||
- ./output:/output:rw
|
||||
user: "1000:1000"
|
||||
command: 'python3 /tests/test.py'
|
@ -0,0 +1,12 @@
|
||||
from selenium import webdriver
|
||||
from time import sleep
|
||||
chrome_options = webdriver.ChromeOptions()
|
||||
print('Attempting to establish connection to remote webdriver...')
|
||||
driver = webdriver.Remote(command_executor='http://selenium-hub:4444', options=chrome_options)
|
||||
print('Connection established.')
|
||||
print('Attempting to get page...')
|
||||
driver.get("https://werefox.cafe")
|
||||
print('Page loaded.')
|
||||
sleep(10)
|
||||
driver.close()
|
||||
driver.quit()
|
Loading…
Reference in New Issue