Skip to content

Commit 740b5e0

Browse files
author
John Dorlus
authored
[ILM][Accessibility] Added A11y test for ILM new policy form. (#92570) (#92760)
* Added A11y test for ILM new policy form. * Separated out the takeSnapshot calls to separate tests.
1 parent 6cb0479 commit 740b5e0

File tree

2 files changed

+66
-1
lines changed

2 files changed

+66
-1
lines changed

x-pack/test/accessibility/apps/index_lifecycle_management.ts

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ const TEST_POLICY_ALL_PHASES = {
2828
};
2929

3030
export default function ({ getService, getPageObjects }: FtrProviderContext) {
31-
const { common } = getPageObjects(['common']);
31+
const { common, indexLifecycleManagement } = getPageObjects([
32+
'common',
33+
'indexLifecycleManagement',
34+
]);
3235
const retry = getService('retry');
3336
const testSubjects = getService('testSubjects');
3437
const esClient = getService('es');
@@ -55,6 +58,32 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
5558
await esClient.ilm.deleteLifecycle({ policy: TEST_POLICY_NAME });
5659
});
5760

61+
it('Create Policy Form', async () => {
62+
await retry.waitFor('Index Lifecycle Policy create/edit view to be present', async () => {
63+
return testSubjects.isDisplayed('createPolicyButton');
64+
});
65+
66+
// Navigate to create policy page and take snapshot
67+
await testSubjects.click('createPolicyButton');
68+
await retry.waitFor('Index Lifecycle Policy create/edit view to be present', async () => {
69+
return (await testSubjects.getVisibleText('policyTitle')) === 'Create policy';
70+
});
71+
72+
// Fill out form after enabling all phases and take snapshot.
73+
await indexLifecycleManagement.fillNewPolicyForm('testPolicy', true, true, false);
74+
await a11y.testAppSnapshot();
75+
});
76+
77+
it('Send Request Flyout on New Policy Page', async () => {
78+
// Take snapshot of the show request panel
79+
await testSubjects.click('requestButton');
80+
await a11y.testAppSnapshot();
81+
82+
// Close panel and save policy
83+
await testSubjects.click('euiFlyoutCloseButton');
84+
await indexLifecycleManagement.saveNewPolicy();
85+
});
86+
5887
it('List policies view', async () => {
5988
await retry.waitFor('Index Lifecycle Policy create/edit view to be present', async () => {
6089
await common.navigateToApp('indexLifecycleManagement');

x-pack/test/functional/page_objects/index_lifecycle_management_page.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { FtrProviderContext } from '../ftr_provider_context';
99

1010
export function IndexLifecycleManagementPageProvider({ getService }: FtrProviderContext) {
1111
const testSubjects = getService('testSubjects');
12+
const retry = getService('retry');
1213

1314
return {
1415
async sectionHeadingText() {
@@ -17,5 +18,40 @@ export function IndexLifecycleManagementPageProvider({ getService }: FtrProvider
1718
async createPolicyButton() {
1819
return await testSubjects.find('createPolicyButton');
1920
},
21+
async fillNewPolicyForm(
22+
policyName: string,
23+
warmEnabled: boolean = false,
24+
coldEnabled: boolean = false,
25+
deletePhaseEnabled: boolean = false
26+
) {
27+
await testSubjects.setValue('policyNameField', policyName);
28+
if (warmEnabled) {
29+
await retry.try(async () => {
30+
await testSubjects.click('enablePhaseSwitch-warm');
31+
});
32+
}
33+
if (coldEnabled) {
34+
await retry.try(async () => {
35+
await testSubjects.click('enablePhaseSwitch-cold');
36+
});
37+
}
38+
if (deletePhaseEnabled) {
39+
await retry.try(async () => {
40+
await testSubjects.click('enableDeletePhaseButton');
41+
});
42+
}
43+
},
44+
async saveNewPolicy() {
45+
await testSubjects.click('savePolicyButton');
46+
},
47+
async createNewPolicyAndSave(
48+
policyName: string,
49+
warmEnabled: boolean = false,
50+
coldEnabled: boolean = false,
51+
deletePhaseEnabled: boolean = false
52+
) {
53+
await this.fillNewPolicyForm(policyName, warmEnabled, coldEnabled, deletePhaseEnabled);
54+
await this.saveNewPolicy();
55+
},
2056
};
2157
}

0 commit comments

Comments
 (0)