Skip to content

Commit

Permalink
✅ Add more axis tests + value labels
Browse files Browse the repository at this point in the history
  • Loading branch information
dej611 committed Dec 22, 2020
1 parent 69c5dfc commit a1ff774
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
42 changes: 42 additions & 0 deletions x-pack/test/functional/apps/lens/smokescreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,48 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});
});

it('should show value labels on bar charts when enabled', async () => {
// enable value labels
await PageObjects.lens.toggleToolbarPopover('lnsValuesButton');
await testSubjects.click('lnsXY_valueLabels_inside');

// check for value labels
await retry.tryForTime(3000, async () => {
const data = await PageObjects.lens.getCurrentChartDebugState();
expect(data?.bars?.[0].labels).not.to.eql(0);
});

// switch to stacked bar chart
await PageObjects.lens.switchToVisualization('bar_stacked');

// check for value labels
await retry.tryForTime(3000, async () => {
const data = await PageObjects.lens.getCurrentChartDebugState();
expect(data?.bars?.[0].labels.length).to.eql(0);
});
});

it('should override axis title', async () => {
const axisTitle = 'overridden axis';
await PageObjects.lens.toggleToolbarPopover('lnsLeftAxisButton');
await testSubjects.setValue('lnsyLeftAxisTitle', axisTitle, {
clearWithKeyboard: true,
});

await retry.tryForTime(3000, async () => {
const data = await PageObjects.lens.getCurrentChartDebugState();
expect(data?.axes?.y?.[0].title).to.eql(axisTitle);
});

// hide the gridlines
await testSubjects.click('lnsshowyLeftAxisGridlines');

await retry.tryForTime(3000, async () => {
const data = await PageObjects.lens.getCurrentChartDebugState();
expect(data?.axes?.y?.[0].gridlines.length).to.eql(0);
});
});

it('should transition from a multi-layer stacked bar to donut chart using suggestions', async () => {
await PageObjects.visualize.navigateToNewVisualization();
await PageObjects.visualize.clickVisType('lens');
Expand Down
4 changes: 4 additions & 0 deletions x-pack/test/functional/page_objects/lens_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont
});
},

async toggleToolbarPopover(buttonTestSub: string) {
await testSubjects.click(buttonTestSub);
},

/**
* Open the specified dimension.
*
Expand Down

0 comments on commit a1ff774

Please sign in to comment.