1
- import { STATUS_TYPE } from 'kubeflow' ;
2
-
3
1
describe ( 'Main table' , ( ) => {
4
2
beforeEach ( ( ) => {
5
3
cy . mockNamespacesRequest ( ) ;
@@ -10,39 +8,25 @@ describe('Main table', () => {
10
8
} ) ;
11
9
cy . fixture ( 'notebooks' ) . as ( 'notebooksRequest' ) ;
12
10
cy . fixture ( 'pvcs' ) . as ( 'pvcsRequest' ) ;
11
+
12
+ cy . visit ( '/' ) ;
13
13
} ) ;
14
14
15
15
it ( 'should have a "Notebooks" title' , ( ) => {
16
- cy . visit ( '/' ) ;
17
16
cy . get ( '[data-cy-toolbar-title]' ) . contains ( 'Notebooks' ) . should ( 'exist' ) ;
18
17
} ) ;
19
18
20
19
it ( 'should list Notebooks without errors' , ( ) => {
21
- cy . visit ( '/' ) ;
22
20
// wait for the request to fetch notebooks and namespaces
23
21
cy . wait ( [ '@mockNamespacesRequest' , '@mockNotebooksRequest' ] ) ;
24
22
25
23
// after fetching the data the page should not have an error snackbar
26
24
cy . get ( '[data-cy-snack-status=ERROR]' ) . should ( 'not.exist' ) ;
27
25
} ) ;
28
26
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
-
42
27
// We use function () in order to be able to access aliases via this
43
28
// tslint:disable-next-line: space-before-function-paren
44
29
it ( 'renders every Notebook name into the table' , function ( ) {
45
- cy . visit ( '/' ) ;
46
30
cy . wait ( [ '@mockNamespacesRequest' , '@mockNotebooksRequest' ] ) ;
47
31
48
32
let i = 0 ;
@@ -57,31 +41,30 @@ describe('Main table', () => {
57
41
58
42
// tslint:disable-next-line: space-before-function-paren
59
43
it ( 'checks Status icon for all notebooks' , function ( ) {
60
- cy . visit ( '/' ) ;
61
44
cy . wait ( [ '@mockNamespacesRequest' , '@mockNotebooksRequest' ] ) ;
62
45
63
46
let i = 0 ;
64
47
const notebooks = this . notebooksRequest . notebooks ;
65
48
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' ) {
67
50
cy . wrap ( element )
68
51
. find ( 'lib-status>mat-icon' )
69
52
. should ( 'contain' , 'check_circle' ) ;
70
- } else if ( notebooks [ i ] . status . phase === STATUS_TYPE . STOPPED ) {
53
+ } else if ( notebooks [ i ] . status . phase === 'stopped' ) {
71
54
cy . wrap ( element )
72
55
. find ( 'lib-status>lib-icon' )
73
56
. should ( 'have.attr' , 'icon' , 'custom:stoppedResource' ) ;
74
- } else if ( notebooks [ i ] . status . phase === STATUS_TYPE . UNAVAILABLE ) {
57
+ } else if ( notebooks [ i ] . status . phase === 'unavailable' ) {
75
58
cy . wrap ( element )
76
59
. find ( 'lib-status>mat-icon' )
77
60
. should ( 'contain' , 'timelapse' ) ;
78
- } else if ( notebooks [ i ] . status . phase === STATUS_TYPE . WARNING ) {
61
+ } else if ( notebooks [ i ] . status . phase === 'warning' ) {
79
62
cy . wrap ( element )
80
63
. find ( 'lib-status>mat-icon' )
81
64
. should ( 'contain' , 'warning' ) ;
82
65
} 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'
85
68
) {
86
69
cy . wrap ( element ) . find ( 'mat-spinner' ) . should ( 'exist' ) ;
87
70
}
@@ -91,7 +74,6 @@ describe('Main table', () => {
91
74
92
75
// We use function () in order to access aliases via this
93
76
it ( 'renders every PVC name into the table' , function ( ) {
94
- cy . visit ( '/' ) ;
95
77
cy . wait ( [
96
78
'@mockNamespacesRequest' ,
97
79
'@mockPVCsRequest' ,
@@ -108,7 +90,6 @@ describe('Main table', () => {
108
90
} ) ;
109
91
110
92
it ( 'checks Status icon for all PVCs' , function ( ) {
111
- cy . visit ( '/' ) ;
112
93
cy . wait ( [
113
94
'@mockNamespacesRequest' ,
114
95
'@mockPVCsRequest' ,
@@ -117,11 +98,11 @@ describe('Main table', () => {
117
98
let i = 0 ;
118
99
const pvcs = this . pvcsRequest . pvcs ;
119
100
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' ) {
121
102
cy . wrap ( element )
122
103
. find ( 'lib-status>mat-icon' )
123
104
. should ( 'contain' , 'link' ) ;
124
- } else if ( pvcs [ i ] . status . phase === STATUS_TYPE . UNMOUNTED ) {
105
+ } else if ( pvcs [ i ] . status . phase === 'unattached' ) {
125
106
cy . wrap ( element )
126
107
. find ( 'lib-status>mat-icon' )
127
108
. should ( 'contain' , 'link_off' ) ;
0 commit comments