Skip to content

Commit

Permalink
Fix Dashboard Smoke Tests for RHOAI 2.17 (#2142)
Browse files Browse the repository at this point in the history
Includes fixes for the following Keywords:
- Get Question Mark Links
- Check Application Switcher Link To Openshift Console 
- Verify Cluster Settings Is Available 
- ODHDashboardResources QuickStart Keywords 
- Model Serving buttons xpath 
- Click Action From Actions Menu 
- Permissions.resource xpath to add user and group 
- Handle Stop Workbench Confirmation Modal
- Verify RHODS Admins Can Import A Custom Serving Runtime Template
- Generate Unique Namespace

Signed-off-by: manosnoam <nmanos@redhat.com>
  • Loading branch information
manosnoam authored Dec 23, 2024
1 parent 3a386c2 commit ccb0d07
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 59 deletions.
25 changes: 10 additions & 15 deletions ods_ci/tests/Resources/Page/ODH/ODHDashboard/ODHDashboard.robot
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ ${APPS_DICT_PATH_LATEST}= tests/Resources/Files/AppsInfoDictionary_latest.json
${SIDEBAR_TEXT_CONTAINER_XP}= //div[contains(@class,'odh-markdown-view')]
${SUCCESS_MSG_XP}= //div[@class='pf-v6-c-alert pf-m-success']
${PAGE_TITLE_XP}= //*[@data-testid="app-page-title"]
${CLUSTER_SETTINGS_XP}= //*[@data-testid="app-page-title" and text()="Cluster settings"]
${CLUSTER_SETTINGS_TITLE}= Cluster settings
${PVC_SIZE_INPUT_XP}= xpath=//*[@data-testid="pvc-size-input"]
${USAGE_DATA_COLLECTION_XP}= //*[@id="usage-data-checkbox"]
${CUSTOM_IMAGE_SOFTWARE_TABLE}= //caption[contains(., "the advertised software")]/../tbody
Expand Down Expand Up @@ -494,8 +494,7 @@ Get Question Mark Links
[Documentation] It returns the link elements from the question mark
Click Button id:help-icon-toggle
@{links_list}= Create List
@{link_elements}= Get WebElements
... //button[@id="help-icon-toggle"]/following-sibling::div//a
@{link_elements}= Get WebElements //ul[@role="menu"]//a
FOR ${link} IN @{link_elements}
${href}= Get Element Attribute ${link} href
Append To List ${links_list} ${href}
Expand All @@ -522,9 +521,8 @@ Check External Links Status
Verify Cluster Settings Is Available
[Documentation] Verifies submenu Settings > Cluster settings is visible
Page Should Contain Settings
Menu.Navigate To Page Settings Cluster settings
Capture Page Screenshot
Wait Until Page Contains Element ${CLUSTER_SETTINGS_XP} timeout=30
Menu.Navigate To Page Settings ${CLUSTER_SETTINGS_TITLE}
Wait For Dashboard Page Title ${CLUSTER_SETTINGS_TITLE}
Wait Until Page Contains Element ${PVC_SIZE_INPUT_XP} timeout=30

Verify Cluster Settings Is Not Available
Expand Down Expand Up @@ -851,35 +849,32 @@ Reload RHODS Dashboard Page
Handle Deletion Confirmation Modal
[Documentation] Handles confirmation modal on item deletion
[Arguments] ${item_title} ${item_type} ${press_cancel}=${FALSE} ${additional_msg}=${NONE}
# Once fixed https://issues.redhat.com/browse/RHODS-9730 change the button xpath to
# xpath=//button[text()="Delete ${item_type}"]
${delete_btn_xp}= Set Variable xpath=//button[contains(text(), 'Delete')]
Wait Until Generic Modal Appears
Run Keyword And Warn On Failure Page Should Contain Delete ${item_type}?
Run Keyword And Warn On Failure Page Should Contain This action cannot be undone.
IF "${additional_msg}" != "${NONE}"
Run Keyword And Continue On Failure Page Should Contain ${additional_msg}
END
Run Keyword And Continue On Failure Page Should Contain Type ${item_title} to confirm deletion:
Run Keyword And Continue On Failure Element Should Be Disabled ${delete_btn_xp}
Run Keyword And Continue On Failure Element Should Be Disabled ${GENERIC_DELETE_BTN_XP}
Input Text xpath=//input[@id="delete-modal-input"] ${item_title}
Wait Until Element Is Enabled ${delete_btn_xp}
Wait Until Element Is Enabled ${GENERIC_DELETE_BTN_XP}
IF ${press_cancel} == ${TRUE}
Click Button ${GENERIC_CANCEL_BTN_XP}
ELSE
Click Button ${delete_btn_xp}
Click Button ${GENERIC_DELETE_BTN_XP}
END
Wait Until Generic Modal Disappears

Click Action From Actions Menu
[Documentation] Clicks an action from Actions menu (3-dots menu on the right)
[Arguments] ${item_title} ${action} ${item_type}=${NONE}
${item_row}= Set Variable //tr[td[@data-label="Name"]//*[text()="${item_title}"]]
${action_btn}= Set Variable //button[@role="menuitem" and starts-with(.,"${action}")]
Click Element xpath=${item_row}//button[@aria-label="Kebab toggle"]
IF "${item_type}" != "${NONE}"
${action}= Catenate ${action} ${item_type}
END
Wait Until Page Contains Element
... xpath=${item_row}//button[@role="menuitem"]//*[.="${action}"]
Wait Until Page Contains Element ${action_btn}
Sleep 0.5 msg=Avoid element missclicking
Click Element xpath=${item_row}//button[@role="menuitem"]//*[.="${action}"]
Click Element ${action_btn}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Resource ../../../Common.robot
... https://console-openshift-console.apps.test-cluster.example.com
... console-openshift-console.apps.test-cluster.example.com
${QUICKSTART_PANNEL}= //div[@data-test="quickstart drawer"]
${QUICKSTART_TASK}= //div[contains(@class, 'quick-start-task')]

*** Keywords ***
Open QuickStart Element in Resource Section By Name
Expand All @@ -26,11 +27,10 @@ Open QuickStart Element in Resource Section By Name

Star QuickStart Tour
Click Button //button[@data-test="Start button"]
Wait Until Page Contains Element //div[@class="pfext-quick-start-content"]

Wait Until Page Contains Element ${QUICKSTART_TASK}
Get The Count Of QuickStart Steps
[Documentation] Gives the count of steps in a the quick start
${count}= Get Element Count //div[@class="pfext-quick-start-content"]/ul/li
${count}= Get Element Count ${QUICKSTART_TASK}/ul/li
RETURN ${count}

Link Text On QuickStart Card Should Be
Expand All @@ -45,7 +45,7 @@ QuickStart Status Should Be
... In Progress
ELSE IF '${progress_string}'=='Complete'
Element Should Contain //div[@id="${element}"]//*[@role="list"]
... Complete
... minutes
ELSE IF '${progress_string}'=='Failed'
Element Should Contain //div[@id="${element}"]//*[@role="list"]
... Failed
Expand Down Expand Up @@ -99,7 +99,7 @@ Go Back And Check Previouse Step Is Selected
# Only verify step number if it's not the first step
IF ${exp_step} != ${0}
Click Button //button[@data-testid="qs-drawer-back"]
Click Button //button[@data-testid="qs-drawer-back"]
Run Keyword And Ignore Error Click Button //button[@data-testid="qs-drawer-back"]
Current Step In QuickStart Should Be n_steps=${n_steps} exp_step=${exp_step}
END

Expand Down Expand Up @@ -142,7 +142,7 @@ Verify Quick Starts Work As Expected When All Steps Are Marked As Yes
... Mark Step Check As Yes
Go To Next QuickStart Step
END
Run Keyword And Continue On Failure Go Back And Check Previouse Step Is Selected
Run Keyword And Ignore Error Go Back And Check Previouse Step Is Selected
... n_steps=${count} exp_step=${count-1}
Go To Next QuickStart Step
Go To Next QuickStart Step
Expand Down Expand Up @@ -229,7 +229,7 @@ Quickstart Steps URLs Are Valid
${quick_start_steps}= Get WebElements //button[contains(@class, "nav-link")]
FOR ${quick_start_step} IN @{quick_start_steps}
Open QuickStart Step ${quick_start_step}
${doc_text}= Get Text //*[@class="pfext-quick-start-task__content"]
${doc_text}= Get Text ${QUICKSTART_TASK}
${doc_link}= Extract URLs From Text text=${doc_text}
Validate Links Extracted From Text ${doc_link}
END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ Resource ../../../Common.robot


*** Variables ***
${ADD_RUNTIME_BTN_XP}= //button[text()="Add serving runtime"]
${SUBMIT_RUNTIME_BTN_XP}= //button[text()="Create"]
${UPLOAD_RUNTIME_BTN_XP}= //button[text()="Upload files"]
${SCRATCH_RUNTIME_BTN_XP}= //button[text()="Start from scratch"]
${ADD_RUNTIME_BTN_XP}= //button[@data-testid="add-serving-runtime-button"]
${SUBMIT_RUNTIME_BTN_XP}= //button[@data-testid="create-button"]
${UPLOAD_RUNTIME_BTN_XP}= //button[contains(., "Upload files")]
${SCRATCH_RUNTIME_BTN_XP}= //button[contains(., "Start from scratch")]
${EDITOR_RUNTIME_BTN_XP}= //div[contains(@class, "odh-dashboard__code-editor")]
&{PLATFORM_NAMES_MAPPING}= single=Single-model serving platform multi=Multi-model serving platform
... both=Single-model and multi-model serving platforms
Expand Down Expand Up @@ -44,15 +44,11 @@ Upload Serving Runtime Template

Serving Runtime Template Should Be Listed
[Arguments] ${displayed_name} ${serving_platform}
${platform_label_xp}= Set Variable
... //tr[contains(., "${displayed_name}")]//ancestor::*[@data-testid="serving-runtime-platform-label"]
Run Keyword And Continue On Failure
... Wait Until Page Contains Element
... //*[@data-testid="serving-runtime ${displayed_name}"]
... timeout=10s
Run Keyword And Continue On Failure
... Wait Until Page Contains Element
... //*[@data-testid="serving-runtime ${displayed_name}"]//ancestor::*[@data-testid="serving-runtime-platform-label"] # robocop: disable
${actual_platform_labels_str}= Get Text
... //*[@data-testid="serving-runtime ${displayed_name}"]//ancestor::*[@data-testid="serving-runtime-platform-label"] # robocop: disable
... Wait Until Page Contains Element ${platform_label_xp} timeout=10s
${actual_platform_labels_str}= Get Text ${platform_label_xp}
${actual_platform_labels}= Split To Lines ${actual_platform_labels_str}
IF "${serving_platform}" == "both"
Run Keyword And Continue On Failure Length Should Be ${actual_platform_labels} ${2}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Assign ${permission_type} Permissions To User ${username}
[Documentation] Assign the user ${username} and level of permission ${permission_type}
... to the currently open DS Project in UI
Log ${username} - ${permission_type}
Click Element xpath://button[text()="Add user"]
Click Element //button[@data-testid="add-button user"]
Element Should Be Disabled ${SAVE_BUTTON}
Input Text xpath:${INPUT_USER} ${username}
Select Permission Type permission_type=${permission_type}
Expand Down Expand Up @@ -61,7 +61,7 @@ Assign ${permission_type} Permissions To Group ${group_name}
[Documentation] Assign the user ${group_name} and level of permission ${permission_type}
... to the currently open DS Project in UI
Log ${group_name} - ${permission_type}
Click Element xpath://button[text()="Add group"]
Click Element //button[@data-testid="add-button group"]
Element Should Be Disabled ${SAVE_BUTTON}
IF ${IS_CLUSTER_ADMIN} == ${FALSE}
Input Text xpath:${INPUT_GROUP} ${group_name}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ ${TITLE_INPUT_XP}= xpath=//input[@id="manage-project-modal-name"]
${DESCR_INPUT_XP}= xpath=//textarea[@id="manage-project-modal-description"]
${RESOURCE_EDIT_BTN_XP}= xpath=//button[.="Edit resource name"]
${RESOURCE_INPUT_XP}= css:[data-testid="manage-project-modal-resourceName"]
${GENERIC_CREATE_BTN_XP}= xpath=//button[text()="Create"]
${GENERIC_CANCEL_BTN_XP}= xpath=//button[text()="Cancel"]
${GENERIC_CREATE_BTN_XP}= xpath=//*[@role="dialog"]//button[.="Create" or starts-with(., "Create")]
${GENERIC_CANCEL_BTN_XP}= xpath=//*[@role="dialog"]//button[.="Cancel" or starts-with(., "Cancel")]
${GENERIC_DELETE_BTN_XP}= xpath=//*[@role="dialog"]//button[.="Delete" or starts-with(., "Delete")]
${GENERIC_STOP_BTN_XP}= xpath=//*[@role="dialog"]//button[.="Stop" or starts-with(., "Stop")]
# TODO: Update to latter option once the change is pulled from ODH into downstream!
${PROJECT_CREATE_BTN_XP}= xpath=//button[text()="Create data science project" or text()="Create project"]
${PROJECT_CREATE_BTN_XP}= xpath=//button[@data-testid="create-data-science-project"]
${ACTIONS_BTN_XP}= xpath=//div/button[@aria-label="Actions"]
${DELETE_ACTION_BTN_XP}= xpath=//div/ul/li/button[text()="Delete project"]
${EDIT_ACTION_BTN_XP}= xpath=//div/ul/li/button[text()="Edit project"]
Expand Down Expand Up @@ -153,7 +155,6 @@ Create Data Science Project
Click Button ${GENERIC_CREATE_BTN_XP}
Wait Until Generic Modal Disappears
END
Wait Until Project Is Open project_title=${title}
${open}= Run Keyword And Return Status Wait Until Project Is Open project_title=${title}
IF ${open} == ${FALSE}
${is_home_open}= Is Data Science Projects Page Open
Expand All @@ -165,14 +166,14 @@ Create Data Science Project
END

Generate Unique Namespace
[Documentation] If DS Project Namespace '${namespace}' already exists - Return the Namespace + Random Suffix.
[Documentation] If DS Project Namespace '${namespace}' already exists - Return it with a Random digits suffix.
... (DS Project Display Name does not need to be unique, but DS Project Namespace does).
[Arguments] ${namespace}
${rc}= Run And Return Rc oc get namespace ${namespace}
IF "${rc}" == "${0}" and len("${namespace}") < 60
# Add unique string to Project resource name (max length is 63 chars)
${suffix}= Generate Random String 3 [LOWER]
${namespace}= Set Variable ${namespace}-${suffix}
IF "${rc}" == "${0}"
# Add Random 3-digits suffix, but trim characters above 30 (allowed namespace length)
${suffix}= Generate Random String 3 [NUMBERS]
${namespace}= Set Variable ${namespace}[0:27]${suffix}
END
RETURN ${namespace}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Resource Projects.resource
*** Variables ***
${PV_MOUNT_PATH}= ods-ci-test-path
${WORKBENCH_SECTION_XP}= xpath=//div[@data-testid="section-workbenches"]
${WORKBENCH_CREATE_BTN_XP}= xpath=//button[text()="Create workbench"]
${WORKBENCH_CREATE_BTN_XP}= xpath=//button[@data-testid="create-workbench-button"]
${WORKBENCH_CREATE_BTN_2_XP}= xpath=//button[@id="create-button"]
${WORKBENCH_NAME_INPUT_XP}= xpath=//input[@name="workbench-name"]
${WORKBENCH_DESCR_TXT_XP}= xpath=//textarea[@name="workbench-description"]
Expand All @@ -30,7 +30,6 @@ ${WORKBENCH_EXISTING_CONNECTION_RAD_XP}= xpath=//input[@name="existing-data
${WORKBENCH_STATUS_STOPPED}= Stopped
${WORKBENCH_STATUS_RUNNING}= Running
${WORKBENCH_STATUS_STARTING}= Starting
${WORKBENCH_STOP_BTN_XP}= xpath=//button[text()="Stop workbench"]
${WORKBENCH_IMAGE_VER_LABEL}= //label[@for="workbench-image-version-selection"]
${WORKBENCH_IMAGE_VER_BUTTON}= ${WORKBENCH_IMAGE_VER_LABEL}/../..//button
${WORKBENCH_IMAGE_VER_DROPDOWN}= //*[@id="workbench-image-version-selection"]
Expand Down Expand Up @@ -191,12 +190,7 @@ Remove All Environment Variables
Select An Existent PV
[Documentation] Selects an existent PV Storage in the workbench creation page
[Arguments] ${name} ${path}
Run Keyword And Continue On Failure
... Wait Until Element Is Enabled xpath=//input[@placeholder="Select a persistent storage"]
Click Element xpath=//input[@placeholder="Select a persistent storage"]
${existing_pv_xpath}= Set Variable xpath=//button//span[text()="${name}"]
Wait Until Page Contains Element ${existing_pv_xpath}
Click Element ${existing_pv_xpath}
Wait Until Page Contains Element //*[@data-testid="mount-path-folder-value"]
Input Text //*[@data-testid="mount-path-folder-value"] ${path}
Click Element //*[@data-testid="modal-submit-button"]

Expand Down Expand Up @@ -434,7 +428,7 @@ Handle Stop Workbench Confirmation Modal
IF ${press_cancel} == ${TRUE}
Click Button ${GENERIC_CANCEL_BTN_XP}
ELSE
Click Button ${WORKBENCH_STOP_BTN_XP}
Click Button ${GENERIC_STOP_BTN_XP}
END

Delete Workbench
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Verify RHODS Explore Section Contains Only Expected ISVs
[Tags] Smoke
... ODS-1890
... AutomationBugOnODH
# TODO: In ODH there are only 2 Apps, we excpect 7 Apps according to:
# TODO: In ODH there are only 2 Apps, we expect 7 Apps according to:
# tests/Resources/Files/AppsInfoDictionary_latest.json
${EXP_DATA_DICT}= Load Expected Data Of RHODS Explore Section
Menu.Navigate To Page Applications Explore
Expand Down Expand Up @@ -192,7 +192,7 @@ Verify "Enabled" Keeps Being Available After One Of The ISV Operators If Uninsta
Uninstall Operator And Check Enabled Page Is Rendering
... operator_name=${openvino_operator_name} operator_appname=${openvino_appname}
[Teardown] Run Keyword And Ignore Error
... Check And Uninstall Operator In Openshift
... Check And Uninstall Operator In Openshift
... ${openvino_operator_name} ${openvino_appname} ${openvino_dashboard_app_id}

Verify Error Message In Logs When A RHODS Group Is Empty
Expand Down Expand Up @@ -588,12 +588,12 @@ Check Application Switcher Link To Openshift Console
[Documentation] Checks the HTTP status of OpenShift Console
${list_of_links}= Get Links From Switcher
${status}= Check HTTP Status Code link_to_check=${list_of_links}[0] verify_ssl=${False}
Should Be Equal ${list_of_links}[0] ${OCP_CONSOLE_URL}/
Should Match Regexp ${list_of_links}[0] ^${OCP_CONSOLE_URL}/*$
Should Be Equal ${status} ${200}

Check Application Switcher Link To Openshift Cluster Manager
[Documentation] Checks for HTTP status of OCM link and verify the Cluster in OCM
${ocm_link}= Get Element Attribute xpath://a[contains(.,"OpenShift Cluster Manager")] href
${ocm_link}= Get Element Attribute xpath://a[contains(.,"OpenShift Cluster Manager")] href
${is_self_managed}= Is RHODS Self-Managed
IF ${is_self_managed}
# For Self-Managed cluster there's no need to verify the cluster in OCM
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Verify RHODS Admins Can Import A Custom Serving Runtime Template By Uploading A
Open Dashboard Settings settings_page=Serving runtimes
Upload Serving Runtime Template runtime_filepath=${OVMS_RUNTIME_FILEPATH}
... serving_platform=multi runtime_protocol=gRPC
Serving Runtime Template Should Be Listed displayed_name=${UPLOADED_OVMS_YAML_NAME}
Serving Runtime Template Should Be Listed displayed_name=${UPLOADED_OVMS_DISPLAYED_NAME}
... serving_platform=multi

Verify RHODS Admins Can Delete A Custom Serving Runtime Template
Expand Down

0 comments on commit ccb0d07

Please sign in to comment.