@@ -202,7 +202,6 @@ function resetParentTenantForm() {
202202 ) ;
203203}
204204
205- // TODO: Aside from test that validates deletion, replace with a more reliable cleanup mechanism when ready
206205function deleteAccordionItems ( accordionsToDelete ) {
207206 cy . get ( `#${ ACCESS_CONTROL_ACCORDION_ITEM_ID } li.list-group-item` ) . each (
208207 ( item ) => {
@@ -274,11 +273,19 @@ describe('Automate Tenant form operations: Settings > Application Settings > Acc
274273 } ) ;
275274
276275 describe ( 'Validate Parent Tenant operations: Edit, Add Project, Manage Quotas' , ( ) => {
276+ afterEach ( ( ) => {
277+ cy . appDbState ( 'restore' ) ;
278+ } ) ;
279+
277280 describe ( 'Validate Edit parent tenant' , ( ) => {
278281 beforeEach ( ( ) => {
279282 cy . toolbar ( CONFIG_TOOLBAR_BUTTON , EDIT_TENANT_CONFIG_OPTION ) ;
280283 } ) ;
281284
285+ afterEach ( ( ) => {
286+ confirmUiNavigation ( ( ) => resetParentTenantForm ( ) ) ;
287+ } ) ;
288+
282289 it ( 'Validate Edit tenant form elements' , ( ) => {
283290 validateFormElements ( ) ;
284291 } ) ;
@@ -303,20 +310,12 @@ describe('Automate Tenant form operations: Settings > Application Settings > Acc
303310 ) ;
304311 saveFormWithOptionalFlashCheck ( { apiMethod : 'PUT' } ) ;
305312 } ) ;
306-
307- afterEach ( ( ) => {
308- confirmUiNavigation ( ( ) => resetParentTenantForm ( ) ) ;
309- } ) ;
310313 } ) ;
311314
312315 describe ( 'Validate Add Project to parent tenant' , ( ) => {
313316 it ( 'Validate Add Project function' , ( ) => {
314317 addProjectToTenant ( ) ;
315318 } ) ;
316-
317- afterEach ( ( ) => {
318- cy . appDbState ( 'restore' ) ;
319- } ) ;
320319 } ) ;
321320
322321 describe ( 'Validate Manage Quotas in parent tenant' , ( ) => {
@@ -338,14 +337,14 @@ describe('Automate Tenant form operations: Settings > Application Settings > Acc
338337 editQuotasTable ( ALLOCATED_STORAGE_QUOTA , '10' ) ;
339338 saveFormWithOptionalFlashCheck ( ) ;
340339 } ) ;
341-
342- afterEach ( ( ) => {
343- cy . appDbState ( 'restore' ) ;
344- } ) ;
345340 } ) ;
346341 } ) ;
347342
348343 describe ( 'Validate Child Tenant operations: Add, Edit, Add Project, Manage Quotas' , ( ) => {
344+ afterEach ( ( ) => {
345+ cy . appDbState ( 'restore' ) ;
346+ } ) ;
347+
349348 describe ( 'Validate Add child tenant function' , ( ) => {
350349 beforeEach ( ( ) => {
351350 cy . toolbar ( CONFIG_TOOLBAR_BUTTON , ADD_CHILD_TENANT_CONFIG_OPTION ) ;
@@ -393,10 +392,6 @@ describe('Automate Tenant form operations: Settings > Application Settings > Acc
393392 ) ;
394393 cancelFormWithOptionalFlashCheck ( false ) ;
395394 } ) ;
396-
397- afterEach ( ( ) => {
398- cy . appDbState ( 'restore' ) ;
399- } ) ;
400395 } ) ;
401396
402397 describe ( 'Validate Edit child tenant' , ( ) => {
@@ -430,10 +425,6 @@ describe('Automate Tenant form operations: Settings > Application Settings > Acc
430425 ) ;
431426 saveFormWithOptionalFlashCheck ( { apiMethod : 'PUT' } ) ;
432427 } ) ;
433-
434- afterEach ( ( ) => {
435- cy . appDbState ( 'restore' ) ;
436- } ) ;
437428 } ) ;
438429
439430 describe ( 'Validate Add Project to child tenant' , ( ) => {
@@ -450,10 +441,6 @@ describe('Automate Tenant form operations: Settings > Application Settings > Acc
450441 deleteAccordionItems ( [ INITIAL_CHILD_TENANT_NAME ] ) ;
451442 cy . expect_flash ( flashClassMap . error , FLASH_MESSAGE_CANT_DELETE ) ;
452443 } ) ;
453-
454- afterEach ( ( ) => {
455- cy . appDbState ( 'restore' ) ;
456- } ) ;
457444 } ) ;
458445
459446 describe ( 'Validate Manage Quotas in child tenant' , ( ) => {
@@ -476,10 +463,6 @@ describe('Automate Tenant form operations: Settings > Application Settings > Acc
476463 editQuotasTable ( ALLOCATED_VM_QUOTA , '10' ) ;
477464 saveFormWithOptionalFlashCheck ( ) ;
478465 } ) ;
479-
480- afterEach ( ( ) => {
481- cy . appDbState ( 'restore' ) ;
482- } ) ;
483466 } ) ;
484467 } ) ;
485468} ) ;
0 commit comments