Skip to content

Commit

Permalink
[RHOAIENG-223] Test VSCode - add checks for VS Code image
Browse files Browse the repository at this point in the history
This introduces tests for the recently added code-server IDE image. For more
information see [1,2].

This is just a basic check. More should be implemented later.

[1] https://issues.redhat.com/browse/RHOAIENG-223
[2] https://issues.redhat.com/browse/RHOAIENG-225
  • Loading branch information
jstourac committed Feb 22, 2024
1 parent 2ca67d8 commit 59120e7
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 9 deletions.
10 changes: 10 additions & 0 deletions ods_ci/tests/Resources/Common.robot
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ End Web Test
END
Close Browser

End Non JupyterLab Web Test
[Documentation] Stops running workbench that was started by logged-in user via the
... JupyterHub launcher space.
Go To ${ODH_DASHBOARD_URL}
Wait for RHODS Dashboard to Load

Check warning

Code scanning / Robocop

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

Keyword name 'Wait for RHODS Dashboard to Load' does not follow case convention
Launch Jupyter From RHODS Dashboard Link
Handle Control Panel
Capture Page Screenshot
Close Browser

Load Json File
[Arguments] ${file_path}
${j_file}= Get File ${file_path}
Expand Down
42 changes: 37 additions & 5 deletions ods_ci/tests/Resources/Page/ODH/JupyterHub/JupyterHubSpawner.robot
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,42 @@ Has Spawn Failed
${spawn_status} = Run Keyword And Return Status Page Should Contain Spawn failed
RETURN ${spawn_status}

Notebook Expected Ide
[Documentation] Returns type of expected IDE for the given image name.
... At the moment, there are two IDE types available in the notebook images:
... JupyterLab and VSCode.
... Returns type of expected IDE for the given image name as a string.
[Arguments] ${image_name}
IF "${image_name}"=="${EMPTY}"
Log level=ERROR message=No image name has been provided!
RETURN ${EMPTY}
END
IF "${image_name}"=="code-server"
RETURN VSCode
ELSE
RETURN JupyterLab
END

Wait Notebook To Be Loaded
[Documentation] Waits for the notebook IDE environment to be loaded completely and performs
... a simple check with the Menu action in the loaded IDE.
[Arguments] ${image_name} ${version}
${ide}= Notebook Expected Ide ${image_name}

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

IF "${ide}"=="VSCode"
Wait Until Page Contains Element xpath://div[@class="menubar-menu-button"] timeout=60s
Wait Until Page Contains Element xpath://div[@class="monaco-dialog-box"] timeout=60s
Wait Until Page Contains Do you trust the authors of the files in this folder?
ELSE IF "${ide}"=="JupyterLab"
Wait Until Page Contains Element xpath://div[@id="jp-top-panel"] timeout=60s
Sleep 2s reason=Wait for a possible popup
Maybe Close Popup
Open New Notebook In Jupyterlab Menu
Spawned Image Check ${image} ${version}
ELSE
Fail msg=Unknown IDE typ has been resolved: '${ide}'. Please check and fix or implement.
END

Spawn Notebook With Arguments # robocop: disable
[Documentation] Selects required settings and spawns a notebook pod. If it fails due to timeout or other issue
... It will try again ${retries} times (Default: 1) after ${retries_delay} delay (Default: 0 seconds).
Expand Down Expand Up @@ -318,11 +354,7 @@ Spawn Notebook With Arguments # robocop: disable
Run Keyword And Warn On Failure Login To Openshift ${username} ${password} ${auth_type}
${authorization_required} = Is Service Account Authorization Required
IF ${authorization_required} Authorize jupyterhub service account
Wait Until Page Contains Element xpath://div[@id="jp-top-panel"] timeout=60s
Sleep 2s reason=Wait for a possible popup
Maybe Close Popup
Open New Notebook In Jupyterlab Menu
Spawned Image Check ${image} ${version}
Wait Notebook To Be Loaded ${image} ${version}
${spawn_fail} = Has Spawn Failed
Exit For Loop If ${spawn_fail} == False
Reload Page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,13 +268,14 @@ Launch And Access Workbench From Projects Home Page
[Documentation] Launches a running workbench from DS Projects home page.
[Arguments] ${workbench_title} ${project_title} ${username}=${TEST_USER_3.USERNAME}
... ${password}=${TEST_USER_3.PASSWORD} ${auth_type}=${TEST_USER_3.AUTH_TYPE}
... ${expected_ide}=JupyterLab
${is_started}= Run Keyword And Return Status Workbench Status Should Be From Projects Home Page
... workbench_title=${workbench_title} status=${WORKBENCH_STATUS_RUNNING} project_title=${project_title}
IF ${is_started} == ${TRUE}
Click Element xpath=//tr//a[text()="${project_title}"]/ancestor::tr/td[@data-label="Workbench"]//a[text()="${workbench_title}"]
Switch Window NEW
Access To Workbench username=${username} password=${password}
... auth_type=${auth_type}
... auth_type=${auth_type} expected_ide=${expected_ide}
ELSE
Fail msg=Cannot Launch And Access Workbench ${workbench_title} because it is not running...
END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,15 +321,23 @@ Start Workbench

