mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
Fix problems with ui tests and the ui.env file for Linux and the IP address of the container for DOcker
This commit is contained in:
parent
9356509007
commit
98b4c06314
2 changed files with 15 additions and 6 deletions
4
.github/workflows/tests-ui-linux.yml
vendored
4
.github/workflows/tests-ui-linux.yml
vendored
|
|
@ -87,8 +87,8 @@ jobs:
|
|||
echo "DATASTORE_MEMORY_SIZE=384m" | sudo tee -a /etc/bunkerweb/variables.env
|
||||
echo "UI_HOST=http://127.0.0.1:7000" | sudo tee -a /etc/bunkerweb/variables.env
|
||||
|
||||
sudo chown nginx:nginx /etc/bunkerweb/variables.env /etc/bunkerweb/ui.env
|
||||
sudo chmod 777 /etc/bunkerweb/variables.env /etc/bunkerweb/ui.env
|
||||
sudo chown nginx:nginx /etc/bunkerweb/variables.env
|
||||
sudo chmod 777 /etc/bunkerweb/variables.env
|
||||
- name: Run tests
|
||||
run: |
|
||||
cd ./tests/ui
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
from contextlib import suppress
|
||||
from datetime import datetime, timedelta
|
||||
from functools import partial
|
||||
from os import getenv, listdir
|
||||
from os import getenv, listdir, sep
|
||||
from os.path import join
|
||||
from pathlib import Path
|
||||
from time import sleep
|
||||
|
|
@ -20,11 +20,20 @@ from selenium.webdriver.remote.webelement import WebElement
|
|||
from selenium.webdriver.support import expected_conditions as EC
|
||||
from selenium.common.exceptions import ElementClickInterceptedException, TimeoutException, WebDriverException
|
||||
|
||||
default_server = "127.0.0.1"
|
||||
|
||||
integration_path = Path(sep, "usr", "share", "bunkerweb", "INTEGRATION")
|
||||
os_release_path = Path(sep, "etc", "os-release")
|
||||
if getenv("KUBERNETES_MODE", "no").lower() == "yes" or getenv("SWARM_MODE", "no").lower() == "yes" or getenv("AUTOCONF_MODE", "no").lower() == "yes":
|
||||
default_server = "192.168.0.2"
|
||||
elif os_release_path.is_file() and "Alpine" in os_release_path.read_text(encoding="utf-8"):
|
||||
default_server = "192.168.0.2"
|
||||
|
||||
ready = False
|
||||
retries = 0
|
||||
while not ready:
|
||||
with suppress(RequestException):
|
||||
status_code = get("http://127.0.0.1/setup").status_code
|
||||
status_code = get(f"http://{default_server}/setup").status_code
|
||||
|
||||
if status_code > 500 and status_code != 502:
|
||||
print("An error occurred with the server, exiting ...", flush=True)
|
||||
|
|
@ -179,9 +188,9 @@ with driver_func() as driver:
|
|||
driver.maximize_window()
|
||||
driver_wait = WebDriverWait(driver, 60)
|
||||
|
||||
print("Navigating to http://127.0.0.1/setup ...", flush=True)
|
||||
print(f"Navigating to http://{default_server}/setup ...", flush=True)
|
||||
|
||||
driver.get("http://127.0.0.1/setup")
|
||||
driver.get(f"http://{default_server}/setup")
|
||||
|
||||
### WIZARD PAGE
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue