Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,11 @@ export const TableContent: React.FunctionComponent<Props> = ({

const rows = sortedPolicies.map((policy) => {
const { name } = policy;
return <EuiTableRow key={`${name}-row`}>{renderRowCells(policy)}</EuiTableRow>;
return (
<EuiTableRow data-test-subj="policyTableRow" key={`${name}-row`}>
{renderRowCells(policy)}
</EuiTableRow>
);
});

const renderAddPolicyToTemplateConfirmModal = (policy: PolicyFromES): ReactElement => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand All @@ -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);
});
});
};
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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,
};
});
},
};
}