-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…#164629) # Backport This will backport the following commits from `main` to `8.10`: - [[DOCS] Automate Elasticsearch query rule screenshots (#164127)](#164127) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Lisa Cawley","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-08-23T18:41:44Z","message":"[DOCS] Automate Elasticsearch query rule screenshots (#164127)","sha":"154ca404d05fd875d1348d537bc518c89a009a00","branchLabelMapping":{"^v8.11.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Alerting","release_note:skip","Team:ResponseOps","docs","backport:prev-minor","v8.11.0"],"number":164127,"url":"https://github.com/elastic/kibana/pull/164127","mergeCommit":{"message":"[DOCS] Automate Elasticsearch query rule screenshots (#164127)","sha":"154ca404d05fd875d1348d537bc518c89a009a00"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.11.0","labelRegex":"^v8.11.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/164127","number":164127,"mergeCommit":{"message":"[DOCS] Automate Elasticsearch query rule screenshots (#164127)","sha":"154ca404d05fd875d1348d537bc518c89a009a00"}}]}] BACKPORT--> Co-authored-by: Lisa Cawley <[email protected]>
- Loading branch information
1 parent
7552ff2
commit e1a7190
Showing
6 changed files
with
118 additions
and
2 deletions.
There are no files selected for viewing
Binary file modified
BIN
+1.5 KB
(100%)
docs/user/alerting/images/rule-types-es-query-conditions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
112 changes: 112 additions & 0 deletions
112
x-pack/test/screenshot_creation/apps/response_ops_docs/stack_alerting/es_query_rule.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
/* | ||
* 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 default function ({ getService, getPageObjects }: FtrProviderContext) { | ||
const browser = getService('browser'); | ||
const commonScreenshots = getService('commonScreenshots'); | ||
const find = getService('find'); | ||
const rules = getService('rules'); | ||
const testSubjects = getService('testSubjects'); | ||
const pageObjects = getPageObjects(['common', 'header']); | ||
const screenshotDirectories = ['response_ops_docs', 'stack_alerting']; | ||
const ruleName = 'test query rule'; | ||
|
||
const validQueryJson = JSON.stringify({ | ||
query: { | ||
bool: { | ||
filter: [ | ||
{ | ||
term: { | ||
'host.keyword': 'www.elastic.co', | ||
}, | ||
}, | ||
], | ||
}, | ||
}, | ||
}); | ||
const invalidQueryJson = JSON.stringify({ | ||
query: { | ||
bool: { | ||
filter: [ | ||
{ | ||
error_clause: { | ||
'host.keyword': 'www.elastic.co', | ||
}, | ||
}, | ||
], | ||
}, | ||
}, | ||
}); | ||
|
||
describe('elasticsearch query rule', function () { | ||
it('create rule screenshot', async () => { | ||
await pageObjects.common.navigateToApp('triggersActions'); | ||
await pageObjects.header.waitUntilLoadingHasFinished(); | ||
await rules.common.clickCreateAlertButton(); | ||
await testSubjects.scrollIntoView('ruleNameInput'); | ||
await testSubjects.setValue('ruleNameInput', ruleName); | ||
await testSubjects.click(`.es-query-SelectOption`); | ||
await testSubjects.click('queryFormType_esQuery'); | ||
const indexSelector = await testSubjects.find('selectIndexExpression'); | ||
await indexSelector.click(); | ||
const indexComboBox = await find.byCssSelector('#indexSelectSearchBox'); | ||
await indexComboBox.type('kibana_sample_data_logs '); | ||
const filterSelectItem = await find.byCssSelector(`.euiFilterSelectItem`); | ||
await filterSelectItem.click(); | ||
await testSubjects.click('thresholdAlertTimeFieldSelect'); | ||
await testSubjects.setValue('thresholdAlertTimeFieldSelect', '@timestamp'); | ||
await testSubjects.click('closePopover'); | ||
await commonScreenshots.takeScreenshot( | ||
'rule-types-es-query-conditions', | ||
screenshotDirectories, | ||
1400, | ||
1500 | ||
); | ||
// Test a valid query | ||
await testSubjects.setValue('queryJsonEditor', '', { | ||
clearWithKeyboard: true, | ||
}); | ||
const queryJsonEditor = await testSubjects.find('queryJsonEditor'); | ||
await queryJsonEditor.clearValue(); | ||
await testSubjects.setValue('queryJsonEditor', validQueryJson, { | ||
clearWithKeyboard: true, | ||
}); | ||
await testSubjects.click('forLastExpression'); | ||
await testSubjects.setValue('timeWindowSizeNumber', '1'); | ||
await testSubjects.setValue('timeWindowUnitSelect', 'day'); | ||
await browser.pressKeys(browser.keys.ESCAPE); | ||
await testSubjects.click('testQuery'); | ||
await testSubjects.scrollIntoView('ruleNameInput'); | ||
await commonScreenshots.takeScreenshot( | ||
'rule-types-es-query-valid', | ||
screenshotDirectories, | ||
1400, | ||
1500 | ||
); | ||
// Test an invalid query | ||
await testSubjects.setValue('queryJsonEditor', '', { | ||
clearWithKeyboard: true, | ||
}); | ||
await queryJsonEditor.clearValue(); | ||
await testSubjects.setValue('queryJsonEditor', invalidQueryJson, { | ||
clearWithKeyboard: true, | ||
}); | ||
await testSubjects.click('testQuery'); | ||
await testSubjects.scrollIntoView('ruleNameInput'); | ||
await pageObjects.header.waitUntilLoadingHasFinished(); | ||
await commonScreenshots.takeScreenshot( | ||
'rule-types-es-query-invalid', | ||
screenshotDirectories, | ||
1400, | ||
1500 | ||
); | ||
await testSubjects.click('cancelSaveRuleButton'); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters