Skip to content

Commit

Permalink
Fix inter warnings
Browse files Browse the repository at this point in the history
Signed-off-by: manosnoam <[email protected]>
  • Loading branch information
manosnoam committed Feb 29, 2024
1 parent eb79032 commit 11e33dd
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 28 deletions.
40 changes: 20 additions & 20 deletions ods_ci/tests/Resources/Page/ODH/ODHDashboard/ODHDashboard.robot
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ Login To RHODS Dashboard
${expected_text_list}= Create List Log in with Data Science Projects
Wait Until Page Contains A String In List ${expected_text_list}

${oauth_prompt_visible} = Is OpenShift OAuth Login Prompt Visible
${oauth_prompt_visible}= Is OpenShift OAuth Login Prompt Visible
IF ${oauth_prompt_visible} Click Button Log in with OpenShift
${login-required} = Is OpenShift Login Visible
${login-required}= Is OpenShift Login Visible

Check notice

Code scanning / Robocop

Use underscore in variable name '{{ variable_name }}' instead of hyphens to avoid treating them like minus sign Note test

Use underscore in variable name '${login-required}=' instead of hyphens to avoid treating them like minus sign
IF ${login-required} Login To Openshift ${ocp_user_name} ${ocp_user_pw} ${ocp_user_auth_type}
${authorize_service_account} = Is rhods-dashboard Service Account Authorization Required
${authorize_service_account}= Is rhods-dashboard Service Account Authorization Required

Check warning

Code scanning / Robocop

Keyword name '{{ keyword_name }}' does not follow case convention Warning test

Keyword name 'Is rhods-dashboard Service Account Authorization Required' does not follow case convention
IF ${authorize_service_account} Authorize rhods-dashboard service account

Logout From RHODS Dashboard
Expand Down Expand Up @@ -154,7 +154,7 @@ Verify Service Is Enabled
Verify Service Is Not Enabled
[Documentation] Verify the service is not present in Applications > Enabled
[Arguments] ${app_name}
${app_is_enabled} = Run Keyword And Return Status Verify Service Is Enabled ${app_name}
${app_is_enabled}= Run Keyword And Return Status Verify Service Is Enabled ${app_name}
Should Be True not ${app_is_enabled} msg=${app_name} should not be enabled in ODS Dashboard

Verify Service Is Available In The Explore Page
Expand Down Expand Up @@ -625,7 +625,7 @@ Delete Custom Image
... Needs an additional check on removed ImageStream
[Arguments] ${image_name}
Click Button xpath://td[@data-label="Name"]/div/div/div[.="${image_name} "]/../../../../td[last()]//button
${image_name_id} = Replace String ${image_name} ${SPACE} -
${image_name_id}= Replace String ${image_name} ${SPACE} -
Click Element xpath://td[@data-label="Name"]/div/div/div[.="${image_name} "]/../../../../td[last()]//button/..//button[@id="custom-${image_name_id}-delete-button"] # robocop: disable
Handle Deletion Confirmation Modal ${image_name} notebook image

Expand All @@ -639,15 +639,15 @@ Open Edit Menu For Custom Image
Expand Custom Image Details
[Documentation] Expands a custom image's row in the dashboard UI
[Arguments] ${image_name}
${is_expanded} = Run Keyword And Return Status Page Should Contain Element xpath://td[.="${image_name}"]/../td[1]/button[@aria-expanded="true"]
${is_expanded}= Run Keyword And Return Status Page Should Contain Element xpath://td[.="${image_name}"]/../td[1]/button[@aria-expanded="true"]

Check warning

Code scanning / Robocop

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

Line is too long (149/120)
IF ${is_expanded}==False
Click Button xpath://td[.="${image_name}"]/../td[1]//button
END

Collapse Custom Image Details
[Documentation] Collapses a custom image's row in the dashboard UI
[Arguments] ${image_name}
${is_expanded} = Run Keyword And Return Status Page Should Contain Element xpath://td[.="${image_name}"]/../td[1]/button[@aria-expanded="true"]
${is_expanded}= Run Keyword And Return Status Page Should Contain Element xpath://td[.="${image_name}"]/../td[1]/button[@aria-expanded="true"]

Check warning

Code scanning / Robocop

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

Line is too long (149/120)
IF ${is_expanded}==True
Click Button xpath://td[.="${image_name}"]/../td[1]//button
END
Expand All @@ -656,10 +656,10 @@ Verify Custom Image Description
[Documentation] Verifies that the description shown in the dashboard UI
... matches the given one
[Arguments] ${image_name} ${expected_description}
${exists} = Run Keyword And Return Status Page Should Contain Element
${exists}= Run Keyword And Return Status Page Should Contain Element
... xpath://td[@data-label="Name"]/div/div/div[.="${image_name} "]/../../../../td[@data-label="Description" and .="${expected_description}"] # robocop: disable
IF ${exists}==False
${desc} = Get Text xpath://td[@data-label="Name"]/div/div/div[.="${image_name} "]/../../../../td[@data-label="Description"]
${desc}= Get Text xpath://td[@data-label="Name"]/div/div/div[.="${image_name} "]/../../../../td[@data-label="Description"]

