Skip to content

Commit

Permalink
Set Variables For User Access Test on Suite Setup
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 88ddc77 commit 54e4733
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -642,15 +642,17 @@ 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"]
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"]
IF ${is_expanded}==True
Click Button xpath://td[.="${image_name}"]/../td[1]//button
END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Delete Data Science Project
ODHDashboard.Click Action From Actions Menu item_title=${project_title} item_type=project action=Delete
Handle Deletion Confirmation Modal item_title=${project_title} item_type=project
... press_cancel=${press_cancel}
... additional_msg=It will destroy all workbenches, storages, data connections and other resources in ${project_title}
... additional_msg=It will destroy all workbenches, storages, data connections and other resources in ${project_title} # robocop: disable
Wait Until Data Science Project Is Deleted project_title=${project_title}

Wait Until Data Science Project Is Deleted
Expand Down Expand Up @@ -107,7 +107,8 @@ Project's Owner Should Be
[Documentation] Checks if the owner of a DS project is displayed and corresponds to the expected one
[Arguments] ${project_title} ${expected_username}
Run Keyword And Continue On Failure
... Page Should Contain Element xpath=//a[text()="${project_title}"]/ancestor::td[@data-label='Name']//small[text()="${expected_username}"]
... Page Should Contain Element
... xpath=//a[text()="${project_title}"]/ancestor::td[@data-label='Name']//small[text()="${expected_username}"]

Create Data Science Project
[Documentation] Creates a DS Project with the given ${title}, ${description} and ${resource_name}.
Expand Down Expand Up @@ -188,7 +189,7 @@ Delete Data Science Project From CLI
END
END


#robocop: disable: line-too-long
Workbench Status Should Be From Projects Home Page
[Documentation] Checks the workbench status is the expected one, from the DS Project home page
[Arguments] ${workbench_title} ${status} ${project_title}
Expand Down Expand Up @@ -223,6 +224,7 @@ Start Workbench From Projects Home Page
Wait Until Workbench Is Started From Projects Home Page workbench_title=${workbench_title}
... project_title=${project_title}

#robocop: disable: line-too-long
Stop Workbench From Projects Home Page
[Documentation] Triggers the workbench "stop" process from DS Projects home page.
... It needs ${workbench_title} and ${project_title} at least. If ${namespace} and/or
Expand Down Expand Up @@ -313,7 +315,6 @@ Launch Data Science Project Main Page
... browser_alias=${browser_alias}
Open Data Science Projects Home Page


Remove Current Page Projects From All Projects
[Documentation] Remove list of currently displayed Data Science projects from list of all projects
[Arguments] ${all_projects} ${curr_page_projects}
Expand Down Expand Up @@ -403,7 +404,8 @@ Create Data Science Project If Not Exists
[Documentation] If the given ${project_title} DS Project does not exist, it creates one.
... Useful as test setup.
[Arguments] ${project_title} ${username} ${description}=${EMPTY}
${rc} ${resource_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' | tr -d '"' # robocop: disable
${rc} ${resource_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' | tr -d '"' # robocop: disable
IF "${resource_name}" == "${EMPTY}"
Log msg=There is no DS Projects with Diplay Name equal to ${project_title}. Creating it now.
Launch Data Science Project Main Page username=${username}
Expand All @@ -418,4 +420,4 @@ Clean Project From Workbench Resources
... ${pvc_title}=${workbench_title}
Delete Workbench From CLI workbench_title=${workbench_title}
... project_title=${project_title}
Delete PVC In Project From CLI pvc_title=${pvc_title} project_title=${project_title}
Delete PVC In Project From CLI pvc_title=${pvc_title} project_title=${project_title} # robocop: disable
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ ${STORAGE_SUBMIT_BTN_XP}= xpath=//footer//button[@data-testid="modal-s


*** Keywords ***
#robocop: disable: line-too-long
Storage Should Be Listed
[Documentation] Checks storage is listed in DS Project details page
[Arguments] ${name} ${description} ${type} ${connected_workbench}
Expand Down Expand Up @@ -51,7 +52,7 @@ Storage Size Should Be
... oc get pvc -n ${namespace} -o jsonpath='{.items[?(@.metadata.annotations.openshift\\.io/display-name=="${name}")].status.phase}' # robocop: disable
Should Be Equal As Integers ${rc} 0 An error occurred during the check of PVC ${name} .status.phase value!
${storage_size_xp}= Set Variable
... ${STORAGE_SECTION_XP}//tr[td//*/div[text()="${name}"]]/following-sibling::*//td[contains(@data-label,"Size")]//div[strong[text()="Size"]]
... ${STORAGE_SECTION_XP}//tr[td//*/div[text()="${name}"]]/following-sibling::*//td[contains(@data-label,"Size")]//div[strong[text()="Size"]] # robocop: disable
IF "${pvc_status_phase}" == "Pending"
# PVC hasn't been bound yet - only simple text with max storage should be shown
Wait Until Page Contains Element ${storage_size_xp} timeout=2m
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ Create Workbench
Wait Until Generic Modal Disappears timeout=1 minute
Wait Until Project Is Open project_title=${prj_title}

#robocop: disable: line-too-long
Add Environment Variables In Workbench
[Documentation] Adds the environment variables through the workbench creation page
[Arguments] ${env_variables}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -538,8 +538,6 @@ Verify User Can Access Only Its Owned Projects
[Setup] Run Keywords
... SeleniumLibrary.Close All Browsers
... AND
... Set Variables For User Access Test
... AND
... Delete Data Science Project From CLI displayed_name=${PRJ_TITLE}
Launch Data Science Project Main Page username=${TEST_USER_3.USERNAME} password=${TEST_USER_3.PASSWORD}
Open Data Science Projects Home Page
Expand Down Expand Up @@ -588,6 +586,7 @@ Project Suite Setup
Set Library Search Order SeleniumLibrary
${to_delete}= Create List ${PRJ_TITLE}
Set Suite Variable ${PROJECTS_TO_DELETE} ${to_delete}
Set Variables For User Access Test
RHOSi Setup
Delete Data Science Projects From CLI ocp_projects=${PROJECTS_TO_DELETE}
Launch Data Science Project Main Page
Expand Down

0 comments on commit 54e4733

Please sign in to comment.