mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[ResponseOps] Automate screenshots for new rule statuses (#147492)
Co-authored-by: Brandon Kobel <brandon.kobel@gmail.com>
This commit is contained in:
parent
6b1dca2b10
commit
4e11ef1b6b
7 changed files with 127 additions and 5 deletions
|
@ -14,6 +14,7 @@ central place to:
|
|||
|
||||
[role="screenshot"]
|
||||
image:images/rules-ui.png[Example rule listing in {rules-ui}]
|
||||
// NOTE: This is an autogenerated screenshot. Do not edit it directly.
|
||||
|
||||
For more information on alerting concepts and the types of rules and connectors
|
||||
available, go to <<alerting-getting-started>>.
|
||||
|
@ -182,6 +183,7 @@ individual rules. For example, you can change the state of a rule:
|
|||
|
||||
[role="screenshot"]
|
||||
image:images/individual-enable-disable.png[Use the rule status dropdown to enable or disable an individual rule]
|
||||
// NOTE: This is an autogenerated screenshot. Do not edit it directly.
|
||||
|
||||
When you snooze a rule, the rule checks continue to run on a schedule but the
|
||||
alert will not trigger any actions. You can snooze for a specified period of
|
||||
|
@ -189,6 +191,7 @@ time, indefinitely, or schedule single or recurring downtimes:
|
|||
|
||||
[role="screenshot"]
|
||||
image:images/snooze-panel.png[Snooze notifications for a rule]
|
||||
// NOTE: This is an autogenerated screenshot. Do not edit it directly.
|
||||
|
||||
When a rule is in a `snoozed` state, you can cancel or change the duration of
|
||||
this state.
|
||||
|
@ -198,11 +201,9 @@ this state.
|
|||
|
||||
A rule can have one of the following statuses:
|
||||
|
||||
`active`:: The conditions for the rule have been met, and the associated actions should be invoked.
|
||||
`ok`:: The conditions for the rule have not been met, and the associated actions are not invoked.
|
||||
`error`:: An error was encountered by the rule.
|
||||
`pending`:: The rule has not yet run. The rule was either just created, or enabled after being disabled.
|
||||
`unknown`:: A problem occurred when calculating the status. Most likely, something went wrong with the alerting code.
|
||||
`failed`:: The rule ran with errors.
|
||||
`succeeded`:: The rule ran without errors.
|
||||
`warning`:: The rule ran with some non-critical errors.
|
||||
|
||||
[float]
|
||||
[[importing-and-exporting-rules]]
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 583 KiB After Width: | Height: | Size: 190 KiB |
Binary file not shown.
Before Width: | Height: | Size: 558 KiB After Width: | Height: | Size: 164 KiB |
Binary file not shown.
Before Width: | Height: | Size: 750 KiB After Width: | Height: | Size: 230 KiB |
68
x-pack/test/functional/services/rules/api.ts
Normal file
68
x-pack/test/functional/services/rules/api.ts
Normal file
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { FtrProviderContext } from '../../ftr_provider_context';
|
||||
|
||||
export function RulesAPIServiceProvider({ getService }: FtrProviderContext) {
|
||||
const kbnSupertest = getService('supertest');
|
||||
const log = getService('log');
|
||||
|
||||
return {
|
||||
async createRule({
|
||||
consumer,
|
||||
name,
|
||||
notifyWhen,
|
||||
params,
|
||||
ruleTypeId,
|
||||
schedule,
|
||||
}: {
|
||||
consumer: string;
|
||||
name: string;
|
||||
notifyWhen: string;
|
||||
params: Record<string, unknown>;
|
||||
ruleTypeId: string;
|
||||
schedule: Record<string, unknown>;
|
||||
}) {
|
||||
log.debug(`Create basic rule...`);
|
||||
const { body: createdRule } = await kbnSupertest
|
||||
.post(`/api/alerting/rule`)
|
||||
.set('kbn-xsrf', 'foo')
|
||||
.send({
|
||||
consumer,
|
||||
name,
|
||||
notify_when: notifyWhen,
|
||||
params,
|
||||
rule_type_id: ruleTypeId,
|
||||
schedule,
|
||||
})
|
||||
.expect(200);
|
||||
return createdRule;
|
||||
},
|
||||
|
||||
async deleteRule(id: string) {
|
||||
log.debug(`Deleting rule with id '${id}'...`);
|
||||
const rsp = kbnSupertest
|
||||
.delete(`/api/alerting/rule/${id}`)
|
||||
.set('kbn-xsrf', 'foo')
|
||||
.expect(204, '');
|
||||
log.debug('> Rule deleted.');
|
||||
return rsp;
|
||||
},
|
||||
|
||||
async deleteAllRules() {
|
||||
log.debug(`Deleting all rules...`);
|
||||
const { body } = await kbnSupertest
|
||||
.get(`/api/alerting/rules/_find`)
|
||||
.set('kbn-xsrf', 'foo')
|
||||
.expect(200);
|
||||
|
||||
for (const rule of body) {
|
||||
await this.deleteRule(rule.id);
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
|
@ -7,9 +7,11 @@
|
|||
|
||||
import { FtrProviderContext } from '../../ftr_provider_context';
|
||||
import { RulesCommonServiceProvider } from './common';
|
||||
import { RulesAPIServiceProvider } from './api';
|
||||
|
||||
export function RulesServiceProvider(context: FtrProviderContext) {
|
||||
return {
|
||||
api: RulesAPIServiceProvider(context),
|
||||
common: RulesCommonServiceProvider(context),
|
||||
};
|
||||
}
|
||||
|
|
|
@ -12,17 +12,40 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
|||
const screenshotDirectories = ['response_ops_docs', 'stack_alerting'];
|
||||
const pageObjects = getPageObjects(['common', 'header']);
|
||||
const actions = getService('actions');
|
||||
const rules = getService('rules');
|
||||
const testSubjects = getService('testSubjects');
|
||||
|
||||
describe('list view', function () {
|
||||
let serverLogConnectorId: string;
|
||||
let ruleId: string;
|
||||
const indexThresholdRule = {
|
||||
consumer: 'alerts',
|
||||
name: 'my rule',
|
||||
notifyWhen: 'onActionGroupChange',
|
||||
params: {
|
||||
index: ['.test-index'],
|
||||
timeField: '@timestamp',
|
||||
aggType: 'count',
|
||||
groupBy: 'all',
|
||||
timeWindowSize: 5,
|
||||
timeWindowUnit: 'd',
|
||||
thresholdComparator: '>',
|
||||
threshold: [1000],
|
||||
},
|
||||
ruleTypeId: '.index-threshold',
|
||||
schedule: { interval: '1m' },
|
||||
tags: [],
|
||||
};
|
||||
|
||||
before(async () => {
|
||||
const connectorName = `server-log-connector`;
|
||||
({ id: serverLogConnectorId } = await createServerLogConnector(connectorName));
|
||||
({ id: ruleId } = await rules.api.createRule(indexThresholdRule));
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
await actions.api.deleteConnector(serverLogConnectorId);
|
||||
await rules.api.deleteRule(ruleId);
|
||||
});
|
||||
|
||||
it('connectors list screenshot', async () => {
|
||||
|
@ -35,6 +58,34 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
|||
1024
|
||||
);
|
||||
});
|
||||
|
||||
it('rules list screenshot', async () => {
|
||||
await pageObjects.common.navigateToApp('triggersActions');
|
||||
await pageObjects.header.waitUntilLoadingHasFinished();
|
||||
await commonScreenshots.takeScreenshot('rules-ui', screenshotDirectories, 1400, 1024);
|
||||
});
|
||||
|
||||
it('rule status screenshot', async () => {
|
||||
await pageObjects.common.navigateToApp('triggersActions');
|
||||
await pageObjects.header.waitUntilLoadingHasFinished();
|
||||
const actionsDropdown = await testSubjects.find('statusDropdown');
|
||||
await actionsDropdown.click();
|
||||
await testSubjects.find('ruleStatusMenu');
|
||||
await commonScreenshots.takeScreenshot(
|
||||
'individual-enable-disable',
|
||||
screenshotDirectories,
|
||||
1400,
|
||||
1024
|
||||
);
|
||||
});
|
||||
|
||||
it('rule snooze screenshot', async () => {
|
||||
await pageObjects.common.navigateToApp('triggersActions');
|
||||
await pageObjects.header.waitUntilLoadingHasFinished();
|
||||
const snoozeBadge = await testSubjects.find('rulesListNotifyBadge-unsnoozed');
|
||||
await snoozeBadge.click();
|
||||
await commonScreenshots.takeScreenshot('snooze-panel', screenshotDirectories, 1400, 1024);
|
||||
});
|
||||
});
|
||||
|
||||
const createServerLogConnector = async (name: string) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue