@@ -11,10 +11,10 @@ describe('Test Free - gutenberg', function() {
11
11
12
12
it ( 'Create all charts' , function ( ) {
13
13
//cy.create_available_charts(Cypress.env('chart_types').free);
14
- cy . create_available_charts ( 1 ) ;
14
+ cy . create_available_charts ( 1 ) ;
15
15
} ) ;
16
16
17
- it ( 'Verify insertion of charts' , function ( ) {
17
+ it . skip ( 'Verify insertion of charts - using load more ' , function ( ) {
18
18
cy . visit ( '/post-new.php' ) ;
19
19
20
20
// get rid of that irritating popup
@@ -40,14 +40,14 @@ describe('Test Free - gutenberg', function() {
40
40
for ( var i = 0 ; i < Math . ceil ( parseInt ( Cypress . env ( 'chart_types' ) . free ) / 6 ) ; i ++ ) {
41
41
$pages . push ( i ) ;
42
42
}
43
- $pages = [ 0 ] ;
43
+ $pages = [ 0 ] ;
44
44
cy . wrap ( $pages ) . each ( ( page , i , array ) => {
45
45
var charts = [ ] ;
46
46
cy . wrap ( page ) . then ( ( ) => {
47
47
for ( var i = page * 6 ; i < ( ( ( page * 6 ) + 6 ) > Cypress . env ( 'chart_types' ) . free ? Cypress . env ( 'chart_types' ) . free : ( ( page * 6 ) + 6 ) ) ; i ++ ) {
48
48
charts . push ( i + 1 ) ;
49
49
}
50
- charts = [ 1 ] ;
50
+ charts = [ 1 ] ;
51
51
} ) . then ( ( ) => {
52
52
cy . wrap ( charts ) . each ( ( num , i , array ) => {
53
53
if ( page > 0 ) {
@@ -82,4 +82,55 @@ describe('Test Free - gutenberg', function() {
82
82
} ) ;
83
83
} ) ;
84
84
85
+
86
+ it ( 'Verify insertion of charts - not using load more' , function ( ) {
87
+ cy . visit ( '/post-new.php' ) ;
88
+
89
+ // get rid of that irritating popup
90
+ cy . get ( '.nux-dot-tip__disable' ) . click ( ) ;
91
+
92
+ // insert a visualizer block
93
+ cy . get ( 'div.edit-post-header-toolbar .block-editor-inserter button' ) . click ( ) ;
94
+ cy . get ( '.components-popover__content' ) . then ( function ( $popup ) {
95
+ cy . wrap ( $popup ) . find ( '.block-editor-inserter__search' ) . type ( 'visua' ) ;
96
+ cy . wrap ( $popup ) . find ( '.block-editor-inserter__results ul.block-editor-block-types-list li' ) . should ( 'have.length' , 1 ) ;
97
+ cy . wrap ( $popup ) . find ( '.block-editor-inserter__results ul.block-editor-block-types-list li button' ) . click ( ) ;
98
+ } ) ;
99
+
100
+ // see the block has the correct elements.
101
+ cy . get ( 'div[data-type="visualizer/chart"]' ) . should ( 'have.length' , 1 ) ;
102
+ cy . get ( '.visualizer-settings__content-option' ) . should ( 'have.length' , 2 ) ;
103
+
104
+ cy . get ( '.visualizer-settings__content-option' ) . last ( ) . click ( ) ;
105
+ cy . wait ( Cypress . env ( 'wait' ) ) ;
106
+
107
+
108
+ var charts = [ ] ;
109
+ for ( var i = 1 ; i <= parseInt ( Cypress . env ( 'chart_types' ) . free ) ; i ++ ) {
110
+ //charts.push(i);
111
+ }
112
+ charts . push ( 1 ) ;
113
+
114
+ cy . wrap ( charts ) . each ( ( num , i , array ) => {
115
+ cy . get ( '.visualizer-settings' ) . then ( ( $div ) => {
116
+ // insert the chart.
117
+ cy . wrap ( $div ) . find ( '.visualizer-settings__charts-single:nth-child(' + num + ')' ) . then ( ( $chart ) => {
118
+ cy . wrap ( $chart ) . find ( '.visualizer-settings__charts-controls' ) . click ( ) . then ( ( ) => {
119
+ cy . wait ( Cypress . env ( 'wait' ) ) ;
120
+ cy . get ( '.visualizer-settings' ) . then ( ( $div ) => {
121
+ // check if inserted
122
+ cy . wrap ( $div ) . find ( '.visualizer-settings__chart' ) . should ( 'have.length' , 1 ) ;
123
+ cy . wrap ( $div ) . find ( '.visualizer-settings__chart > div' ) . should ( 'have.length' , 1 ) ;
124
+ cy . wrap ( $div ) . find ( '.components-button-group button' ) . should ( 'have.length' , 2 ) ;
125
+
126
+ // go back to insert another one.
127
+ cy . wrap ( $div ) . find ( '.components-button-group button' ) . first ( ) . click ( ) ;
128
+ cy . wait ( Cypress . env ( 'wait' ) ) ;
129
+ } ) ;
130
+ } ) ;
131
+ } ) ;
132
+ } ) ;
133
+ } ) ;
134
+ } ) ;
135
+
85
136
} )
0 commit comments