[Exploratory view] Fix single metric and add e2e test (#140043)

This commit is contained in:
Shahzad 2022-09-08 09:57:37 +02:00 committed by GitHub
parent 04135d1f1f
commit 206c8b4ebd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 68 additions and 4 deletions

View file

@ -7,3 +7,4 @@
export * from './exploratory_view';
export * from './step_duration.journey';
export * from './single_metric.journey';

View file

@ -0,0 +1,63 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { journey, step, before } from '@elastic/synthetics';
import { createExploratoryViewUrl } from '../../public/components/shared/exploratory_view/configurations/exploratory_view_url';
import { loginToKibana, TIMEOUT_60_SEC, waitForLoadingToFinish } from '../utils';
journey('SingleMetric', async ({ page, params }) => {
before(async () => {
await waitForLoadingToFinish({ page });
});
const expUrl = createExploratoryViewUrl({
reportType: 'single-metric',
allSeries: [
{
dataType: 'synthetics',
time: {
from: 'now-1y/d',
to: 'now',
},
name: 'synthetics-series-1',
selectedMetricField: 'monitor_availability',
reportDefinitions: {
'monitor.name': ['test-monitor - inline'],
'url.full': ['https://www.elastic.co/'],
},
},
],
});
const baseUrl = `${params.kibanaUrl}${expUrl}`;
step('Go to Exploratory view', async () => {
await page.goto(baseUrl, {
waitUntil: 'networkidle',
});
await loginToKibana({
page,
user: { username: 'elastic', password: 'changeme' },
dismissTour: false,
});
});
step('Open exploratory view with single metric', async () => {
await Promise.all([
page.waitForNavigation(TIMEOUT_60_SEC),
page.click('text=Explore data', TIMEOUT_60_SEC),
]);
await waitForLoadingToFinish({ page });
await page.click('text=0.0%', TIMEOUT_60_SEC);
await page.click('text=0.0%Availability');
await page.click(
'text=Explore data Last Updated: a few seconds agoRefreshHide chart0.0%AvailabilityRep'
);
});
});

View file

@ -174,5 +174,5 @@ export const sampleMetricFormulaAttribute = {
},
},
title: 'Prefilled from exploratory view app',
visualizationType: 'lnsMetric',
visualizationType: 'lnsLegacyMetric',
};

View file

@ -107,7 +107,7 @@ describe('SingleMetricAttributes', () => {
},
},
title: 'Prefilled from exploratory view app',
visualizationType: 'lnsMetric',
visualizationType: 'lnsLegacyMetric',
});
});
@ -173,7 +173,7 @@ describe('SingleMetricAttributes', () => {
},
},
title: 'Prefilled from exploratory view app',
visualizationType: 'lnsMetric',
visualizationType: 'lnsLegacyMetric',
});
});

View file

@ -171,7 +171,7 @@ export class SingleMetricLensAttributes extends LensAttributes {
return {
title: 'Prefilled from exploratory view app',
description: String(refresh),
visualizationType: 'lnsMetric',
visualizationType: 'lnsLegacyMetric',
references: this.getReferences(),
state: {
visualization,