diff --git a/x-pack/plugins/apm/public/components/app/alerts_overview/index.tsx b/x-pack/plugins/apm/public/components/app/alerts_overview/index.tsx index d5cd8c530332e5..7e4914f29a6710 100644 --- a/x-pack/plugins/apm/public/components/app/alerts_overview/index.tsx +++ b/x-pack/plugins/apm/public/components/app/alerts_overview/index.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import React, { useState, useMemo, useEffect } from 'react'; +import React, { useState, useMemo, useEffect, useCallback } from 'react'; import { useHistory } from 'react-router-dom'; import { ObservabilityAlertSearchBar } from '@kbn/observability-plugin/public'; import { AlertStatus } from '@kbn/observability-plugin/common/typings'; @@ -72,6 +72,11 @@ export function AlertsOverview() { ]; }, [serviceName, environment]); + const onKueryChange = useCallback( + (value) => push(history, { query: { kuery: value } }), + [history] + ); + return ( @@ -86,9 +91,7 @@ export function AlertsOverview() { onRangeToChange={(value) => push(history, { query: { rangeTo: value } }) } - onKueryChange={(value) => - push(history, { query: { kuery: value } }) - } + onKueryChange={onKueryChange} defaultSearchQueries={apmQueries} onStatusChange={setAlertStatusFilter} onEsQueryChange={setEsQuery} diff --git a/x-pack/plugins/apm/public/components/routing/templates/apm_service_template/index.tsx b/x-pack/plugins/apm/public/components/routing/templates/apm_service_template/index.tsx index 156ebac930dbd2..39acdc24b3ca27 100644 --- a/x-pack/plugins/apm/public/components/routing/templates/apm_service_template/index.tsx +++ b/x-pack/plugins/apm/public/components/routing/templates/apm_service_template/index.tsx @@ -387,5 +387,6 @@ function useTabs({ selectedTab }: { selectedTab: Tab['key'] }) { prepend, append, isSelected: key === selectedTab, + 'data-test-subj': `${key}Tab`, })); } diff --git a/x-pack/plugins/apm/public/components/routing/templates/mobile_service_template/index.tsx b/x-pack/plugins/apm/public/components/routing/templates/mobile_service_template/index.tsx index 2f92aa4b18f4c7..496010a14853a3 100644 --- a/x-pack/plugins/apm/public/components/routing/templates/mobile_service_template/index.tsx +++ b/x-pack/plugins/apm/public/components/routing/templates/mobile_service_template/index.tsx @@ -222,5 +222,6 @@ function useTabs({ selectedTabKey }: { selectedTabKey: Tab['key'] }) { label, append, isSelected: key === selectedTabKey, + 'data-test-subj': `${key}Tab`, })); } diff --git a/x-pack/test/functional/apps/apm/correlations/failed_transaction_correlations.ts b/x-pack/test/functional/apps/apm/correlations/failed_transaction_correlations.ts index 592edff82eedac..373f52900e8f20 100644 --- a/x-pack/test/functional/apps/apm/correlations/failed_transaction_correlations.ts +++ b/x-pack/test/functional/apps/apm/correlations/failed_transaction_correlations.ts @@ -16,6 +16,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { const PageObjects = getPageObjects(['common', 'error', 'timePicker', 'security']); const testSubjects = getService('testSubjects'); const appsMenu = getService('appsMenu'); + const observability = getService('observability'); const testData = { correlationsTab: 'Failed transaction correlations', @@ -150,6 +151,18 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { ); }); }); + + it('navigates to the alerts tab', async function () { + await find.clickByCssSelector(`[data-test-subj="alertsTab"]`); + + await PageObjects.timePicker.timePickerExists(); + await PageObjects.timePicker.setCommonlyUsedTime('Last_15 minutes'); + + // Should show no data message + await retry.try(async () => { + await observability.overview.common.getAlertsTableNoDataOrFail(); + }); + }); }); }); }