Skip to content

Commit

Permalink
Capture screenshot at Teardown of Keyword 'User Should Not Be Allowed'
Browse files Browse the repository at this point in the history
Signed-off-by: manosnoam <[email protected]>
  • Loading branch information
manosnoam committed Jan 8, 2024
1 parent 5becb29 commit 9c486a3
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 66 deletions.
1 change: 0 additions & 1 deletion ods_ci/tests/Resources/ODS.robot
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ Set Standard RHODS Groups Variables
Set Suite Variable ${STANDARD_SYSTEM_GROUP} system:authenticated
Set Suite Variable ${STANDARD_USERS_GROUP} rhods-users


Apply Access Groups Settings
[Documentation] Changes the rhods-groups config map to set the new access configuration
... and rolls out JH to make the changes effecting in Jupyter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
Library OpenShiftLibrary
Resource ../../LoginPage.robot
Resource ../../ODH/JupyterHub/LoginJupyterHub.robot
Resource ../../../ODS.robot


*** Variables ***
${TOLERATION_CHECKBOX}= //input[@id="tolerations-enabled-checkbox"]
${GROUP_BTN_XP}= (//*[@class="pf-c-chip-group"])//*[@class="pf-c-chip__text" ]//following-sibling::button[1]
${SINGLE_MODE_SERVING_CHECK_BOX}= //input[@id="single-model-serving-platform-enabled-checkbox"]
${MULTI_MODE_SERVING_CHECK_BOX}= //input[@id="multi-model-serving-platform-enabled-checkbox"]

${CUSTOM_EMPTY_GROUP}= empty-group

*** Keywords ***
Add OpenShift Groups To Data Science Administrators
Expand Down Expand Up @@ -306,3 +307,39 @@ Check IF Multi Model Serving IS Enabled From DSC And Cluster Setting
${status}= Get Checkbox State Of Multi Model Serving Platforms
Should Be Equal ${status} True
Element Should Be Enabled ${MULTI_MODEL_SERVING_CHECK_BOX}

Set RHODS Admins Group Empty Group
[Documentation] Sets the "adminGroups" field in "odh-dashboard-config" ConfigMap
... to the given empty group (i.e., with no users)
Set Access Groups Settings admins_group=${CUSTOM_EMPTY_GROUP}
... users_group=${STANDARD_SYSTEM_GROUP}

Set RHODS Admins Group To system:authenticated # robocop:disable
[Documentation] Sets the "adminGroups" field in "odh-dashboard-config" ConfigMap
... to the system:authenticated group
Set Access Groups Settings admins_group=system:authenticated
... users_group=${STANDARD_SYSTEM_GROUP}

Set RHODS Admins Group To Inexistent Group
[Documentation] Sets the "adminGroups" field in "odh-dashboard-config" ConfigMap
... to the given inexistent group
Set Access Groups Settings admins_group=${CUSTOM_INEXISTENT_GROUP}
... users_group=${STANDARD_SYSTEM_GROUP}

Set RHODS Users Group Empty Group
[Documentation] Sets the "allowedGroups" field in "odh-dashboard-config" ConfigMap
... to the given empty group (i.e., with no users)
Set Access Groups Settings admins_group=${STANDARD_ADMINS_GROUP}
... users_group=${CUSTOM_EMPTY_GROUP}

Set RHODS Users Group To rhods-users # robocop:disable
[Documentation] Sets the "allowedGroups" field in "odh-dashboard-config" ConfigMap
... to the rhods-users group
Set Access Groups Settings admins_group=${STANDARD_ADMINS_GROUP}
... users_group=${STANDARD_USERS_GROUP}

Set RHODS Users Group To Inexistent Group
[Documentation] Sets the "allowedGroups" field in "odh-dashboard-config" ConfigMap
... to the given inexistent group
Set Access Groups Settings admins_group=${STANDARD_ADMINS_GROUP}
... users_group=${CUSTOM_INEXISTENT_GROUP}
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
*** Settings ***
Documentation Collection of keywords to interact with Storages
Resource ./Projects.resource
Resource ../../../../../Resources/ODS.robot


*** Variables ***
${SAVE_BUTTON}= xpath://button[@data-id="save-rolebinding-button"]
${PERMISSIONS_DROPDOWN}= xpath://td[@data-label="Permission"]//button[@aria-label="Options menu"]
${IS_CLUSTER_ADMIN}= ${FALSE}
${CUSTOM_EMPTY_GROUP}= empty-group


*** Keywords ***
Expand All @@ -22,6 +20,13 @@ Assign ${permission_type} Permissions To User ${username}
Select Permission Type permission_type=${permission_type}
Save Permission

Assign ${permission_type} Permissions To User ${username} in Project ${project_title}

Check warning

Code scanning / Robocop

Missing documentation in '{{ name }}' keyword Warning test

Missing documentation in 'Assign ${permission_type} Permissions To User ${username} in Project ${project_title}' keyword

Check warning

Code scanning / Robocop

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

Keyword name 'Assign ${permission_type} Permissions To User ${username} in Project ${project_title}' does not follow case convention
Open Data Science Projects Home Page
Wait Until Project Is Listed project_title=${project_title}
Open Data Science Project Details Page ${project_title}
Move To Tab Permissions
Assign ${permission_type} Permissions To User ${username}

Check warning

Code scanning / Robocop

Trailing whitespace at the end of line Warning test

Trailing whitespace at the end of line
Change ${username} Permissions To ${permission_type}
[Documentation] Change the level of permission ${permission_type} for the given user ${username}
... in the currently open DS Project in UI
Expand Down Expand Up @@ -104,51 +109,3 @@ Is ${username} In The Permissions Table
${present}= Run Keyword And Return Status
... Page Should Contain Element xpath=//tr[td[@data-label="Username"]//*[text()="${username}"]]
RETURN ${present}

Set RHODS Admins Group Empty Group
[Documentation] Sets the "adminGroups" field in "odh-dashboard-config" ConfigMap
... to the given empty group (i.e., with no users)
Set Access Groups Settings admins_group=${CUSTOM_EMPTY_GROUP}
... users_group=${STANDARD_SYSTEM_GROUP}

Set RHODS Admins Group To system:authenticated # robocop:disable
[Documentation] Sets the "adminGroups" field in "odh-dashboard-config" ConfigMap
... to the system:authenticated group
Set Access Groups Settings admins_group=system:authenticated
... users_group=${STANDARD_SYSTEM_GROUP}

Set RHODS Admins Group To Inexistent Group
[Documentation] Sets the "adminGroups" field in "odh-dashboard-config" ConfigMap
... to the given inexistent group
Set Access Groups Settings admins_group=${CUSTOM_INEXISTENT_GROUP}
... users_group=${STANDARD_SYSTEM_GROUP}

Set RHODS Users Group Empty Group
[Documentation] Sets the "allowedGroups" field in "odh-dashboard-config" ConfigMap
... to the given empty group (i.e., with no users)
Set Access Groups Settings admins_group=${STANDARD_ADMINS_GROUP}
... users_group=${CUSTOM_EMPTY_GROUP}

Set RHODS Users Group To rhods-users # robocop:disable
[Documentation] Sets the "allowedGroups" field in "odh-dashboard-config" ConfigMap
... to the rhods-users group
Set Access Groups Settings admins_group=${STANDARD_ADMINS_GROUP}
... users_group=${STANDARD_USERS_GROUP}

Set RHODS Users Group To Inexistent Group
[Documentation] Sets the "allowedGroups" field in "odh-dashboard-config" ConfigMap
... to the given inexistent group
Set Access Groups Settings admins_group=${STANDARD_ADMINS_GROUP}
... users_group=${CUSTOM_INEXISTENT_GROUP}

Set Default Groups And Check Logs Do Not Change
[Documentation] Teardown for ODS-1408 and ODS-1494. It sets the default configuration of "odh-dashboard-config"
... ConfigMap and checks if no new lines are generated in the logs after that.
[Arguments] ${delete_group}=${FALSE}
${lengths_dict}= Get Lengths Of Dashboard Pods Logs
Set Access Groups Settings admins_group=${STANDARD_ADMINS_GROUP}
... users_group=${STANDARD_SYSTEM_GROUP}
Logs Of Dashboard Pods Should Not Contain New Lines lengths_dict=${lengths_dict}
IF "${delete_group}" == "${TRUE}"
Delete Group group_name=${CUSTOM_EMPTY_GROUP}
END
13 changes: 12 additions & 1 deletion ods_ci/tests/Tests/400__ods_dashboard/400__ods_dashboard.robot
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ Resource ../../Resources/RHOSi.resource
Resource ../../Resources/ODS.robot
Resource ../../Resources/Page/ODH/ODHDashboard/ODHDashboard.resource
Resource ../../Resources/Page/ODH/ODHDashboard/ODHDashboardResources.resource
Resource ../../Resources/Page/ODH/ODHDashboard/ODHDataScienceProject/Permissions.resource
Resource ../../Resources/Page/ODH/AiApps/Anaconda.resource
Resource ../../Resources/Page/LoginPage.robot
Resource ../../Resources/Page/OCPLogin/OCPLogin.robot
Expand Down Expand Up @@ -399,6 +398,18 @@ Logs Of Dashboard Pods Should Not Contain New Lines
Run Keyword And Continue On Failure Should Be Equal ${new_lines_flag} ${FALSE}
END

Set Default Groups And Check Logs Do Not Change
[Documentation] Teardown for ODS-1408 and ODS-1494. It sets the default configuration of "odh-dashboard-config"
... ConfigMap and checks if no new lines are generated in the logs after that.
[Arguments] ${delete_group}=${FALSE}
${lengths_dict}= Get Lengths Of Dashboard Pods Logs
Set Access Groups Settings admins_group=${STANDARD_ADMINS_GROUP}
... users_group=${STANDARD_SYSTEM_GROUP}
Logs Of Dashboard Pods Should Not Contain New Lines lengths_dict=${lengths_dict}
IF "${delete_group}" == "${TRUE}"

Check notice

Code scanning / Robocop

Variable '{{ name }}' in '{{ block_name }}' condition has unnecessary string conversion Note test

Variable '${delete_group}' in 'IF' condition has unnecessary string conversion

Check notice

Code scanning / Robocop

Variable '{{ name }}' in '{{ block_name }}' condition has unnecessary string conversion Note test

Variable '${TRUE}' in 'IF' condition has unnecessary string conversion
Delete Group group_name=${CUSTOM_EMPTY_GROUP}
END

Favorite Items Should Be Listed First
[Documentation] Compares the ids and checks that favorite Items
... are listed first
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ Verify User Can Assign Access Permissions To User Groups

Verify Project Sharing Does Not Override Dashboard Permissions

Check warning

Code scanning / Robocop

Missing documentation in '{{ name }}' test case Warning test

Missing documentation in 'Verify Project Sharing Does Not Override Dashboard Permissions' test case
[Tags] Tier1 Sanity ODS-2223
# [Setup] Run Keywords Restore Permissions Of The Project
# ... AND Set RHODS Users Group To rhods-users
[Setup] Set RHODS Users Group To rhods-users

Check warning

Code scanning / Robocop

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

Keyword name 'Set RHODS Users Group To rhods-users' does not follow case convention
Launch Data Science Project Main Page username=${OCP_ADMIN_USER.USERNAME} password=${OCP_ADMIN_USER.PASSWORD}
... ocp_user_auth_type=${OCP_ADMIN_USER.AUTH_TYPE}
Expand All @@ -95,9 +93,9 @@ Verify Project Sharing Does Not Override Dashboard Permissions
Remove User From Group username=${USER_B} group_name=rhods-admins
Remove User From Group username=${USER_C} group_name=rhods-users
Remove User From Group username=${USER_C} group_name=rhods-admins
Verify No Permissions For User ${USER_B}
Verify No Permissions For User ${USER_C}
[Teardown] Run Keywords Set RHODS Admins Group To system:authenticated
User ${USER_B} Should Not Be Allowed To Dashboard
User ${USER_C} Should Not Be Allowed To Dashboard
[Teardown] Run Keywords Set Default Access Groups Settings
... AND Set User Groups For Testing


Expand Down Expand Up @@ -229,6 +227,7 @@ Reload Page If Project ${project_title} Is Not Listed
Sleep 5s
END
END
[Teardown] Capture Page Screenshot

Reload Page If Project ${project_title} Is Listed
${is_listed} = Set Variable ${TRUE}

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
Expand All @@ -242,6 +241,7 @@ Reload Page If Project ${project_title} Is Listed
Sleep 5s
END
END
[Teardown] Capture Page Screenshot

${username} Should Have Edit Access To ${project_title}
Switch To User ${username}
Expand Down Expand Up @@ -269,17 +269,11 @@ ${username} Should Not Have Access To ${project_title}
RoleBinding Should Not Exist project_title=${project_title}
... subject_name=${username}

Assign ${permission_type} Permissions To User ${username} in Project ${project_title}
Open Data Science Projects Home Page
Wait Until Project Is Listed project_title=${project_title}
Open Data Science Project Details Page ${project_title}
Move To Tab Permissions
Assign ${permission_type} Permissions To User ${username}

Verify No Permissions For User ${username}
User ${username} Should Not Be Allowed To Dashboard

Check warning

Code scanning / Robocop

Missing documentation in '{{ name }}' keyword Warning test

Missing documentation in 'User ${username} Should Not Be Allowed To Dashboard' keyword
Switch To User ${username}
${permissions_set} = Set Variable ${FALSE}

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
WHILE not ${permissions_set} limit=3m on_limit_message=Timeout exceeded waiting for user ${username} permissions to be updated # robotcode: ignore

Check warning

Code scanning / Robocop

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

Line is too long (161/120)
${permissions_set}= Run Keyword And Return Status Wait Until Page Contains Access permissions needed timeout=15

Check warning

Code scanning / Robocop

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

Line is too long (132/120)
IF ${permissions_set} == ${FALSE} Reload Page

Check notice

Code scanning / Robocop

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

'INLINE IF' condition can be simplified
END
[Teardown] Capture Page Screenshot

0 comments on commit 9c486a3

Please sign in to comment.