2023-10-22 10:35:01 +00:00
|
|
|
#!/usr/bin/python3
|
|
|
|
|
|
|
|
import os
|
2023-10-22 10:44:37 +00:00
|
|
|
import sys
|
2023-10-22 10:35:01 +00:00
|
|
|
import traceback
|
|
|
|
|
|
|
|
from selenium import webdriver
|
|
|
|
from selenium.webdriver.common.by import By
|
|
|
|
|
|
|
|
CI_COMMIT_SHORT_SHA = os.getenv("CI_COMMIT_SHORT_SHA")
|
|
|
|
SELENIUM_GRID_ENDPOINT = os.getenv("SELENIUM_GRID_ENDPOINT")
|
2023-10-22 10:42:41 +00:00
|
|
|
K8S_NAMESPACE = os.getenv("K8S_NAMESPACE")
|
2023-10-22 10:35:01 +00:00
|
|
|
|
|
|
|
driver = webdriver.Remote(command_executor=SELENIUM_GRID_ENDPOINT, options=webdriver.ChromeOptions())
|
|
|
|
|
|
|
|
try:
|
2023-10-22 10:42:41 +00:00
|
|
|
base_url = f"http://tt-rss-{CI_COMMIT_SHORT_SHA}-app.{K8S_NAMESPACE}.svc.cluster.local/tt-rss"
|
|
|
|
print(f"requesting base url: {base_url}")
|
|
|
|
driver.get(base_url)
|
2023-10-22 10:35:01 +00:00
|
|
|
|
|
|
|
print("filling in login information...")
|
|
|
|
|
|
|
|
for name in ["login", "password"]:
|
|
|
|
field = driver.find_element(by=By.CSS_SELECTOR, value=f"input[name='{name}']")
|
|
|
|
field.clear()
|
|
|
|
field.send_keys("test")
|
|
|
|
|
|
|
|
print("logging in...")
|
|
|
|
|
|
|
|
login_button = driver.find_element(by=By.CSS_SELECTOR, value="#dijit_form_Button_0_label")
|
|
|
|
login_button.click()
|
|
|
|
|
|
|
|
print("checking for feedTree...")
|
|
|
|
|
2023-10-22 10:44:37 +00:00
|
|
|
assert driver.find_element(by=By.CSS_SELECTOR, value="#feedTree")
|
2023-10-22 10:35:01 +00:00
|
|
|
|
|
|
|
print("all done.")
|
|
|
|
|
|
|
|
except Exception:
|
|
|
|
traceback.print_exc()
|
2023-10-22 10:44:37 +00:00
|
|
|
sys.exit(1)
|
2023-10-22 10:35:01 +00:00
|
|
|
finally:
|
|
|
|
driver.quit()
|
2023-10-22 10:44:37 +00:00
|
|
|
|