@@ -160,4 +160,56 @@ describe('Test Free - sources', function() {
160
160
} ) ;
161
161
} ) ;
162
162
163
+ it ( 'Manual Data' , function ( ) {
164
+ cy . visit ( Cypress . env ( 'urls' ) . library ) . then ( ( ) => {
165
+ const id = Cypress . $ ( 'div.visualizer-chart div.visualizer-chart-canvas' ) . first ( ) . attr ( 'id' ) ;
166
+ first_chart_content = Cypress . $ ( '#' + id ) . html ( ) ;
167
+ } ) ;
168
+
169
+ cy . get ( '.visualizer-chart-action.visualizer-chart-edit' ) . first ( ) . click ( { force :true } ) ;
170
+
171
+ cy . wait ( Cypress . env ( 'wait' ) ) ;
172
+
173
+ cy . get ( 'iframe' )
174
+ . then ( function ( $iframe ) {
175
+ const $body = $iframe . contents ( ) . find ( 'body' ) ;
176
+
177
+ cy . wrap ( $body ) . find ( '.viz-simple-editor-type.viz-table-editor' ) . should ( 'not.be.visible' ) ;
178
+ cy . wrap ( $body ) . find ( '#viz-editor-type' ) . should ( 'not.be.visible' ) ;
179
+
180
+ cy . wrap ( $body ) . find ( '.viz-group-title.visualizer-editor-tab' ) . click ( ) . then ( ( ) => {
181
+ // check how many editors.
182
+ cy . wrap ( $body ) . find ( '#viz-editor-type option' ) . should ( 'have.length' , Cypress . env ( 'editors' ) . free ) ;
183
+
184
+ // select an editor, save chart and then check if the chart is reloaded with it
185
+ cy . wrap ( $body ) . find ( '#viz-editor-type' ) . select ( Cypress . env ( 'editors' ) . selected ) ;
186
+ cy . wrap ( $body ) . find ( '#editor-button' ) . click ( ) ;
187
+
188
+ cy . wrap ( $body ) . find ( '.viz-simple-editor-type.viz-table-editor' ) . should ( 'be.visible' ) ;
189
+
190
+ cy . wrap ( $body ) . find ( '#editor-button' ) . click ( ) . then ( ( ) => {
191
+ cy . wrap ( $body ) . find ( '.viz-simple-editor-type.viz-table-editor' ) . should ( 'not.be.visible' ) ;
192
+ cy . wrap ( $body ) . find ( '#settings-button' ) . click ( { force :true } ) ;
193
+ } ) ;
194
+ } ) ;
195
+ } ) ;
196
+
197
+ cy . wait ( Cypress . env ( 'wait' ) ) ;
198
+
199
+ // reload the same chart, it should open in the edit tab with the correct editor selected
200
+ cy . get ( '.visualizer-chart-action.visualizer-chart-edit' ) . first ( ) . click ( { force :true } ) ;
201
+
202
+ cy . wait ( Cypress . env ( 'wait' ) ) ;
203
+
204
+ cy . get ( 'iframe' )
205
+ . then ( function ( $iframe ) {
206
+ const $body = $iframe . contents ( ) . find ( 'body' ) ;
207
+
208
+ cy . wrap ( $body ) . find ( '.viz-simple-editor-type.viz-table-editor' ) . should ( 'not.be.visible' ) ;
209
+
210
+ cy . wrap ( $body ) . find ( '#viz-editor-type' ) . should ( 'be.visible' ) ;
211
+ cy . wrap ( $body ) . find ( '#viz-editor-type' ) . invoke ( 'val' ) . should ( 'contain' , Cypress . env ( 'editors' ) . selected ) ;
212
+ } ) ;
213
+ } ) ;
214
+
163
215
} )
0 commit comments