Skip to content

Commit

Permalink
Fix 0410__ods_dashboard_projects Suite Setup and Tags (red-hat-data…
Browse files Browse the repository at this point in the history
…-services#1933)

Fix Tests, Keywords and Tags for Suite 0410__ods_dashboard_projects, including:

- Update Tags in 0410__ods_dashboard_projects.robot
- Fix Dashboard suite 410 setup to reuse existing DS project
- Fix Projects.resource elements locators
- Fix KW Filter Projects By ${Type}
- Update Wait For RHODS Dashboard To Load KW to navigate to Menu page
- Fix KW Select Workbench Jupyter Image
- Rename KW to Verify Workbench Image In Jupyter Lab
- Fix KW Add And Run JupyterLab Code Cell 5 In Active Notebook
- Fix KW Start Workbench From Projects Home Page
- Fix KW Stop Workbench From Projects Home Page

Signed-off-by: manosnoam <[email protected]>
  • Loading branch information
manosnoam authored Oct 28, 2024
1 parent 70db5c4 commit 7c7efd9
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -363,18 +363,15 @@ Add And Run JupyterLab Code Cell 5 In Active Notebook
# This keyword was copied and amended from JupyterLibrary resources - Notebook.Add And Run JupyterLab Code Cell.

${add icon} = Get JupyterLab Icon XPath Custom add

${nb} = Get WebElement xpath://div${JLAB XP NB FRAG}\[${n}]
${nbid} = Get Element Attribute ${nb} id

${active-nb-tab} = Get WebElement xpath:${JL_TABBAR_SELECTED_XPATH}
${tab-id} = Get Element Attribute ${active-nb-tab} id

Click Element xpath://div[@aria-labelledby="${tab-id}"]/div[1]//${add icon}
Click Element xpath://div[@aria-labelledby="${tab-id}"]//*[@data-jp-item-name="insert"]
Sleep 0.1s
Click Element xpath://div[@aria-labelledby="${tab-id}"]//div[contains(concat(' ',normalize-space(@class),' '),' jp-mod-selected ')]
Set CodeMirror Value \#${nbid}${JLAB CSS ACTIVE INPUT} @{code}
Run Current JupyterLab Code Cell 5 ${tab-id}
Press Keys None @{code}
Click Element xpath://div[@aria-labelledby="${tab-id}"]//*[@data-jp-item-name="run"]
Click Element xpath://div[@aria-labelledby="${tab-id}"]//div[contains(concat(' ',normalize-space(@class),' '),' jp-mod-selected ')]

Add And Run JupyterLab Code Cell 6 In Active Notebook
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ Wait For RHODS Dashboard To Load
IF "${expected_page}" == "${NONE}"
Wait Until Page Contains Element //div[@data-testid="home-page"] timeout=${timeout}
ELSE
Menu.Navigate To Page ${expected_page}
Wait Until Keyword Succeeds 3x 5s
... Wait For Dashboard Page Title ${expected_page} timeout=${timeout}
END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,14 @@ ${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"]
${SPAWNER_LINK}= xpath=//*[text()="Launch standalone notebook server"]
${PROJECT_SEARCH_BAR}= //div[@data-testid="dashboard-table-toolbar"]
${PROJECT_FILTER_TYPE}= ${PROJECT_SEARCH_BAR}//button[@data-testid="filter-dropdown-select"]
${PROJECT_SEARCH_INPUT}= ${PROJECT_SEARCH_BAR}//input[@aria-label="Search input"]
${PROJECT_SEARCH_BAR}= [data-testid="projects-table-toolbar"]
${PROJECT_FILTER_TYPE}= ${PROJECT_SEARCH_BAR} [data-testid="filter-toolbar-dropdown"]
${PROJECT_SEARCH_INPUT}= ${PROJECT_SEARCH_BAR} [data-testid="filter-toolbar-text-field"] input

*** Keywords ***
Open Data Science Projects Home Page
[Documentation] Open "Data Science Projects" page from the sidebar
Wait Until Page Contains Data Science Projects
Click Link Data Science Projects
Wait For RHODS Dashboard To Load wait_for_cards=${FALSE} expected_page=Data Science Projects
Wait Until Page Contains View your existing projects or create new projects. timeout=30
Maybe Wait For Dashboard Loading Spinner Page

Is Data Science Projects Page Open
Expand Down Expand Up @@ -314,7 +311,7 @@ Start Workbench From Projects Home Page
${kebab_button}= Set Variable xpath=//a[@data-testid="notebook-route-link" and text()="${workbench_title}"]/ancestor::tr[@data-testid="project-notebooks-table-row"]//button[@aria-label="Kebab toggle"]
Wait Until Element Is Visible ${kebab_button} timeout=10s
Click Element ${kebab_button}
${start_button}= Set Variable xpath=//a[@data-testid="notebook-route-link" and text()="${workbench_title}"]/ancestor::tr[@data-testid="project-notebooks-table-row"]//button[@aria-label="Kebab toggle"]/following::div//span[text()="Start"]
${start_button}= Set Variable xpath=//a[@data-testid="notebook-route-link" and text()="${workbench_title}"]/ancestor::tr[@data-testid="project-notebooks-table-row"]//button[@data-testid="notebook-start-action"]
Wait Until Element Is Visible ${start_button} timeout=10s
Click Element ${start_button}
ELSE
Expand Down Expand Up @@ -348,7 +345,7 @@ Stop Workbench From Projects Home Page
${kebab_button}= Set Variable xpath=//a[@data-testid="notebook-route-link" and text()="${workbench_title}"]/ancestor::tr[@data-testid="project-notebooks-table-row"]//button[@aria-label="Kebab toggle"]
Wait Until Element Is Visible ${kebab_button} timeout=10s
Click Element ${kebab_button}
${stop_button}= Set Variable xpath=//a[@data-testid="notebook-route-link" and text()="${workbench_title}"]/ancestor::tr[@data-testid="project-notebooks-table-row"]//button[@aria-label="Kebab toggle"]/following::div//span[text()="Stop"]
${stop_button}= Set Variable xpath=//a[@data-testid="notebook-route-link" and text()="${workbench_title}"]/ancestor::tr[@data-testid="project-notebooks-table-row"]//button[@data-testid="notebook-stop-action"]
Wait Until Element Is Visible ${stop_button} timeout=10s
Click Element ${stop_button}
Handle Stop Workbench Confirmation Modal press_cancel=${press_cancel}
Expand Down Expand Up @@ -430,13 +427,12 @@ Remove Current Page Projects From All Projects
Filter Projects By ${Type}
[Documentation] Search for projects where ${Type} includes "${text}"
[Arguments] ${text}
Open Data Science Projects Home Page
${searchbar_exists}= Run Keyword And Return Status
... Page Should Contain Element xpath:${PROJECT_SEARCH_BAR}
... Page Should Contain Element css:${PROJECT_SEARCH_BAR}
IF ${searchbar_exists}
Click Element xpath:${PROJECT_FILTER_TYPE}
Click Element xpath:${PROJECT_SEARCH_BAR}//li[@data-testid="${Type}"]
Input Text ${PROJECT_SEARCH_INPUT} ${text}
Click Element css:${PROJECT_FILTER_TYPE}
Click Element css:${PROJECT_SEARCH_BAR} [id="${Type}"]
Input Text css:${PROJECT_SEARCH_INPUT} ${text}
ELSE
Log No projects are listed
END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Create Workbench
Input Text ${WORKBENCH_NAME_INPUT_XP} ${workbench_title}
Input Text ${WORKBENCH_DESCR_TXT_XP} ${workbench_description}
Run Keyword And Continue On Failure Element Should Be Disabled ${WORKBENCH_CREATE_BTN_2_XP}
Select Workbench Jupyter Image image_name=${image_name} version=${version}
Select Workbench Image image_name=${image_name} version=${version}
IF "${deployment_size}" != "${NONE}" Select Workbench Container Size size_name=${deployment_size}
IF "${gpus}" != "${NONE}" Select Workbench Number Of GPUs gpus=${gpus}
IF "${envs}" != "${NONE}"
Expand Down Expand Up @@ -197,7 +197,7 @@ Select An Existent PV
Wait Until Page Contains Element ${existing_pv_xpath}
Click Element ${existing_pv_xpath}

Select Workbench Jupyter Image
Select Workbench Image
[Documentation] Selects a Jupyter image in the workbench creation page
[Arguments] ${image_name} ${version}=default
IF "${PRODUCT}" == "ODH"
Expand All @@ -206,7 +206,6 @@ Select Workbench Jupyter Image
${image_name}= Set Variable Jupyter Data Science
END
END

Click Element //a[@href="#notebook-image"]
Wait Until Page Contains Element ${WORKBENCH_IMAGE_MENU_BTN_XP}
Click Element ${WORKBENCH_IMAGE_MENU_BTN_XP}
Expand All @@ -221,15 +220,15 @@ Select Workbench Jupyter Image
Fail ${version} does not exist, use default/previous
END
END

IF "${version}"=="previous"
# Let's reset the JupyterLibrary settings so that global variables for Jupyter 3 (default) are in place.
Update Globals For JupyterLab 3 Custom
ELSE
# TODO: Create the missing Keyword "Update Globals For JupyterLab 4"
# ELSE
# For Jupyter 4, we need to update global default variable values (images 2024b and newer)
# This calls method from JupyterLibrary Version.resource module
# https://github.com/robots-from-jupyter/robotframework-jupyterlibrary/blob/9e25fcb89a5f1a723c59e9b96706e4c638e0d9be/src/JupyterLibrary/clients/jupyterlab/Version.resource
Update Globals For JupyterLab 4
# Update Globals For JupyterLab 4
END

Verify Version Selection Dropdown
Expand Down Expand Up @@ -446,7 +445,7 @@ Edit Workbench
# Also wait until the workbench name is populated in the text field - let's wait for DOM to finish
Wait For Condition return document.readyState == "complete" timeout=5s

Check Launched Workbench Is The Correct One
Verify Workbench Image In Jupyter Lab
[Documentation] Checks if the launched workbench is the expected one
[Arguments] ${workbench_title} ${image} ${project_title}
${namespace}= Get Openshift Namespace From Data Science Project project_title=${project_title}
Expand Down
Loading

0 comments on commit 7c7efd9

Please sign in to comment.