Skip to content

Commit a1ff774

Browse files
committed
✅ Add more axis tests + value labels
1 parent 69c5dfc commit a1ff774

2 files changed

Lines changed: 46 additions & 0 deletions

File tree

x-pack/test/functional/apps/lens/smokescreen.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,48 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
230230
});
231231
});
232232

233+
it('should show value labels on bar charts when enabled', async () => {
234+
// enable value labels
235+
await PageObjects.lens.toggleToolbarPopover('lnsValuesButton');
236+
await testSubjects.click('lnsXY_valueLabels_inside');
237+
238+
// check for value labels
239+
await retry.tryForTime(3000, async () => {
240+
const data = await PageObjects.lens.getCurrentChartDebugState();
241+
expect(data?.bars?.[0].labels).not.to.eql(0);
242+
});
243+
244+
// switch to stacked bar chart
245+
await PageObjects.lens.switchToVisualization('bar_stacked');
246+
247+
// check for value labels
248+
await retry.tryForTime(3000, async () => {
249+
const data = await PageObjects.lens.getCurrentChartDebugState();
250+
expect(data?.bars?.[0].labels.length).to.eql(0);
251+
});
252+
});
253+
254+
it('should override axis title', async () => {
255+
const axisTitle = 'overridden axis';
256+
await PageObjects.lens.toggleToolbarPopover('lnsLeftAxisButton');
257+
await testSubjects.setValue('lnsyLeftAxisTitle', axisTitle, {
258+
clearWithKeyboard: true,
259+
});
260+
261+
await retry.tryForTime(3000, async () => {
262+
const data = await PageObjects.lens.getCurrentChartDebugState();
263+
expect(data?.axes?.y?.[0].title).to.eql(axisTitle);
264+
});
265+
266+
// hide the gridlines
267+
await testSubjects.click('lnsshowyLeftAxisGridlines');
268+
269+
await retry.tryForTime(3000, async () => {
270+
const data = await PageObjects.lens.getCurrentChartDebugState();
271+
expect(data?.axes?.y?.[0].gridlines.length).to.eql(0);
272+
});
273+
});
274+
233275
it('should transition from a multi-layer stacked bar to donut chart using suggestions', async () => {
234276
await PageObjects.visualize.navigateToNewVisualization();
235277
await PageObjects.visualize.clickVisType('lens');

x-pack/test/functional/page_objects/lens_page.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,10 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont
191191
});
192192
},
193193

194+
async toggleToolbarPopover(buttonTestSub: string) {
195+
await testSubjects.click(buttonTestSub);
196+
},
197+
194198
/**
195199
* Open the specified dimension.
196200
*

0 commit comments

Comments
 (0)