mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
* Show missing switch button * Add functional tests Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> # Conflicts: # src/plugins/vis_type_vislib/public/components/options/point_series/point_series.tsx # test/functional/page_objects/visualize_chart_page.ts # test/functional/page_objects/visualize_editor_page.ts
This commit is contained in:
parent
f02ea8b648
commit
7a7c9f97c4
4 changed files with 49 additions and 1 deletions
|
@ -66,8 +66,9 @@ function PointSeriesOptions(props: ValidationVisOptionsProps<BasicVislibParams>)
|
|||
/>
|
||||
)}
|
||||
|
||||
{vis.type.type === 'histogram' && (
|
||||
{vis.type.name === 'histogram' && (
|
||||
<SwitchOption
|
||||
data-test-subj="showValuesOnChart"
|
||||
label={i18n.translate('visTypeVislib.editors.pointSeries.showLabels', {
|
||||
defaultMessage: 'Show values on chart',
|
||||
})}
|
||||
|
|
|
@ -192,6 +192,38 @@ export default function({ getService, getPageObjects }) {
|
|||
});
|
||||
});
|
||||
|
||||
describe('show values on chart', () => {
|
||||
before(async () => {
|
||||
await PageObjects.visualize.navigateToNewVisualization();
|
||||
await PageObjects.visualize.clickVerticalBarChart();
|
||||
await PageObjects.visualize.clickNewSearch();
|
||||
await PageObjects.timePicker.setDefaultAbsoluteRange();
|
||||
log.debug('Bucket = X-axis');
|
||||
await PageObjects.visEditor.clickBucket('X-axis');
|
||||
log.debug('Aggregation = Terms');
|
||||
await PageObjects.visEditor.selectAggregation('Terms');
|
||||
log.debug('Field = geo.src');
|
||||
await PageObjects.visEditor.selectField('geo.src');
|
||||
await PageObjects.visEditor.clickGo();
|
||||
log.debug('Open Options tab');
|
||||
await PageObjects.visEditor.clickOptionsTab();
|
||||
});
|
||||
|
||||
it('should show values on bar chart', async () => {
|
||||
await PageObjects.visEditor.toggleValuesOnChart();
|
||||
await PageObjects.visEditor.clickGo();
|
||||
const values = await PageObjects.visChart.getChartValues();
|
||||
expect(values).to.eql(['2,592', '2,373', '1,194', '489', '415']);
|
||||
});
|
||||
|
||||
it('should hide values on bar chart', async () => {
|
||||
await PageObjects.visEditor.toggleValuesOnChart();
|
||||
await PageObjects.visEditor.clickGo();
|
||||
const values = await PageObjects.visChart.getChartValues();
|
||||
expect(values.length).to.be(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('custom labels and axis titles', function() {
|
||||
const visName = 'Visualization Point Series Test';
|
||||
const customLabel = 'myLabel';
|
||||
|
|
|
@ -379,6 +379,17 @@ export function VisualizeChartPageProvider({ getService, getPageObjects }: FtrPr
|
|||
);
|
||||
return values.filter(item => item.length > 0);
|
||||
}
|
||||
|
||||
public async getChartValues() {
|
||||
const elements = await find.allByCssSelector('.series.histogram text');
|
||||
const values = await Promise.all(
|
||||
elements.map(async element => {
|
||||
const text = await element.getVisibleText();
|
||||
return text;
|
||||
})
|
||||
);
|
||||
return values;
|
||||
}
|
||||
}
|
||||
|
||||
return new VisualizeChart();
|
||||
|
|
|
@ -487,6 +487,10 @@ export function VisualizeEditorPageProvider({ getService, getPageObjects }: FtrP
|
|||
}
|
||||
await options[optionIndex].click();
|
||||
}
|
||||
|
||||
public async toggleValuesOnChart() {
|
||||
return await testSubjects.click('showValuesOnChart');
|
||||
}
|
||||
}
|
||||
|
||||
return new VisualizeEditorPage();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue