Files
superset2/superset/assets/cypress/integration/explore/visualizations/_pie.js
Krist Wongsuphasawat df64ecaa18 [cypress] Add integration test for area, pie, pivot_table, world_map, dual_line, sunburst, sankey, big_number, bubble, box_plot, treemap (#5924)
* Add integration test for world map

* add pie chart

* add area

* use should for assertion

* update area test

* update it message

* remove null params

* add pivot tests

* remove urlparams

* add dual_line

* add sunburst test

* add big number

* add sankey

* add bubble

* add box plot

* add treemap tests

* combine all vis under single test
2018-10-03 11:44:38 -07:00

54 lines
1.4 KiB
JavaScript

export default () => describe('Pie', () => {
const PIE_FORM_DATA = {
datasource: '3__table',
viz_type: 'pie',
slice_id: 55,
granularity_sqla: 'ds',
time_grain_sqla: 'P1D',
time_range: '100 years ago : now',
metric: 'sum__num',
adhoc_filters: [],
groupby: ['gender'],
row_limit: 50000,
pie_label_type: 'key',
donut: false,
show_legend: true,
show_labels: true,
labels_outside: true,
color_scheme: 'bnbColors',
};
function verify(formData) {
cy.visitChartByParams(JSON.stringify(formData));
cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' });
}
beforeEach(() => {
cy.server();
cy.login();
cy.route('POST', '/superset/explore_json/**').as('getJson');
});
it('should work with ad-hoc metric', () => {
verify(PIE_FORM_DATA);
cy.get('.chart-container .nv-pie .nv-slice path').should('have.length', 2);
});
it('should work with simple filter', () => {
verify({
...PIE_FORM_DATA,
adhoc_filters: [{
expressionType: 'SIMPLE',
subject: 'gender',
operator: '==',
comparator: 'boy',
clause: 'WHERE',
sqlExpression: null,
fromFormData: true,
filterOptionName: 'filter_tqx1en70hh_7nksse7nqic',
}],
});
cy.get('.chart-container .nv-pie .nv-slice path').should('have.length', 1);
});
});