Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
30 changes: 29 additions & 1 deletion x-pack/test/accessibility/apps/index_lifecycle_management.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ const TEST_POLICY_ALL_PHASES = {
};

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const { common } = getPageObjects(['common']);
const { common, indexLifecycleManagement } = getPageObjects([
'common',
'indexLifecycleManagement',
]);
const retry = getService('retry');
const testSubjects = getService('testSubjects');
const esClient = getService('es');
Expand All @@ -55,6 +58,31 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await esClient.ilm.deleteLifecycle({ policy: TEST_POLICY_NAME });
});

it('Create policy Wizard', async () => {
await retry.waitFor('Index Lifecycle Policy create/edit view to be present', async () => {
return testSubjects.isDisplayed('createPolicyButton');
});

// Navigate to create policy page and take snapshot
await testSubjects.click('createPolicyButton');
await retry.waitFor('Index Lifecycle Policy create/edit view to be present', async () => {
return (await testSubjects.getVisibleText('policyTitle')) === 'Create policy';
});
await a11y.testAppSnapshot();

// Fill out form after enabling all phases and take snapshot.
await indexLifecycleManagement.fillNewPolicyForm('testPolicy', true, true, true);
await a11y.testAppSnapshot();
Comment thread
cuff-links marked this conversation as resolved.

// Take snapshot of the show request panel
await testSubjects.click('requestButton');
await a11y.testAppSnapshot();

// Close panel and save policy
await testSubjects.click('euiFlyoutCloseButton');
await indexLifecycleManagement.saveNewPolicy();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it might be worth waiting for the "list"/"table" view to load? That way we know the policy was successfully created, alternatively we can also check for the toast?

});

it('List policies view', async () => {
await retry.waitFor('Index Lifecycle Policy create/edit view to be present', async () => {
await common.navigateToApp('indexLifecycleManagement');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { FtrProviderContext } from '../ftr_provider_context';

export function IndexLifecycleManagementPageProvider({ getService }: FtrProviderContext) {
const testSubjects = getService('testSubjects');
const retry = getService('retry');

return {
async sectionHeadingText() {
Expand All @@ -17,5 +18,40 @@ export function IndexLifecycleManagementPageProvider({ getService }: FtrProvider
async createPolicyButton() {
return await testSubjects.find('createPolicyButton');
},
async fillNewPolicyForm(
policyName: string,
warmEnabled: boolean,
coldEnabled: boolean,
deletePhaseEnabled: boolean
) {
await testSubjects.setValue('policyNameField', policyName);
if (warmEnabled) {
await retry.try(async () => {
await testSubjects.click('enablePhaseSwitch-warm');
});
}
if (coldEnabled) {
await retry.try(async () => {
await testSubjects.click('enablePhaseSwitch-cold');
});
}
if (deletePhaseEnabled) {
await retry.try(async () => {
await testSubjects.click('enableDeletePhaseButton');
});
}
},
async saveNewPolicy() {
await testSubjects.click('savePolicyButton');
},
async createNewPolicyAndSave(
policyName: string,
warmEnabled: boolean,
coldEnabled: boolean,
deletePhaseEnabled: boolean
) {
await this.fillNewPolicyForm(policyName, warmEnabled, coldEnabled, deletePhaseEnabled);
await this.saveNewPolicy();
},
};
}