[Synthetics] Fixed a label for lens viz in synthetics apps (#161446)

## Summary

Some refactor broke our labels, added a test case to make sure it's part
of e2e tests.

### After

<img width="1456" alt="image"
src="23f8cd56-ad4b-4c9d-97e7-2681c963406d">

### Before

<img width="1495" alt="image"
src="f835742b-d506-4beb-b68f-1d51d164ad96">
This commit is contained in:
Shahzad 2023-07-07 19:19:53 +02:00 committed by GitHub
parent 74e3eca687
commit 552a3a6553
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 1 deletions

View file

@ -81,6 +81,7 @@ describe('SingleMetricAttributes', () => {
columnOrder: ['layer-0-column-1'],
columns: {
'layer-0-column-1': {
customLabel: true,
dataType: 'number',
isBucketed: false,
label: 'Page load time',

View file

@ -106,6 +106,7 @@ export class SingleMetricLensAttributes extends LensAttributes {
columns: {
[this.columnId]: {
...buildNumberColumn(sourceField),
customLabel: true,
label: name ?? columnLabel,
operationType: sourceField === RECORDS_FIELD ? 'count' : operationType || 'median',
filter: columnFilter,
@ -175,6 +176,7 @@ export class SingleMetricLensAttributes extends LensAttributes {
...this.getPercentileNumberColumn(sourceField, operationType!, seriesConfig),
label: columnLabel ?? '',
filter: columnFilter,
customLabel: true,
},
},
columnOrder: [this.columnId],

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { journey, step, before, after } from '@elastic/synthetics';
import { journey, step, before, after, expect } from '@elastic/synthetics';
import { byTestId } from '@kbn/ux-plugin/e2e/journeys/utils';
import { RetryService } from '@kbn/ftr-common-functional-services';
import moment from 'moment';
@ -83,5 +83,19 @@ journey(`MonitorSummaryTab`, async ({ page, params }) => {
`${byTestId('monitorActiveAlertsCount')} .legacyMtrVis__value:has-text("1")`
);
});
const existingLabels = [
'Availability',
'Median duration',
'Errors',
'All',
'Active',
'Recovered',
];
const labels = await page.$$(byTestId('metric_label'));
for (const label of labels) {
const text = await label.textContent();
expect(existingLabels).toContain(text);
}
});
});