@@ -15,6 +15,7 @@ const textConstants = {
15
15
tenantsAccordionItem : 'Tenants' ,
16
16
17
17
// Field values
18
+ formHeaderFragment : 'Tenant' ,
18
19
initialParentTenantName : 'My Company' ,
19
20
initialParentTenantDescription : 'Tenant for My Company' ,
20
21
editedTenantNameValue : 'Test-Name' ,
@@ -79,6 +80,7 @@ const {
79
80
tenantsAccordionItem,
80
81
81
82
// Field values
83
+ formHeaderFragment,
82
84
initialParentTenantName,
83
85
initialParentTenantDescription,
84
86
editedTenantNameValue,
@@ -181,6 +183,37 @@ function verifyNameAndDescriptionValues(nameValue, descriptionValue) {
181
183
) ;
182
184
}
183
185
186
+ function validateFormElements ( isEditForm = true ) {
187
+ // Assert form header is visible
188
+ cy . expect_explorer_title ( formHeaderFragment ) ;
189
+ // Assert name field label is visible
190
+ cy . getFormLabelByInputId ( nameInputFieldId ) . should ( 'be.visible' ) ;
191
+ // Assert name field is visible and enabled
192
+ cy . getFormInputFieldById ( nameInputFieldId )
193
+ . should ( 'be.visible' )
194
+ . and ( 'be.enabled' ) ;
195
+ // Assert description field label is visible
196
+ cy . getFormLabelByInputId ( descriptionInputFieldId ) . should ( 'be.visible' ) ;
197
+ // Assert description field is visible and enabled
198
+ cy . getFormInputFieldById ( descriptionInputFieldId )
199
+ . should ( 'be.visible' )
200
+ . and ( 'be.enabled' ) ;
201
+ // Assert cancel button is visible and enabled
202
+ cy . getFormFooterButtonByType ( cancelButton )
203
+ . should ( 'be.visible' )
204
+ . and ( 'be.enabled' ) ;
205
+ if ( isEditForm ) {
206
+ // Assert reset button is visible and disabled
207
+ cy . getFormFooterButtonByType ( resetButton )
208
+ . should ( 'be.visible' )
209
+ . and ( 'be.disabled' ) ;
210
+ }
211
+ // Assert add/save button is visible and disabled
212
+ cy . getFormFooterButtonByType ( isEditForm ? saveButton : addButton , 'submit' )
213
+ . should ( 'be.visible' )
214
+ . and ( 'be.disabled' ) ;
215
+ }
216
+
184
217
function createAndSelectChildTenant ( ) {
185
218
// Open child tenant create form
186
219
cy . toolbar ( configToolbarButton , addChildTenantConfigOption ) ;
@@ -349,6 +382,10 @@ describe('Automate Tenant form operations: Settings > Application Settings > Acc
349
382
cy . toolbar ( configToolbarButton , editTenantConfigOption ) ;
350
383
} ) ;
351
384
385
+ it ( 'Validate Edit tenant form elements' , ( ) => {
386
+ validateFormElements ( ) ;
387
+ } ) ;
388
+
352
389
it ( 'Validate Reset & Cancel buttons on Edit tenant form' , ( ) => {
353
390
// Update name & description fields
354
391
updateNameAndDescription ( editedTenantNameValue , editedDescriptionValue ) ;
@@ -427,6 +464,10 @@ describe('Automate Tenant form operations: Settings > Application Settings > Acc
427
464
cy . toolbar ( configToolbarButton , addChildTenantConfigOption ) ;
428
465
} ) ;
429
466
467
+ it ( 'Validate Add child tenant form elements' , ( ) => {
468
+ validateFormElements ( false ) ;
469
+ } ) ;
470
+
430
471
it ( 'Validate cancel button on Add child tenant form' , ( ) => {
431
472
// Cancel the add operation
432
473
cancelForm ( ) ;
@@ -481,6 +522,14 @@ describe('Automate Tenant form operations: Settings > Application Settings > Acc
481
522
cy . toolbar ( configToolbarButton , editTenantConfigOption ) ;
482
523
} ) ;
483
524
525
+ it ( 'Validate Edit child tenant form elements' , ( ) => {
526
+ validateFormElements ( ) ;
527
+ // Cancel the edit form
528
+ cancelForm ( ) ;
529
+ // Removing the child tenant
530
+ deleteAccordionItem ( initialChildTenantName ) ;
531
+ } ) ;
532
+
484
533
it ( 'Validate Reset & Cancel buttons on the Edit child tenent form' , ( ) => {
485
534
// Update name & description fields
486
535
updateNameAndDescription ( editedTenantNameValue , editedDescriptionValue ) ;
0 commit comments