Skip to content

Commit

Permalink
[ILM] Fixed skipped a11y and functional tests (elastic#116207)
Browse files Browse the repository at this point in the history
* [ILM] Fixed ILM a11y test by creating a snapshot repo that is now required in the ILM API

* [ILM] Fixed functional test by creating a snapshot repository

* [ILM] Updated the params after es client update

* [ILM] Added filtering by policy name to the a11y test to find the correct ILM policy in the list

* [ILM] Added filtering by policy name to the a11y test to find the correct ILM policy in the list

Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
yuliacech and kibanamachine committed Oct 28, 2021
1 parent 3e388b4 commit bce6c45
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,9 @@ export const PolicyTable: React.FunctionComponent<Props> = ({ policies }) => {
direction: 'asc',
},
}}
search={{ box: { incremental: true } }}
search={{
box: { incremental: true, 'data-test-subj': 'ilmSearchBar' },
}}
tableLayout="auto"
items={policies}
columns={columns}
Expand Down
30 changes: 25 additions & 5 deletions x-pack/test/accessibility/apps/index_lifecycle_management.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

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

const REPO_NAME = 'test';
const POLICY_NAME = 'ilm-a11y-test';
const POLICY_ALL_PHASES = {
policy: {
Expand All @@ -23,7 +24,7 @@ const POLICY_ALL_PHASES = {
frozen: {
actions: {
searchable_snapshot: {
snapshot_repository: 'test',
snapshot_repository: REPO_NAME,
},
},
},
Expand All @@ -46,7 +47,12 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const esClient = getService('es');
const a11y = getService('a11y');

const filterByPolicyName = async (policyName: string) => {
await testSubjects.setValue('ilmSearchBar', policyName);
};

const findPolicyLinkInListView = async (policyName: string) => {
await filterByPolicyName(policyName);
const links = await testSubjects.findAll('policyTablePolicyNameLink');
for (const link of links) {
const name = await link.getVisibleText();
Expand All @@ -57,11 +63,19 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
throw new Error(`Could not find ${policyName} in policy table`);
};

// FLAKY
// https://github.com/elastic/kibana/issues/114541
// https://github.com/elastic/kibana/issues/114542
describe.skip('Index Lifecycle Management', async () => {
describe('Index Lifecycle Management', async () => {
before(async () => {
await esClient.snapshot.createRepository({
name: REPO_NAME,
body: {
type: 'fs',
settings: {
// use one of the values defined in path.repo in test/functional/config.js
location: '/tmp/',
},
},
verify: false,
});
await esClient.ilm.putLifecycle({ name: POLICY_NAME, body: POLICY_ALL_PHASES });
await esClient.indices.putIndexTemplate({
name: indexTemplateName,
Expand All @@ -79,6 +93,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});

after(async () => {
await esClient.snapshot.deleteRepository({
name: REPO_NAME,
});
await esClient.ilm.deleteLifecycle({ name: POLICY_NAME });
await esClient.indices.deleteIndexTemplate({ name: indexTemplateName });
});
Expand Down Expand Up @@ -144,6 +161,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});

it('Add policy to index template modal', async () => {
await filterByPolicyName(POLICY_NAME);
const policyRow = await testSubjects.find(`policyTableRow-${POLICY_NAME}`);
const addPolicyButton = await policyRow.findByTestSubject('addPolicyToTemplate');

Expand All @@ -157,6 +175,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});

it('Delete policy modal', async () => {
await filterByPolicyName(POLICY_NAME);
const policyRow = await testSubjects.find(`policyTableRow-${POLICY_NAME}`);
const deleteButton = await policyRow.findByTestSubject('deletePolicy');

Expand All @@ -170,6 +189,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});

it('Index templates flyout', async () => {
await filterByPolicyName(POLICY_NAME);
const policyRow = await testSubjects.find(`policyTableRow-${POLICY_NAME}`);
const actionsButton = await policyRow.findByTestSubject('viewIndexTemplates');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,31 @@ import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';

const policyName = 'testPolicy1';
const repoName = 'test';

export default ({ getPageObjects, getService }: FtrProviderContext) => {
const pageObjects = getPageObjects(['common', 'indexLifecycleManagement']);
const log = getService('log');
const retry = getService('retry');
const esClient = getService('es');

// FAILING ES PROMOTION: https://github.com/elastic/kibana/issues/114473 and https://github.com/elastic/kibana/issues/114474
describe.skip('Home page', function () {
describe('Home page', function () {
before(async () => {
await esClient.snapshot.createRepository({
name: repoName,
body: {
type: 'fs',
settings: {
// use one of the values defined in path.repo in test/functional/config.js
location: '/tmp/',
},
},
verify: false,
});
await pageObjects.common.navigateToApp('indexLifecycleManagement');
});
after(async () => {
await esClient.snapshot.deleteRepository({ name: repoName });
await esClient.ilm.deleteLifecycle({ name: policyName });
});

Expand All @@ -41,6 +53,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
coldEnabled: true,
frozenEnabled: true,
deleteEnabled: true,
snapshotRepository: repoName,
});

await retry.waitFor('navigation back to home page.', async () => {
Expand Down

0 comments on commit bce6c45

Please sign in to comment.