Access To Workbench
[Documentation] Gets access to a workbench from DS Project details page after it got launched
[Arguments] ${username} ${password} ${auth_type}
[Arguments] ${username} ${password} ${auth_type} ${expected_ide}=JupyterLab
Run Keyword And Warn On Failure Wait Until Page Contains Log in with OpenShift timeout=15s
${oauth_prompt_visible} = Is OpenShift OAuth Login Prompt Visible
IF ${oauth_prompt_visible} Click Button Log in with OpenShift
Run Keyword And Warn On Failure Login To Openshift ${username} ${password} ${auth_type}
${authorization_required}= Is Service Account Authorization Required
IF ${authorization_required} Authorize Jupyterhub Service Account
Wait Until Page Contains Element xpath://div[@id="jp-top-panel"] timeout=60s
Maybe Close Popup
IF "${expected_ide}"=="VSCode"
Wait Until Page Contains Element xpath://div[@class="menubar-menu-button"] timeout=60s
Wait Until Page Contains Element xpath://div[@class="monaco-dialog-box"] timeout=60s
Wait Until Page Contains Do you trust the authors of the files in this folder?
ELSE IF "${expected_ide}"=="JupyterLab"
Wait Until Page Contains Element xpath://div[@id="jp-top-panel"] timeout=60s
Maybe Close Popup
ELSE
Fail msg=Unknown IDE typy given: '${expected_ide}'. Please check and fix or implement.
END

Launch And Access Workbench
[Documentation] Launches a workbench from DS Project details page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,28 @@ Verify User Can Create A Workbench Using Intel AiKit Image
... project_title=${PRJ_TITLE} username=${TEST_USER_3.USERNAME}
... password=${TEST_USER_3.PASSWORD} auth_type=${TEST_USER_3.AUTH_TYPE}

Verify User Can Create A Workbench Using Code Server Image

Check warning

Code scanning / Robocop

Test case '{{ test_name }}' has too many keywords inside ({{ keyword_count }}/{{ max_allowed_count }}) Warning test

Test case 'Verify User Can Create A Workbench Using Code Server Image' has too many keywords inside (11/10)
[Documentation] Verifies that a workbench can be created using Code Server image
[Tags] Sanity Tier1
Set Test Variable ${IMG_NAME} code-server

Check notice

Code scanning / Robocop

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

Set Test Variable can be replaced with VAR
Set Test Variable ${WORKBENCH_TITLE} codeServer

Check notice

Code scanning / Robocop

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

Set Test Variable can be replaced with VAR
Set Test Variable ${PV_NAME} codeServerPv

Check notice

Code scanning / Robocop

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

Set Test Variable can be replaced with VAR
Set Test Variable ${PV_DESCRIPTION} PV for codeServer

Check notice

Code scanning / Robocop

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

Set Test Variable can be replaced with VAR
Go To RHODS Dashboard
Open Data Science Project Details Page project_title=${PRJ_TITLE}
Create Workbench workbench_title=${WORKBENCH_TITLE} workbench_description=workbench for testing
... prj_title=${PRJ_TITLE} image_name=${IMG_NAME} version=${NONE} deployment_size=Small
... storage=Persistent pv_name=${PV_NAME} pv_existent=${FALSE}
... pv_description=${PV_DESCRIPTION} pv_size=1
... press_cancel=${FALSE} envs=${NONE}
Wait Until Workbench Is Started workbench_title=${WORKBENCH_TITLE}
Open Data Science Projects Home Page
Wait Until Project Is Listed project_title=${PRJ_TITLE}
Launch And Access Workbench From Projects Home Page workbench_title=${WORKBENCH_TITLE}
... project_title=${PRJ_TITLE} username=${TEST_USER_3.USERNAME}
... password=${TEST_USER_3.PASSWORD} auth_type=${TEST_USER_3.AUTH_TYPE}
... expected_ide=VSCode


*** Keywords ***
Project Suite Setup
Expand Down
32 changes: 32 additions & 0 deletions ods_ci/tests/Tests/500__jupyterhub/minimal-vscode-test.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
*** Settings ***
Documentation Test Suite for Visual Studio Code (VSCode) image
Resource ../../Resources/ODS.robot
Resource ../../Resources/Common.robot
Resource ../../Resources/Page/ODH/JupyterHub/JupyterHubSpawner.robot
Resource ../../Resources/Page/ODH/JupyterHub/JupyterLabLauncher.robot
Resource ../../Resources/Page/OCPDashboard/Builds/Builds.robot
Library Screenshot
Library DebugLibrary
Library JupyterLibrary
Suite Setup Verify VSCode Image Suite Setup
Suite Teardown End Non JupyterLab Web Test
Test Tags JupyterHub


*** Variables ***
${NOTEBOOK_IMAGE} = code-server


*** Test Cases ***
Verify VSCode Image Can Be Spawned
[Documentation] Spawns vscode image
[Tags] Sanity Tier1
Pass Execution Passing tests, as suite setup ensures that image can be spawned


*** Keywords ***
Verify VSCode Image Suite Setup
[Documentation] Suite Setup, spawns vscode image
Begin Web Test
Launch JupyterHub Spawner From Dashboard
Spawn Notebook With Arguments image=${NOTEBOOK_IMAGE} size=Small

0 comments on commit 59120e7

Please sign in to comment.