@@ -28,22 +28,6 @@ describe('Tenants', () => {
28
28
cy . getListingItem ( tenant . tenantName ) . find ( '.title a' ) . click ( )
29
29
}
30
30
31
- const fillPlan = ( plan , trial ) => {
32
- cy . fillFields ( plan )
33
- if ( trial ) {
34
- cy . checkToggle ( 'test' )
35
- } else {
36
- cy . uncheckToggle ( 'test' )
37
- }
38
- cy . clickModalAction ( )
39
- cy . getCy ( 'modal_tenant_plan-edit' ) . should ( 'not.be.visible' )
40
- }
41
-
42
- const createPlan = ( plan , trial , expectActive ) => {
43
- cy . getCy ( 'tenant-detail_add-plan' ) . click ( )
44
- fillPlan ( plan , trial )
45
- }
46
-
47
31
const expectAppName = ( tenantName ) => {
48
32
cy . getCy ( 'detail-page_header-title' ) . contains ( tenantName ) . should ( 'exist' )
49
33
}
@@ -56,30 +40,12 @@ describe('Tenants', () => {
56
40
cy . getCy ( 'detail-page_metadata_enabled' ) . find ( '.badge.bg-success' ) . contains ( 'Enabled' ) . should ( 'exist' )
57
41
}
58
42
59
- const expectDisabled = ( ) => {
60
- cy . getCy ( 'detail-page_metadata_enabled' ) . find ( '.badge.bg-danger' ) . contains ( 'Disabled' ) . should ( 'exist' )
61
- }
62
-
63
- const expectPlan = ( plan , trial , expectActive ) => {
64
- cy . getCy ( 'plans-list_name' ) . contains ( plan . name ) . should ( 'exist' )
65
- if ( trial ) {
66
- cy . getCy ( 'plans-list_name' ) . find ( '.badge.bg-secondary' ) . contains ( 'Trial' ) . should ( 'exist' )
67
- }
68
-
69
- cy . getCy ( 'plans-list_name' ) . find ( '.badge.bg-success' ) . should ( expectActive ? 'exist' : 'not.exist' )
70
- cy . getCy ( 'plans-list_users' ) . contains ( plan . users || '-' ) . should ( 'exist' )
71
- cy . getCy ( 'plans-list_from' ) . contains ( `${ plan . sinceDay } . ${ plan . sinceMonth } . ${ plan . sinceYear } ` ) . should ( 'exist' )
72
- cy . getCy ( 'plans-list_to' ) . contains ( `${ plan . untilDay } . ${ plan . untilMonth } . ${ plan . untilYear } ` ) . should ( 'exist' )
73
- }
74
-
75
-
76
43
before ( ( ) => {
77
44
cy . task ( 'user:delete' , { email : superAdmin . email } )
78
45
cy . createUser ( superAdmin )
79
46
cy . task ( 'user:addPermission' , { perm : 'TENANT_PERM' , email : superAdmin . email } )
80
47
} )
81
48
82
-
83
49
beforeEach ( ( ) => {
84
50
cy . task ( 'tenant:delete' , { tenant_id : tenant . tenantId } )
85
51
cy . task ( 'tenant:delete' , { tenant_id : newApp . tenantId } )
@@ -112,154 +78,4 @@ describe('Tenants', () => {
112
78
expectAppId ( newApp . tenantId )
113
79
expectEnabled ( )
114
80
} )
115
-
116
-
117
- it ( 'add past plan' , ( ) => {
118
- createApp ( )
119
-
120
- const plan = {
121
- name : 'Past plan' ,
122
- users : '10' ,
123
- sinceDay : '10' ,
124
- sinceMonth : '10' ,
125
- sinceYear : '2020' ,
126
- untilDay : '20' ,
127
- untilMonth : '12' ,
128
- untilYear : '2020' ,
129
- }
130
- createPlan ( plan , true , false )
131
- expectPlan ( plan , true , false )
132
- expectDisabled ( )
133
- } )
134
-
135
-
136
- it ( 'add current plan' , ( ) => {
137
- createApp ( )
138
-
139
- const plan = {
140
- name : 'Current plan' ,
141
- users : '10' ,
142
- sinceDay : '10' ,
143
- sinceMonth : '10' ,
144
- sinceYear : '2020' ,
145
- untilDay : '20' ,
146
- untilMonth : '12' ,
147
- untilYear : '2050' ,
148
- }
149
- createPlan ( plan , false , true )
150
- expectPlan ( plan , false , true )
151
- expectEnabled ( )
152
- } )
153
-
154
-
155
- it ( 'add future plan' , ( ) => {
156
- createApp ( )
157
-
158
- const plan = {
159
- name : 'Future plan' ,
160
- users : '10' ,
161
- sinceDay : '10' ,
162
- sinceMonth : '10' ,
163
- sinceYear : '2070' ,
164
- untilDay : '20' ,
165
- untilMonth : '12' ,
166
- untilYear : '2080' ,
167
- }
168
- createPlan ( plan , false , false )
169
- expectPlan ( plan , false , false )
170
- expectDisabled ( )
171
- } )
172
-
173
-
174
- it ( 'edit plan' , ( ) => {
175
- createApp ( )
176
-
177
- // create current plan
178
- const plan = {
179
- name : 'Current plan' ,
180
- users : '10' ,
181
- sinceDay : '10' ,
182
- sinceMonth : '10' ,
183
- sinceYear : '2020' ,
184
- untilDay : '24' ,
185
- untilMonth : '12' ,
186
- untilYear : '2050' ,
187
- }
188
- createPlan ( plan , false , true )
189
- expectPlan ( plan , false , true )
190
- expectEnabled ( )
191
-
192
- // edit it to be a past plan
193
- const plan2 = {
194
- name : 'Past plan now' ,
195
- users : '13' ,
196
- sinceDay : '10' ,
197
- sinceMonth : '10' ,
198
- sinceYear : '2020' ,
199
- untilDay : '23' ,
200
- untilMonth : '12' ,
201
- untilYear : '2020' ,
202
- }
203
- cy . getCy ( 'tenant-detail_plan_edit' ) . click ( )
204
- fillPlan ( plan2 , true )
205
- expectPlan ( plan2 , true , false )
206
- expectDisabled ( )
207
-
208
- // edit it to be a future plan
209
- const plan3 = {
210
- name : 'Future plan now' ,
211
- users : '16' ,
212
- sinceDay : '10' ,
213
- sinceMonth : '10' ,
214
- sinceYear : '2060' ,
215
- untilDay : '22' ,
216
- untilMonth : '12' ,
217
- untilYear : '2070' ,
218
- }
219
- cy . getCy ( 'tenant-detail_plan_edit' ) . click ( )
220
- fillPlan ( plan3 , false )
221
- expectPlan ( plan3 , false , false )
222
- expectDisabled ( )
223
-
224
- // edit it to be a current plan again
225
- const plan4 = {
226
- name : 'Current plan now' ,
227
- users : '19' ,
228
- sinceDay : '10' ,
229
- sinceMonth : '10' ,
230
- sinceYear : '2000' ,
231
- untilDay : '21' ,
232
- untilMonth : '12' ,
233
- untilYear : '2070' ,
234
- }
235
- cy . getCy ( 'tenant-detail_plan_edit' ) . click ( )
236
- fillPlan ( plan4 , false )
237
- expectPlan ( plan4 , false , true )
238
- expectEnabled ( )
239
- } )
240
-
241
-
242
- it ( 'delete plan' , ( ) => {
243
- createApp ( )
244
-
245
- // create current plan
246
- const plan = {
247
- name : 'Current plan' ,
248
- users : '10' ,
249
- sinceDay : '10' ,
250
- sinceMonth : '10' ,
251
- sinceYear : '2020' ,
252
- untilDay : '24' ,
253
- untilMonth : '12' ,
254
- untilYear : '2050' ,
255
- }
256
- createPlan ( plan , false , true )
257
- expectPlan ( plan , false , true )
258
- expectEnabled ( )
259
-
260
- cy . getCy ( 'tenant-detail_plan_delete' ) . click ( )
261
- cy . clickModalAction ( )
262
- cy . getCy ( 'modal_tenant_plan-delete' ) . should ( 'not.be.visible' )
263
- expectDisabled ( )
264
- } )
265
- } )
81
+ } )
0 commit comments