Skip to content

Commit 7ceb076

Browse files
cypress: fixes from pro
1 parent 4d41844 commit 7ceb076

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

cypress/support/commands.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,12 @@ import 'cypress-file-upload';
3030

3131
// generates a random number upto max
3232
Cypress.Commands.add( 'get_random_int', (max) => {
33-
return Math.floor(Math.random() * Math.floor(max));
33+
var num = Math.floor(Math.random() * Math.floor(max));
34+
// 0 is 'empty', so generate a
35+
if(num === 0){
36+
num = 1;
37+
}
38+
return num;
3439
});
3540

3641

@@ -221,7 +226,8 @@ Cypress.Commands.add( 'test_advanced_settings', ($create_new_chart) => {
221226
expect(content).to.not.equal(first_chart);
222227
});
223228

224-
cy.get('.visualizer-chart-action.visualizer-chart-edit').first().click();
229+
// if the settings cause the chart to be malformed, an error might show and click has to be forced
230+
cy.get('.visualizer-chart-action.visualizer-chart-edit').first().click({force:true});
225231

226232
cy.wait( Cypress.env('wait') );
227233

0 commit comments

Comments
 (0)