Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/
import { QueryFormData } from '@superset-ui/core';

describe('Visualization > Histogram', () => {
const HISTOGRAM_FORM_DATA = {
const HISTOGRAM_FORM_DATA: QueryFormData = {
datasource: '3__table',
viz_type: 'histogram',
slice_id: 60,
Expand All @@ -36,7 +38,7 @@ describe('Visualization > Histogram', () => {
normalized: false,
};

function verify(formData) {
function verify(formData: QueryFormData) {
cy.visitChartByParams(JSON.stringify(formData));
cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' });
}
Expand Down Expand Up @@ -73,12 +75,10 @@ describe('Visualization > Histogram', () => {
adhoc_filters: [
{
expressionType: 'SIMPLE',
clause: 'WHERE',
subject: 'state',
operator: '==',
comparator: 'CA',
clause: 'WHERE',
sqlExpression: null,
filterOptionName: 'filter_tqx1en70hh_7nksse7nqic',
},
],
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,21 @@ describe('Visualization > Table', () => {
cy.verifySliceSuccess({ waitAlias: '@chartData', chartSelector: 'table' });
});

it('Test table with groupby + order by + no metric', () => {
cy.visitChartByParams({
...VIZ_DEFAULTS,
metrics: [],
groupby: ['name'],
timeseries_limit_metric: NUM_METRIC,
order_desc: true,
});
// should contain only the group by column
cy.get('.chart-container th').its('length').should('eq', 1);
// should order correctly
cy.get('.chart-container td:eq(0)').contains('Michael');
cy.verifySliceSuccess({ waitAlias: '@chartData', chartSelector: 'table' });
});

it('Test table with groupby and limit', () => {
const limit = 10;
const formData = {
Expand All @@ -172,9 +187,9 @@ describe('Visualization > Table', () => {
...VIZ_DEFAULTS,
// should still work when query_mode is not-set/invalid
query_mode: undefined,
all_columns: ['name'],
all_columns: ['state'],
metrics: [],
row_limit: 10,
row_limit: 100,
});

// should display in raw records mode
Expand All @@ -183,8 +198,9 @@ describe('Visualization > Table', () => {
cy.get('div[data-test="groupby"]').should('not.exist');

cy.verifySliceSuccess({ waitAlias: '@chartData', chartSelector: 'table' });
cy.get('[data-test="row-count-label"]').contains('100 rows');

// should allow switch to aggregate mode
// should allow switch back to aggregate mode
cy.get('div[data-test="query_mode"] .btn').contains('Aggregate').click();
cy.get('div[data-test="query_mode"] .btn.active').contains('Aggregate');
cy.get('div[data-test="all_columns"]').should('not.exist');
Expand Down
Loading