Skip to content

Commit f6d5cfd

Browse files
Merge pull request #576 from contactashish13/issue-481
change in cypress for moving button to the right menu
2 parents 400fb15 + e802979 commit f6d5cfd

File tree

3 files changed

+31
-16
lines changed

3 files changed

+31
-16
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,4 @@ after_deploy:
8181
- ". ./bin/deploy.sh"
8282
after_failure:
8383
- cat "logs/phpcs.log"
84-
- cat "logs/jslogs.log"
84+
- cat "logs/jslogs.log"

cypress/integration/free-sources.js

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ describe('Test Free - sources', function() {
9595
first_chart_content = Cypress.$('#' + id).html();
9696
});
9797

98-
cy.get('.visualizer-chart-action.visualizer-chart-edit').first().click();
98+
cy.get('.visualizer-chart-action.visualizer-chart-edit').first().click({force:true});
9999

100100
cy.wait( Cypress.env('wait') );
101101

@@ -114,25 +114,38 @@ describe('Test Free - sources', function() {
114114
cy.wrap($body).find('#json-chart-button').click();
115115

116116
cy.wrap($body).find('input[type="url"]#vz-import-json-url').clear().type( fileName, {force:true} );
117-
cy.wrap($body).find('#visualizer-json-fetch').click().then( () => {
117+
cy.wrap($body).find('#visualizer-json-fetch').click({force:true}).then( () => {
118118
cy.wait( Cypress.env('wait') );
119119
cy.wrap($body).find('#visualizer-json-parse').should('be.visible');
120120
cy.wrap($body).find('#vz-import-json-root').should('be.visible');
121-
cy.wrap($body).find('#vz-import-json-root option').should('have.length', 1);
121+
cy.wrap($body).find('#vz-import-json-root option').should('have.length', 2);
122+
cy.wrap($body).find('#vz-import-json-root').invoke('prop', 'selectedIndex', 1);
122123
});
123124

124-
cy.wrap($body).find('#visualizer-json-parse').click().then( () => {
125+
cy.wrap($body).find('#visualizer-json-parse').click({force:true}).then( () => {
125126
cy.wait( Cypress.env('wait') );
126127
cy.wrap($body).find('#json-conclude-form').should('be.visible');
127128
cy.wrap($body).find('.json-table tr').should('have.length', 15);
129+
130+
/*
131+
// TODO: Alert does not get auto accepted
132+
// check alert, if no columns are selected.
133+
const stub = cy.stub();
134+
cy.on('window:alert', stub);
135+
136+
cy.wrap($body).find('#json-chart-button').click().then( () => {
137+
expect(stub.getCall(0)).to.be.calledWith('Please select a few columns to include in the chart.');
138+
});
139+
*/
140+
128141
cy.wrap($body).find('.json-table tbody tr td select').each( function( el, index ) {
129142
if(index === 0){
130143
cy.wrap(el).select('date');
131144
}else{
132145
cy.wrap(el).select('number');
133146
}
134147
});
135-
cy.wrap($body).find('#visualizer-json-conclude').click().then( () => {
148+
cy.wrap($body).find('#json-chart-button').click().then( () => {
136149
cy.wait( Cypress.env('wait') );
137150
cy.wrap($body).find('#settings-button').click();
138151
});

js/frame.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -403,19 +403,21 @@
403403
}else{
404404
// toggle from LHS form to chart
405405
$( '#json-conclude-form' ).trigger('submit');
406-
$('body').on('visualizer:json:form:submit', function() {
407-
var filter_button = $bttn;
408-
$( '#visualizer-json-screen' ).css("z-index", "-1").hide();
409-
$('#canvas').lock();
410-
filter_button.val( filter_button.attr( 'data-t-chart' ) );
411-
filter_button.html( filter_button.attr( 'data-t-chart' ) );
412-
filter_button.attr( 'data-current', 'chart' );
413-
end_ajax( $( '#visualizer-json-screen' ) );
414-
$( '#canvas' ).css("z-index", "1").show();
415-
});
416406
}
417407
} );
418408

409+
$('body').on('visualizer:json:form:submit', function() {
410+
var filter_button = $( '#json-chart-button' );
411+
$( '#visualizer-json-screen' ).css("z-index", "-1").hide();
412+
$('#canvas').lock();
413+
filter_button.val( filter_button.attr( 'data-t-chart' ) );
414+
filter_button.html( filter_button.attr( 'data-t-chart' ) );
415+
filter_button.attr( 'data-current', 'chart' );
416+
end_ajax( $( '#visualizer-json-screen' ) );
417+
$( '#canvas' ).css("z-index", "1").show();
418+
});
419+
420+
419421
// fetch the roots for the provided endpoint
420422
$( '#visualizer-json-fetch' ).on( 'click', function(e){
421423
e.preventDefault();

0 commit comments

Comments
 (0)