Skip to content

Commit

Permalink
Stabilize Dashboard Test Suite (415)
Browse files Browse the repository at this point in the history
Fix known Automation bugs and general stability of Dashboard Suite 415.

It also includes fixes to Keywords in Storages, Workbenches and Projects
resources, that are being used by this suite:
- `Create PersistentVolume Storage` option to update existing PVC
- Fix supported mount name with to lower case and dashes only
- `Workbench Should Be Listed` with timeout option
- Fix `Select Existing Data Connection` in Workbench
- `Wait Until Project Is Open` first waits for spinner ball to disappear
- `Open Workbench` waits for workbench link, before clicking it
- `Verify Cluster Settings Is Available` by `data-testid`
- Increase timeout waiting to switch to/from JupyterLab console
- New Storage KW: `Delete All PVC In Project From CLI`
- New Common KW: `Get All Text Under Element`
- New Common KW: `Get All Strings That Contain`
- Removed All Tags of Product/Automation Bugs (All Suite Tests Passed)
- Append to Suite 415: `Test Tags   Dashboard`

Signed-off-by: manosnoam <[email protected]>
  • Loading branch information
manosnoam committed Feb 29, 2024
1 parent da97eb1 commit eb79032
Show file tree
Hide file tree
Showing 6 changed files with 164 additions and 110 deletions.
22 changes: 22 additions & 0 deletions ods_ci/tests/Resources/Common.robot
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,28 @@ CSS Property Value Should Be
Run Keyword And Continue On Failure Should Be Equal ${actual_value} ${exp_value}
END

Get All Text Under Element
[Documentation] Returns a list of all text content under an element tree, including trailing spaces
# This is usefull since Get Text ignores trailing spaces and sibling elements.
# The returned list can be evaluated with keyword: Should Contain ${text_list} Text Data
[Arguments] ${parent_element}
${elements}= Get WebElements ${parent_element}
${text_list}= Create List

Check notice

Code scanning / Robocop

{{ create_keyword }} can be replaced with VAR Note test

Create List can be replaced with VAR
FOR ${element} IN @{elements}
${text}= Get Element Attribute ${element} textContent
Append To List ${text_list} ${text}
END
RETURN ${text_list}

Get All Strings That Contain
[Documentation] Returns new list of strings, for each item in ${list_of_strings} that contains ${substring_to_search}

Check warning

Code scanning / Robocop

Line is too long ({{ line_length }}/{{ allowed_length }}) Warning test

Line is too long (124/120)
[Arguments] ${list_of_strings} ${substring_to_search}
${matched_list}= Create List

Check notice

Code scanning / Robocop

{{ create_keyword }} can be replaced with VAR Note test

Create List can be replaced with VAR
FOR ${str} IN @{list_of_strings}
IF "${substring_to_search}" in "${str}" Append To List ${matched_list} ${str}
END
RETURN ${matched_list}

Page Should Contain A String In List
[Documentation] Verifies that page contains at least one of the strings in text_list
[Arguments] ${text_list}
Expand Down
30 changes: 16 additions & 14 deletions ods_ci/tests/Resources/Page/ODH/ODHDashboard/ODHDashboard.robot
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ ${IMAGE_XP_OLD}= ${HEADER_XP}/img[contains(@class, 'odh-card__header-brand')]
${APPS_DICT_PATH_LATEST}= ods_ci/tests/Resources/Files/AppsInfoDictionary_latest.json
${SIDEBAR_TEXT_CONTAINER_XP}= //div[contains(@class,'odh-markdown-view')]
${SUCCESS_MSG_XP}= //div[@class='pf-v5-c-alert pf-m-success']
${PAGE_TITLE_XP}= //*[@data-testid="app-page-title" and text()="Cluster settings"]
${USAGE_DATA_COLLECTION_XP}= //*[@id="usage-data-checkbox"]
${CUSTOM_IMAGE_SOFTWARE_TABLE}= //caption[contains(., "the advertised software")]/../tbody
${CUSTOM_IMAGE_PACKAGE_TABLE}= //caption[contains(., "the advertised packages")]/../tbody
Expand Down Expand Up @@ -256,7 +257,7 @@ Load Expected Data Of RHODS Explore Section

Wait Until Cards Are Loaded
[Documentation] Waits until the Application cards are displayed in the page
Run Keyword And Continue On Failure Wait Until Page Contains Element
Run Keyword And Ignore Error Wait Until Page Contains Element
... xpath:${CARDS_XP} timeout=15s error="This might be caused by bug RHOAIENG-404"

Get App ID From Card
Expand Down Expand Up @@ -508,7 +509,7 @@ Verify Cluster Settings Is Available
Page Should Contain Settings
Menu.Navigate To Page Settings Cluster settings
Capture Page Screenshot
Wait Until Page Contains Update global settings for all users timeout=30
Wait Until Page Contains Element ${PAGE_TITLE_XP} timeout=30
Wait Until Page Contains Element ${USAGE_DATA_COLLECTION_XP} timeout=30

