@@ -10,8 +10,8 @@ describe('Test Free - gutenberg', function() {
10
10
} ) ;
11
11
12
12
it ( 'Create all charts' , function ( ) {
13
- // cy.create_available_charts(Cypress.env('chart_types').free);
14
- cy . create_available_charts ( 1 ) ;
13
+ cy . create_available_charts ( Cypress . env ( 'chart_types' ) . free ) ;
14
+ // cy.create_available_charts(1);
15
15
} ) ;
16
16
17
17
it ( 'Verify insertion of charts' , function ( ) {
@@ -20,37 +20,35 @@ describe('Test Free - gutenberg', function() {
20
20
// get rid of that irritating popup
21
21
cy . get ( '.nux-dot-tip__disable' ) . click ( ) ;
22
22
23
- // insert a visualizer block
24
- cy . get ( 'div.edit-post-header-toolbar .block-editor-inserter button' ) . click ( ) ;
25
- cy . get ( '.components-popover__content' ) . then ( function ( $popup ) {
26
- cy . wrap ( $popup ) . find ( '.block-editor-inserter__search' ) . type ( 'visua' ) ;
27
- cy . wrap ( $popup ) . find ( '.block-editor-inserter__results ul.block-editor-block-types-list li' ) . should ( 'have.length' , 1 ) ;
28
- cy . wrap ( $popup ) . find ( '.block-editor-inserter__results ul.block-editor-block-types-list li button' ) . click ( ) ;
29
- } ) ;
30
-
31
- // see the block has the correct elements.
32
- cy . get ( 'div[data-type="visualizer/chart"]' ) . should ( 'have.length' , 1 ) ;
33
- cy . get ( '.visualizer-settings__content-option' ) . should ( 'have.length' , 2 ) ;
34
-
35
- cy . get ( '.visualizer-settings__content-option' ) . last ( ) . click ( ) ;
36
- cy . wait ( Cypress . env ( 'wait' ) ) ;
37
-
38
-
39
23
var charts = [ ] ;
40
24
for ( var i = 1 ; i <= parseInt ( Cypress . env ( 'chart_types' ) . free ) ; i ++ ) {
41
- // charts.push(i);
25
+ charts . push ( i ) ;
42
26
}
43
- charts . push ( 1 ) ;
27
+ // charts.push(1);charts.push(2 );
44
28
45
29
cy . wrap ( charts ) . each ( ( num , i , array ) => {
46
- cy . get ( '.visualizer-settings .visualizer-settings__charts-single:nth-child(' + num + ')' ) . find ( '.visualizer-settings__charts-controls' ) . click ( ) ;
47
- cy . wait ( Cypress . env ( 'wait' ) ) ;
48
- cy . get ( '.visualizer-settings .visualizer-settings__chart' ) . should ( 'have.length' , 1 ) ;
49
- cy . get ( '.visualizer-settings .visualizer-settings__chart > div' ) . should ( 'have.length' , 1 ) ;
50
- cy . get ( '.visualizer-settings .components-button-group button' ) . should ( 'have.length' , 2 ) ;
51
- // go back to insert another one.
52
- cy . get ( '.visualizer-settings .components-button-group button' ) . first ( ) . click ( ) ;
53
- cy . wait ( Cypress . env ( 'wait' ) ) ;
30
+ // insert a visualizer block
31
+ cy . get ( 'div.edit-post-header-toolbar .block-editor-inserter button' ) . click ( ) ;
32
+ cy . get ( '.components-popover__content' ) . then ( function ( $popup ) {
33
+ cy . wrap ( $popup ) . find ( '.block-editor-inserter__search' ) . type ( 'visua' ) ;
34
+ cy . wrap ( $popup ) . find ( '.block-editor-inserter__results ul.block-editor-block-types-list li' ) . should ( 'have.length' , 1 ) ;
35
+ cy . wrap ( $popup ) . find ( '.block-editor-inserter__results ul.block-editor-block-types-list li button' ) . click ( ) ;
36
+ } ) ;
37
+
38
+ // see the block has the correct elements.
39
+ cy . get ( 'div[data-type="visualizer/chart"]' ) . should ( 'have.length' , num ) ;
40
+ cy . get ( 'div[data-type="visualizer/chart"]:nth-child(' + num + ')' ) . then ( ( $block ) => {
41
+ cy . wrap ( $block ) . find ( '.visualizer-settings__content-option' ) . should ( 'have.length' , 2 ) ;
42
+
43
+ cy . wrap ( $block ) . find ( '.visualizer-settings__content-option' ) . last ( ) . click ( ) ;
44
+ cy . wait ( Cypress . env ( 'wait' ) ) ;
45
+
46
+ cy . wrap ( $block ) . find ( '.visualizer-settings .visualizer-settings__charts-single:nth-child(' + num + ') .visualizer-settings__charts-controls' ) . click ( ) ;
47
+ cy . wait ( Cypress . env ( 'wait' ) ) ;
48
+ cy . wrap ( $block ) . find ( '.visualizer-settings .visualizer-settings__chart' ) . should ( 'have.length' , 1 ) ;
49
+ cy . wrap ( $block ) . find ( '.visualizer-settings .visualizer-settings__chart > div' ) . should ( 'have.length' , 1 ) ;
50
+ cy . wrap ( $block ) . find ( '.visualizer-settings .components-button-group button' ) . should ( 'have.length' , 2 ) ;
51
+ } ) ;
54
52
} ) ;
55
53
} ) ;
56
54
0 commit comments