Update ui tests to new formats

This commit is contained in:
Théophile Diot 2023-12-26 15:24:56 +00:00
parent 38eb98c395
commit ffbe1e3b67
No known key found for this signature in database
GPG key ID: 248FEA4BAE400D06
3 changed files with 20 additions and 20 deletions

View file

@ -15,6 +15,7 @@ services:
API_WHITELIST_IP: "127.0.0.0/8 10.20.30.0/24"
USE_BUNKERNET: "no"
USE_BLACKLIST: "no"
SEND_ANONYMOUS_REPORT: "no"
DISABLE_DEFAULT_SERVER: "yes"
USE_CLIENT_CACHE: "yes"
USE_GZIP: "yes"
@ -22,9 +23,8 @@ services:
www.example.com_USE_UI: "yes"
www.example.com_SERVE_FILES: "no"
www.example.com_USE_REVERSE_PROXY: "yes"
www.example.com_REVERSE_PROXY_URL: "/admin/"
www.example.com_REVERSE_PROXY_URL: "/admin"
www.example.com_REVERSE_PROXY_HOST: "http://bw-ui:7000"
www.example.com_REVERSE_PROXY_KEEPALIVE: "yes"
www.example.com_INTERCEPTED_ERROR_CODES: "400 405 413 429 500 501 502 503 504"
labels:
- "bunkerweb.INSTANCE=yes"
@ -78,17 +78,16 @@ services:
networks:
bw-services:
ipv4_address: 192.168.0.4
ui-tests:
build: .
environment:
- PYTHONUNBUFFERED=1
extra_hosts:
- "www.example.com:192.168.0.2"
- "app1.example.com:192.168.0.2"
networks:
bw-services:
ipv4_address: 192.168.0.3
# ui-tests:
# build: .
# environment:
# - PYTHONUNBUFFERED=1
# extra_hosts:
# - "www.example.com:192.168.0.2"
# - "app1.example.com:192.168.0.2"
# networks:
# bw-services:
# ipv4_address: 192.168.0.3
volumes:
bw-data:

View file

@ -15,6 +15,7 @@ services:
LOG_LEVEL: "info"
USE_BUNKERNET: "no"
USE_BLACKLIST: "no"
SEND_ANONYMOUS_REPORT: "no"
DISABLE_DEFAULT_SERVER: "yes"
USE_CLIENT_CACHE: "yes"
USE_GZIP: "yes"

View file

@ -23,7 +23,7 @@ ready = False
retries = 0
while not ready:
with suppress(RequestException):
status_code = get("http://www.example.com/admin").status_code
status_code = get("http://www.example.com/admin/login").status_code
if status_code > 500 and status_code != 502:
print("An error occurred with the server, exiting ...", flush=True)
@ -116,7 +116,7 @@ def assert_alert_message(driver, message: str):
print(f'Message "{message}" found in one of the messages in the list', flush=True)
assert_button_click(driver, "//aside[@data-flash-sidebar='']/*[local-name() = 'svg']")
assert_button_click(driver, "//button[@data-flash-sidebar-close='']/*[local-name() = 'svg']")
def access_page(
@ -178,9 +178,9 @@ with driver_func() as driver:
driver.maximize_window()
driver_wait = WebDriverWait(driver, 60)
print("Navigating to http://www.example.com/admin ...", flush=True)
print("Navigating to http://www.example.com/admin/login ...", flush=True)
driver.get("http://www.example.com/admin")
driver.get("http://www.example.com/admin/login")
### LOGIN PAGE
@ -1171,7 +1171,7 @@ location /hello {
exit(1)
assert_button_click(driver, instances[0])
assert_button_click(driver, safe_get_element(driver, By.ID, "submit-settings"))
assert_button_click(driver, safe_get_element(driver, By.ID, "submit-data"))
sleep(3)
@ -1184,7 +1184,7 @@ location /hello {
print("Logs found, trying auto refresh ...", flush=True)
assert_button_click(driver, safe_get_element(driver, By.ID, "live-update"))
assert_button_click(driver, "//button[@id='submit-settings' and contains(text(), 'Go Live')]")
assert_button_click(driver, safe_get_element(driver, By.ID, "submit-live"))
sleep(3)
@ -1202,7 +1202,7 @@ location /hello {
print("Auto refresh is working, deactivating it ...", flush=True)
assert_button_click(driver, safe_get_element(driver, By.ID, "live-update"))
assert_button_click(driver, safe_get_element(driver, By.ID, "submit-settings"))
assert_button_click(driver, safe_get_element(driver, By.ID, "submit-data"))
sleep(3)