Verify Cluster Settings Is Not Available
Expand Down Expand Up @@ -755,9 +756,9 @@ Get Dashboard Pods Names
Get Dashboard Pod Logs
[Documentation] Fetches the logs from one dashboard pod
[Arguments] ${pod_name}
${pod_logs}= Oc Get Pod Logs name=${pod_name} namespace=${APPLICATIONS_NAMESPACE} container=rhods-dashboard
${pod_logs_lines}= Split String string=${pod_logs} separator=\n
${n_lines}= Get Length ${pod_logs_lines}
${pod_logs}= Oc Get Pod Logs name=${pod_name} namespace=${APPLICATIONS_NAMESPACE} container=rhods-dashboard
${pod_logs_lines}= Split String string=${pod_logs} separator=\n
${n_lines}= Get Length ${pod_logs_lines}
Log ${pod_logs_lines}[${n_lines-3}:]
IF "${pod_logs_lines}[${n_lines-1}]" == "${EMPTY}"
Remove From List ${pod_logs_lines} ${n_lines-1}
Expand All @@ -768,8 +769,10 @@ Get Dashboard Pod Logs
Get ConfigMaps For RHODS Groups Configuration
[Documentation] Returns a dictionary containing "rhods-group-config" and "groups-config"
... ConfigMaps
${rgc_status} ${rgc_yaml}= Run Keyword And Ignore Error OpenShiftLibrary.Oc Get kind=ConfigMap name=${RHODS_GROUPS_CONFIG_CM} namespace=${APPLICATIONS_NAMESPACE}
${gc_status} ${gc_yaml}= Run Keyword And Ignore Error OpenShiftLibrary.Oc Get kind=ConfigMap name=${GROUPS_CONFIG_CM} namespace=${APPLICATIONS_NAMESPACE}
${rgc_status} ${rgc_yaml}= Run Keyword And Ignore Error OpenShiftLibrary.Oc Get
... kind=ConfigMap name=${RHODS_GROUPS_CONFIG_CM} namespace=${APPLICATIONS_NAMESPACE}
${gc_status} ${gc_yaml}= Run Keyword And Ignore Error OpenShiftLibrary.Oc Get
... kind=ConfigMap name=${GROUPS_CONFIG_CM} namespace=${APPLICATIONS_NAMESPACE}
IF $rgc_status == 'FAIL'
${rgc_yaml}= Create List ${EMPTY}
END
Expand All @@ -783,7 +786,7 @@ Get ConfigMaps For RHODS Groups Configuration
Get Links From Switcher
[Documentation] Returns the OpenShift Console and OpenShift Cluster Manager Link
${list_of_links} = Create List
${link_elements}= Get WebElements //a[@class="pf-m-external pf-v5-c-app-launcher__menu-item" and not(starts-with(@href, '#'))]
${link_elements} = Get WebElements //a[@class="pf-m-external pf-v5-c-app-launcher__menu-item" and not(starts-with(@href, '#'))]

Check warning

Code scanning / Robocop

Line is too long ({{ line_length }}/{{ allowed_length }}) Warning test

Line is too long (137/120)

Check warning

Code scanning / Robocop

The assignment sign is not consistent within the file. Expected '{{ expected_sign }}' but got '{{ actual_sign }}' instead Warning test

The assignment sign is not consistent within the file. Expected '=' but got ' =' instead
FOR ${ext_link} IN @{link_elements}
${href}= Get Element Attribute ${ext_link} href
Append To List ${list_of_links} ${href}
Expand All @@ -798,16 +801,15 @@ Maybe Wait For Dashboard Loading Spinner Page
[Documentation] Detecs the loading symbol (spinner) and wait for it to disappear.
... If the spinner does not appear, the keyword ignores the error.
[Arguments] ${timeout-pre}=3s ${timeout}=5s

${do not wait for spinner}= Get Variable Value ${ODH_DASHBOARD_DO_NOT_WAIT_FOR_SPINNER_PAGE} # defaults to None if undefined
IF ${do not wait for spinner} == ${true}
RETURN
END

${spinner_ball} = Set Variable xpath=//span[@class="pf-v5-c-spinner__tail-ball"]

Check warning

Code scanning / Robocop

The assignment sign is not consistent within the file. Expected '{{ expected_sign }}' but got '{{ actual_sign }}' instead Warning test

The assignment sign is not consistent within the file. Expected '=' but got ' =' instead
Run Keyword And Ignore Error Run Keywords
... Wait Until Page Contains Element xpath=//span[@class="pf-v5-c-spinner__tail-ball"] timeout=${timeout-pre}
... Wait Until Page Contains Element ${spinner_ball} timeout=${timeout-pre}
... AND
... Wait Until Page Does Not Contain Element xpath=//span[@class="pf-v5-c-spinner__tail-ball"] timeout=${timeout}
... Wait Until Page Does Not Contain Element ${spinner_ball} timeout=${timeout}

