forked from kubeflow/kubeflow
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Jupyter-Web-App]:Add basic E2E Tests (kubeflow#4773)
* Add basic e2e tests for JWA This test has two basic test cases for now. * Navigate to index page and ensure that no error appeared * Navigate to form page and ensure that no error appeared Needs to add logic for IAP authentication Signed-off-by: Kimonas Sotirchos <[email protected]> * Handle IAP login logic We need to set the driver request headers in order to allow the tests to conect to the IAP protected cluster. For this we use the selenium-wire which will create a proxy server which will be setting the necessary headers. Signed-off-by: Kimonas Sotirchos <[email protected]>
- Loading branch information
1 parent
6188f27
commit bf00f9e
Showing
3 changed files
with
467 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import logging | ||
|
||
from . import gcp_util as gcp | ||
|
||
logging.basicConfig( | ||
level=logging.INFO, | ||
format=("%(levelname)s | %(lineno)d | AUTH | %(message)s"), | ||
) | ||
|
||
|
||
def login_to_kubeflow_iap(driver, kubeflow_url): | ||
""" | ||
This function logs in to the kubeflow cluster via IAP | ||
""" | ||
service_account_credentials = gcp.get_service_account_credentials( | ||
"CLIENT_ID" | ||
) | ||
google_open_id_connect_token = gcp.get_google_open_id_connect_token( | ||
service_account_credentials | ||
) | ||
|
||
driver.header_overrides = { | ||
"Authorization": "Bearer {}".format(google_open_id_connect_token) | ||
} | ||
|
||
driver.get(kubeflow_url) | ||
|
||
|
||
def login_to_kubeflow_dex(driver, kubeflow_url, username, password): | ||
""" | ||
This function logs in to the kubeflow cluster via DEX | ||
""" | ||
driver.get(kubeflow_url) | ||
username_input = driver.find_element_by_id("login") | ||
password_input = driver.find_element_by_id("password") | ||
login_button = driver.find_element_by_id("submit-login") | ||
|
||
username_input.send_keys(username) | ||
password_input.send_keys(password) | ||
login_button.click() |
Oops, something went wrong.