Skip to content

Commit 02b6ae2

Browse files
mathis-marcotteMathis Marcotte
and
Mathis Marcotte
authoredSep 22, 2023
Volume details delete button (#291)
* updated delete button logic for volume details * updated cypress version --------- Co-authored-by: Mathis Marcotte <mathis.marcotte@statcan.gc.ca>
1 parent 3fc2600 commit 02b6ae2

15 files changed

+304
-165
lines changed
 

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

+6-3
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ describe('New notebook form', () => {
99
cy.mockNotebooksRequest(settings.namespace);
1010
cy.mockPoddefaultsRequest(settings.namespace);
1111
});
12+
13+
cy.visit('/new');
1214
});
1315

1416
it('should have a "New notebook" title', () => {
15-
cy.visit('/new');
1617
cy.get('[data-cy-toolbar-title]').contains('New notebook').should('exist');
1718
});
1819

@@ -30,14 +31,16 @@ describe('New notebook form', () => {
3031
const nameValue = $nameInput.val();
3132
cy.get('.last[data-cy="data volumes"]')
3233
.find('[data-cy="mount path"]')
33-
.should($mountInput => {
34+
.then($mountInput => {
3435
const mountValue = $mountInput.val();
3536
expect(mountValue).equal(`/home/jovyan/${nameValue}`);
3637
});
3738
});
3839
});
3940

