Skip to content

Commit 38ba7fe

Browse files
authored
Merge branch 'red-hat-data-services:master' into master
2 parents 62f1edf + 66daa7a commit 38ba7fe

23 files changed

+350
-68
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ must-gather-results.txt
1010
.DS_Store
1111
.idea/
1212
Results/
13+
__pycache__/

libs/Helpers.py

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from robotlibcore import keyword
2+
3+
4+
class Helpers:
5+
"""Custom keywords written in Python"""
6+
@keyword
7+
def text_to_list(self, text):
8+
rows = text.split('\n')
9+
print(rows)
10+
return rows

tests/Resources/Common.robot

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ Begin Web Test
2020
${authorization_required} = Is Service Account Authorization Required
2121
Run Keyword If ${authorization_required} Authorize jupyterhub service account
2222
Fix Spawner Status
23-
Sleep 10
2423
Go To ${ODH_DASHBOARD_URL}
2524

2625
End Web Test
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
*** Settings ***
2+
Resource ../../OCPDashboard/Page.robot
3+
Resource ../../ODH/ODHDashboard/ODHDashboard.robot
4+
5+
*** Keywords ***
6+
Get Build Status
7+
[Arguments] ${namespace} ${build_search_term}
8+
Navigate To Page Builds Builds
9+
Search Last Item Instance By Title in OpenShift Table search_term=${build_search_term} namespace=${namespace}
10+
${build_status}= Get Text xpath://tr[@data-id='0-0']/td/*/span[@data-test='status-text']
11+
[Return] ${build_status}

tests/Resources/Page/OCPDashboard/Page.robot

+19-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,22 @@ Open Page
1111

1212
Page Should Be Open
1313
[Arguments] ${url}
14-
Location Should Contain ${url}
14+
Location Should Contain ${url}
15+
16+
Select Project By Name
17+
[Arguments] ${project_name}
18+
Wait Until Page Contains Element xpath://div/button[contains(@class, 'co-namespace-dropdown__menu-toggle')]
19+
Click Element xpath://div/button[contains(@class, 'co-namespace-dropdown__menu-toggle')]
20+
Wait Until Page Contains Element xpath://li[contains(@class, 'pf-c-menu__list-item')]
21+
Click Element xpath://li[contains(@class, 'pf-c-menu__list-item')]/*/span[.='${project_name}']
22+
23+
Search Last Item Instance By Title in OpenShift Table
24+
[Arguments] ${search_term} ${namespace}=All Projects
25+
Select Project By Name ${namespace}
26+
Wait Until Page Contains Element xpath://input[@data-test='name-filter-input']
27+
Wait Until Page Contains Element xpath://a[contains(., "${search_term}")]
28+
Clear Element Text xpath://input[@data-test='name-filter-input']
29+
Input Text xpath://input[@data-test='name-filter-input'] ${search_term}
30+
Sleep 2
31+
Click Button xpath://*/th[@data-label='Created']/button # asc order
32+
Click Button xpath://*/th[@data-label='Created']/button # desc order

tests/Resources/Page/OCPDashboard/Pods/Pods.robot

+17
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/Resources/Page/ODH/JupyterHub/JupyterHubSpawner.robot

+21-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
*** Settings ***
22
Resource JupyterLabLauncher.robot
3+
Resource ../../LoginPage.robot
4+
Resource ../../ODH/ODHDashboard/ODHDashboard.robot
5+
Resource LoginJupyterHub.robot
36
Library JupyterLibrary
47
Library String
58
Library Collections
@@ -9,7 +12,7 @@ ${JUPYTERHUB_SPAWNER_HEADER_XPATH} = //div[contains(@class,"jsp-spawner__header
912

1013
*** Keywords ***
1114
JupyterHub Spawner Is Visible
12-
${spawner_visible} = Run Keyword and Return Status Wait Until Element Is Visible xpath:${JUPYTERHUB_SPAWNER_HEADER_XPATH}
15+
${spawner_visible} = Run Keyword and Return Status Page Should Contain xpath:${JUPYTERHUB_SPAWNER_HEADER_XPATH}
1316
[return] ${spawner_visible}
1417

1518
Select Notebook Image
@@ -116,6 +119,16 @@ Spawn Notebook With Arguments
116119
Click Element xpath://span[@id='jupyterhub-logo']
117120
END
118121

