1
- describe ( 'Notebook Details Page' , ( ) => {
2
- beforeEach ( ( ) => {
1
+ describe ( 'Notebook Details Page' , ( ) => {
2
+ beforeEach ( ( ) => {
3
3
cy . mockGetNotebookRequest ( 'kubeflow-user' , 'test-notebook' ) ;
4
- cy . intercept ( 'GET' , `/api/namespaces/kubeflow-user/notebooks/test-notebook/pod` , {
5
- statusCode : 404
6
- } ) . as ( 'mockGetNotebookPodRequest' ) ;
4
+ cy . intercept (
5
+ 'GET' ,
6
+ `/api/namespaces/kubeflow-user/notebooks/test-notebook/pod` ,
7
+ {
8
+ statusCode : 404 ,
9
+ } ,
10
+ ) . as ( 'mockGetNotebookPodRequest' ) ;
7
11
cy . mockPoddefaultsRequest ( 'kubeflow-user' ) ;
8
12
cy . visit ( '/notebook/details/kubeflow-user/test-notebook' ) ;
9
- cy . wait ( [ '@mockGetNotebookRequest' , '@mockGetNotebookPodRequest' , '@mockPoddefaultsRequest' ] ) ;
13
+ cy . wait ( [
14
+ '@mockGetNotebookRequest' ,
15
+ '@mockGetNotebookPodRequest' ,
16
+ '@mockPoddefaultsRequest' ,
17
+ ] ) ;
10
18
} ) ;
11
19
12
- it ( 'should open notebook details page' , ( ) => {
20
+ it ( 'should open notebook details page' , ( ) => {
13
21
cy . get ( '[data-cy-toolbar-title]' ) . should ( 'have.text' , ' Notebook details ' ) ;
14
22
cy . get ( '.notebook-name' ) . should ( 'have.text' , 'test-notebook' ) ;
15
23
// assert overview tab
16
- cy . get ( 'lib-content-list-item[key="Volumes"]' ) . find ( 'app-volumes' ) . get ( '.vol-group-container' ) . should ( 'exist' ) ;
17
- cy . get ( 'lib-content-list-item[key="Volumes"]' ) . find ( 'app-volumes' ) . get ( '.vol-group-container > lib-urls > a' ) . should ( 'have.text' , ' test-notebook-volume\n' ) . should ( 'have.attr' , 'href' ) . and ( 'eq' , '/volume/details/kubeflow-user/test-notebook-volume' ) ;
18
- cy . get ( 'lib-details-list-item[key="Shared memory enabled"] > .list-entry-row > .list-entry-value > div' ) . should ( 'have.text' , ' No\n' ) ;
19
- cy . get ( 'lib-content-list-item[key="Configurations"] > .list-entry-row > .container > app-configurations' ) . should ( 'have.text' , ' No configurations available for this notebook. ' ) ;
20
- cy . get ( 'lib-details-list-item[key="Type"] > .list-entry-row > .list-entry-value > div' ) . should ( 'have.text' , ' JupyterLab\n' ) ;
21
- cy . get ( 'lib-details-list-item[key="Minimum CPU"] > .list-entry-row > .list-entry-value > div' ) . should ( 'have.text' , ' 500m\n' ) ;
22
- cy . get ( 'lib-details-list-item[key="Maximum CPU"] > .list-entry-row > .list-entry-value > div' ) . should ( 'have.text' , ' 4\n' ) ;
23
- cy . get ( 'lib-details-list-item[key="Minimum memory"] > .list-entry-row > .list-entry-value > div' ) . should ( 'have.text' , ' 2Gi\n' ) ;
24
- cy . get ( 'lib-details-list-item[key="Maximum memory"] > .list-entry-row > .list-entry-value > div' ) . should ( 'have.text' , ' 4Gi\n' ) ;
25
- cy . get ( 'lib-details-list-item[key="Image"] > .list-entry-row > .list-entry-value > div' ) . should ( 'have.text' , ' k8scc01covidacr.azurecr.io/jupyterlab-cpu:v1\n content_copy ' ) ;
26
- cy . get ( 'lib-content-list-item[key="Environment"] > .list-entry-row > .container > lib-variables-group-table > .env-group-container > .group-key' ) . should ( 'have.text' , 'Notebook CR' ) ;
27
- cy . get ( 'lib-content-list-item[key="Environment"] > .list-entry-row > .container > lib-variables-group-table > .env-group-container > mat-chip-listbox' ) . should ( 'have.text' , ' KF_LANG: en ' ) ;
24
+ cy . get ( 'lib-content-list-item[key="Volumes"]' )
25
+ . find ( 'app-volumes' )
26
+ . get ( '.vol-group-container' )
27
+ . should ( 'exist' ) ;
28
+ cy . get ( 'lib-content-list-item[key="Volumes"]' )
29
+ . find ( 'app-volumes' )
30
+ . get ( '.vol-group-container > lib-urls > a' )
31
+ . should ( 'have.text' , ' test-notebook-volume\n' )
32
+ . should ( 'have.attr' , 'href' )
33
+ . and ( 'eq' , '/volume/details/kubeflow-user/test-notebook-volume' ) ;
34
+ cy . get (
35
+ 'lib-details-list-item[key="Shared memory enabled"] > .list-entry-row > .list-entry-value > div' ,
36
+ ) . should ( 'have.text' , ' No\n' ) ;
37
+ cy . get (
38
+ 'lib-content-list-item[key="Configurations"] > .list-entry-row > .container > app-configurations' ,
39
+ ) . should ( 'have.text' , ' No configurations available for this notebook. ' ) ;
40
+ cy . get (
41
+ 'lib-details-list-item[key="Type"] > .list-entry-row > .list-entry-value > div' ,
42
+ ) . should ( 'have.text' , ' JupyterLab\n' ) ;
43
+ cy . get (
44
+ 'lib-details-list-item[key="Minimum CPU"] > .list-entry-row > .list-entry-value > div' ,
45
+ ) . should ( 'have.text' , ' 500m\n' ) ;
46
+ cy . get (
47
+ 'lib-details-list-item[key="Maximum CPU"] > .list-entry-row > .list-entry-value > div' ,
48
+ ) . should ( 'have.text' , ' 4\n' ) ;
49
+ cy . get (
50
+ 'lib-details-list-item[key="Minimum memory"] > .list-entry-row > .list-entry-value > div' ,
51
+ ) . should ( 'have.text' , ' 2Gi\n' ) ;
52
+ cy . get (
53
+ 'lib-details-list-item[key="Maximum memory"] > .list-entry-row > .list-entry-value > div' ,
54
+ ) . should ( 'have.text' , ' 4Gi\n' ) ;
55
+ cy . get (
56
+ 'lib-details-list-item[key="Image"] > .list-entry-row > .list-entry-value > div' ,
57
+ ) . should (
58
+ 'have.text' ,
59
+ ' k8scc01covidacr.azurecr.io/jupyterlab-cpu:v1\n content_copy ' ,
60
+ ) ;
61
+ cy . get (
62
+ 'lib-content-list-item[key="Environment"] > .list-entry-row > .container > lib-variables-group-table > .env-group-container > .group-key' ,
63
+ ) . should ( 'have.text' , 'Notebook CR' ) ;
64
+ cy . get (
65
+ 'lib-content-list-item[key="Environment"] > .list-entry-row > .container > lib-variables-group-table > .env-group-container > mat-chip-listbox' ,
66
+ ) . should ( 'have.text' , ' KF_LANG: en ' ) ;
28
67
cy . get ( 'lib-conditions-table[title="Conditions"]' ) . should ( 'exist' ) ;
29
- cy . get ( 'lib-conditions-table[title="Conditions"]' ) . find ( 'tbody > tr > td' ) . should ( 'have.text' , 'No rows to display' ) ;
68
+ cy . get ( 'lib-conditions-table[title="Conditions"]' )
69
+ . find ( 'tbody > tr > td' )
70
+ . should ( 'have.text' , 'No rows to display' ) ;
30
71
// assert log tab
31
72
cy . get ( 'div[role="tab"]' ) . eq ( 1 ) . click ( ) ;
32
- cy . get ( 'lib-panel > .panel-body > .panel-message' ) . should ( 'have.text' , ' No logs were found for this Notebook. ' ) ;
73
+ cy . get ( 'lib-panel > .panel-body > .panel-message' ) . should (
74
+ 'have.text' ,
75
+ ' No logs were found for this Notebook. ' ,
76
+ ) ;
33
77
// assert events tab
34
- cy . intercept ( 'GET' , '/api/namespaces/kubeflow-user/notebooks/test-notebook/events' , {
35
- "success" :true ,
36
- "status" :200 ,
37
- "events" :[ ]
38
- } ) . as ( 'mockNotebookEventsRequest' ) ;
78
+ cy . intercept (
79
+ 'GET' ,
80
+ '/api/namespaces/kubeflow-user/notebooks/test-notebook/events' ,
81
+ {
82
+ success : true ,
83
+ status : 200 ,
84
+ events : [ ] ,
85
+ } ,
86
+ ) . as ( 'mockNotebookEventsRequest' ) ;
39
87
cy . get ( 'div[role="tab"]' ) . eq ( 2 ) . click ( ) ;
40
88
cy . wait ( '@mockNotebookEventsRequest' ) ;
41
89
cy . get ( 'tbody > tr > td' ) . should ( 'have.text' , 'No rows to display' ) ;
42
90
// assert yaml tab
43
91
cy . get ( 'div[role="tab"]' ) . eq ( 3 ) . click ( ) ;
44
92
cy . get ( 'div.monaco-editor' ) . should ( 'exist' ) ;
45
- cy . get ( 'div.monaco-editor' ) . contains ( " name: test-notebook" ) . should ( 'exist' ) ;
93
+ cy . get ( 'div.monaco-editor' ) . contains ( ' name: test-notebook' ) . should ( 'exist' ) ;
46
94
cy . get ( 'mat-select' ) . click ( ) ;
47
95
cy . get ( 'mat-option[value="pod"]' ) . click ( ) ;
48
96
cy . get ( 'div.monaco-editor' ) . should ( 'exist' ) ;
49
- cy . get ( 'div.monaco-editor' ) . contains ( "No pod available for this notebook." ) . should ( 'exist' ) ;
97
+ cy . get ( 'div.monaco-editor' )
98
+ . contains ( 'No pod available for this notebook.' )
99
+ . should ( 'exist' ) ;
50
100
} ) ;
51
101
52
- it ( 'should start notebook from details page' , ( ) => {
102
+ it ( 'should start notebook from details page' , ( ) => {
53
103
cy . get ( '[data-cy-toolbar-button="CONNECT"]' ) . should ( 'be.disabled' ) ;
54
104
cy . get ( '[data-cy-toolbar-button="START"]' ) . should ( 'be.enabled' ) ;
55
105
cy . get ( '[data-cy-toolbar-button="STOP"]' ) . should ( 'not.exist' ) ;
56
106
cy . get ( '[data-cy-toolbar-button="DELETE"]' ) . should ( 'be.enabled' ) ;
57
107
cy . get ( 'lib-status-icon > mat-icon' ) . should ( 'have.text' , ' stop_circle\n' ) ;
58
108
// start the notebook
59
- cy . intercept ( 'PATCH' , '/api/namespaces/kubeflow-user/notebooks/test-notebook' , { "success" :true , "status" :200 } ) . as ( 'mockStartNotebookRequest' ) ;
109
+ cy . intercept (
110
+ 'PATCH' ,
111
+ '/api/namespaces/kubeflow-user/notebooks/test-notebook' ,
112
+ { success : true , status : 200 } ,
113
+ ) . as ( 'mockStartNotebookRequest' ) ;
60
114
cy . get ( '[data-cy-toolbar-button="START"]' ) . click ( ) ;
61
115
cy . wait ( '@mockStartNotebookRequest' ) ;
62
- cy . intercept ( 'GET' , `/api/namespaces/kubeflow-user/notebooks/test-notebook` , {
63
- fixture : 'runningNotebook' ,
64
- } ) . as ( 'mockGetNotebookRequest' ) ;
116
+ cy . intercept (
117
+ 'GET' ,
118
+ `/api/namespaces/kubeflow-user/notebooks/test-notebook` ,
119
+ {
120
+ fixture : 'runningNotebook' ,
121
+ } ,
122
+ ) . as ( 'mockGetNotebookRequest' ) ;
65
123
cy . mockGetNotebookPodRequest ( 'kubeflow-user' , 'test-notebook' ) ;
66
124
cy . wait ( [ '@mockGetNotebookRequest' , '@mockGetNotebookPodRequest' ] ) ;
67
125
// assert changes with now running notebook
68
126
cy . get ( '[data-cy-toolbar-button="CONNECT"]' ) . should ( 'be.enabled' ) ;
69
127
cy . get ( '[data-cy-toolbar-button="STOP"]' ) . should ( 'exist' ) . and ( 'be.enabled' ) ;
70
128
cy . get ( '[data-cy-toolbar-button="START"]' ) . should ( 'not.exist' ) ;
71
129
cy . get ( 'lib-status-icon > mat-icon' ) . should ( 'have.text' , ' check_circle\n' ) ;
72
- cy . get ( 'lib-conditions-table[title="Conditions"]' ) . find ( 'tbody > tr' ) . should ( 'have.length' , 4 ) ;
130
+ cy . get ( 'lib-conditions-table[title="Conditions"]' )
131
+ . find ( 'tbody > tr' )
132
+ . should ( 'have.length' , 4 ) ;
73
133
74
134
cy . mockGetNotebookLogsRequest ( 'kubeflow-user' , 'test-notebook' , 'test-pod' ) ;
75
135
cy . get ( 'div[role="tab"]' ) . eq ( 1 ) . click ( ) ;
76
136
cy . wait ( '@mockGetNotebookLogsRequest' ) ;
77
- cy . get ( 'cdk-virtual-scroll-viewport' ) . should ( 'have.text' , '0 Test logs - messages are messages. 1 abc 2 one two three 3 ' ) ;
137
+ cy . get ( 'cdk-virtual-scroll-viewport' ) . should (
138
+ 'have.text' ,
139
+ '0 Test logs - messages are messages. 1 abc 2 one two three 3 ' ,
140
+ ) ;
78
141
79
142
cy . mockGetNotebookEventsRequest ( 'kubeflow-user' , 'test-notebook' ) ;
80
143
cy . get ( 'div[role="tab"]' ) . eq ( 2 ) . click ( ) ;
@@ -83,57 +146,85 @@ describe('Notebook Details Page', ()=>{
83
146
84
147
cy . get ( 'div[role="tab"]' ) . eq ( 3 ) . click ( ) ;
85
148
cy . get ( 'div.monaco-editor' ) . should ( 'exist' ) ;
86
- cy . get ( 'div.monaco-editor' ) . contains ( " name: test-notebook" ) . should ( 'exist' ) ;
149
+ cy . get ( 'div.monaco-editor' ) . contains ( ' name: test-notebook' ) . should ( 'exist' ) ;
87
150
cy . get ( 'mat-select' ) . click ( ) ;
88
151
cy . get ( 'mat-option[value="pod"]' ) . click ( ) ;
89
152
cy . get ( 'div.monaco-editor' ) . should ( 'exist' ) ;
90
- cy . get ( 'div.monaco-editor' ) . contains ( " name: test-pod" ) . should ( 'exist' ) ;
153
+ cy . get ( 'div.monaco-editor' ) . contains ( ' name: test-pod' ) . should ( 'exist' ) ;
91
154
} ) ;
92
155
93
- it ( 'should stop notebook from details page' , ( ) => {
156
+ it ( 'should stop notebook from details page' , ( ) => {
94
157
// have a running notebook
95
- cy . intercept ( 'GET' , `/api/namespaces/kubeflow-user/notebooks/test-notebook` , {
96
- fixture : 'runningNotebook' ,
97
- } ) . as ( 'mockGetNotebookRequest' ) ;
158
+ cy . intercept (
159
+ 'GET' ,
160
+ `/api/namespaces/kubeflow-user/notebooks/test-notebook` ,
161
+ {
162
+ fixture : 'runningNotebook' ,
163
+ } ,
164
+ ) . as ( 'mockGetNotebookRequest' ) ;
98
165
cy . mockGetNotebookPodRequest ( 'kubeflow-user' , 'test-notebook' ) ;
99
166
cy . wait ( [ '@mockGetNotebookRequest' , '@mockGetNotebookPodRequest' ] ) ;
100
167
// stop the notebook
101
168
cy . get ( '[data-cy-toolbar-button="STOP"]' ) . click ( ) ;
102
- cy . get ( '.mat-mdc-dialog-title' ) . should ( 'be.visible' ) . and ( 'have.text' , 'Are you sure you want to stop this notebook server? test-notebook' ) ;
169
+ cy . get ( '.mat-mdc-dialog-title' )
170
+ . should ( 'be.visible' )
171
+ . and (
172
+ 'have.text' ,
173
+ 'Are you sure you want to stop this notebook server? test-notebook' ,
174
+ ) ;
103
175
cy . get ( '.mat-mdc-dialog-actions > button' ) . contains ( 'CANCEL' ) . click ( ) ;
104
176
cy . get ( 'mat-dialog-container' ) . should ( 'not.exist' ) ;
105
177
cy . get ( '[data-cy-toolbar-button="STOP"]' ) . click ( ) ;
106
- cy . intercept ( 'PATCH' , '/api/namespaces/kubeflow-user/notebooks/test-notebook' , { "success" :true , "status" :200 } ) . as ( 'mockStartNotebookRequest' ) ;
178
+ cy . intercept (
179
+ 'PATCH' ,
180
+ '/api/namespaces/kubeflow-user/notebooks/test-notebook' ,
181
+ { success : true , status : 200 } ,
182
+ ) . as ( 'mockStartNotebookRequest' ) ;
107
183
cy . get ( '.mat-mdc-dialog-actions > button' ) . contains ( 'STOP' ) . click ( ) ;
108
184
cy . wait ( '@mockStartNotebookRequest' ) ;
109
185
110
186
cy . mockGetNotebookRequest ( 'kubeflow-user' , 'test-notebook' ) ;
111
- cy . intercept ( 'GET' , `/api/namespaces/kubeflow-user/notebooks/test-notebook/pod` , {
112
- statusCode : 404
113
- } ) . as ( 'mockGetNotebookPodRequest' ) ;
187
+ cy . intercept (
188
+ 'GET' ,
189
+ `/api/namespaces/kubeflow-user/notebooks/test-notebook/pod` ,
190
+ {
191
+ statusCode : 404 ,
192
+ } ,
193
+ ) . as ( 'mockGetNotebookPodRequest' ) ;
114
194
cy . wait ( [ '@mockGetNotebookRequest' , '@mockGetNotebookPodRequest' ] ) ;
115
195
116
196
cy . get ( '[data-cy-toolbar-button="START"]' ) . should ( 'be.enabled' ) ;
117
197
cy . get ( '[data-cy-toolbar-button="STOP"]' ) . should ( 'not.exist' ) ;
118
198
cy . get ( 'lib-status-icon > mat-icon' ) . should ( 'have.text' , ' stop_circle\n' ) ;
119
- cy . get ( 'lib-conditions-table[title="Conditions"]' ) . find ( 'tbody > tr > td' ) . should ( 'have.text' , 'No rows to display' ) ;
199
+ cy . get ( 'lib-conditions-table[title="Conditions"]' )
200
+ . find ( 'tbody > tr > td' )
201
+ . should ( 'have.text' , 'No rows to display' ) ;
120
202
} ) ;
121
203
122
- it ( 'should delete notebook from details page' , ( ) => {
204
+ it ( 'should delete notebook from details page' , ( ) => {
123
205
cy . get ( '[data-cy-toolbar-button="DELETE"]' ) . should ( 'be.enabled' ) ;
124
206
cy . get ( '[data-cy-toolbar-button="DELETE"]' ) . click ( ) ;
125
207
126
- cy . get ( '.mat-mdc-dialog-title' ) . should ( 'be.visible' ) . and ( 'have.text' , 'Are you sure you want to delete this notebook server? test-notebook' ) ;
208
+ cy . get ( '.mat-mdc-dialog-title' )
209
+ . should ( 'be.visible' )
210
+ . and (
211
+ 'have.text' ,
212
+ 'Are you sure you want to delete this notebook server? test-notebook' ,
213
+ ) ;
127
214
cy . get ( '.mat-mdc-dialog-actions > button' ) . contains ( 'CANCEL' ) . click ( ) ;
128
215
cy . get ( 'mat-dialog-container' ) . should ( 'not.exist' ) ;
129
216
cy . get ( '[data-cy-toolbar-button="DELETE"]' ) . click ( ) ;
130
217
131
- cy . intercept ( 'DELETE' , '/api/namespaces/kubeflow-user/notebooks/test-notebook' , {
132
- success : true ,
133
- status : 200
134
- } ) . as ( 'mockDeleteNotebookRequest' ) ;
218
+ cy . intercept (
219
+ 'DELETE' ,
220
+ '/api/namespaces/kubeflow-user/notebooks/test-notebook' ,
221
+ {
222
+ success : true ,
223
+ status : 200 ,
224
+ } ,
225
+ ) . as ( 'mockDeleteNotebookRequest' ) ;
135
226
cy . get ( '.mat-mdc-dialog-actions > button' ) . contains ( 'DELETE' ) . click ( ) ;
136
227
cy . wait ( '@mockDeleteNotebookRequest' ) ;
137
- cy . url ( ) . should ( 'eq' , " http://localhost:4200/" ) ;
228
+ cy . url ( ) . should ( 'eq' , ' http://localhost:4200/' ) ;
138
229
} ) ;
139
- } ) ;
230
+ } ) ;
0 commit comments