@@ -233,6 +233,36 @@ describe('Rule editor authoring sanity for core-components',function(){
233233 submitFormButtonEditPath = submitFormContainerPath + "/" + afConstants . components . forms . resourceType . submitButton . split ( "/" ) . pop ( ) ,
234234 submitFormButtonEditPathSelector = "[data-path='" + submitFormButtonEditPath + "']" ;
235235
236+ it ( 'should open rule-editor from spa' , function ( ) {
237+ if ( cy . af . isLatestAddon ( ) && toggle_array . includes ( "FT_FORMS-14068" ) ) {
238+ cy . openAuthoring ( formPath ) ;
239+ cy . selectLayer ( "Edit" ) ;
240+ cy . get ( sitesSelectors . overlays . overlay . component + "[data-path='" + formContainerPath + "/*']" ) . should ( "exist" ) ;
241+
242+ cy . insertComponent ( sitesSelectors . overlays . overlay . component + "[data-path='" + formContainerPath + "/*']" ,
243+ "Adaptive Form Button" , afConstants . components . forms . resourceType . formbutton ) ;
244+ cy . openEditableToolbar ( sitesSelectors . overlays . overlay . component + buttonEditPathSelector ) ;
245+
246+ cy . intercept ( 'GET' , / s o l u t i o n s \/ l i v e c y c l e - r u l e e d i t o r - u i - s e r v i c e .* / ) . as ( 'ruleEditorRequest' ) ;
247+
248+ // Edit rule option not existing on button toolbar
249+ cy . get ( formsSelectors . ruleEditor . action . editRule ) . should ( "exist" ) ;
250+ cy . initializeEventHandlerOnChannel ( "af-rule-editor-initialized" ) . as ( "isRuleEditorInitialized" ) ;
251+ cy . get ( formsSelectors . ruleEditor . action . editRule ) . click ( ) ;
252+
253+ // click on create option from rule editor header
254+ cy . get ( "@isRuleEditorInitialized" ) . its ( 'done' ) . should ( 'equal' , true ) ;
255+ cy . wait ( '@ruleEditorRequest' ) . its ( 'response.statusCode' ) . should ( 'equal' , 200 ) ;
256+ cy . getRuleEditorIframe ( ) . find ( formsSelectors . ruleEditor . action . closeRuleEditor ) . should ( "exist" ) ;
257+ cy . getRuleEditorIframe ( ) . find ( formsSelectors . ruleEditor . action . closeRuleEditor ) . click ( ) ;
258+
259+ cy . get ( sitesSelectors . overlays . overlay . component + buttonEditPathSelector ) . should ( "exist" ) ;
260+
261+ cy . selectLayer ( "Edit" ) ;
262+ cy . deleteComponentByPath ( buttonEditPath ) ;
263+ }
264+ } )
265+
236266 /**
237267 * RuleSanity for button to change label of textbox
238268 * [To add rule on button item so that when it get clicked
@@ -360,6 +390,37 @@ describe('Rule editor authoring sanity for core-components',function(){
360390 buttonEditPath = formContainerPath + "/" + afConstants . components . forms . resourceType . formbutton . split ( "/" ) . pop ( ) ,
361391 buttonEditPathSelector = "[data-path='" + buttonEditPath + "']" ;
362392
393+ it ( 'should open rule-editor from spa' , function ( ) {
394+ if ( cy . af . isLatestAddon ( ) && toggle_array . includes ( "FT_FORMS-14068" ) ) {
395+ cy . openAuthoring ( pagePath ) ;
396+ cy . selectLayer ( "Edit" ) ;
397+ cy . get ( sitesSelectors . overlays . overlay . component + "[data-path='" + formContainerPath + "/*']" ) . should ( "exist" ) ;
398+
399+ cy . insertComponent ( sitesSelectors . overlays . overlay . component + "[data-path='" + formContainerPath + "/*']" ,
400+ "Adaptive Form Button" , afConstants . components . forms . resourceType . formbutton ) ;
401+ cy . openEditableToolbar ( sitesSelectors . overlays . overlay . component + buttonEditPathSelector ) ;
402+
403+ cy . intercept ( 'GET' , / s o l u t i o n s \/ l i v e c y c l e - r u l e e d i t o r - u i - s e r v i c e .* / ) . as ( 'ruleEditorRequest' ) ;
404+
405+ // Edit rule option not existing on button toolbar
406+ cy . get ( formsSelectors . ruleEditor . action . editRule ) . should ( "exist" ) ;
407+ cy . initializeEventHandlerOnChannel ( "af-rule-editor-initialized" ) . as ( "isRuleEditorInitialized" ) ;
408+ cy . get ( formsSelectors . ruleEditor . action . editRule ) . click ( ) ;
409+
410+ // click on create option from rule editor header
411+ cy . get ( "@isRuleEditorInitialized" ) . its ( 'done' ) . should ( 'equal' , true ) ;
412+ cy . wait ( '@ruleEditorRequest' ) . its ( 'response.statusCode' ) . should ( 'equal' , 200 ) ;
413+
414+ cy . getRuleEditorIframe ( ) . find ( formsSelectors . ruleEditor . action . closeRuleEditor ) . should ( "exist" ) ;
415+ cy . getRuleEditorIframe ( ) . find ( formsSelectors . ruleEditor . action . closeRuleEditor ) . click ( ) ;
416+
417+ cy . get ( sitesSelectors . overlays . overlay . component + buttonEditPathSelector ) . should ( "exist" ) ;
418+
419+ cy . selectLayer ( "Edit" ) ;
420+ cy . deleteComponentByPath ( buttonEditPath ) ;
421+ }
422+ } )
423+
363424 /**
364425 * RuleSanity for button to change label of textbox
365426 * [To add rule on button item so that when it get clicked
0 commit comments