From 5f05b74ac5e37984c8b218f4d584c56579ca20c4 Mon Sep 17 00:00:00 2001 From: Marco Antonio Ghiani Date: Mon, 2 Dec 2024 12:04:48 +0100 Subject: [PATCH] [Dataset Quality] Fix tests for degraded fields flyout (#202288) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 📓 Summary Closes #198849 Closes #200287 Closes #201273 Closes #201975 The above issues were raised with similar conditions which converged in the following assumptions: - They are raised due to timeout identifying a visual element on the degraded fields flyout. - They are raised due to a missing UI element, which is part of a common sub-tree conditionally rendered when the data analysis is completed. - They are raised in serverless tests, where the latency might be randomly higher. Given the nature of these tests, which locally always pass correctly given the fastest nature of a local setup, I assume these random failures are due to latency on the common request gating the rendering of these sections. As a fix, I added a wait on the global loading indicator before the assertions, which should wait for the data loading to be completed before running the assertions on the UI elements. Co-authored-by: Marco Antonio Ghiani --- .../dataset_quality/degraded_field_flyout.ts | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/x-pack/test_serverless/functional/test_suites/observability/dataset_quality/degraded_field_flyout.ts b/x-pack/test_serverless/functional/test_suites/observability/dataset_quality/degraded_field_flyout.ts index 42a5a095ed6c4..154bd43b3ef7b 100644 --- a/x-pack/test_serverless/functional/test_suites/observability/dataset_quality/degraded_field_flyout.ts +++ b/x-pack/test_serverless/functional/test_suites/observability/dataset_quality/degraded_field_flyout.ts @@ -22,6 +22,7 @@ import { logsNginxMappings } from './custom_mappings/custom_integration_mappings export default function ({ getService, getPageObjects }: FtrProviderContext) { const PageObjects = getPageObjects([ 'common', + 'header', 'navigationalSearch', 'observabilityLogsExplorer', 'datasetQuality', @@ -452,6 +453,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { expandedDegradedField: 'test_field', }); + await PageObjects.header.waitUntilLoadingHasFinished(); + await retry.tryForTime(5000, async () => { const fieldIgnoredMessageExists = await PageObjects.datasetQuality.doesTextExist( 'datasetQualityDetailsDegradedFieldFlyoutFieldValue-cause', @@ -469,6 +472,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { expandedDegradedField: 'test_field', }); + await PageObjects.header.waitUntilLoadingHasFinished(); + await retry.tryForTime(5000, async () => { const testFieldValue1Exists = await PageObjects.datasetQuality.doesTextExist( 'datasetQualityDetailsDegradedFieldFlyoutFieldValue-values', @@ -491,6 +496,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { expandedDegradedField: 'test_field', }); + await PageObjects.header.waitUntilLoadingHasFinished(); + await retry.tryForTime(5000, async () => { const limitValueExists = await PageObjects.datasetQuality.doesTextExist( 'datasetQualityDetailsDegradedFieldFlyoutFieldValue-characterLimit', @@ -508,6 +515,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { expandedDegradedField: 'test_field', }); + await PageObjects.header.waitUntilLoadingHasFinished(); + // Possible Mitigation Section should exist await testSubjects.existOrFail( 'datasetQualityDetailsDegradedFieldFlyoutPossibleMitigationTitle' @@ -567,6 +576,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { expandedDegradedField: 'test_field', }); + await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.datasetQuality.waitUntilPossibleMitigationsLoaded(); // Possible Mitigation Section should exist @@ -632,6 +642,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { expandedDegradedField: 'cloud', }); + await PageObjects.header.waitUntilLoadingHasFinished(); + await retry.tryForTime(5000, async () => { const fieldLimitMessageExists = await PageObjects.datasetQuality.doesTextExist( 'datasetQualityDetailsDegradedFieldFlyoutFieldValue-cause', @@ -649,6 +661,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { expandedDegradedField: 'cloud', }); + await PageObjects.header.waitUntilLoadingHasFinished(); + await retry.tryForTime(5000, async () => { const limitExists = await PageObjects.datasetQuality.doesTextExist( 'datasetQualityDetailsDegradedFieldFlyoutFieldValue-mappingLimit', @@ -666,6 +680,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { expandedDegradedField: 'cloud', }); + await PageObjects.header.waitUntilLoadingHasFinished(); + await testSubjects.existOrFail( PageObjects.datasetQuality.testSubjectSelectors .datasetQualityDetailsDegradedFieldFlyoutIssueDoesNotExist @@ -680,6 +696,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { expandedDegradedField: 'cloud.project.id', }); + await PageObjects.header.waitUntilLoadingHasFinished(); + // Field Limit Mitigation Section should exist await testSubjects.existOrFail( 'datasetQualityDetailsDegradedFieldFlyoutFieldLimitMitigationAccordion' @@ -710,6 +728,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { expandedDegradedField: 'cloud.project', }); + await PageObjects.header.waitUntilLoadingHasFinished(); + // Field Limit Mitigation Section should exist await testSubjects.existOrFail( 'datasetQualityDetailsDegradedFieldFlyoutFieldLimitMitigationAccordion' @@ -732,6 +752,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { expandedDegradedField: 'cloud.project.id', }); + await PageObjects.header.waitUntilLoadingHasFinished(); + // Should display current field limit await testSubjects.existOrFail('datasetQualityIncreaseFieldMappingCurrentLimitFieldText'); @@ -782,6 +804,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { expandedDegradedField: 'cloud.project.id', }); + await PageObjects.header.waitUntilLoadingHasFinished(); + // Should not allow values less than current limit of 44 await testSubjects.setValue( 'datasetQualityIncreaseFieldMappingProposedLimitFieldText', @@ -816,6 +840,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { expandedDegradedField: 'cloud.project.id', }); + await PageObjects.header.waitUntilLoadingHasFinished(); + await retry.tryForTime(5000, async () => { const applyButton = await testSubjects.find( 'datasetQualityIncreaseFieldMappingLimitButtonButton' @@ -835,6 +861,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { expandedDegradedField: 'cloud.project.id', }); + await PageObjects.header.waitUntilLoadingHasFinished(); + const applyButton = await testSubjects.find( 'datasetQualityIncreaseFieldMappingLimitButtonButton' );