update tests

* remove tab mobile logic (doesn't exist anymore)
* add dropdown open click before clicking on select tab element
* add options to get higher window width and height to fix not into view exception
This commit is contained in:
Jordan Blasenhauer 2024-03-01 14:14:43 +01:00
parent 103cf705f2
commit c0454b9ad2
4 changed files with 8 additions and 12 deletions

View file

@ -24,11 +24,6 @@ try:
assert_button_click(DRIVER, "//button[@data-tab-handler='password']")
assert_button_click(DRIVER, "//button[@data-tab-handler='totp']")
log_info("Looking that all mobile tabs are working programmatically ...")
DRIVER.execute_script(f"""document.querySelector('button[data-tab-handler-mobile="username"]').click()""")
DRIVER.execute_script(f"""document.querySelector('button[data-tab-handler-mobile="global"]').click()""")
log_info("Start username tab ...")
assert_button_click(DRIVER, "//button[@data-tab-handler='username']")

View file

@ -25,9 +25,10 @@ local_geckodriver = "geckodriver" in listdir(Path.cwd())
FIREFOX_OPTIONS = Options()
if not local_geckodriver:
FIREFOX_OPTIONS.add_argument("--headless")
FIREFOX_OPTIONS.add_argument("--width=2560")
FIREFOX_OPTIONS.add_argument("--height=1440")
FIREFOX_OPTIONS.log.level = "trace" # type: ignore
ready = False
retries = 0
while not ready:

View file

@ -15,11 +15,6 @@ try:
log_info("Navigating to the global config page ...")
access_page(DRIVER, "/html/body/aside[1]/div[1]/div[3]/ul/li[3]/a", "global config")
log_info("Looking that tabs are working programmatically ...")
DRIVER.execute_script(f"""document.querySelector('button[data-tab-handler-mobile="blacklist"]').click()""")
DRIVER.execute_script(f"""document.querySelector('button[data-tab-handler="general"]').click()""")
log_info("Trying filters ...")
# Set keyword with no matching settings
@ -96,11 +91,13 @@ try:
log_info("The value was updated successfully, trying to navigate through the global config tabs ...")
buttons = safe_get_element(DRIVER, By.XPATH, "//div[@data-global-config-tabs-desktop='']/button", multiple=True)
buttons = safe_get_element(DRIVER, By.XPATH, "//button[@data-tab-handler='']", multiple=True)
assert isinstance(buttons, list), "Buttons is not a list of WebElements"
# Open dropdown and click button
shuffle(buttons)
for button in buttons:
assert_button_click(DRIVER, "//button[@data-tab-dropdown-btn='']")
assert_button_click(DRIVER, button)
log_info("Trying to filter the global config ...")

View file

@ -48,6 +48,7 @@ try:
log_info('The value for the "SERVER_NAME" input is the expected one, trying to edit the config ...')
assert_button_click(DRIVER, "//button[@data-tab-dropdown-btn='']")
assert_button_click(DRIVER, "//button[@data-tab-handler='gzip']")
gzip_select = safe_get_element(DRIVER, By.XPATH, "//button[@data-setting-select='gzip-comp-level']")
assert isinstance(gzip_select, WebElement), "Gzip select is not a WebElement"
@ -70,6 +71,7 @@ try:
log_error("Modal is hidden even though it shouldn't be, exiting ...")
exit(1)
assert_button_click(DRIVER, "//button[@data-tab-dropdown-btn='']")
assert_button_click(DRIVER, "//button[@data-tab-handler='gzip']")
gzip_comp_level_selected_elem = safe_get_element(DRIVER, By.XPATH, "//select[@id='GZIP_COMP_LEVEL']/option[@selected='']")
@ -91,6 +93,7 @@ try:
server_name_input.send_keys("app1.example.com")
if TEST_TYPE == "docker":
assert_button_click(DRIVER, "//button[@data-tab-dropdown-btn='']")
assert_button_click(DRIVER, "//button[@data-tab-handler='reverseproxy']")
use_reverse_proxy_checkbox = safe_get_element(DRIVER, By.ID, "USE_REVERSE_PROXY")