Check warning

Code scanning / Robocop

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

Line is too long (132/120)
Log Description for ${image_name} does not match ${expected_description} - Actual description is ${desc}
FAIL
END
Expand All @@ -671,7 +671,7 @@ Verify Custom Image Is Listed
[Arguments] ${image_name}
# whitespace after ${image_name} in the xpath is important!
Sleep 2s #wait for page to finish loading
${exists} = Run Keyword And Return Status Page Should Contain Element xpath://td[@data-label="Name"]/div/div/div[.="${image_name} "] # robocop: disable
${exists}= Run Keyword And Return Status Page Should Contain Element xpath://td[@data-label="Name"]/div/div/div[.="${image_name} "] # robocop: disable
IF ${exists}==False
Log ${image_name} not visible in page
FAIL
Expand All @@ -682,10 +682,10 @@ Verify Custom Image Provider
[Documentation] Verifies that the user listed for an image in the dahsboard
... UI matches the given one
[Arguments] ${image_name} ${expected_user}
${exists} = Run Keyword And Return Status Page Should Contain Element
${exists}= Run Keyword And Return Status Page Should Contain Element
... xpath://td[@data-label="Name"]/div/div/div[.="${image_name} "]/../../../../td[@data-label="Provider" and .="${expected_user}"] # robocop: disable
IF ${exists}==False
${user} = Get Text xpath://td[@data-label="Name"]/div/div/div[.="${image_name} "]/../../../../td[@data-label="Provider"] # robocop: disable
${user}= Get Text xpath://td[@data-label="Name"]/div/div/div[.="${image_name} "]/../../../../td[@data-label="Provider"] # robocop: disable
Log User for ${image_name} does not match ${expected_user} - Actual user is ${user}
FAIL
END
Expand All @@ -694,15 +694,15 @@ Verify Custom Image Provider
Enable Custom Image
[Documentation] Enables a custom image (i.e. displayed in JH) [WIP]
[Arguments] ${image_name}
${is_enabled} = # Need to find a check
${is_enabled}= # Need to find a check
IF ${is_enabled}==False
Click Element xpath://td[@data-label="Name"]/div/div/div[.="${image_name} "]/../../../..//input
END

Disable Custom Image
[Documentation] Disables a custom image (i.e. not displayed in JH) [WIP]
[Arguments] ${image_name}
${is_enabled} = # Need to find a check
${is_enabled}= # Need to find a check
IF ${is_enabled}==True
Click Element xpath://td[@data-label="Name"]/div/div/div[.="${image_name} "]/../../../..//input
END
Expand Down Expand Up @@ -737,7 +737,7 @@ Clear Dashboard Notifications
[Documentation] Clears Notifications present in RHODS dashboard
Click Element xpath=//*[contains(@class,'notification-badge')]
Sleep 2s reason=To avoid Element Not Interactable Exception
${notification_count} = Get Element Count class:odh-dashboard__notification-drawer__item-remove
${notification_count}= Get Element Count class:odh-dashboard__notification-drawer__item-remove
FOR ${index} IN RANGE ${notification_count}
Click Element xpath=//*[contains(@class,"odh-dashboard__notification-drawer__item-remove")]
END
Expand Down Expand Up @@ -785,8 +785,8 @@ 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, '#'))]
${list_of_links}= Create List

Check notice

Code scanning / Robocop

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

