mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
update global config ui test
*add global and multisite context filtering test *add multiple settings filtering test *add multiple interaction test
This commit is contained in:
parent
329cceab72
commit
9705202ef3
1 changed files with 120 additions and 2 deletions
|
|
@ -52,9 +52,127 @@ try:
|
|||
input_keyword.send_keys(Keys.CONTROL, "a")
|
||||
input_keyword.send_keys(Keys.BACKSPACE)
|
||||
|
||||
log_info("Matching a setting done ...")
|
||||
log_info("Matching a setting done, try context global filter ...")
|
||||
|
||||
log_info("Filters working, trying settings interaction ...")
|
||||
select_context = safe_get_element(DRIVER, By.XPATH, "//button[@data-global-config-setting-select='context']")
|
||||
assert_button_click(DRIVER, select_context)
|
||||
assert_button_click(DRIVER, "//button[@data-global-config-setting-select-dropdown-btn='context' and @value='global']")
|
||||
|
||||
is_server_type_hidden = DRIVER.execute_script("return document.querySelector('#form-edit-global-config-server-type').classList.contains('hidden')")
|
||||
|
||||
if not is_server_type_hidden:
|
||||
log_error("Setting server type should be hidden.")
|
||||
exit(1)
|
||||
|
||||
is_http_port_hidden = DRIVER.execute_script("return document.querySelector('#form-edit-global-config-http-port').classList.contains('hidden')")
|
||||
|
||||
if is_http_port_hidden:
|
||||
log_error("Setting http port shouldn't be hidden.")
|
||||
exit(1)
|
||||
|
||||
log_info("Context global filter working, trying context multisite filter ...")
|
||||
|
||||
select_context = safe_get_element(DRIVER, By.XPATH, "//button[@data-global-config-setting-select='context']")
|
||||
assert_button_click(DRIVER, select_context)
|
||||
assert_button_click(DRIVER, "//button[@data-global-config-setting-select-dropdown-btn='context' and @value='multisite']")
|
||||
|
||||
is_server_type_hidden = DRIVER.execute_script("return document.querySelector('#form-edit-global-config-server-type').classList.contains('hidden')")
|
||||
|
||||
if is_server_type_hidden:
|
||||
log_error("Setting server type shouldn't be hidden.")
|
||||
exit(1)
|
||||
|
||||
is_http_port_hidden = DRIVER.execute_script("return document.querySelector('#form-edit-global-config-http-port').classList.contains('hidden')")
|
||||
|
||||
if not is_http_port_hidden:
|
||||
log_error("Setting http port should be hidden.")
|
||||
exit(1)
|
||||
|
||||
select_context = safe_get_element(DRIVER, By.XPATH, "//button[@data-global-config-setting-select='context']")
|
||||
assert_button_click(DRIVER, select_context)
|
||||
assert_button_click(DRIVER, "//button[@data-global-config-setting-select-dropdown-btn='context' and @value='all']")
|
||||
|
||||
log_info("Context multisite filter working with setting, trying filter with multiple settings using Headers plugin ...")
|
||||
|
||||
select_plugin = safe_get_element(DRIVER, By.XPATH, "//button[@data-tab-select-dropdown-btn='']")
|
||||
assert_button_click(DRIVER, select_plugin)
|
||||
assert_button_click(DRIVER, "//button[@data-tab-select-handler='headers']")
|
||||
|
||||
log_info("Start keyword to show only one multiple ...")
|
||||
|
||||
input_keyword = safe_get_element(DRIVER, By.ID, "keyword")
|
||||
input_keyword.send_keys("custom header")
|
||||
|
||||
is_remove_headers = DRIVER.execute_script("return document.querySelector('#form-edit-global-config-remove-headers').classList.contains('hidden')")
|
||||
|
||||
if not is_remove_headers:
|
||||
log_error("Setting remove headers should be hidden.")
|
||||
exit(1)
|
||||
|
||||
is_multiple_handle_headers = DRIVER.execute_script(
|
||||
"""return document.querySelector('[data-multiple-handler="custom-headers"]').classList.contains('hidden')"""
|
||||
)
|
||||
|
||||
if is_multiple_handle_headers:
|
||||
log_error("Multiple setting custom headers shouldn't be hidden.")
|
||||
exit(1)
|
||||
|
||||
is_multiple_handle_cookie_flag = DRIVER.execute_script(
|
||||
"""return document.querySelector('[data-multiple-handler="cookie-flags"]').classList.contains('hidden')"""
|
||||
)
|
||||
|
||||
if not is_multiple_handle_cookie_flag:
|
||||
log_error("Multiple setting cookie flags should be hidden.")
|
||||
exit(1)
|
||||
|
||||
# Reset
|
||||
input_keyword.send_keys(Keys.CONTROL, "a")
|
||||
input_keyword.send_keys(Keys.BACKSPACE)
|
||||
|
||||
log_info("Filter to keep only one multiple worked, trying to hide all multiples ...")
|
||||
|
||||
input_keyword.send_keys("remove headers")
|
||||
|
||||
is_remove_headers = DRIVER.execute_script("return document.querySelector('#form-edit-global-config-remove-headers').classList.contains('hidden')")
|
||||
|
||||
if is_remove_headers:
|
||||
log_error("Setting remove headers shouldn't be hidden.")
|
||||
exit(1)
|
||||
|
||||
is_multiple_handle_headers = DRIVER.execute_script(
|
||||
"""return document.querySelector('[data-multiple-handler="custom-headers"]').classList.contains('hidden')"""
|
||||
)
|
||||
|
||||
if not is_multiple_handle_headers:
|
||||
log_error("Multiple setting custom headers should be hidden.")
|
||||
exit(1)
|
||||
|
||||
is_multiple_handle_cookie_flag = DRIVER.execute_script(
|
||||
"""return document.querySelector('[data-multiple-handler="cookie-flags"]').classList.contains('hidden')"""
|
||||
)
|
||||
|
||||
if not is_multiple_handle_cookie_flag:
|
||||
log_error("Multiple setting cookie flags should be hidden.")
|
||||
exit(1)
|
||||
|
||||
# Reset
|
||||
input_keyword.send_keys(Keys.CONTROL, "a")
|
||||
input_keyword.send_keys(Keys.BACKSPACE)
|
||||
|
||||
log_info("Filter to keep only regular setting and hide all multiple done ...")
|
||||
|
||||
log_info("Filters working, trying settings interaction, start with multiple settings ...")
|
||||
|
||||
DRIVER.execute_script("""document.querySelector('[data-global-config-multiple-add="custom-headers"]').click()""")
|
||||
DRIVER.execute_script("""document.querySelector('[data-global-config-multiple-toggle="custom-headers"]').click()""")
|
||||
DRIVER.execute_script("""document.querySelector('[data-global-config-multiple-toggle="custom-headers"]').click()""")
|
||||
DRIVER.execute_script("""document.querySelector('[data-global-config-multiple-delete="Headers"]').click()""")
|
||||
|
||||
log_info("Multiple settings interaction worked, trying general settings ...")
|
||||
|
||||
select_plugin = safe_get_element(DRIVER, By.XPATH, "//button[@data-tab-select-dropdown-btn='']")
|
||||
assert_button_click(DRIVER, select_plugin)
|
||||
assert_button_click(DRIVER, "//button[@data-tab-select-handler='general']")
|
||||
|
||||
log_info("Select from dropdown ...")
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue