Skip to content

Commit

Permalink
tests/cockpit: each wait with its own waiter, treat /nonexistent case
Browse files Browse the repository at this point in the history
Signed-off-by: lucasew <[email protected]>
  • Loading branch information
lucasew committed Dec 28, 2024
1 parent b06a23a commit 44812cd
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions nixos/tests/cockpit.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand All @@ -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"))
Expand Down

0 comments on commit 44812cd

Please sign in to comment.