Reload RHODS Dashboard Page
[Documentation] Reload the web page and wait for RHODS Dashboard
Expand All @@ -822,7 +824,7 @@ Handle Deletion Confirmation Modal
[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')]
${delete_btn_xp} = Set Variable xpath=//button[contains(text(), 'Delete')]

Check warning

Code scanning / Robocop

The assignment sign is not consistent within the file. Expected '{{ expected_sign }}' but got '{{ actual_sign }}' instead Warning test

The assignment sign is not consistent within the file. Expected '=' but got ' =' instead
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.
Expand All @@ -845,7 +847,7 @@ Click Action From Actions Menu
[Arguments] ${item_title} ${action} ${item_type}=${NONE}
Click Element xpath=//tr[td[@data-label="Name"]//*[text()="${item_title}"]]/td[contains(@class,"-table__action")]//button[@aria-label="Kebab toggle"] # robocop: disable
IF "${item_type}" != "${NONE}"
${action}= Catenate ${action} ${item_type}
${action} = Catenate ${action} ${item_type}

Check warning

Code scanning / Robocop

The assignment sign is not consistent within the file. Expected '{{ expected_sign }}' but got '{{ actual_sign }}' instead Warning test

The assignment sign is not consistent within the file. Expected '=' but got ' =' instead
END
Wait Until Page Contains Element xpath=//tr[td[@data-label="Name"]//*[text()="${item_title}"]]//td//li//*[text()="${action}"] # robocop: disable
Click Element xpath=//tr[td[@data-label="Name"]//*[text()="${item_title}"]]//td//li//*[text()="${action}"]
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Is Data Science Projects Page Open
[Documentation] Checks if Data Science Projects home page is open. Returns TRUE or FALSE
Close Generic Modal If Present
${page_open}= Run Keyword And Return Status Page Should Contain Element ${DS_PROJECT_XP}
[Return] ${page_open}
RETURN ${page_open}

Open Data Science Project Details Page
[Documentation] Verifies submenu Settings > "Data Science Projects" is visible
Expand Down Expand Up @@ -78,14 +78,14 @@ Is Data Science Project Details Page Open
[Arguments] ${project_title}
${page_open}= Run Keyword And Return Status
... SeleniumLibrary.Page Should Contain Element xpath=//h1[contains(text(),"${project_title}")]
[Return] ${page_open}
RETURN ${page_open}

Wait Until Project Is Open
[Documentation] Waits until a DS Project Details page is laoded
[Arguments] ${project_title} ${timeout-pre-spinner}=3s ${timeout-spinner}=5s
Wait Until Page Contains Element xpath=//h1[contains(text(),"${project_title}")] timeout=30
Maybe Wait For Dashboard Loading Spinner Page
... timeout-pre=${timeout-pre-spinner} timeout=${timeout-spinner}
Wait Until Page Contains Element xpath=//h1[contains(text(),"${project_title}")] timeout=30s

Project Should Be Listed
[Documentation] Checks a Project is available in DS Project home page
Expand Down Expand Up @@ -161,7 +161,7 @@ Get Openshift Namespace From Data Science Project
[Arguments] ${project_title}
${rc} ${k8s_name}= Run And Return Rc And Output oc get projects -o json | jq '.items[] | select((.metadata.annotations."openshift.io/display-name" != null) and (.metadata.labels."opendatahub.io/dashboard"=="true") and (.metadata.annotations."openshift.io/display-name"=="${project_title}")) | .metadata.name' # robocop: disable
${k8s_name}= Replace String ${k8s_name} " ${EMPTY}
[Return] ${k8s_name}
RETURN ${k8s_name}

Delete Data Science Projects From CLI
[Documentation] Deletes the Openshift Projects using OpenshiftLibrary.
Expand Down Expand Up @@ -290,14 +290,8 @@ Workbench Launch Link Should Be Disabled

Get All Displayed Projects
[Documentation] Gets all the DS projects visible in the DS Projects home page
${projects_names}= Create List
${elements}= Get WebElements xpath=//td[@data-label="Name"]//a
FOR ${element} IN @{elements}
# Get exact project display name (including trailing spaces)
${name}= Get Element Attribute ${element} textContent
Append To List ${projects_names} ${name}
END
[Return] ${projects_names}
${projects_names}= Get All Text Under Element xpath=//td[@data-label="Name"]//a
RETURN ${projects_names}

Number Of Displayed Projects Should Be
[Documentation] Checks the number the DS projects visible in the DS Projects home page is expected
Expand Down Expand Up @@ -424,4 +418,4 @@ Clean Project From Workbench Resources
... ${pvc_title}=${workbench_title}
Delete Workbench From CLI workbench_title=${workbench_title}
... project_title=${project_title}
Delete PVC From CLI pvc_title=${pvc_title} project_title=${project_title}
Delete PVC In Project From CLI pvc_title=${pvc_title} project_title=${project_title}

Check warning

Code scanning / Robocop

File has too many lines ({{ lines_count }}/{{max_allowed_count }}) Warning test

File has too many lines (421/400)
Loading

0 comments on commit eb79032

Please sign in to comment.