@@ -38,29 +38,31 @@ describe('Page - Authoring', function () {
3838 const testTitleEditDialog = function ( titleEditPathSelector , titleDrop , isSites ) {
3939 if ( isSites ) {
4040 dropTitleInSites ( ) ;
41- cy . openEditableToolbar ( sitesSelectors . overlays . overlay . component + titleEditPathSelector ) ;
41+ cy . openEditableToolbar ( sitesSelectors . overlays . overlay . component + titleEditPathSelector )
42+ . should ( 'exist' ) ;
4243 cy . invokeEditableAction ( "[data-action='CONFIGURE']" ) ;
4344 cy . get ( "[name='./fd:htmlelementType']" )
44- . should ( "exist" ) ;
45- cy . get ( '.cq-dialog-cancel' ) . click ( ) ;
45+ . should ( "exist" ) ;
46+ cy . get ( '.cq-dialog-cancel' ) . should ( 'be.visible' ) . click ( ) ;
4647 cy . deleteComponentByPath ( titleDrop ) ;
4748 } else {
4849 dropTitleInContainer ( ) ;
49- cy . openEditableToolbar ( sitesSelectors . overlays . overlay . component + titleEditPathSelector ) ;
50+ cy . openEditableToolbar ( sitesSelectors . overlays . overlay . component + titleEditPathSelector )
51+ . should ( 'exist' ) ;
5052 cy . invokeEditableAction ( "[data-action='CONFIGURE']" ) ;
5153 cy . get ( "[name='./fd:htmlelementType']" )
52- cy . get ( '[name="./fd:htmlelementType"]' ) . eq ( 0 ) . click ( )
53- . should ( "exist" ) ;
54- cy . get ( '.cq-dialog-cancel' ) . click ( ) ;
54+ . should ( "exist" ) ;
55+ cy . get ( '[name="./fd:htmlelementType"]' ) . eq ( 0 ) . should ( 'exist' ) . click ( ) ;
56+ cy . get ( '.cq-dialog-cancel' ) . should ( 'be.visible' ) . click ( ) ;
5557 cy . get ( '[data-path^="/content/forms/af/core-components-it/blank/jcr:content/guideContainer/title"]' )
58+ . should ( 'exist' )
5659 . invoke ( 'attr' , 'data-path' )
5760 . then ( dataPath => {
5861 const id = dataPath . replace ( '/content/forms/af/core-components-it/blank/jcr:content/guideContainer/title' , '' ) ;
5962 const _titleDrop = titleDrop + id ;
6063 cy . deleteComponentByPath ( dataPath ) ;
61- } )
64+ } ) ;
6265 }
63-
6466 }
6567
6668 context ( 'Open Forms Editor' , function ( ) {
@@ -76,8 +78,8 @@ describe('Page - Authoring', function () {
7678
7779 it ( 'check edit dialog availability of Title' , function ( ) {
7880 cy . cleanTitleTest ( titleEditPath ) . then ( ( ) => {
79- testTitleEditDialog ( titleEditPathSelector , titleDrop , false ) ;
80- } )
81+ return testTitleEditDialog ( titleEditPathSelector , titleDrop , false ) ;
82+ } ) ;
8183 } ) ;
8284
8385 } ) ;
@@ -100,7 +102,9 @@ describe('Page - Authoring', function () {
100102 } ) ;
101103
102104 it ( 'check edit dialog availability of Title' , function ( ) {
103- testTitleEditDialog ( titleEditPathSelector , titleDrop , true ) ;
105+ cy . cleanTitleTest ( titleEditPath ) . then ( ( ) => {
106+ testTitleEditDialog ( titleEditPathSelector , titleDrop , true ) ;
107+ } ) ;
104108 } ) ;
105109
106110 } ) ;
@@ -121,22 +125,27 @@ describe('Page - Authoring', function () {
121125
122126 it ( 'Selecting default pattern from the policy and it should be selected by default' , function ( ) {
123127 cy . get ( titlePolicy ) . click ( { force : true } ) ;
124- cy . get ( bemDesignDialog ) . contains ( 'Title' ) . click ( ) ;
125- cy . get ( '[name="./type"]' ) . eq ( 0 ) . click ( { force : true } ) . then ( ( ) => {
126- cy . get ( 'coral-selectlist-item' ) . contains ( defaultValue ) . click ( { force : true } ) ;
127- cy . get ( '[name="./type"]' ) . eq ( 0 ) . should ( 'contain' , defaultValue ) ;
128- cy . get ( '[placeholder="New policy"]' ) . eq ( 1 ) . type ( "Default policy" ) ;
129- cy . get ( '[title="Done"]' ) . click ( ) ;
130- } ) . then ( ( ) => {
128+ cy . get ( bemDesignDialog ) . contains ( 'Title' ) . click ( { force : true } ) ;
129+ cy . get ( '[name="./type"]' ) . eq ( 0 ) . click ( { force : true } ) ;
130+
131+ // Handle coral-selectlist-item visibility issue
132+ cy . get ( 'coral-selectlist-item' ) . contains ( defaultValue ) . click ( { force : true } ) ;
133+
134+ // Verify the selection was made
135+ cy . get ( '[name="./type"]' ) . eq ( 0 ) . should ( 'contain' , defaultValue ) ;
136+ cy . get ( '[placeholder="New policy"]' ) . eq ( 1 ) . type ( "Default policy" , { force : true } ) ;
137+ cy . get ( '[title="Done"]' ) . click ( { force : true } ) ;
138+
139+ cy . cleanTitleTest ( titleEditPath ) . then ( ( ) => {
131140 cy . openSiteAuthoring ( pagePath ) ;
132141 dropTitleInContainer ( ) ;
133142 // Switching from edit layer to preview layer is flaky, so using previewForm method
134143 cy . previewForm ( pagePath + ".html" ) ;
135- cy . get ( "h2" ) . should ( "be.visible" ) ;
144+ cy . get ( "h2" ) . should ( 'exist' ) ;
136145 cy . openPage ( "" ) ;
137146 cy . openSiteAuthoring ( pagePath ) ;
138147 cy . deleteComponentByTitle ( 'Adaptive Form Title' ) ;
139- } )
148+ } ) ;
140149 } ) ;
141150 } ) ;
142151
0 commit comments