@@ -16,6 +16,7 @@ const textConstants = {
16
16
tenantsAccordionItem : 'Tenants' ,
17
17
18
18
// Field values
19
+ formHeaderFragment : 'Tenant' ,
19
20
initialParentTenantName : 'My Company' ,
20
21
initialParentTenantDescription : 'Tenant for My Company' ,
21
22
editedTenantNameValue : 'Test-Name' ,
@@ -75,6 +76,7 @@ const {
75
76
tenantsAccordionItem,
76
77
77
78
// Field values
79
+ formHeaderFragment,
78
80
initialParentTenantName,
79
81
initialParentTenantDescription,
80
82
editedTenantNameValue,
@@ -172,6 +174,37 @@ function verifyNameAndDescriptionValues(nameValue, descriptionValue) {
172
174
) ;
173
175
}
174
176
177
+ function validateFormElements ( isEditForm = true ) {
178
+ // Assert form header is visible
179
+ cy . expect_explorer_title ( formHeaderFragment ) ;
180
+ // Assert name field label is visible
181
+ cy . getFormLabelByInputId ( nameInputFieldId ) . should ( 'be.visible' ) ;
182
+ // Assert name field is visible and enabled
183
+ cy . getFormInputFieldById ( nameInputFieldId )
184
+ . should ( 'be.visible' )
185
+ . and ( 'be.enabled' ) ;
186
+ // Assert description field label is visible
187
+ cy . getFormLabelByInputId ( descriptionInputFieldId ) . should ( 'be.visible' ) ;
188
+ // Assert description field is visible and enabled
189
+ cy . getFormInputFieldById ( descriptionInputFieldId )
190
+ . should ( 'be.visible' )
191
+ . and ( 'be.enabled' ) ;
192
+ // Assert cancel button is visible and enabled
193
+ cy . getFormFooterButtonByType ( cancelButton )
194
+ . should ( 'be.visible' )
195
+ . and ( 'be.enabled' ) ;
196
+ if ( isEditForm ) {
197
+ // Assert reset button is visible and disabled
198
+ cy . getFormFooterButtonByType ( resetButton )
199
+ . should ( 'be.visible' )
200
+ . and ( 'be.disabled' ) ;
201
+ }
202
+ // Assert add/save button is visible and disabled
203
+ cy . getFormFooterButtonByType ( isEditForm ? saveButton : addButton , 'submit' )
204
+ . should ( 'be.visible' )
205
+ . and ( 'be.disabled' ) ;
206
+ }
207
+
175
208
function createAndSelectChildTenant ( ) {
176
209
// Open child tenant create form
177
210
cy . toolbar ( configToolbarButton , addChildTenantConfigOption ) ;
@@ -342,6 +375,11 @@ describe('Automate Tenant form operations: Settings > Application Settings > Acc
342
375
cy . toolbar ( configToolbarButton , editTenantConfigOption ) ;
343
376
} ) ;
344
377
378
+ it ( 'Validate Edit tenant form elements' , ( ) => {
379
+ // Validate form fields
380
+ validateFormElements ( ) ;
381
+ } ) ;
382
+
345
383
it ( 'Validate Reset & Cancel buttons on Edit tenant form' , ( ) => {
346
384
// Update name & description fields
347
385
updateNameAndDescription ( editedTenantNameValue , editedDescriptionValue ) ;
@@ -477,6 +515,15 @@ describe('Automate Tenant form operations: Settings > Application Settings > Acc
477
515
cy . toolbar ( configToolbarButton , editTenantConfigOption ) ;
478
516
} ) ;
479
517
518
+ it ( 'Validate Edit child tenant form elements' , ( ) => {
519
+ // Validate form fields
520
+ validateFormElements ( ) ;
521
+ // Cancel the edit form
522
+ cancelForm ( ) ;
523
+ // Removing the child tenant
524
+ deleteAccordionItem ( initialChildTenantName ) ;
525
+ } ) ;
526
+
480
527
it ( 'Validate Reset & Cancel buttons on the Edit child tenent form' , ( ) => {
481
528
// Update name & description fields
482
529
updateNameAndDescription ( editedTenantNameValue , editedDescriptionValue ) ;
0 commit comments