@@ -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,41 @@ 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 )
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
+
149
182
function cancelButtonValidation ( ) {
150
183
// Click cancel button in the form
151
- cy . getFormFooterButtonByType ( cancelButton ) . should ( 'be.enabled' ) . click ( ) ;
184
+ cy . getFormFooterButtonByType ( cancelButton ) . click ( ) ;
152
185
// Validating confirmation flash message
153
186
cy . expect_flash ( flashTypeSuccess , flashMessageOperationCanceled ) ;
154
187
}
155
188
156
189
function resetButtonValidation ( ) {
157
- // Confirm Reset button is disabled initially
158
- cy . getFormFooterButtonByType ( resetButton ) . should ( 'be.disabled' ) ;
159
-
160
190
// Selecting Samba option from dropdown
161
191
cy . getFormSelectFieldById ( protocolSelectFieldId ) . select ( sambaDropdownValue ) ;
162
192
// Confirm Reset button is enabled once dropdown value is changed and then click on Reset
@@ -169,10 +199,6 @@ function resetButtonValidation() {
169
199
}
170
200
171
201
function saveButtonValidation ( ) {
172
- // Confirm Save button is disabled initially
173
- cy . getFormFooterButtonByType ( saveButton , submitButtonType ) . should (
174
- 'be.disabled'
175
- ) ;
176
202
// Selecting Samba option from dropdown
177
203
cy . getFormSelectFieldById ( protocolSelectFieldId ) . select ( sambaDropdownValue ) ;
178
204
// 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', () => {
214
240
goToCollectLogsNavbarAndOpenEditForm ( registeredApiIntercepts ) ;
215
241
} ) ;
216
242
243
+ it ( 'Validate form elements' , ( ) => {
244
+ validateFormElements ( ) ;
245
+ } ) ;
246
+
217
247
it ( 'Validate Cancel button' , ( ) => {
218
248
cancelButtonValidation ( ) ;
219
249
} ) ;
@@ -258,6 +288,10 @@ describe('Automate Collect logs Edit form operations', () => {
258
288
goToCollectLogsNavbarAndOpenEditForm ( registeredApiIntercepts ) ;
259
289
} ) ;
260
290
291
+ it ( 'Validate form elements' , ( ) => {
292
+ validateFormElements ( ) ;
293
+ } ) ;
294
+
261
295
it ( 'Validate Cancel button' , ( ) => {
262
296
cancelButtonValidation ( ) ;
263
297
} ) ;
0 commit comments