Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix custom image tests #988

Merged
merged 7 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 26 additions & 16 deletions ods_ci/tests/Resources/Page/ODH/ODHDashboard/ODHDashboard.robot
Original file line number Diff line number Diff line change
Expand Up @@ -537,11 +537,12 @@
[Documentation] Verifies RHODS Notifications contains given Message
[Arguments] ${message}
Click Element xpath=//*[contains(@class,'notification-badge')]
Wait Until Page Contains text=${message} timeout=300s
Run Keyword And Continue On Failure Wait Until Page Contains text=${message} timeout=10s
Close Notification Drawer

Open Notebook Images Page
[Documentation] Opens the RHODS dashboard and navigates to the Notebook Images page
Wait Until Page Contains Settings
Page Should Contain Settings
Menu.Navigate To Page Settings Notebook images
Wait Until Page Contains Notebook image settings
Expand All @@ -552,11 +553,12 @@
[Arguments] ${repo} ${name} ${description} ${software} ${packages}
Sleep 1
Open Custom Image Import Popup
Input Text xpath://input[@id="notebook-image-repository-input"] ${repo}
Input Text xpath://input[@id="notebook-image-name-input"] ${name}
Input Text xpath://input[@id="notebook-image-description-input"] ${description}
Add Softwares To Custom Image ${software}
Add Packages To Custom Image ${packages}
Input Text xpath://input[@id="byon-image-repository-input"] ${repo}
Input Text xpath://input[@id="byon-image-name-input"] ${name}
Input Text xpath://input[@id="byon-image-description-input"] ${description}
# No button present anymore?
#Add Softwares To Custom Image ${software}

Check warning

Code scanning / Robocop

Missing blank space after comment character Warning test

Missing blank space after comment character
#Add Packages To Custom Image ${packages}

Check warning

Code scanning / Robocop

Missing blank space after comment character Warning test

Missing blank space after comment character
Click Element xpath://button[.="Import"]

Open Custom Image Import Popup
Expand All @@ -567,7 +569,7 @@
ELSE
Click Element xpath://button[.="Import new image"]
END
Wait Until Page Contains Import Notebook images
Wait Until Page Contains Import notebook images

Add Softwares To Custom Image
[Documentation] Loops through a dictionary to add software to the custom img metadata
Expand Down Expand Up @@ -618,8 +620,8 @@
[Documentation] Deletes a custom image through the dashboard UI.
... Needs an additional check on removed ImageStream
[Arguments] ${image_name}
Click Button xpath://td[.="${image_name}"]/../td[last()]//button
Click Element xpath://td[.="${image_name}"]/../td[last()]//button/..//li[@id="${image_name}-delete-button"]
Click Button xpath://td[@data-label="Name"]/div/div/div[.="${image_name} "]/../../../../td[last()]//button
Click Element xpath://td[@data-label="Name"]/div/div/div[.="${image_name} "]/../../../../td[last()]//button/..//li[@id="${image_name}-delete-button"] # robocop: disable
Wait Until Page Contains Do you wish to permanently delete ${image_name}?
Click Button xpath://button[.="Delete"]

