Fix visualize tests (#34390)
* wait for rendering * run ciGroup12 x60 times * [visualize/_tsvb_chart] redesign tests * wait for viz initial loading before navigation * [visualize/_tsvb_chart] assert tab is loaded * Revert "wait for viz initial loading before navigation" This reverts commit1023db4fb9
. * [TSVB] [Performance]request for api/metrics/fields triggered after all UI changes Fix: #34433 * [TSVB] [Performance]request for api/metrics/fields triggered after all UI changes - prevent reRender in case of no changes Fix: #34433 * improve tests * Revert "[TSVB] [Performance]request for api/metrics/fields triggered after all UI changes - prevent reRender in case of no changes" This reverts commita04ed55103
. * Revert "[TSVB] [Performance]request for api/metrics/fields triggered after all UI changes" This reverts commit040f0b106b
. * Revert "run ciGroup12 x60 times" This reverts commitc38427f67f
. * rename dataTestSubj
This commit is contained in:
parent
34cd8a3c67
commit
aa08669ca3
|
@ -132,7 +132,7 @@ class VisEditor extends Component {
|
|||
|
||||
if (model) {
|
||||
return (
|
||||
<div className="tvbEditor">
|
||||
<div className="tvbEditor" data-test-subj="tvbVisEditor">
|
||||
<div className="tvbEditor--hideForReporting">
|
||||
<VisPicker model={model} onChange={this.handleChange}/>
|
||||
</div>
|
||||
|
|
|
@ -172,6 +172,7 @@ class Gauge extends Component {
|
|||
<div
|
||||
ref={(el) => this.resize = el}
|
||||
className={`tvbVisGauge__resize`}
|
||||
data-test-subj="tvbVisGaugeContainer"
|
||||
>
|
||||
{ metrics }
|
||||
<GaugeVis {...gaugeProps}/>
|
||||
|
|
|
@ -119,7 +119,7 @@ class TopN extends Component {
|
|||
|
||||
return (
|
||||
<div className={className}>
|
||||
<table className="tvbVisTopN__table" ref={this.tableRef}>
|
||||
<table className="tvbVisTopN__table" data-test-subj="tvbVisTopNTable" ref={this.tableRef}>
|
||||
<tbody>
|
||||
{ rows }
|
||||
</tbody>
|
||||
|
|
|
@ -25,82 +25,47 @@ export default function({ getService, getPageObjects }: FtrProviderContext) {
|
|||
const esArchiver = getService('esArchiver');
|
||||
const log = getService('log');
|
||||
const inspector = getService('inspector');
|
||||
const retry = getService('retry');
|
||||
const kibanaServer = getService('kibanaServer');
|
||||
const testSubjects = getService('testSubjects');
|
||||
const PageObjects = getPageObjects([
|
||||
'common',
|
||||
'visualize',
|
||||
'header',
|
||||
'settings',
|
||||
'visualBuilder',
|
||||
'timePicker',
|
||||
]);
|
||||
const PageObjects = getPageObjects(['visualize', 'visualBuilder', 'timePicker']);
|
||||
|
||||
describe('visual builder', function describeIndexTests() {
|
||||
beforeEach(async () => {
|
||||
await PageObjects.visualize.navigateToNewVisualization();
|
||||
await PageObjects.visualize.clickVisualBuilder();
|
||||
await PageObjects.visualBuilder.checkVisualBuilderIsPresent();
|
||||
});
|
||||
|
||||
// FAILING: https://github.com/elastic/kibana/issues/34299
|
||||
// FAILING: https://github.com/elastic/kibana/issues/34292
|
||||
describe.skip('visual builder', function describeIndexTests() {
|
||||
describe('Time Series', () => {
|
||||
before(async () => {
|
||||
beforeEach(async () => {
|
||||
await PageObjects.visualBuilder.resetPage();
|
||||
});
|
||||
|
||||
it('should show the correct count in the legend', async () => {
|
||||
await retry.try(async () => {
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
const actualCount = await PageObjects.visualBuilder.getRhythmChartLegendValue();
|
||||
expect(actualCount).to.be('156');
|
||||
});
|
||||
});
|
||||
|
||||
it('should show the correct count in the legend with 2h offset', async () => {
|
||||
await PageObjects.visualBuilder.clickSeriesOption();
|
||||
await PageObjects.visualBuilder.enterOffsetSeries('2h');
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
const actualCount = await PageObjects.visualBuilder.getRhythmChartLegendValue();
|
||||
expect(actualCount).to.be('293');
|
||||
});
|
||||
|
||||
it('should show the correct count in the legend with -2h offset', async () => {
|
||||
await PageObjects.visualBuilder.clickSeriesOption();
|
||||
await PageObjects.visualBuilder.enterOffsetSeries('-2h');
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
const actualCount = await PageObjects.visualBuilder.getRhythmChartLegendValue();
|
||||
expect(actualCount).to.be('53');
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
// set back to no offset for the next test, an empty string didn't seem to work here
|
||||
await PageObjects.visualBuilder.enterOffsetSeries('0h');
|
||||
});
|
||||
});
|
||||
|
||||
describe('Math Aggregation', () => {
|
||||
before(async () => {
|
||||
await PageObjects.visualBuilder.resetPage();
|
||||
await PageObjects.visualBuilder.clickMetric();
|
||||
await PageObjects.visualBuilder.createNewAgg();
|
||||
await PageObjects.visualBuilder.selectAggType('math', 1);
|
||||
await PageObjects.visualBuilder.fillInVariable();
|
||||
await PageObjects.visualBuilder.fillInExpression('params.test + 1');
|
||||
});
|
||||
|
||||
it('should not have inspector enabled', async () => {
|
||||
await inspector.expectIsNotEnabled();
|
||||
});
|
||||
|
||||
it('should show correct data', async () => {
|
||||
const expectedMetricValue = '157';
|
||||
const value = await PageObjects.visualBuilder.getMetricValue();
|
||||
log.debug(`metric value: ${JSON.stringify(value)}`);
|
||||
log.debug(`metric value: ${value}`);
|
||||
expect(value).to.eql(expectedMetricValue);
|
||||
});
|
||||
});
|
||||
|
||||
describe('metric', () => {
|
||||
before(async () => {
|
||||
beforeEach(async () => {
|
||||
await PageObjects.visualBuilder.resetPage();
|
||||
await PageObjects.visualBuilder.clickMetric();
|
||||
await PageObjects.visualBuilder.checkMetricTabIsPresent();
|
||||
});
|
||||
|
||||
it('should not have inspector enabled', async () => {
|
||||
|
@ -108,74 +73,66 @@ export default function({ getService, getPageObjects }: FtrProviderContext) {
|
|||
});
|
||||
|
||||
it('should show correct data', async () => {
|
||||
const expectedMetricValue = '156';
|
||||
await PageObjects.visualize.waitForVisualization();
|
||||
const value = await PageObjects.visualBuilder.getMetricValue();
|
||||
log.debug(`metric value: ${value}`);
|
||||
expect(value).to.eql(expectedMetricValue);
|
||||
expect(value).to.eql('156');
|
||||
});
|
||||
|
||||
it('should show correct data with Math Aggregation', async () => {
|
||||
await PageObjects.visualBuilder.createNewAgg();
|
||||
await PageObjects.visualBuilder.selectAggType('math', 1);
|
||||
await PageObjects.visualBuilder.fillInVariable();
|
||||
await PageObjects.visualBuilder.fillInExpression('params.test + 1');
|
||||
const value = await PageObjects.visualBuilder.getMetricValue();
|
||||
expect(value).to.eql('157');
|
||||
});
|
||||
});
|
||||
|
||||
// add a gauge test
|
||||
describe('gauge', () => {
|
||||
before(async () => {
|
||||
beforeEach(async () => {
|
||||
await PageObjects.visualBuilder.resetPage();
|
||||
await PageObjects.visualBuilder.clickGauge();
|
||||
log.debug('clicked on Gauge');
|
||||
await PageObjects.visualBuilder.checkGaugeTabIsPresent();
|
||||
});
|
||||
|
||||
it('should verify gauge label and count display', async () => {
|
||||
await retry.try(async () => {
|
||||
await PageObjects.visualize.waitForVisualization();
|
||||
await PageObjects.visualize.waitForVisualizationRenderingStabilized();
|
||||
const labelString = await PageObjects.visualBuilder.getGaugeLabel();
|
||||
expect(labelString).to.be('Count');
|
||||
const gaugeCount = await PageObjects.visualBuilder.getGaugeCount();
|
||||
expect(gaugeCount).to.be('156');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// add a top N test
|
||||
describe('topN', () => {
|
||||
before(async () => {
|
||||
beforeEach(async () => {
|
||||
await PageObjects.visualBuilder.resetPage();
|
||||
await PageObjects.visualBuilder.clickTopN();
|
||||
log.debug('clicked on TopN');
|
||||
await PageObjects.visualBuilder.checkTopNTabIsPresent();
|
||||
});
|
||||
|
||||
it('should verify topN label and count display', async () => {
|
||||
await retry.try(async () => {
|
||||
await PageObjects.visualize.waitForVisualization();
|
||||
await PageObjects.visualize.waitForVisualizationRenderingStabilized();
|
||||
const labelString = await PageObjects.visualBuilder.getTopNLabel();
|
||||
expect(labelString).to.be('Count');
|
||||
const gaugeCount = await PageObjects.visualBuilder.getTopNCount();
|
||||
expect(gaugeCount).to.be('156');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// add a table sanity timestamp
|
||||
describe('table', () => {
|
||||
before(async () => {
|
||||
await PageObjects.visualBuilder.resetPage();
|
||||
await PageObjects.visualBuilder.clickTable();
|
||||
await PageObjects.timePicker.setAbsoluteRange(
|
||||
beforeEach(async () => {
|
||||
await PageObjects.visualBuilder.resetPage(
|
||||
'2015-09-22 06:00:00.000',
|
||||
'2015-09-22 11:00:00.000'
|
||||
);
|
||||
log.debug('clicked on Table');
|
||||
await PageObjects.visualBuilder.clickTable();
|
||||
});
|
||||
|
||||
it('should be able to set values for group by field and column name', async () => {
|
||||
it('should display correct values on changing group by field and column name', async () => {
|
||||
await PageObjects.visualBuilder.selectGroupByField('machine.os.raw');
|
||||
await PageObjects.visualBuilder.setLabelValue('OS');
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
log.debug('finished setting field and column name');
|
||||
});
|
||||
|
||||
it('should be able verify that values are displayed in the table', async () => {
|
||||
await PageObjects.visualize.waitForVisualizationRenderingStabilized();
|
||||
const tableData = await PageObjects.visualBuilder.getViewTable();
|
||||
log.debug(`Values on ${tableData}`);
|
||||
const expectedData = 'OS Count\nwin 8 13\nwin xp 10\nwin 7 12\nios 5\nosx 3';
|
||||
expect(tableData).to.be(expectedData);
|
||||
});
|
||||
|
|
|
@ -33,27 +33,46 @@ export function VisualBuilderPageProvider({ getService, getPageObjects }: FtrPro
|
|||
fromTime = '2015-09-19 06:31:44.000',
|
||||
toTime = '2015-09-22 18:31:44.000'
|
||||
) {
|
||||
log.debug('navigateToApp visualize');
|
||||
await PageObjects.visualize.navigateToNewVisualization();
|
||||
log.debug('clickVisualBuilderChart');
|
||||
await PageObjects.visualize.clickVisualBuilder();
|
||||
await PageObjects.common.navigateToUrl('visualize', 'create?type=metrics');
|
||||
log.debug('Set absolute time range from "' + fromTime + '" to "' + toTime + '"');
|
||||
await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime);
|
||||
}
|
||||
|
||||
public async checkTabIsLoaded(testSubj: string, name: string) {
|
||||
const isPresent = await testSubjects.exists(testSubj, { timeout: 5000 });
|
||||
if (!isPresent) {
|
||||
throw new Error(`TSVB ${name} tab is not loaded`);
|
||||
}
|
||||
}
|
||||
|
||||
public async checkVisualBuilderIsPresent() {
|
||||
await this.checkTabIsLoaded('tvbVisEditor', 'Time Series');
|
||||
}
|
||||
|
||||
public async checkMetricTabIsPresent() {
|
||||
await this.checkTabIsLoaded('tsvbMetricValue', 'Metric');
|
||||
}
|
||||
|
||||
public async checkGaugeTabIsPresent() {
|
||||
await this.checkTabIsLoaded('tvbVisGaugeContainer', 'Gauge');
|
||||
}
|
||||
|
||||
public async checkTopNTabIsPresent() {
|
||||
await this.checkTabIsLoaded('tvbVisTopNTable', 'TopN');
|
||||
}
|
||||
|
||||
public async clickMetric() {
|
||||
const button = await testSubjects.find('metricTsvbTypeBtn');
|
||||
await button.click();
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
}
|
||||
|
||||
public async clickMarkdown() {
|
||||
const button = await testSubjects.find('markdownTsvbTypeBtn');
|
||||
await button.click();
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
}
|
||||
|
||||
public async getMetricValue() {
|
||||
await PageObjects.visualize.waitForVisualizationRenderingStabilized();
|
||||
const metricValue = await find.byCssSelector('.tvbVisMetric__value--primary');
|
||||
return metricValue.getVisibleText();
|
||||
}
|
||||
|
@ -61,10 +80,8 @@ export function VisualBuilderPageProvider({ getService, getPageObjects }: FtrPro
|
|||
public async enterMarkdown(markdown: string) {
|
||||
const input = await find.byCssSelector('.tvbMarkdownEditor__editor textarea');
|
||||
await this.clearMarkdown();
|
||||
const prevRenderingCount = await PageObjects.visualize.getVisualizationRenderingCount();
|
||||
await input.type(markdown);
|
||||
await PageObjects.visualize.waitForVisualizationRenderingStabilized();
|
||||
await PageObjects.visualize.waitForRenderingCount(prevRenderingCount + 1);
|
||||
}
|
||||
|
||||
public async clearMarkdown() {
|
||||
|
@ -159,23 +176,21 @@ export function VisualBuilderPageProvider({ getService, getPageObjects }: FtrPro
|
|||
public async clickSeriesOption(nth = 0) {
|
||||
const el = await testSubjects.findAll('seriesOptions');
|
||||
await el[nth].click();
|
||||
await PageObjects.common.sleep(500);
|
||||
}
|
||||
|
||||
public async clearOffsetSeries() {
|
||||
const el = await testSubjects.find('offsetTimeSeries');
|
||||
await el.clearValue();
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
}
|
||||
|
||||
public async enterOffsetSeries(value: string) {
|
||||
const el = await testSubjects.find('offsetTimeSeries');
|
||||
await el.clearValue();
|
||||
await el.type(value);
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
}
|
||||
|
||||
public async getRhythmChartLegendValue() {
|
||||
await PageObjects.visualize.waitForVisualizationRenderingStabilized();
|
||||
const metricValue = await find.byCssSelector('.tvbLegend__itemValue');
|
||||
await metricValue.moveMouseTo();
|
||||
return await metricValue.getVisibleText();
|
||||
|
@ -183,7 +198,6 @@ export function VisualBuilderPageProvider({ getService, getPageObjects }: FtrPro
|
|||
|
||||
public async clickGauge() {
|
||||
await testSubjects.click('gaugeTsvbTypeBtn');
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
}
|
||||
|
||||
public async getGaugeLabel() {
|
||||
|
@ -198,7 +212,6 @@ export function VisualBuilderPageProvider({ getService, getPageObjects }: FtrPro
|
|||
|
||||
public async clickTopN() {
|
||||
await testSubjects.click('top_nTsvbTypeBtn');
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
}
|
||||
|
||||
public async getTopNLabel() {
|
||||
|
@ -213,7 +226,6 @@ export function VisualBuilderPageProvider({ getService, getPageObjects }: FtrPro
|
|||
|
||||
public async clickTable() {
|
||||
await testSubjects.click('tableTsvbTypeBtn');
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
}
|
||||
|
||||
public async createNewAgg(nth = 0) {
|
||||
|
|
Loading…
Reference in a new issue