@@ -121,11 +121,47 @@ describe('Nextcloud integration', function() {
121121 cy . get ( '.modal-container__content' ) . should ( 'be.visible' )
122122 } )
123123
124- it ( 'Smart picker' , function ( ) {
125- cy . get ( '@loleafletframe' ) . within ( ( ) => {
126- cy . get ( '#Insert-tab-label' ) . click ( )
127- cy . get ( '#insert-insert-remote-link-button' ) . click ( )
124+ describe ( 'Smart picker' , function ( ) {
125+ describe ( 'Link to office document section' , function ( ) {
126+ beforeEach ( function ( ) {
127+ // Proc the smart picker from Collabora
128+ cy . get ( '@loleafletframe' ) . within ( ( ) => {
129+ cy . get ( '#Insert-tab-label' ) . click ( )
130+ cy . get ( '#insert-insert-remote-link-button' ) . click ( )
131+ } )
132+
133+ // Wait for the reference picker to show
134+ cy . get ( '.reference-picker-modal--content' )
135+ . should ( 'be.visible' )
136+ . as ( 'referencePickerContent' )
137+
138+ // Select "Link to office document section"
139+ cy . get ( '@referencePickerContent' )
140+ . find ( 'input[id="provider-select-input"]' )
141+ . as ( 'smartPickerDropdown' )
142+ cy . get ( '@smartPickerDropdown' ) . click ( )
143+ cy . get ( '@referencePickerContent' )
144+ . contains ( 'Link to office document section' )
145+ . click ( )
146+
147+ // Pick the fixture document
148+ cy . pickFile ( 'document.odt' )
149+ } )
150+
151+ it ( 'Can link to heading' , function ( ) {
152+ cy . get ( '[data-cy-section-label="Headings"]' ) . children ( ) . first ( ) . click ( )
153+ cy . get ( '[data-cy-link-to-section=""]' ) . click ( )
154+ } )
155+
156+ it ( 'Can link to section' , function ( ) {
157+ cy . get ( '[data-cy-section-label="Sections"]' ) . children ( ) . first ( ) . click ( )
158+ cy . get ( '[data-cy-link-to-section=""]' ) . click ( )
159+ } )
160+
161+ it ( 'Can link to image' , function ( ) {
162+ cy . get ( '[data-cy-section-label="Images"]' ) . children ( ) . first ( ) . click ( )
163+ cy . get ( '[data-cy-link-to-section=""]' ) . click ( )
164+ } )
128165 } )
129- cy . get ( '.reference-picker-modal--content' ) . should ( 'be.visible' )
130166 } )
131167} )
0 commit comments