diff --git a/x-pack/test/accessibility/apps/index_lifecycle_management.ts b/x-pack/test/accessibility/apps/index_lifecycle_management.ts index 43fd805a42d376..d6ba222e50eb44 100644 --- a/x-pack/test/accessibility/apps/index_lifecycle_management.ts +++ b/x-pack/test/accessibility/apps/index_lifecycle_management.ts @@ -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'); @@ -55,6 +58,32 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await esClient.ilm.deleteLifecycle({ policy: TEST_POLICY_NAME }); }); + it('Create Policy Form', 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'; + }); + + // Fill out form after enabling all phases and take snapshot. + await indexLifecycleManagement.fillNewPolicyForm('testPolicy', true, true, false); + await a11y.testAppSnapshot(); + }); + + it('Send Request Flyout on New Policy Page', async () => { + // 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(); + }); + it('List policies view', async () => { await retry.waitFor('Index Lifecycle Policy create/edit view to be present', async () => { await common.navigateToApp('indexLifecycleManagement'); 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 04db9e4544c9a1..ddf46926f122ad 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 @@ -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() { @@ -17,5 +18,40 @@ export function IndexLifecycleManagementPageProvider({ getService }: FtrProvider async createPolicyButton() { return await testSubjects.find('createPolicyButton'); }, + async fillNewPolicyForm( + policyName: string, + warmEnabled: boolean = false, + coldEnabled: boolean = false, + deletePhaseEnabled: boolean = false + ) { + 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 = false, + coldEnabled: boolean = false, + deletePhaseEnabled: boolean = false + ) { + await this.fillNewPolicyForm(policyName, warmEnabled, coldEnabled, deletePhaseEnabled); + await this.saveNewPolicy(); + }, }; }