diff --git a/x-pack/packages/security-solution/ecs_data_quality_dashboard/impl/data_quality/data_quality_panel/summary_table/helpers.test.tsx b/x-pack/packages/security-solution/ecs_data_quality_dashboard/impl/data_quality/data_quality_panel/summary_table/helpers.test.tsx index f79c64ab0387c..814f0b234b63c 100644 --- a/x-pack/packages/security-solution/ecs_data_quality_dashboard/impl/data_quality/data_quality_panel/summary_table/helpers.test.tsx +++ b/x-pack/packages/security-solution/ecs_data_quality_dashboard/impl/data_quality/data_quality_panel/summary_table/helpers.test.tsx @@ -452,7 +452,7 @@ describe('helpers', () => { ); - expect(screen.getByTestId('incompatibleStat')).toHaveTextContent('-- --'); // the euiScreenReaderOnly content renders an additional set of -- + expect(screen.getByTestId('incompatibleStat')).toHaveTextContent('--'); }); }); diff --git a/x-pack/plugins/monitoring/public/components/summary_status/__snapshots__/summary_status.test.js.snap b/x-pack/plugins/monitoring/public/components/summary_status/__snapshots__/summary_status.test.js.snap index 8cb9d4f657347..8c6dc9bd29ee5 100644 --- a/x-pack/plugins/monitoring/public/components/summary_status/__snapshots__/summary_status.test.js.snap +++ b/x-pack/plugins/monitoring/public/components/summary_status/__snapshots__/summary_status.test.js.snap @@ -18,14 +18,11 @@ exports[`Summary Status Component should allow label to be optional 1`] = `
-

Status

-

-

- 127.0.0.1:9300 -

-

Documents

-

- Documents 24.8k -

@@ -123,23 +104,15 @@ exports[`Summary Status Component should allow status to be optional 1`] = `
-

Free Disk Space

-

- Free Disk Space 173.9 GB -

-

Documents

-

- Documents 24.8k -

@@ -194,14 +159,11 @@ exports[`Summary Status Component should render metrics in a summary bar 1`] = `
-

Status

-

Free Disk Space

-

- Free Disk Space 173.9 GB -

-

Documents

-

- Documents 24.8k -

diff --git a/x-pack/plugins/observability_solution/observability/public/pages/overview/components/sections/apm/apm_section.test.tsx b/x-pack/plugins/observability_solution/observability/public/pages/overview/components/sections/apm/apm_section.test.tsx index 683d6bd4d9107..a7297d5ff170e 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/overview/components/sections/apm/apm_section.test.tsx +++ b/x-pack/plugins/observability_solution/observability/public/pages/overview/components/sections/apm/apm_section.test.tsx @@ -7,6 +7,7 @@ import React from 'react'; import * as fetcherHook from '@kbn/observability-shared-plugin/public/hooks/use_fetcher'; +import { screen } from '@elastic/eui/lib/test/rtl'; import { render, data as dataMock } from '../../../../../utils/test_helper'; import { CoreStart } from '@kbn/core/public'; import { ConfigSchema, ObservabilityPublicPluginsStart } from '../../../../../plugin'; @@ -31,6 +32,14 @@ jest.mock('react-router-dom', () => ({ const { ObservabilityAIAssistantContextualInsight } = observabilityAIAssistantPluginMock.createStartContract(); +const assertServiceStat = (description: string, stat: string) => { + const serviceStat = screen.getByTestSubject('apmServiceStat'); + + expect(serviceStat).toBeInTheDocument(); + expect(serviceStat!.children[0]).toHaveTextContent(description); + expect(serviceStat!.children[1]).toHaveTextContent(stat); +}; + describe('APMSection', () => { const bucketSize = { intervalString: '60s', bucketSize: 60, dateFormat: 'YYYY-MM-DD HH:mm' }; @@ -90,7 +99,7 @@ describe('APMSection', () => { expect(getByRole('heading')).toHaveTextContent('Services'); expect(getByText('Show service inventory')).toBeInTheDocument(); - expect(getByText('Services 11')).toBeInTheDocument(); + assertServiceStat('Services', '11'); expect(getByText('900.0 tpm')).toBeInTheDocument(); expect(queryAllByTestId('loading')).toEqual([]); }); @@ -107,7 +116,7 @@ describe('APMSection', () => { expect(getByRole('heading')).toHaveTextContent('Services'); expect(getByText('Show service inventory')).toBeInTheDocument(); - expect(getByText('Services 11')).toBeInTheDocument(); + assertServiceStat('Services', '11'); expect(getByText('312.00k tpm')).toBeInTheDocument(); expect(queryAllByTestId('loading')).toEqual([]); }); @@ -117,14 +126,14 @@ describe('APMSection', () => { status: fetcherHook.FETCH_STATUS.LOADING, refetch: jest.fn(), }); - const { getByRole, queryAllByText, getByTestId } = render( + const { getByRole, queryAllByText, getByTestId, getAllByLabelText } = render( ); expect(getByRole('heading')).toHaveTextContent('Services'); expect(getByTestId('loading')).toBeInTheDocument(); expect(queryAllByText('Show service inventory')).toEqual([]); - expect(queryAllByText('Services 11')).toEqual([]); + expect(getAllByLabelText('Statistic is loading').length).toEqual(2); expect(queryAllByText('312.00k tpm')).toEqual([]); }); }); diff --git a/x-pack/plugins/observability_solution/observability/public/pages/overview/components/sections/apm/apm_section.tsx b/x-pack/plugins/observability_solution/observability/public/pages/overview/components/sections/apm/apm_section.tsx index ed6f55006c5e7..2535dc07ef234 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/overview/components/sections/apm/apm_section.tsx +++ b/x-pack/plugins/observability_solution/observability/public/pages/overview/components/sections/apm/apm_section.tsx @@ -114,6 +114,7 @@ export function APMSection({ bucketSize }: Props) { defaultMessage: 'Services', })} isLoading={isLoading} + data-test-subj="apmServiceStat" /> diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list_table_status_cell.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list_table_status_cell.test.tsx index c4cd31cd4b07a..1361cf8792bea 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list_table_status_cell.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list_table_status_cell.test.tsx @@ -121,7 +121,7 @@ describe('RulesListTableStatusCell', () => { }); it('should render loading indicator for new rules', async () => { - const { getByText } = render( + const { getByLabelText } = render( { /> ); - expect(getByText('Statistic is loading')).not.toBe(null); + expect(getByLabelText('Statistic is loading')).not.toBe(null); }); it('should render rule with no last run', async () => {