mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
Update cache file logic in cache_page.py for ui tests
This commit is contained in:
parent
0de28127d7
commit
01794124aa
1 changed files with 16 additions and 4 deletions
|
|
@ -1,5 +1,4 @@
|
|||
from logging import info as log_info, exception as log_exception
|
||||
from time import sleep
|
||||
|
||||
from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.remote.webelement import WebElement
|
||||
|
|
@ -13,9 +12,10 @@ try:
|
|||
log_info("Navigating to the cache page ...")
|
||||
access_page(DRIVER, "/html/body/aside[1]/div[1]/div[3]/ul/li[7]/a", "cache")
|
||||
|
||||
log_info("Trying to open a cache file ...")
|
||||
log_info('Trying to open "jobs/asn.mmdb" cache file ...')
|
||||
|
||||
assert_button_click(DRIVER, "//div[@data-cache-element='mmdb-asn/asn.mmdb']")
|
||||
assert_button_click(DRIVER, "//div[@data-cache-element='jobs']")
|
||||
assert_button_click(DRIVER, "//div[@data-cache-element='asn.mmdb']")
|
||||
|
||||
file_content_elem = safe_get_element(DRIVER, By.XPATH, "//div[@id='editor']//div[@class='ace_content']")
|
||||
assert isinstance(file_content_elem, WebElement), "The file content element is not an instance of WebElement"
|
||||
|
|
@ -25,7 +25,19 @@ try:
|
|||
|
||||
assert_button_click(DRIVER, "//button[@data-cache-modal-submit='']")
|
||||
|
||||
sleep(3)
|
||||
log_info('The cache file content is correct, trying "misc/default-server-cert.pem" cache file ...')
|
||||
|
||||
assert_button_click(DRIVER, "//li[@data-cache-breadcrumb-item='' and @data-level='0']")
|
||||
assert_button_click(DRIVER, "//div[@data-cache-element='misc']")
|
||||
assert_button_click(DRIVER, "//div[@data-cache-element='default-server-cert.pem']")
|
||||
|
||||
file_content_elem = safe_get_element(DRIVER, By.XPATH, "//div[@id='editor']//div[@class='ace_content']")
|
||||
assert isinstance(file_content_elem, WebElement), "The file content element is not an instance of WebElement"
|
||||
if file_content_elem.text.strip() == "Download file to view content":
|
||||
log_exception("The cache file content is not correct, exiting ...")
|
||||
exit(1)
|
||||
|
||||
assert_button_click(DRIVER, "//button[@data-cache-modal-submit='']")
|
||||
|
||||
log_info("The cache file content is correct")
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue