@@ -102,4 +102,44 @@ Soit ("qui n'a pas de document source", () => {
102102
103103Soit ( "qui a un document source" , ( ) => {
104104 cy . get ( '.sources' ) . find ( '.card-body' ) . should ( 'exist' ) ;
105- } ) ;
105+ } ) ;
106+
107+ Soit ( "le document contenant l'image {string} affiché comme document principal" , ( alt ) => {
108+ cy . sign_in ( 'alice' , '/' ) ;
109+ cy . create_glose ( ) ;
110+
111+ context = cy . get ( '.scholium' ) . eq ( 1 ) ;
112+ cy . click_on_contextual_menu_item ( context , 'Add a picture...' ) ;
113+ cy . get ( '[id="image-input"]' ) . selectFile ( '../docs/component_bookshelf.png' , {
114+ force : true ,
115+ } )
116+
117+ cy . get ( 'img[alt="<IMAGE DESCRIPTION>"]' )
118+ . should ( 'not.be.visible' )
119+
120+ cy . click_on_text ( 'content' ) ;
121+ cy . get ( 'textarea' )
122+ . should ( 'be.visible' )
123+ . should ( ( $textarea ) => {
124+ expect ( $textarea . val ( ) . trim ( ) ) . not . to . be . empty ;
125+ } )
126+ . invoke ( 'val' )
127+ . then ( ( text ) => {
128+ const updatedText = text . replace ( / \! \[ .* ?\] / , `![${ alt } ]` ) ;
129+ cy . get ( 'textarea' ) . clear ( ) . type ( updatedText ) ;
130+ } ) ;
131+ cy . get ( 'body' ) . click ( 0 , 0 ) ;
132+
133+ cy . get ( 'img[alt="graphique"]' )
134+ . should ( 'be.visible' )
135+
136+ context = cy . get ( '.scholium' ) . eq ( 1 ) ;
137+ cy . click_on_contextual_menu_item ( context , 'Add a picture...' ) ;
138+ cy . get ( '[id="image-input"]' ) . selectFile ( '../docs/architecture.png' , {
139+ force : true ,
140+ } ) ;
141+ cy . get ( 'img[alt="<IMAGE DESCRIPTION>"]' )
142+ . should ( 'be.visible' )
143+ cy . sign_out ( )
144+ } ) ;
145+
0 commit comments