Skip to content

Commit

Permalink
[Dataset Quality] Fix tests for degraded fields flyout (elastic#202288)
Browse files Browse the repository at this point in the history
## 📓 Summary

Closes elastic#198849
Closes elastic#200287
Closes elastic#201273
Closes elastic#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 <[email protected]>
(cherry picked from commit d13904e)
  • Loading branch information
tonyghiani committed Dec 2, 2024
1 parent cff07f7 commit ab88b97
Showing 1 changed file with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand All @@ -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',
Expand All @@ -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'
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand All @@ -666,6 +680,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
expandedDegradedField: 'cloud',
});

await PageObjects.header.waitUntilLoadingHasFinished();

await testSubjects.existOrFail(
PageObjects.datasetQuality.testSubjectSelectors
.datasetQualityDetailsDegradedFieldFlyoutIssueDoesNotExist
Expand All @@ -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'
Expand Down Expand Up @@ -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'
Expand All @@ -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');

Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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'
Expand All @@ -835,6 +861,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
expandedDegradedField: 'cloud.project.id',
});

await PageObjects.header.waitUntilLoadingHasFinished();

const applyButton = await testSubjects.find(
'datasetQualityIncreaseFieldMappingLimitButtonButton'
);
Expand Down

0 comments on commit ab88b97

Please sign in to comment.