Skip to content

Commit d63f302

Browse files
authored
Add icon for default notebook (#319)
* Initial * Update config.ts * Fix format * Fix translation + format
1 parent 22af5fc commit d63f302

15 files changed

+1744
-767
lines changed

frontend/jupyter/cypress/e2e/form-page.cy.ts

+687-228
Large diffs are not rendered by default.

frontend/jupyter/cypress/e2e/main-page.cy.ts

+418-172
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,143 @@
1-
describe('Notebook Details Page', ()=>{
2-
beforeEach(()=>{
1+
describe('Notebook Details Page', () => {
2+
beforeEach(() => {
33
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');
711
cy.mockPoddefaultsRequest('kubeflow-user');
812
cy.visit('/notebook/details/kubeflow-user/test-notebook');
9-
cy.wait(['@mockGetNotebookRequest', '@mockGetNotebookPodRequest', '@mockPoddefaultsRequest']);
13+
cy.wait([
14+
'@mockGetNotebookRequest',
15+
'@mockGetNotebookPodRequest',
16+
'@mockPoddefaultsRequest',
17+
]);
1018
});
1119

12-
it('should open notebook details page', ()=>{
20+
it('should open notebook details page', () => {
1321
cy.get('[data-cy-toolbar-title]').should('have.text', ' Notebook details ');
1422
cy.get('.notebook-name').should('have.text', 'test-notebook');
1523
// 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 ');
2867
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');
3071
// assert log tab
3172
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+
);
3377
// 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');
3987
cy.get('div[role="tab"]').eq(2).click();
4088
cy.wait('@mockNotebookEventsRequest');
4189
cy.get('tbody > tr > td').should('have.text', 'No rows to display');
4290
// assert yaml tab
4391
cy.get('div[role="tab"]').eq(3).click();
4492
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');
4694
cy.get('mat-select').click();
4795
cy.get('mat-option[value="pod"]').click();
4896
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');
50100
});
51101

52-
it('should start notebook from details page', ()=>{
102+
it('should start notebook from details page', () => {
53103
cy.get('[data-cy-toolbar-button="CONNECT"]').should('be.disabled');
54104
cy.get('[data-cy-toolbar-button="START"]').should('be.enabled');
55105
cy.get('[data-cy-toolbar-button="STOP"]').should('not.exist');
56106
cy.get('[data-cy-toolbar-button="DELETE"]').should('be.enabled');
57107
cy.get('lib-status-icon > mat-icon').should('have.text', ' stop_circle\n');
58108
// 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');
60114
cy.get('[data-cy-toolbar-button="START"]').click();
61115
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');
65123
cy.mockGetNotebookPodRequest('kubeflow-user', 'test-notebook');
66124
cy.wait(['@mockGetNotebookRequest', '@mockGetNotebookPodRequest']);
67125
// assert changes with now running notebook
68126
cy.get('[data-cy-toolbar-button="CONNECT"]').should('be.enabled');
69127
cy.get('[data-cy-toolbar-button="STOP"]').should('exist').and('be.enabled');
70128
cy.get('[data-cy-toolbar-button="START"]').should('not.exist');
71129
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);
73133

74134
cy.mockGetNotebookLogsRequest('kubeflow-user', 'test-notebook', 'test-pod');
75135
cy.get('div[role="tab"]').eq(1).click();
76136
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+
);
78141

79142
cy.mockGetNotebookEventsRequest('kubeflow-user', 'test-notebook');
80143
cy.get('div[role="tab"]').eq(2).click();
@@ -83,57 +146,85 @@ describe('Notebook Details Page', ()=>{
83146

84147
cy.get('div[role="tab"]').eq(3).click();
85148
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');
87150
cy.get('mat-select').click();
88151
cy.get('mat-option[value="pod"]').click();
89152
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');
91154
});
92155

93-
it('should stop notebook from details page', ()=>{
156+
it('should stop notebook from details page', () => {
94157
// 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');
98165
cy.mockGetNotebookPodRequest('kubeflow-user', 'test-notebook');
99166
cy.wait(['@mockGetNotebookRequest', '@mockGetNotebookPodRequest']);
100167
// stop the notebook
101168
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+
);
103175
cy.get('.mat-mdc-dialog-actions > button').contains('CANCEL').click();
104176
cy.get('mat-dialog-container').should('not.exist');
105177
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');
107183
cy.get('.mat-mdc-dialog-actions > button').contains('STOP').click();
108184
cy.wait('@mockStartNotebookRequest');
109185

110186
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');
114194
cy.wait(['@mockGetNotebookRequest', '@mockGetNotebookPodRequest']);
115195

116196
cy.get('[data-cy-toolbar-button="START"]').should('be.enabled');
117197
cy.get('[data-cy-toolbar-button="STOP"]').should('not.exist');
118198
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');
120202
});
121203

122-
it('should delete notebook from details page', ()=>{
204+
it('should delete notebook from details page', () => {
123205
cy.get('[data-cy-toolbar-button="DELETE"]').should('be.enabled');
124206
cy.get('[data-cy-toolbar-button="DELETE"]').click();
125207

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+
);
127214
cy.get('.mat-mdc-dialog-actions > button').contains('CANCEL').click();
128215
cy.get('mat-dialog-container').should('not.exist');
129216
cy.get('[data-cy-toolbar-button="DELETE"]').click();
130217

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');
135226
cy.get('.mat-mdc-dialog-actions > button').contains('DELETE').click();
136227
cy.wait('@mockDeleteNotebookRequest');
137-
cy.url().should('eq', "http://localhost:4200/");
228+
cy.url().should('eq', 'http://localhost:4200/');
138229
});
139-
});
230+
});

0 commit comments

Comments
 (0)