|
36 | 36 | from selenium.webdriver.firefox.options import Options |
37 | 37 | from selenium.webdriver.support.ui import WebDriverWait |
38 | 38 | from selenium.webdriver.support import expected_conditions as EC |
| 39 | + from selenium.common.exceptions import ElementClickInterceptedException |
| 40 | +
|
| 41 | +
|
| 42 | + def click_when_unobstructed(mark): |
| 43 | + while True: |
| 44 | + try: |
| 45 | + wait.until(EC.element_to_be_clickable(mark)).click() |
| 46 | + break |
| 47 | + except ElementClickInterceptedException: |
| 48 | + continue |
| 49 | +
|
39 | 50 |
|
40 | 51 | options = Options() |
41 | 52 | options.add_argument('--headless') |
|
74 | 85 | ) |
75 | 86 | driver.find_element(By.XPATH, "//button[contains(., 'Log in with master password')]").click() |
76 | 87 |
|
77 | | - wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, 'button#newItemDropdown'))).click() |
| 88 | + click_when_unobstructed((By.CSS_SELECTOR, 'button#newItemDropdown')) |
78 | 89 | driver.find_element(By.XPATH, "//button[contains(., 'Item')]").click() |
79 | 90 |
|
80 | 91 | driver.find_element(By.CSS_SELECTOR, 'input#name').send_keys( |
|
178 | 189 | testScript |
179 | 190 | else |
180 | 191 | '' |
| 192 | + import json |
| 193 | +
|
181 | 194 | start_all() |
182 | 195 | server.wait_for_unit("vaultwarden.service") |
183 | 196 | server.wait_for_open_port(8080) |
|
202 | 215 | client.succeed(f"bw --nointeraction --raw --session {key} sync -f") |
203 | 216 |
|
204 | 217 | with subtest("get the password with the cli"): |
205 | | - password = client.wait_until_succeeds( |
206 | | - f"bw --nointeraction --raw --session {key} list items | ${pkgs.jq}/bin/jq -r .[].login.password", |
207 | | - timeout=60 |
208 | | - ) |
209 | | - assert password.strip() == "${storedPassword}" |
| 218 | + output = json.loads(client.succeed(f"bw --nointeraction --raw --session {key} list items")) |
| 219 | +
|
| 220 | + assert output[0]['login']['password'] == "${storedPassword}" |
210 | 221 |
|
211 | 222 | with subtest("Check systemd unit hardening"): |
212 | 223 | server.log(server.succeed("systemd-analyze security vaultwarden.service | grep -v ✓")) |
|
0 commit comments