@@ -41,44 +41,43 @@ describe('Test Free - gutenberg', function() {
41
41
}
42
42
cy . wrap ( $pages ) . each ( ( page , i , array ) => {
43
43
var charts = [ ] ;
44
- cy . wrap ( charts ) . then ( ( ) => {
44
+ cy . wrap ( page ) . then ( ( ) => {
45
45
for ( var i = page * 6 ; i < ( ( ( page * 6 ) + 6 ) > Cypress . env ( 'chart_types' ) . free ? Cypress . env ( 'chart_types' ) . free : ( ( page * 6 ) + 6 ) ) ; i ++ ) {
46
46
charts . push ( i + 1 ) ;
47
47
}
48
- } ) ;
49
-
50
- cy . wrap ( charts ) . each ( ( num , i , array ) => {
51
- if ( page > 0 ) {
52
- // click load more for every page except the first.
53
- cy . get ( '.visualizer-settings' ) . then ( ( $div ) => {
54
- cy . wrap ( $div ) . find ( '.visualizer-settings__charts .components-button' ) . click ( ) ;
55
- } ) ;
56
- cy . wait ( Cypress . env ( 'wait' ) ) ;
57
- }
48
+ } ) . then ( ( ) => {
49
+ cy . wrap ( charts ) . each ( ( num , i , array ) => {
50
+ if ( page > 0 ) {
51
+ // click load more for every page except the first.
52
+ cy . get ( '.visualizer-settings' ) . then ( ( $div ) => {
53
+ cy . wrap ( $div ) . find ( '.visualizer-settings__charts .components-button' ) . click ( ) ;
54
+ } ) ;
55
+ cy . wait ( Cypress . env ( 'wait' ) ) ;
56
+ }
58
57
59
- cy . get ( '.visualizer-settings' ) . then ( ( $div ) => {
60
- // insert the chart.
61
- cy . wrap ( $div ) . find ( '.visualizer-settings__charts-single:nth-child(' + num + ')' ) . then ( ( $chart ) => {
62
- cy . wrap ( $chart ) . find ( '.visualizer-settings__charts-controls' ) . click ( ) ;
63
- } ) ;
64
- } )
65
- . then ( ( ) => {
66
- cy . wait ( Cypress . env ( 'wait' ) ) ;
67
58
cy . get ( '.visualizer-settings' ) . then ( ( $div ) => {
68
- // check if inserted
69
- cy . wrap ( $div ) . find ( '.visualizer-settings__chart' ) . should ( 'have.length' , 1 ) ;
70
- cy . wrap ( $div ) . find ( '.visualizer-settings__chart > div' ) . should ( 'have.length' , 1 ) ;
71
- cy . wrap ( $div ) . find ( '.components-button-group button' ) . should ( 'have.length' , 2 ) ;
72
-
73
- // go back to insert another one.
74
- cy . wrap ( $div ) . find ( '.components-button-group button' ) . first ( ) . click ( ) ;
59
+ // insert the chart.
60
+ cy . wrap ( $div ) . find ( '.visualizer-settings__charts-single:nth-child(' + num + ')' ) . then ( ( $chart ) => {
61
+ cy . wrap ( $chart ) . find ( '.visualizer-settings__charts-controls' ) . click ( ) ;
62
+ } ) ;
63
+ } )
64
+ . then ( ( ) => {
75
65
cy . wait ( Cypress . env ( 'wait' ) ) ;
66
+ cy . get ( '.visualizer-settings' ) . then ( ( $div ) => {
67
+ // check if inserted
68
+ cy . wrap ( $div ) . find ( '.visualizer-settings__chart' ) . should ( 'have.length' , 1 ) ;
69
+ cy . wrap ( $div ) . find ( '.visualizer-settings__chart > div' ) . should ( 'have.length' , 1 ) ;
70
+ cy . wrap ( $div ) . find ( '.components-button-group button' ) . should ( 'have.length' , 2 ) ;
71
+
72
+ // go back to insert another one.
73
+ cy . wrap ( $div ) . find ( '.components-button-group button' ) . first ( ) . click ( ) ;
74
+ cy . wait ( Cypress . env ( 'wait' ) ) ;
75
+ } ) ;
76
76
} ) ;
77
77
} ) ;
78
78
} ) ;
79
79
} ) ;
80
80
81
- expect ( 1 ) . to . equal ( 1 ) ;
82
81
} ) ;
83
82
84
83
} )
0 commit comments