Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Upgrade Assistant] Add integration tests for Overview page #111370

Merged
merged 11 commits into from
Sep 16, 2021
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export const getUpgradeStep = ({ docLinks, nextMajor }: Props): EuiStepProps =>
return {
title: i18nTexts.upgradeStepTitle(nextMajor),
status: 'incomplete',
'data-test-subj': 'upgradeStep',
children: <UpgradeStep docLinks={docLinks} />,
};
};
24 changes: 20 additions & 4 deletions x-pack/test/accessibility/apps/upgrade_assistant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,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', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default function upgradeAssistantFunctionalTests({
const es = getService('es');
const log = getService('log');

describe('Upgrade Assistant', function () {
describe('Deprecation pages', function () {
this.tags('skipFirefox');

before(async () => {
Expand Down Expand Up @@ -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();
Expand Down
3 changes: 2 additions & 1 deletion x-pack/test/functional/apps/upgrade_assistant/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
});
}
69 changes: 69 additions & 0 deletions x-pack/test/functional/apps/upgrade_assistant/overview_page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* 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.navigateToPage();
sabarasaba marked this conversation as resolved.
Show resolved Hide resolved
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();
sabarasaba marked this conversation as resolved.
Show resolved Hide resolved
testSubjects.exists('noWarningsCallout');
});
});
});
}
12 changes: 12 additions & 0 deletions x-pack/test/functional/page_objects/upgrade_assistant_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down