tests/cockpit: each wait with its own waiter, treat /nonexistent case

Signed-off-by: lucasew <lucas59356@gmail.com>
This commit is contained in:
lucasew
2024-12-28 16:10:44 -03:00
parent b06a23a614
commit 44812cdb98
+11 -9
View File
@@ -67,14 +67,14 @@ import ./make-test-python.nix (
log("Opening homepage")
driver.get("https://server:9090")
wait = WebDriverWait(driver, 60)
def wait_elem(by, query):
def wait_elem(by, query, timeout=10):
wait = WebDriverWait(driver, timeout)
wait.until(EC.presence_of_element_located((by, query)))
def wait_title_contains(title):
def wait_title_contains(title, timeout=10):
wait = WebDriverWait(driver, timeout)
wait.until(EC.title_contains(title))
@@ -121,6 +121,12 @@ import ./make-test-python.nix (
assert "Web console is running in limited access mode" in driver.page_source
log("Clicking the sudo button")
driver.switch_to.default_content()
driver.find_element(By.CSS_SELECTOR, 'button.ct-locked').click()
log("Checking that /nonexistent is not a thing")
assert '/nonexistent' not in driver.page_source
driver.close()
'';
in
@@ -136,12 +142,8 @@ import ./make-test-python.nix (
testScript = ''
start_all()
server.wait_for_unit("sockets.target")
server.wait_for_open_port(9090)
server.wait_for_unit("network.target")
server.wait_for_unit("multi-user.target")
server.systemctl("start", "polkit")
client.wait_for_unit("multi-user.target")
client.succeed("curl -k https://server:9090 -o /dev/stderr")
print(client.succeed("whoami"))