From 716985c771b88be51705ca1ab9e69aaf9c03d488 Mon Sep 17 00:00:00 2001 From: Melissa Alvarez Date: Thu, 7 Nov 2024 10:21:52 -0700 Subject: [PATCH] [ML][AIOPS] Log rate analysis: add basic functional test (#199054) This PR adds a basic functional test for [this](https://github.com/elastic/kibana/pull/198179) change that adds a switch to Rerun analysis copy if the search bar search changed. Flaky test runner: https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7344 ## Summary Summarize your PR. If it involves visual changes include a screenshot or gif. ### Checklist Delete any items that are not applicable to this PR. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] Any UI touched in this PR is usable by keyboard only (learn more about [keyboard accessibility](https://webaim.org/techniques/keyboard/)) - [ ] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US)) - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)) - [ ] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers) Co-authored-by: Elastic Machine --- x-pack/test/functional/apps/aiops/log_rate_analysis.ts | 6 ++++++ .../test_data/farequote_data_view_test_data_with_query.ts | 1 + x-pack/test/functional/apps/aiops/types.ts | 1 + 3 files changed, 8 insertions(+) diff --git a/x-pack/test/functional/apps/aiops/log_rate_analysis.ts b/x-pack/test/functional/apps/aiops/log_rate_analysis.ts index d6acad691b195..8ffbea4f1a0b0 100644 --- a/x-pack/test/functional/apps/aiops/log_rate_analysis.ts +++ b/x-pack/test/functional/apps/aiops/log_rate_analysis.ts @@ -167,6 +167,12 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { testData.dataGenerator ); + if (testData.editedQuery && testData.query) { + await aiops.logRateAnalysisPage.setQueryInput(testData.editedQuery); + await aiops.logRateAnalysisPage.assertRerunAnalysisButtonExists(true); + await aiops.logRateAnalysisPage.setQueryInput(testData.query); + } + // At this stage the baseline and deviation brush position should be stored in // the url state and a full browser refresh should restore the analysis. await browser.refresh(); diff --git a/x-pack/test/functional/apps/aiops/log_rate_analysis/test_data/farequote_data_view_test_data_with_query.ts b/x-pack/test/functional/apps/aiops/log_rate_analysis/test_data/farequote_data_view_test_data_with_query.ts index e5a8b4783d7bb..8a9957a82b89a 100644 --- a/x-pack/test/functional/apps/aiops/log_rate_analysis/test_data/farequote_data_view_test_data_with_query.ts +++ b/x-pack/test/functional/apps/aiops/log_rate_analysis/test_data/farequote_data_view_test_data_with_query.ts @@ -23,6 +23,7 @@ export const farequoteDataViewTestDataWithQuery: TestData = { fieldSelectorSearch: 'airline', fieldSelectorApplyAvailable: true, query: 'NOT airline:("SWR" OR "ACA" OR "AWE" OR "BAW" OR "JAL" OR "JBU" OR "JZA" OR "KLM")', + editedQuery: 'NOT airline:("SWR")', expected: { totalDocCountFormatted: '48,799', analysisGroupsTable: [ diff --git a/x-pack/test/functional/apps/aiops/types.ts b/x-pack/test/functional/apps/aiops/types.ts index aeac2ce33f718..bf72b9d987030 100644 --- a/x-pack/test/functional/apps/aiops/types.ts +++ b/x-pack/test/functional/apps/aiops/types.ts @@ -68,6 +68,7 @@ export interface TestData { fieldSelectorSearch: string; fieldSelectorApplyAvailable: boolean; query?: string; + editedQuery?: string; action?: TestDataTableActionLogPatternAnalysis; expected: TestDataExpectedWithSampleProbability | TestDataExpectedWithoutSampleProbability; }