Expand Down Expand Up @@ -650,9 +652,10 @@
[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 xpath://td[.="${image_name}"]/../td[@data-label="Description"][.="${expected_description}"]
${exists} = Run Keyword And Return Status Page Should Contain Element

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

Check warning

Code scanning / Robocop

Trailing whitespace at the end of line Warning test

Trailing whitespace at the end of line
... 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[.="${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 (133/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
Log Description for ${image_name} does not match ${expected_description} - Actual description is ${desc}
FAIL
END
Expand All @@ -662,7 +665,8 @@
[Documentation] Verifies that the custom image is displayed in the dashboard
... UI with the correct name
[Arguments] ${image_name}
${exists} = Run Keyword And Return Status Page Should Contain Element xpath://td[.="${image_name}"]
# whitespace after ${image_name} in the xpath is important!
${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 @@ -673,9 +677,10 @@
[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 xpath://td[.="${image_name}"]/../td[@data-label="User"][.="${expected_user}"]
${exists} = Run Keyword And Return Status Page Should Contain Element

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

Check warning

Code scanning / Robocop

Trailing whitespace at the end of line Warning test

Trailing whitespace at the end of line
... xpath://td[@data-label="Name"]/div/div/div[.="${image_name} "]/../../../../td[@data-label="User" and .="${expected_user}"] # robocop: disable
IF ${exists}==False
${user} = Get Text xpath://td[.="${image_name}"]/../td[@data-label="User"]
${user} = Get Text xpath://td[@data-label="Name"]/div/div/div[.="${image_name} "]/../../../../td[@data-label="User"] # robocop: disable
Log User for ${image_name} does not match ${expected_user} - Actual user is ${user}
FAIL
END
Expand All @@ -686,19 +691,24 @@
[Arguments] ${image_name}
${is_enabled} = # Need to find a check
IF ${is_enabled}==False
Click Element xpath://td[.="${image_name}"]/..//input
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
IF ${is_enabled}==True
Click Element xpath://td[.="${image_name}"]/..//input
Click Element xpath://td[@data-label="Name"]/div/div/div[.="${image_name} "]/../../../..//input
END

Close Notification Drawer
[Documentation] Closes the dashboard notification drawer, if it is open
# the notification popup could be present and prevent from closing the drawer, let's check and close if exists
${popup}= Run Keyword And Return Status Page Should Contain Element xpath://div[@aria-label="Danger Alert"]
IF ${popup}==True

Check notice

Code scanning / Robocop

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

'IF' condition can be simplified
Click Element xpath://div[@aria-label="Danger Alert"]//button[contains(@aria-label,"Close Danger alert")]
END
${closed}= Run Keyword And Return Status Page Should Contain Element ${NOTIFICATION_DRAWER_CLOSED}
IF ${closed}==False
Click Element ${NOTIFICATION_DRAWER_CLOSE_BTN}
Expand Down
27 changes: 15 additions & 12 deletions ods_ci/tests/Tests/500__jupyterhub/custom-image.robot
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*** Variables ***
${YAML} = tests/Resources/Files/custom_image.yaml
${IMG_NAME} = custom-test-image
${IMG_URL} = quay.io/thoth-station/s2i-lab-elyra:v0.1.1
${IMG_URL} = quay.io/opendatahub-contrib/workbench-images:jupyter-datascience-c9s-py311_2023c_latest
lugi0 marked this conversation as resolved.
Show resolved Hide resolved
${IMG_DESCRIPTION} = Testing Only This image is only for illustration purposes, and comes with no support. Do not use.
&{IMG_SOFTWARE} = Software1=x.y.z
&{IMG_PACKAGES} = elyra=2.2.4 foo-pkg=a.b.c
Expand All @@ -38,7 +38,6 @@
... Then loads the spawner and tries using the custom img
[Tags] Sanity Tier1
... ODS-1208 ODS-1365
... ProductBug
Create Custom Image
Get ImageStream Metadata And Check Name
Verify Custom Image Is Listed ${IMG_NAME}
Expand All @@ -61,23 +60,25 @@
[Documentation] Test adding two images with the same name (should fail)
[Tags] Sanity Tier1
... ODS-1368
... ProductBug
Sleep 1
Create Custom Image
Sleep 1
Import New Custom Image ${IMG_URL} ${IMG_NAME} ${IMG_DESCRIPTION}
... software=${IMG_SOFTWARE}
... packages=${IMG_PACKAGES}
RHODS Notification Drawer Should Contain Unable to add notebook image ${IMG_NAME}
Run Keyword And Warn On Failure RHODS Notification Drawer Should Contain
... Unable to add notebook image ${IMG_NAME}
Sleep 1
Delete Custom Image ${IMG_NAME}
# If both imgs can be created they also have to be deleted twice
Sleep 2
Run Keyword And Continue On Failure Delete Custom Image ${IMG_NAME}
Reset Image Name

Test Bad Image URL
[Documentation] Test adding an image with a bad repo URL (should fail)
[Tags] Sanity Tier1
... ODS-1367
... ProductBug
${OG_URL}= Set Variable ${IMG_URL}
${IMG_URL}= Set Variable quay.io/RandomName/RandomImage:v1.2.3
Set Global Variable ${IMG_URL} ${IMG_URL}
Expand All @@ -92,18 +93,20 @@
... in the JH spawner page
[Tags] Sanity Tier1
... ODS-1364
... ProductBug
${OG_URL}= Set Variable ${IMG_URL}
${IMG_URL}= Set Variable randomstring
Set Global Variable ${IMG_URL} ${IMG_URL}
Create Custom Image
Get ImageStream Metadata And Check Name
Launch JupyterHub Spawner From Dashboard
RHODS Notification Drawer Should Contain
... Unable to add notebook image ${IMG_NAME}
#### Image does not get imported anymore at all ####
#Get ImageStream Metadata And Check Name

Check warning

Code scanning / Robocop

Missing blank space after comment character Warning test

Missing blank space after comment character
#Launch JupyterHub Spawner From Dashboard

Check warning

Code scanning / Robocop

Missing blank space after comment character Warning test

Missing blank space after comment character
# Imgs imported with a broken/wrong url will be disabled in the spawner
Element Should Be Disabled xpath://input[contains(@id, "${IMAGESTREAM_NAME}")]
${IMG_URL}= Set Variable ${OG_URL}
Set Global Variable ${IMG_URL} ${IMG_URL}
[Teardown] Custom Image Teardown cleanup=False
#Element Should Be Disabled xpath://input[contains(@id, "${IMAGESTREAM_NAME}")]

Check warning

Code scanning / Robocop

Missing blank space after comment character Warning test

Missing blank space after comment character
#${IMG_URL}= Set Variable ${OG_URL}

Check warning

Code scanning / Robocop

Missing blank space after comment character Warning test

Missing blank space after comment character
#Set Global Variable ${IMG_URL} ${IMG_URL}

Check warning

Code scanning / Robocop

Missing blank space after comment character Warning test

Missing blank space after comment character
#[Teardown] Custom Image Teardown cleanup=False

Check warning

Code scanning / Robocop

Missing blank space after comment character Warning test

Missing blank space after comment character


*** Keywords ***
Expand Down
Loading