diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cee85ba28..dffd8968e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -66,6 +66,7 @@ integration-test: SELENIUM_GRID_ENDPOINT: http://selenium-hub.selenium-grid.svc.cluster.local:4444/wd/hub extends: .integration-test script: + - export K8S_NAMESPACE=$(kubectl get pods -o=custom-columns=NS:.metadata.namespace | tail -1) - python3 tests/integration/selenium_test.py rules: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH diff --git a/tests/integration/selenium_test.py b/tests/integration/selenium_test.py index 8aef738c2..9df1cc099 100644 --- a/tests/integration/selenium_test.py +++ b/tests/integration/selenium_test.py @@ -9,19 +9,14 @@ 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") - -if not CI_COMMIT_SHORT_SHA or not SELENIUM_GRID_ENDPOINT: - print("both CI_COMMIT_SHORT_SHA snd SELENIUM_GRID_ENDPOINT env vars should be defined") - exit(1) +K8S_NAMESPACE = os.getenv("K8S_NAMESPACE") driver = webdriver.Remote(command_executor=SELENIUM_GRID_ENDPOINT, options=webdriver.ChromeOptions()) -app_url = f"http://tt-rss-{CI_COMMIT_SHORT_SHA}-app.gitlab-fakecake.svc.cluster.local/tt-rss" - -print(f"requesting base url: {app_url}") - try: - driver.get(app_url) + 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) print("filling in login information...") @@ -37,7 +32,7 @@ try: print("checking for feedTree...") - assert driver.find_element(by=By.CSS_SELECTOR, value="#feedTree") + assert driver.find_element(by=By.CSS_SELECTOR, value="#zfeedTree") print("all done.")