Skip to content

Commit

Permalink
Update ui tests to new formats
Browse files Browse the repository at this point in the history
  • Loading branch information
TheophileDiot committed Dec 26, 2023
1 parent 38eb98c commit ffbe1e3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
25 changes: 12 additions & 13 deletions tests/ui/docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ 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"
DATASTORE_MEMORY_SIZE: "384m"
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"
Expand Down Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions tests/ui/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
14 changes: 7 additions & 7 deletions tests/ui/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
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)
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -178,9 +178,9 @@ def access_page(
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

Expand Down Expand Up @@ -1171,7 +1171,7 @@ def access_page(
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)

Expand All @@ -1184,7 +1184,7 @@ def access_page(
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)

Expand All @@ -1202,7 +1202,7 @@ def access_page(
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)

Expand Down

0 comments on commit ffbe1e3

Please sign in to comment.