Skip to content

Commit

Permalink
added basic a11y tests for ILM policy list view and create/edit polic…
Browse files Browse the repository at this point in the history
…y view
  • Loading branch information
jloleysens committed Jan 15, 2021
1 parent 72ec821 commit ab51e18
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export const ColdPhase: FunctionComponent = () => {
<SearchableSnapshotField phase="cold" />

<EuiAccordion
id="ilmWarmPhaseAdvancedSettings"
id="ilmColdPhaseAdvancedSettings"
buttonContent={i18n.translate(
'xpack.indexLifecycleMgmt.warmPhase.advancedSettingsButton',
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ export const TableContent: React.FunctionComponent<Props> = ({
style={{ width: 150 }}
>
<EuiPopover
id="contextMenuPolicy"
id={`contextMenuPolicy-${name}`}
button={button}
isOpen={isPolicyPopoverOpen(policy.name)}
closePopover={closePolicyPopover}
Expand Down
79 changes: 79 additions & 0 deletions x-pack/test/accessibility/apps/index_lifecycle_management.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import util from 'util';
import { FtrProviderContext } from '../ftr_provider_context';

const TEST_POLICY_NAME = 'ilm-a11y-test';
const TEST_POLICY_ALL_PHASES = {
policy: {
phases: {
hot: {
actions: {},
},
warm: {
actions: {},
},
cold: {
actions: {},
},
delete: {
actions: {},
},
},
},
};

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const { common } = getPageObjects(['common']);
const retry = getService('retry');
const testSubjects = getService('testSubjects');
const esClient = getService('es');
const a11y = getService('a11y');

const findPolicyLinkInListView = async (policyName: string) => {
const links = await testSubjects.findAll('policyTablePolicyNameLink');
for (const link of links) {
const name = await link.getVisibleText();
if (name === policyName) {
return link;
}
}
throw new Error(`Could not find ${policyName} in policy table`);
};

describe('Index Lifecycle Management', async () => {
before(async () => {
await esClient.ilm.putLifecycle({ policy: TEST_POLICY_NAME, body: TEST_POLICY_ALL_PHASES });
await common.navigateToApp('indexLifecycleManagement');
});

after(async () => {
await esClient.ilm.deleteLifecycle({ policy: TEST_POLICY_NAME });
});

it('List policies view', async () => {
await retry.waitFor('Index Lifecycle Policy create/edit view to be present', async () => {
await common.navigateToApp('indexLifecycleManagement');
return testSubjects.exists('policyTablePolicyNameLink') ? true : false;
});
await a11y.testAppSnapshot();
});

it('Edit policy with all phases view', async () => {
await retry.waitFor('Index Lifecycle Policy create/edit view to be present', async () => {
await common.navigateToApp('indexLifecycleManagement');
return testSubjects.exists('policyTablePolicyNameLink');
});
const link = await findPolicyLinkInListView(TEST_POLICY_NAME);
await link.click();
await retry.waitFor('Index Lifecycle Policy create/edit view to be present', async () => {
return testSubjects.exists('policyTitle');
});
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 @@ -27,6 +27,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
require.resolve('./apps/roles'),
require.resolve('./apps/kibana_overview'),
require.resolve('./apps/ingest_node_pipelines'),
require.resolve('./apps/index_lifecycle_management'),
],

pageObjects,
Expand Down

0 comments on commit ab51e18

Please sign in to comment.