Skip to content

Commit

Permalink
[Upgrade Assistant] Add A11y Tests (elastic#90265)
Browse files Browse the repository at this point in the history
* Added overview a11y test. Added data test subjects to the tabs in the app.

* Added data test subjects for all tabs and the detail panel on the indidual pages. Updated tests to wait for detail panel to be visible before taking snapshot.

* Updated snapshot for upgrade assistant jest tests.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
2 people authored and John Dorlus committed Feb 9, 2021
1 parent 1675cb3 commit b5a05a5
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,15 @@ export class UpgradeAssistantTabs extends React.Component<Props, TabsState> {
return [
{
id: 'overview',
'data-test-subj': 'upgradeAssistantOverviewTab',
name: i18n.translate('xpack.upgradeAssistant.overviewTab.overviewTabTitle', {
defaultMessage: 'Overview',
}),
content: <OverviewTab checkupData={checkupData} {...commonProps} />,
},
{
id: 'cluster',
'data-test-subj': 'upgradeAssistantClusterTab',
name: i18n.translate('xpack.upgradeAssistant.checkupTab.clusterTabLabel', {
defaultMessage: 'Cluster',
}),
Expand All @@ -213,6 +215,7 @@ export class UpgradeAssistantTabs extends React.Component<Props, TabsState> {
},
{
id: 'indices',
'data-test-subj': 'upgradeAssistantIndicesTab',
name: i18n.translate('xpack.upgradeAssistant.checkupTab.indicesTabLabel', {
defaultMessage: 'Indices',
}),
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,11 @@ export const CheckupTab: FunctionComponent<CheckupTabProps> = ({
<>
<EuiSpacer />
<EuiText grow={false}>
<p>
<p
data-test-subj={`upgradeAssistant${
checkupLabel.charAt(0).toUpperCase() + checkupLabel.slice(1)
}TabDetail`}
>
<FormattedMessage
id="xpack.upgradeAssistant.checkupTab.tabDetail"
defaultMessage="These {strongCheckupLabel} issues need your attention. Resolve them before upgrading to Elasticsearch {nextEsVersion}."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const OverviewTab: FunctionComponent<UpgradeAssistantTabProps> = (props)
<>
<EuiSpacer />

<EuiText grow={false}>
<EuiText data-test-subj="upgradeAssistantOverviewTabDetail" grow={false}>
<p>
<FormattedMessage
id="xpack.upgradeAssistant.overviewTab.tabDetail"
Expand Down
44 changes: 44 additions & 0 deletions x-pack/test/accessibility/apps/upgrade_assistant.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* 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 ({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['upgradeAssistant', 'common']);
const a11y = getService('a11y');
const testSubjects = getService('testSubjects');
const retry = getService('retry');

describe('Upgrade Assistant Home', () => {
before(async () => {
await PageObjects.upgradeAssistant.navigateToPage();
});

it('Overview Tab', async () => {
await retry.waitFor('Upgrade Assistant overview tab to be visible', async () => {
return testSubjects.exists('upgradeAssistantOverviewTabDetail');
});
await a11y.testAppSnapshot();
});

it('Cluster Tab', async () => {
await testSubjects.click('upgradeAssistantClusterTab');
await retry.waitFor('Upgrade Assistant Cluster tab to be visible', async () => {
return testSubjects.exists('upgradeAssistantClusterTabDetail');
});
await a11y.testAppSnapshot();
});

it('Indices Tab', async () => {
await testSubjects.click('upgradeAssistantIndicesTab');
await retry.waitFor('Upgrade Assistant Cluster tab to be visible', async () => {
return testSubjects.exists('upgradeAssistantIndexTabDetail');
});
await a11y.testAppSnapshot();
});
});
}
1 change: 1 addition & 0 deletions x-pack/test/accessibility/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
require.resolve('./apps/index_lifecycle_management'),
require.resolve('./apps/ml'),
require.resolve('./apps/lens'),
require.resolve('./apps/upgrade_assistant'),
],

pageObjects,
Expand Down

0 comments on commit b5a05a5

Please sign in to comment.