Skip to content

Commit 3074ed4

Browse files
committed
updated tests
1 parent 9a009ca commit 3074ed4

File tree

3 files changed

+69
-8
lines changed

3 files changed

+69
-8
lines changed

x-pack/test/api_integration/apis/uptime/rest/dynamic_settings.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@ export default function({ getService }: FtrProviderContext) {
1818
});
1919

2020
it('can change the settings', async () => {
21-
const newSettings = { heartbeatIndices: 'myIndex1*' };
21+
const newSettings = {
22+
heartbeatIndices: 'myIndex1*',
23+
certificatesThresholds: {
24+
errorState: 5,
25+
warningState: 15,
26+
},
27+
};
2228
const postResponse = await supertest
2329
.post(`/api/uptime/dynamic_settings`)
2430
.set('kbn-xsrf', 'true')

x-pack/test/functional/apps/uptime/settings.ts

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,41 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
7474
// Verify that the settings page shows the value we previously saved
7575
await settings.go();
7676
const fields = await settings.loadFields();
77-
expect(fields).to.eql(newFieldValues);
77+
expect(fields.heartbeatIndices).to.eql(newFieldValues.heartbeatIndices);
78+
});
79+
80+
it('changing certificate expiration error threshold is reflected in settings page', async () => {
81+
const settings = uptimeService.settings;
82+
83+
await settings.go();
84+
85+
const newErrorThreshold = '5';
86+
await settings.changeErrorThresholdInput(newErrorThreshold);
87+
await settings.apply();
88+
89+
await uptimePage.goToRoot();
90+
91+
// Verify that the settings page shows the value we previously saved
92+
await settings.go();
93+
const fields = await settings.loadFields();
94+
expect(fields.certificatesThresholds.errorState).to.eql(newErrorThreshold);
95+
});
96+
97+
it('changing certificate expiration warning threshold is reflected in settings page', async () => {
98+
const settings = uptimeService.settings;
99+
100+
await settings.go();
101+
102+
const newWarningThreshold = '15';
103+
await settings.changeWarningThresholdInput(newWarningThreshold);
104+
await settings.apply();
105+
106+
await uptimePage.goToRoot();
107+
108+
// Verify that the settings page shows the value we previously saved
109+
await settings.go();
110+
const fields = await settings.loadFields();
111+
expect(fields.certificatesThresholds.warningState).to.eql(newWarningThreshold);
78112
});
79113
});
80114
};

x-pack/test/functional/services/uptime/settings.ts

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,41 @@ export function UptimeSettingsProvider({ getService }: FtrProviderContext) {
1010
const testSubjects = getService('testSubjects');
1111
const retry = getService('retry');
1212

13+
const changeInputField = async (text: string, field: string) => {
14+
const input = await testSubjects.find(field, 5000);
15+
await input.clearValueWithKeyboard();
16+
await input.type(text);
17+
};
18+
1319
return {
1420
go: async () => {
1521
await testSubjects.click('settings-page-link', 5000);
1622
},
23+
1724
changeHeartbeatIndicesInput: async (text: string) => {
18-
const input = await testSubjects.find('heartbeat-indices-input-loaded', 5000);
19-
await input.clearValueWithKeyboard();
20-
await input.type(text);
25+
await changeInputField(text, 'heartbeat-indices-input-loaded');
26+
},
27+
changeErrorThresholdInput: async (text: string) => {
28+
await changeInputField(text, 'error-state-threshold-input-loaded');
29+
},
30+
changeWarningThresholdInput: async (text: string) => {
31+
await changeInputField(text, 'warning-state-threshold-input-loaded');
2132
},
2233
loadFields: async () => {
23-
const input = await testSubjects.find('heartbeat-indices-input-loaded', 5000);
24-
const heartbeatIndices = await input.getAttribute('value');
34+
const indInput = await testSubjects.find('heartbeat-indices-input-loaded', 5000);
35+
const errorInput = await testSubjects.find('error-state-threshold-input-loaded', 5000);
36+
const warningInput = await testSubjects.find('warning-state-threshold-input-loaded', 5000);
37+
const heartbeatIndices = await indInput.getAttribute('value');
38+
const errorThreshold = await errorInput.getAttribute('value');
39+
const warningThreshold = await warningInput.getAttribute('value');
2540

26-
return { heartbeatIndices };
41+
return {
42+
heartbeatIndices,
43+
certificatesThresholds: {
44+
errorState: errorThreshold,
45+
warningState: warningThreshold,
46+
},
47+
};
2748
},
2849
applyButtonIsDisabled: async () => {
2950
return !!(await (await testSubjects.find('apply-settings-button')).getAttribute('disabled'));

0 commit comments

Comments
 (0)