@@ -12,6 +12,10 @@ const textConstants = {
12
12
zoneAccordItem : / ^ Z o n e : / ,
13
13
serverAccordItem : / ^ S e r v e r : / ,
14
14
15
+ // Field values
16
+ formHeader : 'Editing Log Depot settings' ,
17
+ formSubheaderSnippet : 'Editing Log Depot Settings' ,
18
+
15
19
// Config options
16
20
editToolbarButton : 'Edit' ,
17
21
@@ -61,6 +65,8 @@ const {
61
65
flashMessageOperationCanceled,
62
66
submitButtonType,
63
67
protocolSelectFieldId,
68
+ formHeader,
69
+ formSubheaderSnippet,
64
70
} = textConstants ;
65
71
66
72
function interceptAndAwaitApi ( {
@@ -146,17 +152,39 @@ function goToCollectLogsNavbarAndOpenEditForm(registeredApiIntercepts) {
146
152
} ) ;
147
153
}
148
154
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 ) . should ( 'be.visible' ) ;
166
+ // Assert cancel button is visible and enabled
167
+ cy . getFormFooterButtonByType ( cancelButton )
168
+ . should ( 'be.visible' )
169
+ . and ( 'be.enabled' ) ;
170
+ // Assert save button is visible and disabled
171
+ cy . getFormFooterButtonByType ( saveButton , submitButtonType )
172
+ . should ( 'be.visible' )
173
+ . and ( 'be.disabled' ) ;
174
+ // Assert reset button is visible and disabled
175
+ cy . getFormFooterButtonByType ( resetButton )
176
+ . should ( 'be.visible' )
177
+ . and ( 'be.disabled' ) ;
178
+ }
179
+
149
180
function cancelButtonValidation ( ) {
150
181
// Click cancel button in the form
151
- cy . getFormFooterButtonByType ( cancelButton ) . should ( 'be.enabled' ) . click ( ) ;
182
+ cy . getFormFooterButtonByType ( cancelButton ) . click ( ) ;
152
183
// Validating confirmation flash message
153
184
cy . expect_flash ( flashTypeSuccess , flashMessageOperationCanceled ) ;
154
185
}
155
186
156
187
function resetButtonValidation ( ) {
157
- // Confirm Reset button is disabled initially
158
- cy . getFormFooterButtonByType ( resetButton ) . should ( 'be.disabled' ) ;
159
-
160
188
// Selecting Samba option from dropdown
161
189
cy . getFormSelectFieldById ( protocolSelectFieldId ) . select ( sambaDropdownValue ) ;
162
190
// Confirm Reset button is enabled once dropdown value is changed and then click on Reset
@@ -169,10 +197,6 @@ function resetButtonValidation() {
169
197
}
170
198
171
199
function saveButtonValidation ( ) {
172
- // Confirm Save button is disabled initially
173
- cy . getFormFooterButtonByType ( saveButton , submitButtonType ) . should (
174
- 'be.disabled'
175
- ) ;
176
200
// Selecting Samba option from dropdown
177
201
cy . getFormSelectFieldById ( protocolSelectFieldId ) . select ( sambaDropdownValue ) ;
178
202
// Confirm Save button is enabled once dropdown value is changed and then click on Save
@@ -214,6 +238,10 @@ describe('Automate Collect logs Edit form operations', () => {
214
238
goToCollectLogsNavbarAndOpenEditForm ( registeredApiIntercepts ) ;
215
239
} ) ;
216
240
241
+ it ( 'Validate form elements' , ( ) => {
242
+ validateFormElements ( ) ;
243
+ } ) ;
244
+
217
245
it ( 'Validate Cancel button' , ( ) => {
218
246
cancelButtonValidation ( ) ;
219
247
} ) ;
@@ -258,6 +286,10 @@ describe('Automate Collect logs Edit form operations', () => {
258
286
goToCollectLogsNavbarAndOpenEditForm ( registeredApiIntercepts ) ;
259
287
} ) ;
260
288
289
+ it ( 'Validate form elements' , ( ) => {
290
+ validateFormElements ( ) ;
291
+ } ) ;
292
+
261
293
it ( 'Validate Cancel button' , ( ) => {
262
294
cancelButtonValidation ( ) ;
263
295
} ) ;
0 commit comments