@@ -12,6 +12,10 @@ const textConstants = {
1212 zoneAccordItem : / ^ Z o n e : / ,
1313 serverAccordItem : / ^ S e r v e r : / ,
1414
15+ // Field values
16+ formHeader : 'Editing Log Depot settings' ,
17+ formSubheaderSnippet : 'Editing Log Depot Settings' ,
18+
1519 // Config options
1620 editToolbarButton : 'Edit' ,
1721
@@ -61,6 +65,8 @@ const {
6165 flashMessageOperationCanceled,
6266 submitButtonType,
6367 protocolSelectFieldId,
68+ formHeader,
69+ formSubheaderSnippet,
6470} = textConstants ;
6571
6672function interceptAndAwaitApi ( {
@@ -146,17 +152,41 @@ function goToCollectLogsNavbarAndOpenEditForm(registeredApiIntercepts) {
146152 } ) ;
147153}
148154
155+ function validateFormElements ( ) {
156+ // Assert form header is visible
157+ cy . expect_explorer_title ( formHeader ) . should ( 'be.visible' ) ;
158+ // Assert form sub-header is visible
159+ cy . contains ( '#main-content .bx--form h3' , formSubheaderSnippet ) . should (
160+ 'be.visible'
161+ ) ;
162+ // Assert protocol field label is visible
163+ cy . getFormLabelByInputId ( protocolSelectFieldId ) . should ( 'be.visible' ) ;
164+ // Assert protocol field is visible and enabled
165+ cy . getFormSelectFieldById ( protocolSelectFieldId )
166+ . should ( 'be.visible' )
167+ . and ( 'be.enabled' ) ;
168+ // Assert cancel button is visible and enabled
169+ cy . getFormFooterButtonByType ( cancelButton )
170+ . should ( 'be.visible' )
171+ . and ( 'be.enabled' ) ;
172+ // Assert save button is visible and disabled
173+ cy . getFormFooterButtonByType ( saveButton , submitButtonType )
174+ . should ( 'be.visible' )
175+ . and ( 'be.disabled' ) ;
176+ // Assert reset button is visible and disabled
177+ cy . getFormFooterButtonByType ( resetButton )
178+ . should ( 'be.visible' )
179+ . and ( 'be.disabled' ) ;
180+ }
181+
149182function cancelButtonValidation ( ) {
150183 // Click cancel button in the form
151- cy . getFormFooterButtonByType ( cancelButton ) . should ( 'be.enabled' ) . click ( ) ;
184+ cy . getFormFooterButtonByType ( cancelButton ) . click ( ) ;
152185 // Validating confirmation flash message
153186 cy . expect_flash ( flashTypeSuccess , flashMessageOperationCanceled ) ;
154187}
155188
156189function resetButtonValidation ( ) {
157- // Confirm Reset button is disabled initially
158- cy . getFormFooterButtonByType ( resetButton ) . should ( 'be.disabled' ) ;
159-
160190 // Selecting Samba option from dropdown
161191 cy . getFormSelectFieldById ( protocolSelectFieldId ) . select ( sambaDropdownValue ) ;
162192 // Confirm Reset button is enabled once dropdown value is changed and then click on Reset
@@ -169,10 +199,6 @@ function resetButtonValidation() {
169199}
170200
171201function saveButtonValidation ( ) {
172- // Confirm Save button is disabled initially
173- cy . getFormFooterButtonByType ( saveButton , submitButtonType ) . should (
174- 'be.disabled'
175- ) ;
176202 // Selecting Samba option from dropdown
177203 cy . getFormSelectFieldById ( protocolSelectFieldId ) . select ( sambaDropdownValue ) ;
178204 // Confirm Save button is enabled once dropdown value is changed and then click on Save
@@ -214,6 +240,10 @@ describe('Automate Collect logs Edit form operations', () => {
214240 goToCollectLogsNavbarAndOpenEditForm ( registeredApiIntercepts ) ;
215241 } ) ;
216242
243+ it ( 'Validate form elements' , ( ) => {
244+ validateFormElements ( ) ;
245+ } ) ;
246+
217247 it ( 'Validate Cancel button' , ( ) => {
218248 cancelButtonValidation ( ) ;
219249 } ) ;
@@ -258,6 +288,10 @@ describe('Automate Collect logs Edit form operations', () => {
258288 goToCollectLogsNavbarAndOpenEditForm ( registeredApiIntercepts ) ;
259289 } ) ;
260290
291+ it ( 'Validate form elements' , ( ) => {
292+ validateFormElements ( ) ;
293+ } ) ;
294+
261295 it ( 'Validate Cancel button' , ( ) => {
262296 cancelButtonValidation ( ) ;
263297 } ) ;
0 commit comments