4041
it('should not auto update mount value when it is dirty', () => {
42+
cy.get('.lib-advanced-options').find('.toggle-button').click();
43+
4144
cy.get('[data-cy="add new volume"]').click();
4245

4346
cy.get('.last[data-cy="data volumes"]').click();
@@ -53,7 +56,7 @@ describe('New notebook form', () => {
5356
const nameValue = $nameInput.val();
5457
cy.get('.last[data-cy="data volumes"]')
5558
.find('[data-cy="mount path"]')
56-
.should($mountInput => {
59+
.then($mountInput => {
5760
const mountValue = $mountInput.val();
5861
expect(mountValue).not.equal(`/home/jovyan/${nameValue}`);
5962
});

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

+10-29
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { STATUS_TYPE } from 'kubeflow';
2-
31
describe('Main table', () => {
42
beforeEach(() => {
53
cy.mockNamespacesRequest();
@@ -10,39 +8,25 @@ describe('Main table', () => {
108
});
119
cy.fixture('notebooks').as('notebooksRequest');
1210
cy.fixture('pvcs').as('pvcsRequest');
11+
12+
cy.visit('/');
1313
});
1414

1515
it('should have a "Notebooks" title', () => {
16-
cy.visit('/');
1716
cy.get('[data-cy-toolbar-title]').contains('Notebooks').should('exist');
1817
});
1918

2019
it('should list Notebooks without errors', () => {
21-
cy.visit('/');
2220
// wait for the request to fetch notebooks and namespaces
2321
cy.wait(['@mockNamespacesRequest', '@mockNotebooksRequest']);
2422

2523
// after fetching the data the page should not have an error snackbar
2624
cy.get('[data-cy-snack-status=ERROR]').should('not.exist');
2725
});
2826

29-
//AAW: We removed the all-namespaces option
30-
/*it('should have a `Namespace` column, when showing all-namespaces', () => {
31-
cy.visit('/');
32-
cy.wait(['@mockNamespacesRequest', '@mockNotebooksRequest']);
33-
34-
cy.fixture('settings').then(settings => {
35-
cy.mockNotebooksAllNamespacesRequest(settings.namespace);
36-
});
37-
cy.selectAllNamespaces();
38-
39-
cy.get('[data-cy-table-header-row="Namespace"]').should('exist');
40-
});*/
41-
4227
// We use function () in order to be able to access aliases via this
4328
// tslint:disable-next-line: space-before-function-paren
4429
it('renders every Notebook name into the table', function () {
45-
cy.visit('/');
4630
cy.wait(['@mockNamespacesRequest', '@mockNotebooksRequest']);
4731

4832
let i = 0;
@@ -57,31 +41,30 @@ describe('Main table', () => {
5741

5842
// tslint:disable-next-line: space-before-function-paren
5943
it('checks Status icon for all notebooks', function () {
60-
cy.visit('/');
6144
cy.wait(['@mockNamespacesRequest', '@mockNotebooksRequest']);
6245

6346
let i = 0;
6447
const notebooks = this.notebooksRequest.notebooks;
6548
cy.get('[data-cy-table-id="notebooks-table"]').find('[data-cy-resource-table-row="Status"]').each(element => {
66-
if (notebooks[i].status.phase === STATUS_TYPE.READY) {
49+
if (notebooks[i].status.phase === 'ready') {
6750
cy.wrap(element)
6851
.find('lib-status>mat-icon')
6952
.should('contain', 'check_circle');
70-
} else if (notebooks[i].status.phase === STATUS_TYPE.STOPPED) {
53+
} else if (notebooks[i].status.phase === 'stopped') {
7154
cy.wrap(element)
7255
.find('lib-status>lib-icon')
7356
.should('have.attr', 'icon', 'custom:stoppedResource');
74-
} else if (notebooks[i].status.phase === STATUS_TYPE.UNAVAILABLE) {
57+
} else if (notebooks[i].status.phase === 'unavailable') {
7558
cy.wrap(element)
7659
.find('lib-status>mat-icon')
7760
.should('contain', 'timelapse');
78-
} else if (notebooks[i].status.phase === STATUS_TYPE.WARNING) {
61+
} else if (notebooks[i].status.phase === 'warning') {
7962
cy.wrap(element)
8063
.find('lib-status>mat-icon')
8164
.should('contain', 'warning');
8265
} else if (
83-
notebooks[i].status.phase === STATUS_TYPE.WAITING ||
84-
notebooks[i].status.phase === STATUS_TYPE.TERMINATING
66+
notebooks[i].status.phase === 'waiting' ||
67+
notebooks[i].status.phase === 'terminating'
8568
) {
8669
cy.wrap(element).find('mat-spinner').should('exist');
8770
}
@@ -91,7 +74,6 @@ describe('Main table', () => {
9174

9275
// We use function () in order to access aliases via this
9376
it('renders every PVC name into the table', function () {
94-
cy.visit('/');
9577
cy.wait([
9678
'@mockNamespacesRequest',
9779
'@mockPVCsRequest',
@@ -108,7 +90,6 @@ describe('Main table', () => {
10890
});
10991

11092
it('checks Status icon for all PVCs', function () {
111-
cy.visit('/');
11293
cy.wait([
11394
'@mockNamespacesRequest',
11495
'@mockPVCsRequest',
@@ -117,11 +98,11 @@ describe('Main table', () => {
11798
let i = 0;
11899
const pvcs = this.pvcsRequest.pvcs;
119100
cy.get('[data-cy-table-id="volumes-table"]').find('[data-cy-resource-table-row="Status"]').each(element => {
120-
if (pvcs[i].status.phase === STATUS_TYPE.MOUNTED) {
101+
if (pvcs[i].status.phase === 'attached') {
121102
cy.wrap(element)
122103
.find('lib-status>mat-icon')
123104
.should('contain', 'link');
124-
} else if (pvcs[i].status.phase === STATUS_TYPE.UNMOUNTED) {
105+
} else if (pvcs[i].status.phase === 'unattached') {
125106
cy.wrap(element)
126107
.find('lib-status>mat-icon')
127108
.should('contain', 'link_off');

‎frontend/jupyter/i18n/fr/messages.fr.xlf

+10-2
Original file line numberDiff line numberDiff line change
@@ -1709,7 +1709,7 @@
17091709
</context-group>
17101710
<context-group purpose="location">
17111711
<context context-type="sourcefile">src/app/pages/volume-details-page/volume-details-page.component.ts</context>
1712-
<context context-type="linenumber">28</context>
1712+
<context context-type="linenumber">83</context>
17131713
</context-group>
17141714
<context-group purpose="location">
17151715
<context context-type="sourcefile">src/app/services/actions.service.ts</context>
@@ -2052,12 +2052,20 @@
20522052
<context context-type="linenumber">3</context>
20532053
</context-group>
20542054
</trans-unit>
2055+
<trans-unit id="5763559481424691176" datatype="html">
2056+
<source>Can&apos;t delete a volume in use</source>
2057+
<target>Impossible de supprimer un volume en cours d'utilisation</target>
2058+
<context-group purpose="location">
2059+
<context context-type="sourcefile">src/app/pages/volume-details-page/volume-details-page.component.ts</context>
2060+
<context context-type="linenumber">85</context>
2061+
</context-group>
2062+
</trans-unit>
20552063
<trans-unit id="1508943860666676311" datatype="html">
20562064
<source>Delete this volume</source>
20572065
<target>Supprimer ce volume</target>
20582066
<context-group purpose="location">
20592067
<context context-type="sourcefile">src/app/pages/volume-details-page/volume-details-page.component.ts</context>
2060-
<context context-type="linenumber">30</context>
2068+
<context context-type="linenumber">85</context>
20612069
</context-group>
20622070
</trans-unit>
20632071
<trans-unit id="1070872441946497109" datatype="html">

‎frontend/jupyter/i18n/messages.xlf

+9-2
Original file line numberDiff line numberDiff line change
@@ -1525,7 +1525,7 @@
15251525
</context-group>
15261526
<context-group purpose="location">
15271527
<context context-type="sourcefile">src/app/pages/volume-details-page/volume-details-page.component.ts</context>
1528-
<context context-type="linenumber">28</context>
1528+
<context context-type="linenumber">83</context>
15291529
</context-group>
15301530
<context-group purpose="location">
15311531
<context context-type="sourcefile">src/app/services/actions.service.ts</context>
@@ -1823,11 +1823,18 @@
18231823
<context context-type="linenumber">3</context>
18241824
</context-group>
18251825
</trans-unit>
1826+
<trans-unit id="5763559481424691176" datatype="html">
1827+
<source>Can&apos;t delete a volume in use</source>
1828+
<context-group purpose="location">
1829+
<context context-type="sourcefile">src/app/pages/volume-details-page/volume-details-page.component.ts</context>
1830+
<context context-type="linenumber">85</context>
1831+
</context-group>
1832+
</trans-unit>
18261833
<trans-unit id="1508943860666676311" datatype="html">
18271834
<source>Delete this volume</source>
18281835
<context-group purpose="location">
18291836
<context context-type="sourcefile">src/app/pages/volume-details-page/volume-details-page.component.ts</context>
1830-
<context context-type="linenumber">30</context>
1837+
<context context-type="linenumber">85</context>
18311838
</context-group>
18321839
</trans-unit>
18331840
<trans-unit id="1070872441946497109" datatype="html">

0 commit comments

Comments
 (0)
Please sign in to comment.