[TSVB] [AT] implement new test cases for time series formatter (#37506) (#38124)

* implement new test cases for time series formatter
This commit is contained in:
Vitali Haradkou 2019-06-06 10:59:59 +03:00 committed by GitHub
parent d898d77e6d
commit b6ae2f7a34
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 40 additions and 1 deletions

View file

@ -78,7 +78,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
expect(series.length).to.be(2);
});
it('should show the correct count in the legend with custom numeric template', async () => {
it('should show the correct count in the legend with custom numeric formatter', async () => {
const expectedLegendValue = '$ 156';
await visualBuilder.clickSeriesOption();
@ -86,6 +86,33 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
const actualCount = await visualBuilder.getRhythmChartLegendValue();
expect(actualCount).to.be(expectedLegendValue);
});
it('should show the correct count in the legend with percent formatter', async () => {
const expectedLegendValue = '15,600%';
await visualBuilder.clickSeriesOption();
await visualBuilder.changeDataFormatter('Percent');
const actualCount = await visualBuilder.getRhythmChartLegendValue();
expect(actualCount).to.be(expectedLegendValue);
});
it('should show the correct count in the legend with bytes formatter', async () => {
const expectedLegendValue = '156B';
await visualBuilder.clickSeriesOption();
await visualBuilder.changeDataFormatter('Bytes');
const actualCount = await visualBuilder.getRhythmChartLegendValue();
expect(actualCount).to.be(expectedLegendValue);
});
it('should show the correct count in the legend with duration formatter', async () => {
const expectedLegendValue = '156.00';
await visualBuilder.clickSeriesOption();
await visualBuilder.changeDataFormatter('Duration');
const actualCount = await visualBuilder.getRhythmChartLegendValue();
expect(actualCount).to.be(expectedLegendValue);
});
});
});
}

View file

@ -218,6 +218,18 @@ export function VisualBuilderPageProvider({ getService, getPageObjects }: FtrPro
await testSubjects.clickWhenNotDisabled('applyBtn');
}
/**
* change the data formatter for template in an `options` label tab
*
* @param formatter - typeof formatter which you can use for presenting data. By default kibana show `Number` formatter
*/
public async changeDataFormatter(
formatter: 'Bytes' | 'Number' | 'Percent' | 'Duration' | 'Custom'
) {
const [formatterEl] = await find.allByCssSelector('.euiComboBox');
await comboBox.setElement(formatterEl, formatter);
}
/**
* write template for aggregation row in the `option` tab
*