Skip to content

Commit

Permalink
Merge pull request #104 from jgarciao/fix-monitoring-test-ocp-4.9
Browse files Browse the repository at this point in the history
Fix monitoring tests ODS-173 and ODS-175 after changes in OpenShift 4.9
  • Loading branch information
vasukulkarni authored Oct 28, 2021
2 parents 202132f + 6612bb4 commit 99158c0
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 7 deletions.
5 changes: 5 additions & 0 deletions tests/Resources/Page/Components/Menu.robot
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,8 @@ Is Menu Expanded
... ${menu}
${is_menu_expanded} = Get Element Attribute //button[text()="${menu}"] attribute=aria-expanded
[Return] ${is_menu_expanded}

Page Should Contain Menu
[Arguments] ${menu}
Page Should Contain Element //button[text()="${menu}"]

16 changes: 11 additions & 5 deletions tests/Resources/Page/OCPDashboard/OCPMenu.robot
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ Library String
${APP_LAUNCHER_ELEMENT} xpath=//*[@aria-label='Application launcher']/button
${PERSPECTIVE_SWITCHER_BUTTON_ELEMENT} xpath=//*[@data-test-id="perspective-switcher-toggle"]
${PERSPECTIVE_SWITCHER_TEXT_ELEMENT} xpath=//*[@data-test-id="perspective-switcher-toggle"]/span/h2
${PERSPECTIVE_ADMINISTRATOR_BUTTON} xpath=//*[@id="page-sidebar"]/div/nav/div/div/ul/li[1]/*[contains(@class, 'pf-c-dropdown__menu-item')]/h2
${PERSPECTIVE_DEVELOPER_BUTTON} xpath=//*[@id="page-sidebar"]/div/nav/div/div/ul/li[2]/*[contains(@class, 'pf-c-dropdown__menu-item')]/h2

${PERSPECTIVE_ADMINISTRATOR_BUTTON} xpath=//*[@data-test-id="perspective-switcher-menu-option"][starts-with(., "Administrator")]
${PERSPECTIVE_DEVELOPER_BUTTON} xpath=//*[@data-test-id="perspective-switcher-menu-option"][starts-with(., "Developer")]
${LOADING_INDICATOR_ELEMENT} xpath=//*[@data-test="loading-indicator"]

*** Keywords ***
Wait Until OpenShift Console Is Loaded
Expand All @@ -20,8 +20,11 @@ Switch To Administrator Perspective
${current_perspective}= Get Text ${PERSPECTIVE_SWITCHER_TEXT_ELEMENT}
IF '${current_perspective}' != 'Administrator'
Click Button ${PERSPECTIVE_SWITCHER_BUTTON_ELEMENT}
Wait Until Page Contains Element ${PERSPECTIVE_ADMINISTRATOR_BUTTON}
Wait Until Page Does Not Contain Element ${LOADING_INDICATOR_ELEMENT} timeout=30
Wait Until Element Is Visible ${PERSPECTIVE_ADMINISTRATOR_BUTTON} timeout=30
Sleep 1
Click Element ${PERSPECTIVE_ADMINISTRATOR_BUTTON}
Wait Until Page Does Not Contain Element ${LOADING_INDICATOR_ELEMENT} timeout=30
Wait Until Page Contains Element ${PERSPECTIVE_SWITCHER_TEXT_ELEMENT} timeout=30
END

Expand All @@ -31,8 +34,11 @@ Switch To Developer Perspective
${current_perspective}= Get Text ${PERSPECTIVE_SWITCHER_TEXT_ELEMENT}
IF '${current_perspective}' != 'Developer'
Click Button ${PERSPECTIVE_SWITCHER_BUTTON_ELEMENT}
Wait Until Page Contains Element ${PERSPECTIVE_DEVELOPER_BUTTON}
Wait Until Page Does Not Contain Element ${LOADING_INDICATOR_ELEMENT} timeout=30
Wait Until Element Is Visible ${PERSPECTIVE_DEVELOPER_BUTTON} timeout=30
Sleep 1
Click Element ${PERSPECTIVE_DEVELOPER_BUTTON}
Wait Until Page Does Not Contain Element ${LOADING_INDICATOR_ELEMENT} timeout=30
Wait Until Page Contains Element ${PERSPECTIVE_SWITCHER_TEXT_ELEMENT} timeout=30
END

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ Maybe Select Kernel
Run Keyword If not ${is_kernel_selected} Click Button xpath=//div[@class="jp-Dialog-buttonLabel"][.="Select"]/..

Clean Up Server
Maybe Accept a JupyterLab Prompt
Navigate Home (Root folder) In JupyterLab Sidebar File Browser
Open With JupyterLab Menu File New Notebook
Sleep 5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Verify OpenShift Monitoring results are correct when running undefined queries
[Tags] Smoke Sanity ODS-173
Run OpenShift Metrics Query ${METRIC_RHODS_UNDEFINED} retry-attempts=1
Metrics.Verify Query Results Dont Contain Data
[Teardown] SeleniumLibrary.Close All Browsers

Test Billing Metric (notebook cpu usage) on OpenShift Monitoring
[Tags] Smoke Sanity ODS-175
Expand Down Expand Up @@ -50,8 +51,20 @@ Run OpenShift Metrics Query
Open Browser ${OCP_CONSOLE_URL} browser=${BROWSER.NAME} options=${BROWSER.OPTIONS}
LoginPage.Login To Openshift ${OCP_ADMIN_USER.USERNAME} ${OCP_ADMIN_USER.PASSWORD} ${OCP_ADMIN_USER.AUTH_TYPE}
OCPMenu.Switch To Administrator Perspective
Wait Until Page Contains Monitoring timeout=20 error=${OCP_ADMIN_USER.USERNAME} can't see the Monitoring section in OpenShift Console, please make sure it belongs to a group with "view" role
Menu.Navigate To Page Monitoring Metrics

# In OCP 4.9 metrics are under the Observe menu (it was called Monitoring in 4.8)
${menu_observe_exists} = Run Keyword and Return Status Menu.Page Should Contain Menu Observe
IF ${menu_observe_exists}
Menu.Navigate To Page Observe Metrics
ELSE
${menu_monitoring_exists} = Run Keyword and Return Status Menu.Page Should Contain Menu Monitoring
IF ${menu_monitoring_exists}
Menu.Navigate To Page Monitoring Metrics
ELSE
Fail msg=${OCP_ADMIN_USER.USERNAME} can't see the Observe/Monitoring section in OpenShift Console, please make sure it belongs to a group with "view" role
END
END

Metrics.Verify Page Loaded
Metrics.Run Query ${query} ${retry-attempts}
${result} = Metrics.Get Query Results
Expand Down

0 comments on commit 99158c0

Please sign in to comment.