@@ -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 ) ;
@@ -313,6 +346,7 @@ function rollbackQuotas() {
313
346
describe ( 'Automate Tenant form operations: Settings > Application Settings > Access Control > Tenants' , ( ) => {
314
347
beforeEach ( ( ) => {
315
348
cy . login ( ) ;
349
+ cy . wait ( 500 ) ;
316
350
// Navigate to Settings -> Application-Settings in the UI
317
351
cy . menu ( settingsMenuOption , appSettingsMenuOption ) ;
318
352
// Expand Access-Control accordion
@@ -349,6 +383,10 @@ describe('Automate Tenant form operations: Settings > Application Settings > Acc
349
383
cy . toolbar ( configToolbarButton , editTenantConfigOption ) ;
350
384
} ) ;
351
385
386
+ it ( 'Validate Edit tenant form elements' , ( ) => {
387
+ validateFormElements ( ) ;
388
+ } ) ;
389
+
352
390
it ( 'Validate Reset & Cancel buttons on Edit tenant form' , ( ) => {
353
391
// Update name & description fields
354
392
updateNameAndDescription ( editedTenantNameValue , editedDescriptionValue ) ;
@@ -427,6 +465,10 @@ describe('Automate Tenant form operations: Settings > Application Settings > Acc
427
465
cy . toolbar ( configToolbarButton , addChildTenantConfigOption ) ;
428
466
} ) ;
429
467
468
+ it ( 'Validate Add child tenant form elements' , ( ) => {
469
+ validateFormElements ( false ) ;
470
+ } ) ;
471
+
430
472
it ( 'Validate cancel button on Add child tenant form' , ( ) => {
431
473
// Cancel the add operation
432
474
cancelForm ( ) ;
@@ -481,6 +523,14 @@ describe('Automate Tenant form operations: Settings > Application Settings > Acc
481
523
cy . toolbar ( configToolbarButton , editTenantConfigOption ) ;
482
524
} ) ;
483
525
526
+ it ( 'Validate Edit child tenant form elements' , ( ) => {
527
+ validateFormElements ( ) ;
528
+ // Cancel the edit form
529
+ cancelForm ( ) ;
530
+ // Removing the child tenant
531
+ deleteAccordionItem ( initialChildTenantName ) ;
532
+ } ) ;
533
+
484
534
it ( 'Validate Reset & Cancel buttons on the Edit child tenent form' , ( ) => {
485
535
// Update name & description fields
486
536
updateNameAndDescription ( editedTenantNameValue , editedDescriptionValue ) ;
0 commit comments