Skip to content

Commit 820efee

Browse files
cypress tests
1 parent e7efa26 commit 820efee

File tree

2 files changed

+57
-1
lines changed

2 files changed

+57
-1
lines changed

cypress.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@
1414
"plan2": 0
1515
},
1616
"query": "SELECT post_type, count(*) from wp_posts GROUP by post_type",
17-
"wait": 10000
17+
"wait": 10000,
18+
"editors": {
19+
"free": 2,
20+
"selected" : "table"
21+
}
1822
},
1923
"videoUploadOnPasses": false,
2024
"projectId": "yhx2jj"

cypress/integration/free-sources.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,4 +160,56 @@ describe('Test Free - sources', function() {
160160
});
161161
});
162162

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+
163215
})

0 commit comments

Comments
 (0)