Create List can be replaced with VAR
${link_elements}= Get WebElements //a[@class="pf-m-external pf-v5-c-app-launcher__menu-item" and not(starts-with(@href, '#'))]
FOR ${ext_link} IN @{link_elements}
${href}= Get Element Attribute ${ext_link} href
Append To List ${list_of_links} ${href}
Expand All @@ -805,7 +805,7 @@ Maybe Wait For Dashboard Loading Spinner Page
IF ${do not wait for spinner} == ${true}
RETURN
END
${spinner_ball} = Set Variable xpath=//span[@class="pf-v5-c-spinner__tail-ball"]
${spinner_ball}= Set Variable xpath=//span[@class="pf-v5-c-spinner__tail-ball"]
Run Keyword And Ignore Error Run Keywords
... Wait Until Page Contains Element ${spinner_ball} timeout=${timeout-pre}
... AND
Expand All @@ -824,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')]
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 @@ -847,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}
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 @@ -57,7 +57,7 @@ Storage Size Should Be
... ${STORAGE_SECTION_XP}//td[contains(@data-label,"Size")]//div[strong[text()="Size"]]/div # robocop: disable
Wait Until Page Contains Element ${storage_size_el} timeout=20s
${displayed_sizes}= Get All Text Under Element ${storage_size_el}
${matched_sizes}= Get All Strings That Contain ${displayed_sizes} ${size}Gi
${matched_sizes}= Get All Strings That Contain ${displayed_sizes} Max ${size}Gi
Run Keyword And Continue On Failure Should Not Be Empty ${matched_sizes}
ELSE IF "${pvc_status_phase}" == "Bound"
# PVC is now or had been bound already sometime in past - there is:
Expand Down Expand Up @@ -140,7 +140,7 @@ Fill In New PV Data
Run Keyword And Continue On Failure Element Should Be Enabled
... xpath=//div[contains(@class,"modal")]//input[contains(@placeholder,"Select a workbench to connect")]
FOR ${workbench_title} IN @{connected_workbench}
${mount_dir}= Genereta Mount Name ${workbench_title}
${mount_dir}= Generate Mount Name ${workbench_title}
Set Connection Between PV And Workbench ${workbench_title} ${mount_dir}
Run Keyword And Continue On Failure Element Should Be Enabled ${STORAGE_SUBMIT_BTN_XP}
END
Expand Down Expand Up @@ -192,7 +192,7 @@ Delete All PVC In Project From CLI
... oc delete pvc -n ${ns_name} --all shell=yes
Should Be True ${result.rc} == 0 msg=${result.stderr}

Check notice

Code scanning / Robocop

'{{ block_name }}' condition can be simplified Note test

'Should Be True' condition can be simplified

Genereta Mount Name
Generate Mount Name
[Documentation] Generate a supported mount directory name (lower case and dashes only) from string '${str}'
[Arguments] ${str}
${str}= Replace String Using Regexp string=${str} pattern=[^a-zA-Z] replace_with=-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,7 @@ Get Openshift Notebook CR From Workbench

Start Workbench Should Fail
[Documentation] Checks the workbench fails to start
[Arguments] ${prj_title} ${workbench_title}
Wait Until Project Is Open project_title=${prj_title}
[Arguments] ${workbench_title}
${failed}= Run Keyword And Return Status
... Wait Until Workbench Is Started workbench_title=${workbench_title}
IF ${failed} != ${FALSE} Fail msg=Workbench is expected to fail starting...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ Verify User Can Create A PV Storage
... prj_title=${PRJ_TITLE} image_name=${NB_IMAGE} deployment_size=Small
... storage=Persistent pv_existent=${NONE}
... pv_name=${NONE} pv_description=${NONE} pv_size=${NONE}
Workbench Should Be Listed workbench_title=${WORKBENCH_TITLE}
Wait Until Workbench Is Started workbench_title=${WORKBENCH_TITLE}
${workbenches}= Create List ${WORKBENCH_TITLE}

Check notice

Code scanning / Robocop

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

Create List can be replaced with VAR
Create PersistentVolume Storage name=${pv_name} description=${PV_DESCRIPTION} project_title=${PRJ_TITLE}
... size=${PV_SIZE} connected_workbench=${NONE} press_cancel=${TRUE}
Expand Down Expand Up @@ -223,8 +225,6 @@ Verify User Can Create A S3 Data Connection And Connect It To Workbenches
... aws_s3_endpoint=${DC_S3_ENDPOINT} aws_region=${DC_S3_REGION}
... connected_workbench=${workbenches}
Data Connection Should Be Listed name=${DC_2_S3_NAME} type=${DC_S3_TYPE} connected_workbench=${workbenches}
Run Keyword And Ignore Error Wait Until Workbench Is Started workbench_title=${WORKBENCH_TITLE}
... status=${WORKBENCH_STATUS_STARTING}
Run Keyword And Continue On Failure Wait Until Workbench Is Started workbench_title=${WORKBENCH_TITLE}
Workbench Status Should Be workbench_title=${WORKBENCH_2_TITLE} status=${WORKBENCH_STATUS_STOPPED}
[Teardown] Run Keywords
Expand Down Expand Up @@ -441,7 +441,7 @@ Verify Error Is Reported When Workbench Fails To Start # robocop: disable
... press_cancel=${FALSE} envs=${NONE}
Workbench Status Should Be workbench_title=${WORKBENCH_5_TITLE}
... status=${WORKBENCH_STATUS_STARTING}
Start Workbench Should Fail prj_title=${PRJ_TITLE} workbench_title=${WORKBENCH_5_TITLE}
Start Workbench Should Fail workbench_title=${WORKBENCH_5_TITLE}
Open Notebook Event Log workbench_title=${WORKBENCH_5_TITLE}
... exp_preview_text=Insufficient
Event Log Should Report The Failure exp_progress_text=Insufficient resources to start
Expand Down

0 comments on commit 11e33dd

Please sign in to comment.