@@ -76,7 +76,18 @@ describe('Page/Form Authoring', function () {
7676 cy . get ( "coral-numberinput[name='./fd:autoSaveInterval']" ) . should ( "exist" ) ;
7777 }
7878
79-
79+ const checkValidatorFunctioning = function ( formContainerEditPathSelector ) {
80+ cy . openEditableToolbar ( sitesSelectors . overlays . overlay . component + formContainerEditPathSelector ) ;
81+ cy . invokeEditableAction ( "[data-action='CONFIGURE']" ) ;
82+ cy . get ( '.cmp-adaptiveform-container__editdialog' ) . contains ( 'Submission' ) . click ( { force :true } ) ;
83+ cy . get ( ".cmp-adaptiveform-container__submitaction" ) . children ( 'button[is="coral-button"][aria-haspopup="listbox"]' ) . first ( ) . click ( { force : true } ) ;
84+ cy . get ( 'coral-selectlist-item[value="fd/af/components/guidesubmittype/restendpoint"]' ) . should ( 'be.visible' ) . click ( ) ;
85+ cy . get ( "[name='./restEndpointPostUrl']" ) . scrollIntoView ( ) . clear ( { force : true } ) . type ( "invalid-url" , { force : true } ) ;
86+ cy . get ( '.coral-Form-errorlabel' ) . should ( 'contain.text' , "Please enter the absolute path of the REST endpoint." ) ;
87+ cy . get ( "[name='./restEndpointPostUrl']" ) . clear ( { force : true } ) . type ( "http://localhost:4502/some/endpoint" , { force : true } ) ;
88+ cy . get ( '.coral-Form-errorlabel' ) . should ( 'not.exist' ) ;
89+ cy . get ( '.cq-dialog-submit' ) . click ( ) ;
90+ } ;
8091
8192 const checkAndSaveSubmitAction = function ( formContainerEditPathSelector ) {
8293 // click configure action on adaptive form container component
@@ -107,11 +118,11 @@ describe('Page/Form Authoring', function () {
107118 cy . get ( "[name='./restEndpointConfigPath']" ) . should ( "exist" ) . should ( "be.visible" ) ;
108119 cy . get ( "coral-radio[name='./restEndPointSource'][value='posturl']" ) . first ( ) . click ( ) ;
109120 cy . get ( "[name='./restEndpointPostUrl']" ) . should ( "exist" ) . should ( "be.visible" ) ;
121+ cy . get ( "[name='./restEndpointPostUrl']" ) . should ( "exist" ) . clear ( ) . type ( "http://localhost:4502/some/endpoint" ) ;
110122 cy . get ( "[name='./restEndpointConfigPath']" ) . should ( "exist" ) . should ( "not.be.visible" ) ;
111123 }
112- cy . get ( "[name='./restEndpointPostUrl']" ) . should ( "exist" ) . type ( "http://localhost:4502/some/endpoint" ) ;
113-
114124 //save the configuration
125+ cy . get ( "[name='./restEndpointPostUrl']" ) . scrollIntoView ( ) . should ( "exist" ) . clear ( ) . type ( "http://localhost:4502/some/endpoint" ) ;
115126 cy . get ( '.cq-dialog-submit' ) . click ( ) ;
116127 } ;
117128
@@ -243,6 +254,9 @@ describe('Page/Form Authoring', function () {
243254 }
244255 } ) ;
245256
257+ it ( 'check validator functioning for REST endpoint URL' , function ( ) {
258+ checkValidatorFunctioning ( formContainerEditPathSelector ) ;
259+ } ) ;
246260 } ) ;
247261
248262 // commenting once we support adaptive form container in sites editor, uncomment this test
@@ -296,6 +310,10 @@ describe('Page/Form Authoring', function () {
296310 checkEditDialog ( formContainerEditPathSelector ) ;
297311 cy . get ( sitesSelectors . confirmDialog . actions . first ) . click ( ) ;
298312 } )
313+
314+ it ( 'check validator functioning for REST endpoint URL' , function ( ) {
315+ checkValidatorFunctioning ( formContainerEditPathSelector ) ;
316+ } ) ;
299317 } ) ;
300318
301319 context ( "Render Forms in Disabled mode" , function ( ) {
0 commit comments