diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/overview/upgrade_step/upgrade_step.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/overview/upgrade_step/upgrade_step.tsx index cb8c88b9d2af2..dffdf39e5dd59 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/overview/upgrade_step/upgrade_step.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/overview/upgrade_step/upgrade_step.tsx @@ -123,6 +123,7 @@ export const getUpgradeStep = ({ docLinks, nextMajor }: Props): EuiStepProps => return { title: i18nTexts.upgradeStepTitle(nextMajor), status: 'incomplete', + 'data-test-subj': 'upgradeStep', children: , }; }; diff --git a/x-pack/test/accessibility/apps/upgrade_assistant.ts b/x-pack/test/accessibility/apps/upgrade_assistant.ts index 55873d98b4df9..38ade6e908859 100644 --- a/x-pack/test/accessibility/apps/upgrade_assistant.ts +++ b/x-pack/test/accessibility/apps/upgrade_assistant.ts @@ -76,11 +76,27 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { } }); - it('Overview page', async () => { - await retry.waitFor('Upgrade Assistant overview page to be visible', async () => { - return testSubjects.exists('overview'); + describe('Overview page', () => { + beforeEach(async () => { + await PageObjects.upgradeAssistant.navigateToPage(); + await retry.waitFor('Upgrade Assistant overview page to be visible', async () => { + return testSubjects.exists('overview'); + }); + }); + + it('with logs collection disabled', async () => { + await a11y.testAppSnapshot(); + }); + + it('with logs collection enabled', async () => { + await PageObjects.upgradeAssistant.clickDeprecationLoggingToggle(); + + await retry.waitFor('UA external links title to be present', async () => { + return testSubjects.isDisplayed('externalLinksTitle'); + }); + + await a11y.testAppSnapshot(); }); - await a11y.testAppSnapshot(); }); describe('Elasticsearch deprecations page', () => { diff --git a/x-pack/test/functional/apps/upgrade_assistant/upgrade_assistant.ts b/x-pack/test/functional/apps/upgrade_assistant/deprecation_pages.ts similarity index 92% rename from x-pack/test/functional/apps/upgrade_assistant/upgrade_assistant.ts rename to x-pack/test/functional/apps/upgrade_assistant/deprecation_pages.ts index 6ab46cb3be93d..3cb1989f4f732 100644 --- a/x-pack/test/functional/apps/upgrade_assistant/upgrade_assistant.ts +++ b/x-pack/test/functional/apps/upgrade_assistant/deprecation_pages.ts @@ -84,13 +84,6 @@ export default function upgradeAssistantFunctionalTests({ await security.testUser.restoreDefaults(); }); - it('renders the Overview page', async () => { - await PageObjects.upgradeAssistant.navigateToPage(); - await retry.waitFor('Upgrade Assistant overview page to be visible', async () => { - return testSubjects.exists('overview'); - }); - }); - it('renders the Elasticsearch deprecations page', async () => { await PageObjects.upgradeAssistant.navigateToPage(); await PageObjects.upgradeAssistant.clickEsDeprecationsPanel(); diff --git a/x-pack/test/functional/apps/upgrade_assistant/index.ts b/x-pack/test/functional/apps/upgrade_assistant/index.ts index cacf55c58dce2..d99d1cd033327 100644 --- a/x-pack/test/functional/apps/upgrade_assistant/index.ts +++ b/x-pack/test/functional/apps/upgrade_assistant/index.ts @@ -12,6 +12,7 @@ export default function upgradeCheckup({ loadTestFile }: FtrProviderContext) { this.tags('ciGroup4'); loadTestFile(require.resolve('./feature_controls')); - loadTestFile(require.resolve('./upgrade_assistant')); + loadTestFile(require.resolve('./deprecation_pages')); + loadTestFile(require.resolve('./overview_page')); }); } diff --git a/x-pack/test/functional/apps/upgrade_assistant/overview_page.ts b/x-pack/test/functional/apps/upgrade_assistant/overview_page.ts new file mode 100644 index 0000000000000..76663a9f57c89 --- /dev/null +++ b/x-pack/test/functional/apps/upgrade_assistant/overview_page.ts @@ -0,0 +1,68 @@ +/* + * 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 { FtrProviderContext } from '../../ftr_provider_context'; + +export default function upgradeAssistantOverviewPageFunctionalTests({ + getService, + getPageObjects, +}: FtrProviderContext) { + const PageObjects = getPageObjects(['upgradeAssistant', 'common']); + const retry = getService('retry'); + const security = getService('security'); + const testSubjects = getService('testSubjects'); + const es = getService('es'); + + describe('Overview Page', function () { + this.tags('skipFirefox'); + + before(async () => { + await security.testUser.setRoles(['superuser']); + }); + + after(async () => { + await security.testUser.restoreDefaults(); + }); + + beforeEach(async () => { + await PageObjects.upgradeAssistant.navigateToPage(); + + await retry.waitFor('Upgrade Assistant overview page to be visible', async () => { + return testSubjects.exists('overview'); + }); + }); + + it('Should render all steps', async () => { + testSubjects.exists('backupStep-incomplete'); + testSubjects.exists('fixIssuesStep-incomplete'); + testSubjects.exists('fixLogsStep-incomplete'); + testSubjects.exists('upgradeStep'); + }); + + describe('fixLogsStep', () => { + before(async () => { + // Access to system indices will be deprecated and should generate a deprecation log + await es.indices.get({ index: '.kibana' }); + + await PageObjects.upgradeAssistant.clickDeprecationLoggingToggle(); + + await retry.waitFor('UA external links title to be present', async () => { + return testSubjects.isDisplayed('externalLinksTitle'); + }); + }); + + it('Shows warnings callout if there are deprecations', async () => { + testSubjects.exists('hasWarningsCallout'); + }); + + it('Shows no warnings callout if there are no deprecations', async () => { + await PageObjects.upgradeAssistant.clickResetLastCheckpointButton(); + testSubjects.exists('noWarningsCallout'); + }); + }); + }); +} 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 e763145a715ff..54d7f3d452123 100644 --- a/x-pack/test/functional/page_objects/upgrade_assistant_page.ts +++ b/x-pack/test/functional/page_objects/upgrade_assistant_page.ts @@ -35,6 +35,18 @@ export class UpgradeAssistantPageObject extends FtrService { }); } + async clickDeprecationLoggingToggle() { + return await this.retry.try(async () => { + await this.testSubjects.click('deprecationLoggingToggle'); + }); + } + + async clickResetLastCheckpointButton() { + return await this.retry.try(async () => { + await this.testSubjects.click('resetLastStoredDate'); + }); + } + async clickKibanaDeprecationsPanel() { return await this.retry.try(async () => { await this.testSubjects.click('kibanaStatsPanel');