From 08474df02d73733c62a02370263fd50ed6e13d17 Mon Sep 17 00:00:00 2001 From: Ignacio Rivas Date: Wed, 13 Oct 2021 10:22:20 +0200 Subject: [PATCH] Refactor kibana deprecation tests --- .../client_integration/helpers/index.ts | 1 - .../deprecation_details_flyout.test.ts | 18 +++++++++++++++--- .../deprecations_table.test.ts} | 7 ++++--- .../error_handling.test.ts | 7 ++++--- .../service.mock.ts} | 1 + .../elasticsearch_deprecation_issues.test.tsx | 3 ++- .../fix_issues_step/fix_issues_step.test.tsx | 3 ++- .../kibana_deprecation_issues.test.tsx | 3 ++- .../deprecation_details_flyout.tsx | 2 +- 9 files changed, 31 insertions(+), 14 deletions(-) rename x-pack/plugins/upgrade_assistant/__jest__/client_integration/kibana_deprecations/{ => deprecation_details_flyout}/deprecation_details_flyout.test.ts (89%) rename x-pack/plugins/upgrade_assistant/__jest__/client_integration/kibana_deprecations/{deprecations_list.test.ts => deprecations_table/deprecations_table.test.ts} (93%) rename x-pack/plugins/upgrade_assistant/__jest__/client_integration/kibana_deprecations/{ => deprecations_table}/error_handling.test.ts (91%) rename x-pack/plugins/upgrade_assistant/__jest__/client_integration/{helpers/kibana_deprecations_service.mock.ts => kibana_deprecations/service.mock.ts} (98%) diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/index.ts b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/index.ts index ce054fc8af84e..7eb530f441bc0 100644 --- a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/index.ts +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/index.ts @@ -7,4 +7,3 @@ export { setupEnvironment, WithAppDependencies } from './setup_environment'; export { advanceTime } from './time_manipulation'; -export { kibanaDeprecationsServiceHelpers } from './kibana_deprecations_service.mock'; diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/kibana_deprecations/deprecation_details_flyout.test.ts b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/kibana_deprecations/deprecation_details_flyout/deprecation_details_flyout.test.ts similarity index 89% rename from x-pack/plugins/upgrade_assistant/__jest__/client_integration/kibana_deprecations/deprecation_details_flyout.test.ts rename to x-pack/plugins/upgrade_assistant/__jest__/client_integration/kibana_deprecations/deprecation_details_flyout/deprecation_details_flyout.test.ts index eb76e3c016a39..9677104a6e558 100644 --- a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/kibana_deprecations/deprecation_details_flyout.test.ts +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/kibana_deprecations/deprecation_details_flyout/deprecation_details_flyout.test.ts @@ -8,10 +8,11 @@ import { act } from 'react-dom/test-utils'; import { deprecationsServiceMock } from 'src/core/public/mocks'; -import { setupEnvironment, kibanaDeprecationsServiceHelpers } from '../helpers'; -import { KibanaTestBed, setupKibanaPage } from './kibana_deprecations.helpers'; +import { setupEnvironment } from '../../helpers'; +import { kibanaDeprecationsServiceHelpers } from '../service.mock'; +import { KibanaTestBed, setupKibanaPage } from '../kibana_deprecations.helpers'; -describe('Kibana deprecation details flyout', () => { +describe('Kibana deprecations - Deprecation details flyout', () => { let testBed: KibanaTestBed; const { server } = setupEnvironment(); const { @@ -75,6 +76,17 @@ describe('Kibana deprecation details flyout', () => { }); }); + test('Shows documentationUrl when present', async () => { + const { find, actions } = testBed; + const deprecation = mockedKibanaDeprecations[1]; + + await actions.table.clickDeprecationAt(1); + + expect(find('kibanaDeprecationDetails.documentationLink').props().href).toBe( + deprecation.documentationUrl + ); + }); + describe('Deprecation with automatic resolution', () => { test('resolves deprecation successfully', async () => { const { find, exists, actions } = testBed; diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/kibana_deprecations/deprecations_list.test.ts b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/kibana_deprecations/deprecations_table/deprecations_table.test.ts similarity index 93% rename from x-pack/plugins/upgrade_assistant/__jest__/client_integration/kibana_deprecations/deprecations_list.test.ts rename to x-pack/plugins/upgrade_assistant/__jest__/client_integration/kibana_deprecations/deprecations_table/deprecations_table.test.ts index 9a3b1d1882cc7..a14d6e087b017 100644 --- a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/kibana_deprecations/deprecations_list.test.ts +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/kibana_deprecations/deprecations_table/deprecations_table.test.ts @@ -9,10 +9,11 @@ import { act } from 'react-dom/test-utils'; import { deprecationsServiceMock } from 'src/core/public/mocks'; import type { DeprecationsServiceStart } from 'kibana/public'; -import { setupEnvironment, kibanaDeprecationsServiceHelpers } from '../helpers'; -import { KibanaTestBed, setupKibanaPage } from './kibana_deprecations.helpers'; +import { setupEnvironment } from '../../helpers'; +import { kibanaDeprecationsServiceHelpers } from '../service.mock'; +import { KibanaTestBed, setupKibanaPage } from '../kibana_deprecations.helpers'; -describe('Kibana deprecations table', () => { +describe('Kibana deprecations - Deprecations table', () => { let testBed: KibanaTestBed; let deprecationService: jest.Mocked; diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/kibana_deprecations/error_handling.test.ts b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/kibana_deprecations/deprecations_table/error_handling.test.ts similarity index 91% rename from x-pack/plugins/upgrade_assistant/__jest__/client_integration/kibana_deprecations/error_handling.test.ts rename to x-pack/plugins/upgrade_assistant/__jest__/client_integration/kibana_deprecations/deprecations_table/error_handling.test.ts index 650af2025ee2b..918ee759a0f45 100644 --- a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/kibana_deprecations/error_handling.test.ts +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/kibana_deprecations/deprecations_table/error_handling.test.ts @@ -8,10 +8,11 @@ import { act } from 'react-dom/test-utils'; import { deprecationsServiceMock } from 'src/core/public/mocks'; -import { setupEnvironment, kibanaDeprecationsServiceHelpers } from '../helpers'; -import { KibanaTestBed, setupKibanaPage } from './kibana_deprecations.helpers'; +import { setupEnvironment } from '../../helpers'; +import { kibanaDeprecationsServiceHelpers } from '../service.mock'; +import { KibanaTestBed, setupKibanaPage } from '../kibana_deprecations.helpers'; -describe('Error handling', () => { +describe('Kibana deprecations - Deprecations table - Error handling', () => { let testBed: KibanaTestBed; const { server } = setupEnvironment(); const deprecationService = deprecationsServiceMock.createStartContract(); diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/kibana_deprecations_service.mock.ts b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/kibana_deprecations/service.mock.ts similarity index 98% rename from x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/kibana_deprecations_service.mock.ts rename to x-pack/plugins/upgrade_assistant/__jest__/client_integration/kibana_deprecations/service.mock.ts index fb0edcdc875d1..1767143fdf527 100644 --- a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/kibana_deprecations_service.mock.ts +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/kibana_deprecations/service.mock.ts @@ -31,6 +31,7 @@ const kibanaDeprecations: DomainDeprecationDetails[] = [ domainId: 'test_domain_2', level: 'warning', title: 'Test deprecation title 1', + documentationUrl: 'https://', message: 'Test deprecation message 2', deprecationType: 'feature', }, diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/fix_issues_step/elasticsearch_deprecation_issues.test.tsx b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/fix_issues_step/elasticsearch_deprecation_issues.test.tsx index bbb8b049ec2b8..e1cef64dfb20c 100644 --- a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/fix_issues_step/elasticsearch_deprecation_issues.test.tsx +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/fix_issues_step/elasticsearch_deprecation_issues.test.tsx @@ -8,7 +8,8 @@ import { act } from 'react-dom/test-utils'; import { deprecationsServiceMock } from 'src/core/public/mocks'; -import { setupEnvironment, kibanaDeprecationsServiceHelpers } from '../../helpers'; +import { setupEnvironment } from '../../helpers'; +import { kibanaDeprecationsServiceHelpers } from '../../kibana_deprecations/service.mock'; import { OverviewTestBed, setupOverviewPage } from '../overview.helpers'; import { esCriticalAndWarningDeprecations, diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/fix_issues_step/fix_issues_step.test.tsx b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/fix_issues_step/fix_issues_step.test.tsx index e9fa57b54ae0e..b7c417fbfcb8d 100644 --- a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/fix_issues_step/fix_issues_step.test.tsx +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/fix_issues_step/fix_issues_step.test.tsx @@ -8,7 +8,8 @@ import { act } from 'react-dom/test-utils'; import { deprecationsServiceMock } from 'src/core/public/mocks'; -import { setupEnvironment, kibanaDeprecationsServiceHelpers } from '../../helpers'; +import { setupEnvironment } from '../../helpers'; +import { kibanaDeprecationsServiceHelpers } from '../../kibana_deprecations/service.mock'; import { OverviewTestBed, setupOverviewPage } from '../overview.helpers'; import { esCriticalAndWarningDeprecations, esNoDeprecations } from './mock_es_issues'; diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/fix_issues_step/kibana_deprecation_issues.test.tsx b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/fix_issues_step/kibana_deprecation_issues.test.tsx index 719e2f674fb2f..c11a1481b68b5 100644 --- a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/fix_issues_step/kibana_deprecation_issues.test.tsx +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/fix_issues_step/kibana_deprecation_issues.test.tsx @@ -9,7 +9,8 @@ import { act } from 'react-dom/test-utils'; import { deprecationsServiceMock } from 'src/core/public/mocks'; import type { DomainDeprecationDetails } from 'kibana/public'; -import { setupEnvironment, kibanaDeprecationsServiceHelpers } from '../../helpers'; +import { setupEnvironment } from '../../helpers'; +import { kibanaDeprecationsServiceHelpers } from '../../kibana_deprecations/service.mock'; import { OverviewTestBed, setupOverviewPage } from '../overview.helpers'; import { esNoDeprecations } from './mock_es_issues'; diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/kibana_deprecations/deprecation_details_flyout.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/kibana_deprecations/deprecation_details_flyout.tsx index 8844386be5081..577354b35fa4e 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/kibana_deprecations/deprecation_details_flyout.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/kibana_deprecations/deprecation_details_flyout.tsx @@ -165,7 +165,7 @@ export const DeprecationDetailsFlyout = ({ {documentationUrl && (

- + {i18nTexts.learnMoreLinkLabel}