From 358182693a0892a41814f46a5c82f08accecb0ca Mon Sep 17 00:00:00 2001 From: Alison Goryachev Date: Thu, 9 Sep 2021 15:12:15 -0400 Subject: [PATCH] [Upgrade Assistant] Add a11y tests for es deprecation flyouts (#110843) --- .../deprecation_types/default/flyout.tsx | 6 +- .../index_settings/flyout.tsx | 2 +- .../deprecation_types/ml_snapshots/flyout.tsx | 2 +- .../reindex/flyout/container.tsx | 2 +- .../accessibility/apps/upgrade_assistant.ts | 86 +++++++++++++++---- .../page_objects/upgrade_assistant_page.ts | 13 +++ 6 files changed, 88 insertions(+), 23 deletions(-) diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/default/flyout.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/default/flyout.tsx index 439062e027650..9262ea9664033 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/default/flyout.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/default/flyout.tsx @@ -62,7 +62,9 @@ export const DefaultDeprecationFlyout = ({ <> -

{message}

+

+ {message} +

{index && ( @@ -74,7 +76,7 @@ export const DefaultDeprecationFlyout = ({
-

{details}

+

{details}

{i18nTexts.learnMoreLinkLabel} diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/index_settings/flyout.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/index_settings/flyout.tsx index 1567562db53ee..edb46ee0dc85b 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/index_settings/flyout.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/index_settings/flyout.tsx @@ -110,7 +110,7 @@ export const RemoveIndexSettingsFlyout = ({ <> -

{message}

+

{message}

diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/ml_snapshots/flyout.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/ml_snapshots/flyout.tsx index 5d61b076119e7..a972b7ec192d2 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/ml_snapshots/flyout.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/ml_snapshots/flyout.tsx @@ -169,7 +169,7 @@ export const FixSnapshotsFlyout = ({ <> -

{i18nTexts.flyoutTitle}

+

{i18nTexts.flyoutTitle}

diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/container.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/container.tsx index 23008a4f2f1b8..d2d07b47acd49 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/container.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/container.tsx @@ -131,7 +131,7 @@ export const ReindexFlyout: React.FunctionComponent = ({ <> -

+

{ await PageObjects.upgradeAssistant.navigateToPage(); try { - // Create an index that will trigger a deprecation warning to test the ES deprecations page + // Create two indices that will trigger deprecation warnings to test the ES deprecations page + await es.indices.create(multiFieldsIndexDeprecation); await es.indices.create(translogSettingsIndexDeprecation); } catch (e) { - log.debug('[Setup error] Error creating index'); + log.debug('[Setup error] Error creating indices'); throw e; } }); @@ -42,10 +68,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { after(async () => { try { await es.indices.delete({ - index: [translogSettingsIndexDeprecation.index], + index: [multiFieldsIndexDeprecation.index, translogSettingsIndexDeprecation.index], }); } catch (e) { - log.debug('[Cleanup error] Error deleting index'); + log.debug('[Cleanup error] Error deleting indices'); throw e; } }); @@ -57,22 +83,46 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await a11y.testAppSnapshot(); }); - it('Elasticsearch deprecations page', async () => { - await PageObjects.common.navigateToUrl( - 'management', - 'stack/upgrade_assistant/es_deprecations', - { - ensureCurrentUrl: false, - shouldLoginIfPrompted: false, - shouldUseHashForSubUrl: false, - } - ); - - await retry.waitFor('Elasticsearch deprecations table to be visible', async () => { - return testSubjects.exists('esDeprecationsTable'); + describe('Elasticsearch deprecations page', () => { + beforeEach(async () => { + await PageObjects.common.navigateToUrl( + 'management', + 'stack/upgrade_assistant/es_deprecations', + { + ensureCurrentUrl: false, + shouldLoginIfPrompted: false, + shouldUseHashForSubUrl: false, + } + ); + + await retry.waitFor('Elasticsearch deprecations table to be visible', async () => { + return testSubjects.exists('esDeprecationsTable'); + }); }); - await a11y.testAppSnapshot(); + it('Deprecations table', async () => { + await a11y.testAppSnapshot(); + }); + + it('Index settings deprecation flyout', async () => { + await PageObjects.upgradeAssistant.clickEsDeprecation( + 'indexSettings' // An index setting deprecation was added in the before() hook so should be guaranteed + ); + await retry.waitFor('ES index settings deprecation flyout to be visible', async () => { + return testSubjects.exists('indexSettingsDetails'); + }); + await a11y.testAppSnapshot(); + }); + + it('Default deprecation flyout', async () => { + await PageObjects.upgradeAssistant.clickEsDeprecation( + 'default' // A default deprecation was added in the before() hook so should be guaranteed + ); + await retry.waitFor('ES default deprecation flyout to be visible', async () => { + return testSubjects.exists('defaultDeprecationDetails'); + }); + await a11y.testAppSnapshot(); + }); }); describe('Kibana deprecations page', () => { diff --git a/x-pack/test/functional/page_objects/upgrade_assistant_page.ts b/x-pack/test/functional/page_objects/upgrade_assistant_page.ts index 406800d775417..e763145a715ff 100644 --- a/x-pack/test/functional/page_objects/upgrade_assistant_page.ts +++ b/x-pack/test/functional/page_objects/upgrade_assistant_page.ts @@ -57,4 +57,17 @@ export class UpgradeAssistantPageObject extends FtrService { this.log.debug('Unable to find selected deprecation row'); } } + + async clickEsDeprecation(deprecationType: 'indexSettings' | 'default' | 'reindex' | 'ml') { + const table = await this.testSubjects.find('esDeprecationsTable'); + const deprecationIssueLink = await ( + await table.findByTestSubject(`${deprecationType}TableCell-message`) + ).findByCssSelector('button'); + + if (deprecationIssueLink) { + await deprecationIssueLink.click(); + } else { + this.log.debug('Unable to find selected deprecation'); + } + } }