Skip to content

Commit

Permalink
adding dissabled aggs functional tests (elastic#20454) (elastic#20458)
Browse files Browse the repository at this point in the history
  • Loading branch information
ppisljar authored Jul 5, 2018
1 parent f85af48 commit 941533e
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/ui/public/vis/editors/default/agg.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
aria-label="Enable aggregation"
tooltip="Enable aggregation"
tooltip-append-to-body="true"
data-test-subj="disableAggregationBtn"
type="button"
class="kuiButton kuiButton--basic kuiButton--small">
<i aria-hidden="true" class="fa fa-toggle-off"></i>
Expand Down
56 changes: 56 additions & 0 deletions test/functional/apps/visualize/_pie_chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,61 @@ export default function ({ getService, getPageObjects }) {
log.debug('pieData.length = ' + pieData.length);
expect(pieData).to.eql(expectedTableData);
});

describe('disabled aggs', () => {
before(async () => {
await PageObjects.visualize.loadSavedVisualization(vizName1);
await PageObjects.visualize.waitForVisualization();
// sleep a bit before trying to get the pie chart data below
await PageObjects.common.sleep(2000);
});

it('should show correct result with one agg disabled', async () => {
const expectedTableData = [ 'win 8', 'win xp', 'win 7', 'ios', 'osx' ];

await PageObjects.visualize.clickAddBucket();
await PageObjects.visualize.clickBucket('Split Slices');
await PageObjects.visualize.selectAggregation('Terms');
await PageObjects.visualize.selectField('machine.os.raw');
await PageObjects.visualize.toggleDisabledAgg(2);
await PageObjects.visualize.clickGo();
await PageObjects.header.waitUntilLoadingHasFinished();

const pieData = await PageObjects.visualize.getPieChartLabels();
log.debug('pieData.length = ' + pieData.length);
expect(pieData).to.eql(expectedTableData);
});

it('should correctly save disabled agg', async () => {
await PageObjects.visualize.saveVisualization(vizName1);
const pageTitle = await PageObjects.common.getBreadcrumbPageTitle();
log.debug(`Save viz page title is ${pageTitle}`);
expect(pageTitle).to.contain(vizName1);
await PageObjects.header.waitForToastMessageGone();
await PageObjects.visualize.loadSavedVisualization(vizName1);
await PageObjects.visualize.waitForVisualization();

const expectedTableData = [ 'win 8', 'win xp', 'win 7', 'ios', 'osx' ];
const pieData = await PageObjects.visualize.getPieChartLabels();
log.debug('pieData.length = ' + pieData.length);
expect(pieData).to.eql(expectedTableData);
});

it('should show correct result when agg is re-enabled', async () => {
await PageObjects.visualize.toggleDisabledAgg(2);
await PageObjects.visualize.clickGo();
await PageObjects.header.waitUntilLoadingHasFinished();

const expectedTableData = [
'0', 'win 7', 'win xp', 'win 8', 'ios', 'osx', '40,000', 'win 8', 'ios', 'win 7', 'win xp', 'osx', '80,000',
'win 7', 'win 8', 'osx', 'win xp', 'ios', '120,000', 'ios', 'win xp', 'win 7', 'win 8', 'osx', '160,000',
'win 8', 'ios', 'win 7', 'win xp', 'osx', '200,000', 'win 8', 'ios', 'win xp', 'win 7', 'osx', '240,000',
'ios', 'win 7', 'win xp', 'win 8', 'osx', '280,000', 'win xp', 'win 8', 'win 7', 'ios', 'osx', '320,000',
'win xp', 'win 7', 'ios', 'win 8', 'osx', '360,000', 'win 7', 'win xp', 'ios', 'win 8', 'osx' ];
const pieData = await PageObjects.visualize.getPieChartLabels();
log.debug('pieData.length = ' + pieData.length);
expect(pieData).to.eql(expectedTableData);
});
});
});
}

0 comments on commit 941533e

Please sign in to comment.