diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/policy_table/components/table_content.tsx b/x-pack/plugins/index_lifecycle_management/public/application/sections/policy_table/components/table_content.tsx index 76d2cf666f6593..2c653ee5f76f66 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/policy_table/components/table_content.tsx +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/policy_table/components/table_content.tsx @@ -319,7 +319,11 @@ export const TableContent: React.FunctionComponent = ({ const rows = sortedPolicies.map((policy) => { const { name } = policy; - return {renderRowCells(policy)}; + return ( + + {renderRowCells(policy)} + + ); }); const renderAddPolicyToTemplateConfirmModal = (policy: PolicyFromES): ReactElement => { diff --git a/x-pack/test/functional/apps/index_lifecycle_management/home_page.ts b/x-pack/test/functional/apps/index_lifecycle_management/home_page.ts index 5c1ec2f39d663f..44cd2cda7e1aff 100644 --- a/x-pack/test/functional/apps/index_lifecycle_management/home_page.ts +++ b/x-pack/test/functional/apps/index_lifecycle_management/home_page.ts @@ -11,6 +11,8 @@ import { FtrProviderContext } from '../../ftr_provider_context'; export default ({ getPageObjects, getService }: FtrProviderContext) => { const pageObjects = getPageObjects(['common', 'indexLifecycleManagement']); const log = getService('log'); + const retry = getService('retry'); + const testSubjects = getService('testSubjects'); describe('Home page', function () { before(async () => { @@ -25,5 +27,26 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { const createPolicyButton = await pageObjects.indexLifecycleManagement.createPolicyButton(); expect(await createPolicyButton.isDisplayed()).to.be(true); }); + + it('Create new policy with Warm and Cold Phases', async () => { + const policyName = 'testPolicy1'; + await pageObjects.indexLifecycleManagement.createNewPolicyAndSave( + policyName, + true, + true, + false + ); + + await retry.waitFor('navigation back to home page.', async () => { + return (await testSubjects.getVisibleText('sectionHeading')) === 'Index Lifecycle Policies'; + }); + + const allPolicies = await pageObjects.indexLifecycleManagement.getPolicyList(); + const filteredPolicies = allPolicies.filter(function (policy) { + return policy.name === policyName; + }); + + expect(filteredPolicies.length).to.be(1); + }); }); }; diff --git a/x-pack/test/functional/page_objects/index_lifecycle_management_page.ts b/x-pack/test/functional/page_objects/index_lifecycle_management_page.ts index ddf46926f122ad..f47e79260e61c8 100644 --- a/x-pack/test/functional/page_objects/index_lifecycle_management_page.ts +++ b/x-pack/test/functional/page_objects/index_lifecycle_management_page.ts @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ - +import { map as mapAsync } from 'bluebird'; import { FtrProviderContext } from '../ftr_provider_context'; export function IndexLifecycleManagementPageProvider({ getService }: FtrProviderContext) { @@ -50,8 +50,34 @@ export function IndexLifecycleManagementPageProvider({ getService }: FtrProvider coldEnabled: boolean = false, deletePhaseEnabled: boolean = false ) { + await testSubjects.click('createPolicyButton'); await this.fillNewPolicyForm(policyName, warmEnabled, coldEnabled, deletePhaseEnabled); await this.saveNewPolicy(); }, + + async getPolicyList() { + const policies = await testSubjects.findAll('policyTableRow'); + return mapAsync(policies, async (policy) => { + const policyNameElement = await policy.findByTestSubject('policyTableCell-name'); + const policyLinkedIndicesElement = await policy.findByTestSubject( + 'policyTableCell-linkedIndices' + ); + const policyVersionElement = await policy.findByTestSubject('policyTableCell-version'); + const policyModifiedDateElement = await policy.findByTestSubject( + 'policyTableCell-modified_date' + ); + const policyActionsButtonElement = await policy.findByTestSubject( + 'policyActionsContextMenuButton' + ); + + return { + name: await policyNameElement.getVisibleText(), + linkedIndices: await policyLinkedIndicesElement.getVisibleText(), + version: await policyVersionElement.getVisibleText(), + modifiedDate: await policyModifiedDateElement.getVisibleText(), + actionsButton: policyActionsButtonElement, + }; + }); + }, }; }