122+
Launch JupyterHub Spawner From Dashboard
123+
Menu.Navigate To Page Applications Enabled
124+
Launch JupyterHub From RHODS Dashboard Dropdown
125+
Login To Jupyterhub ${TEST_USER.USERNAME} ${TEST_USER.PASSWORD} ${TEST_USER.AUTH_TYPE}
126+
${authorization_required} = Is Service Account Authorization Required
127+
Run Keyword If ${authorization_required} Authorize jupyterhub service account
128+
Fix Spawner Status
129+
Wait Until Page Contains Element xpath://span[@id='jupyterhub-logo']
130+
131+
119132
Get Spawner Progress Message
120133
[Documentation] Get the progress message currently displayed
121134
${msg} = Get Text progress-message
@@ -167,10 +180,15 @@ Fix Spawner Status
167180
ELSE
168181
${JL_visible} = JupyterLab Is Visible
169182
IF ${JL_visible}==True
183+
Maybe Close Popup
170184
Click Element xpath://span[@title="/opt/app-root/src"]
171-
Launch a new JupyterLab Document
185+
Open With JupyterLab Menu File New Notebook
186+
Sleep 1
187+
Maybe Close Popup
172188
Close Other JupyterLab Tabs
173-
Add and Run JupyterLab Code Cell !rm -rf *
189+
Add and Run JupyterLab Code Cell in Active Notebook !rm -rf *
190+
Open With JupyterLab Menu File Close All Tabs
191+
Maybe Close Popup
174192
Stop JupyterLab Notebook Server
175193
Handle Start My Server
176194
END

tests/Resources/Page/ODH/JupyterHub/JupyterLabLauncher.robot

+94-14
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,21 @@
22
Library JupyterLibrary
33
Library jupyter-helper.py
44
Library OperatingSystem
5+
Library Screenshot
6+
Library String
57

68
*** Variables ***
79
${JL_TABBAR_CONTENT_XPATH} = //div[contains(@class,"lm-DockPanel-tabBar")]/ul[@class="lm-TabBar-content p-TabBar-content"]
810
${JL_TABBAR_SELECTED_XPATH} = ${JL_TABBAR_CONTENT_XPATH}/li[contains(@class,"lm-mod-current p-mod-current")]
911
${JL_TABBAR_NOT_SELECTED_XPATH} = ${JL_TABBAR_CONTENT_XPATH}/li[not(contains(@class,"lm-mod-current p-mod-current"))]
12+
${JLAB CSS ACTIVE DOC} .jp-Document:not(.jp-mod-hidden)
13+
${JLAB CSS ACTIVE CELL} ${JLAB CSS ACTIVE DOC} .jp-Cell.jp-mod-active
14+
${JLAB CSS ACTIVE INPUT} ${JLAB CSS ACTIVE CELL} .CodeMirror
15+
${JLAB XP NB TOOLBAR FRAG} [contains(@class, 'jp-NotebookPanel-toolbar')]
16+
${JLAB CSS ACTIVE DOC} .jp-Document:not(.jp-mod-hidden)
17+
${JLAB CSS ACTIVE DOC CELLS} ${JLAB CSS ACTIVE DOC} .jp-Cell
18+
${JLAB CSS ACTIVE CELL} ${JLAB CSS ACTIVE DOC} .jp-Cell.jp-mod-active
19+
${JLAB CSS ACTIVE INPUT} ${JLAB CSS ACTIVE CELL} .CodeMirror
1020

1121
*** Keywords ***
1222
Get JupyterLab Selected Tab Label
@@ -29,6 +39,7 @@ Wait Until ${filename} JupyterLab Tab Is Selected
2939

3040
Close Other JupyterLab Tabs
3141
${original_tab} = Get WebElement xpath:${JL_TABBAR_SELECTED_XPATH}/div[contains(@class, "p-TabBar-tabLabel")]
42+
#${original_tab} = Get WebElement xpath:${JL_TABBAR_SELECTED_XPATH}/div[contains(concat(' ',normalize-space(@class),' '),' p-TabBar-tabLabel ')]
3243

3344
${xpath_background_tab} = Set Variable xpath:${JL_TABBAR_NOT_SELECTED_XPATH}
3445
${jl_tabs} = Get WebElements ${xpath_background_tab}
@@ -38,14 +49,17 @@ Close Other JupyterLab Tabs
3849
Click Element ${tab}
3950
#Click the close tab icon
4051
Open With JupyterLab Menu File Close Tab
41-
Maybe Accept a JupyterLab Prompt
52+
Sleep 2
53+
Maybe Close Popup
4254
END
55+
Sleep 2
56+
Maybe Close Popup
4357
Element Should Be Visible ${original_tab}
4458
Element Should Not Be Visible ${xpath_background_tab}
4559

