Skip to content

Commit

Permalink
[Upgrade Assistant] Add integration tests for Overview page (elastic#…
Browse files Browse the repository at this point in the history
…111370)

* Add a11y tests for when overview page has toggle enabled

* Add functional and accessibility tests for overview page

* Load test files

* Fix linter error

* Navigate before asserting

* Steps have now completion state

* Remove duped word

* Run setup only once, not per test

* Address CR changes

* No need to renavigate to the page

Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
sabarasaba and kibanamachine committed Oct 26, 2021
1 parent a9b5204 commit 123cf5f
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 12 deletions.
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 @@ -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', () => {
Expand Down
Original file line number Diff line number Diff line change
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'));
});
}
68 changes: 68 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,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');
});
});
});
}
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

0 comments on commit 123cf5f

Please sign in to comment.