4660
Close JupyterLab Selected Tab
4761
Click Element xpath:${JL_TABBAR_SELECTED_XPATH}/div[contains(@class,"lm-TabBar-tabCloseIcon")]
48-
Maybe Accept a JupyterLab Prompt
62+
Maybe Close Popup
4963

5064
JupyterLab Code Cell Error Output Should Not Be Visible
5165
Element Should Not Be Visible xpath://div[contains(@class,"jp-OutputArea-output") and @data-mime-type="application/vnd.jupyter.stderr"] A JupyterLab code cell output returned an error
@@ -91,15 +105,15 @@ Logout JupyterLab
91105

92106
Run Cell And Check For Errors
93107
[Arguments] ${input}
94-
Add and Run JupyterLab Code Cell ${input}
108+
Add and Run JupyterLab Code Cell in Active Notebook ${input}
95109
Wait Until JupyterLab Code Cell Is Not Active
96110
#Get the text of the last output cell
97111
${output} = Get Text (//div[contains(@class,"jp-OutputArea-output")])[last()]
98112
Should Not Match ${output} ERROR*
99113

100114
Run Cell And Check Output
101115
[Arguments] ${input} ${expected_output}
102-
Add and Run JupyterLab Code Cell ${input}
116+
Add and Run JupyterLab Code Cell in Active Notebook ${input}
103117
Wait Until JupyterLab Code Cell Is Not Active
104118
#Get the text of the last output cell
105119
${output} = Get Text (//div[contains(@class,"jp-OutputArea-output")])[last()]
@@ -110,20 +124,22 @@ Maybe Select Kernel
110124
Run Keyword If not ${is_kernel_selected} Click Button xpath=//div[@class="jp-Dialog-buttonLabel"][.="Select"]/..
111125

112126
Clean Up Server
113-
Maybe Accept a JupyterLab Prompt
127+
Sleep 1
128+
Maybe Close Popup
114129
Navigate Home (Root folder) In JupyterLab Sidebar File Browser
130+
Open With JupyterLab Menu File Close All Tabs
131+
Maybe Close Popup
132+
Sleep 1
133+
Maybe Close Popup
115134
Open With JupyterLab Menu File New Notebook
116-
Sleep 5
117-
Maybe Select Kernel
118-
Close Other JupyterLab Tabs
135+
Sleep 1
136+
Maybe Close Popup
119137
Open With JupyterLab Menu File Open from Path…
120138
Input Text xpath=//input[@placeholder="/path/relative/to/jlab/root"] Untitled.ipynb
121139
Click Element xpath://div[.="Open"]
122-
Sleep 5
123-
Maybe Select Kernel
140+
Maybe Close Popup
124141
Wait Until Untitled.ipynb JupyterLab Tab Is Selected
125-
Close Other JupyterLab Tabs
126-
Add and Run JupyterLab Code Cell !rm -rf *
142+
Add and Run JupyterLab Code Cell in Active Notebook !rm -rf *
127143

128144

129145
Get User Notebook Pod Name
@@ -160,7 +176,7 @@ Clean Up User Notebook
160176

161177

162178
JupyterLab Is Visible
163-
${jupyterlab_visible} = Run Keyword and Return Status Wait Until Element Is Visible xpath:${JL_TABBAR_CONTENT_XPATH} timeout=60
179+
${jupyterlab_visible} = Run Keyword and Return Status Wait Until Element Is Visible xpath:${JL_TABBAR_CONTENT_XPATH} timeout=30
164180
[return] ${jupyterlab_visible}
165181

166182
Wait Until JupyterLab Is Loaded
@@ -178,7 +194,7 @@ Clone Git Repository And Open
178194
[Documentation] The ${NOTEBOOK_TO_RUN} argument should be of the form /path/relative/to/jlab/root.ipynb
179195
[Arguments] ${REPO_URL} ${NOTEBOOK_TO_RUN}
180196
Clone Git Repository ${REPO_URL}
181-
Sleep 10
197+
Sleep 15
182198
Open With JupyterLab Menu File Open from Path…
183199
Input Text xpath=//input[@placeholder="/path/relative/to/jlab/root"] ${NOTEBOOK_TO_RUN}
184200
Click Element xpath://div[.="Open"]
@@ -207,3 +223,67 @@ Handle Kernel Restarts
207223
Click Button xpath:/html/body/div[8]/div/div[2]/button
208224
END
209225
END
226+
227+
Run Repo and Clean
228+
[Arguments] ${REPO_URL} ${NB_NAME}
229+
Click Element xpath://span[@title="/opt/app-root/src"]
230+
Run Keyword And Continue On Failure Clone Git Repository And Run ${REPO_URL} ${NB_NAME}
231+
Sleep 15
232+
Click Element xpath://span[@title="/opt/app-root/src"]
233+
Open With JupyterLab Menu File Close All Tabs
234+
Maybe Accept a JupyterLab Prompt
235+
Open With JupyterLab Menu File New Notebook
236+
Sleep 1
237+
Maybe Close Popup
238+
Sleep 1
239+
Add and Run JupyterLab Code Cell in Active Notebook !rm -rf *
240+
Wait Until JupyterLab Code Cell Is Not Active
241+
Open With JupyterLab Menu File Close All Tabs
242+
Maybe Close Popup
243+
244+
Maybe Close Popup
245+
[Documentation] Click the last button in a JupyterLab dialog (if one is open).
246+
### TODO ###
247+
# Check if the last button is always the confirmation one
248+
# Server unavailable or unreachable modal has "Dismiss" as last button
249+
250+
# Sometimes there are multiple tabs already open when loggin into the server and each one might
251+
# Open a pop-up. Closing all tabs at once also might create a pop-up for each tab. Let's get the
252+
# Number of open tabs and try closing popups for each one.
253+
${jl_tabs} = Get WebElements xpath:${JL_TABBAR_NOT_SELECTED_XPATH}
254+
${len} = Get Length ${jl_tabs}
255+
FOR ${index} IN RANGE 0 2+${len}
256+
# Check if a popup exists
257+
${accept} = Get WebElements xpath://div[contains(concat(' ',normalize-space(@class),' '),' jp-Dialog-footer ')]
258+
# Click the right most button of the popup
259+
Run Keyword If ${accept} Click Element xpath://div[contains(concat(' ',normalize-space(@class),' '),' jp-Dialog-footer ')]/button[last()]
260+
Capture Page Screenshot
261+
END
262+
263+
Add and Run JupyterLab Code Cell in Active Notebook
264+
[Arguments] @{code} ${n}=1
265+
[Documentation] Add a ``code`` cell to the ``n`` th notebook on the page and run it.
266+
... ``code`` is a list of strings to set as lines in the code editor.
267+
... ``n`` is the 1-based index of the notebook, usually in order of opening.
268+
${add icon} = Get JupyterLab Icon XPath add
269+
270+
${nb} = Get WebElement xpath://div${JLAB XP NB FRAG}\[${n}]
271+
${nbid} = Get Element Attribute ${nb} id
272+
273+
${active-nb-tab} = Get WebElement xpath:${JL_TABBAR_SELECTED_XPATH}
274+
${tab-id} = Get Element Attribute ${active-nb-tab} id
275+
276+
Click Element xpath://div[@aria-labelledby="${tab-id}"]/div[1]//${add icon}
277+
Sleep 0.1s
278+
Click Element xpath://div[@aria-labelledby="${tab-id}"]//div[contains(concat(' ',normalize-space(@class),' '),' jp-mod-selected ')]
279+
Set CodeMirror Value \#${nbid}${JLAB CSS ACTIVE INPUT} @{code}
280+
Run Current JupyterLab Code Cell MOD ${tab-id}
281+
Click Element xpath://div[@aria-labelledby="${tab-id}"]//div[contains(concat(' ',normalize-space(@class),' '),' jp-mod-selected ')]
282+
283+
Run Current JupyterLab Code Cell MOD
284+
[Arguments] ${tab-id}
285+
[Documentation] Run the currently-selected cell(s) in the ``n`` th notebook.
286+
... ``n`` is the 1-based index of the notebook, usually in order of opening.
287+
${run icon} = Get JupyterLab Icon XPath run
288+
Click Element xpath://div[@aria-labelledby="${tab-id}"]/div[1]//${run icon}
289+
Sleep 0.5s

tests/Resources/Page/ODH/JupyterHub/LaunchPython3.robot

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
*** Settings ***
22
#Library JupyterLibrary
3-
Library JupyterLibrary
3+
Resource JupyterLabLauncher.robot
4+
Library JupyterLibrary
45

56
*** Keywords ***
67
Launch Python3 JupyterHub

tests/Resources/Page/ODH/ODHDashboard/ODHDashboard.robot

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Login To RHODS Dashboard
2525

2626
Wait for RHODS Dashboard to Load
2727
[Arguments] ${dashboard_title}="Red Hat OpenShift Data Science Dashboard"
28-
Wait For Condition return document.title == ${dashboard_title} timeout=60
28+
Wait For Condition return document.title == ${dashboard_title} timeout=15
2929

3030
Wait Until RHODS Dashboard ${dashboard_app} Is Visible
3131
# Ideally the timeout would be an arg but Robot does not allow "normal" and "embedded" arguments

tests/Tests/200__monitor_and_manage/200__metrics/201__billing_metrics.robot

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ Iterative Image Test
9595
Fix Spawner Status
9696
Spawn Notebook With Arguments image=${image}
9797
Wait for JupyterLab Splash Screen timeout=30
98-
Maybe Select Kernel
98+
Maybe Close Popup
9999
${is_launcher_selected} = Run Keyword And Return Status JupyterLab Launcher Tab Is Selected
100100
Run Keyword If not ${is_launcher_selected} Open JupyterLab Launcher
101101
Launch a new JupyterLab Document

tests/Tests/500__jupyterhub/image-iteration.robot

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Iterative Image Test
4747
Fix Spawner Status
4848
Spawn Notebook With Arguments image=${image}
4949
Wait for JupyterLab Splash Screen timeout=30
50-
Maybe Select Kernel
50+
Maybe Close Popup
5151
${is_launcher_selected} = Run Keyword And Return Status JupyterLab Launcher Tab Is Selected
5252
Run Keyword If not ${is_launcher_selected} Open JupyterLab Launcher
5353
Launch a new JupyterLab Document

tests/Tests/500__jupyterhub/long-running-test-generic-ds.robot

+4-19
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
*** Settings ***
22
Resource ../../Resources/ODS.robot
33
Resource ../../Resources/Common.robot
4+
Resource ../../Resources/Page/ODH/JupyterHub/JupyterHubSpawner.robot
5+
Resource ../../Resources/Page/ODH/JupyterHub/JupyterLabLauncher.robot
46
Library DebugLibrary
57
Library JupyterLibrary
68
Suite Setup Begin Web Test
@@ -33,7 +35,7 @@ Launch JupyterLab
3335
Spawn Notebook
3436
Wait for JupyterLab Splash Screen timeout=30
3537
Sleep 5
36-
Maybe Select Kernel
38+
Maybe Close Popup
3739
${is_launcher_selected} = Run Keyword And Return Status JupyterLab Launcher Tab Is Selected
3840
Run Keyword If not ${is_launcher_selected} Open JupyterLab Launcher
3941
Launch a new JupyterLab Document
@@ -45,21 +47,4 @@ Long Running Test Case
4547
Run Repo and Clean https://github.com/lugi0/clustering-notebook clustering-notebook/customer-segmentation-k-means-analysis.ipynb
4648
Run Repo and Clean https://github.com/lugi0/clustering-notebook clustering-notebook/CCFraud-clustering-S3.ipynb
4749
Run Repo and Clean https://github.com/lugi0/notebook-benchmarks notebook-benchmarks/pytorch/PyTorch-MNIST-Minimal.ipynb
48-
Run Repo and Clean https://github.com/lugi0/notebook-benchmarks notebook-benchmarks/tensorflow/TensorFlow-MNIST-Minimal.ipynb
49-
50-
*** Keywords ***
51-
52-
Run Repo and Clean
53-
[Arguments] ${REPO_URL} ${NB_NAME}
54-
Click Element xpath://span[@title="/opt/app-root/src"]
55-
Run Keyword And Continue On Failure Clone Git Repository And Run ${REPO_URL} ${NB_NAME}
56-
Sleep 15
57-
Click Element xpath://span[@title="/opt/app-root/src"]
58-
Open With JupyterLab Menu File Close All Tabs
59-
Maybe Accept a JupyterLab Prompt
60-
Open With JupyterLab Menu File New Notebook
61-
Sleep 5
62-
Maybe Select Kernel
63-
Sleep 5
64-
Add and Run JupyterLab Code Cell !rm -rf *
65-
Wait Until JupyterLab Code Cell Is Not Active
50+
Run Repo and Clean https://github.com/lugi0/notebook-benchmarks notebook-benchmarks/tensorflow/GPU-no-warnings.ipynb

0 commit comments

Comments
 (0)