Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML] AIOps: Stabilize flaky functional tests. #155710

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 58 additions & 58 deletions x-pack/test/functional/apps/aiops/explain_log_rate_spikes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,86 +155,86 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
// The group switch should be disabled by default
await aiops.explainLogRateSpikesPage.assertSpikeAnalysisGroupSwitchExists(false);

// Enabled grouping
await aiops.explainLogRateSpikesPage.clickSpikeAnalysisGroupSwitch(false);
if (!isTestDataExpectedWithSampleProbability(testData.expected)) {
// Enabled grouping
await aiops.explainLogRateSpikesPage.clickSpikeAnalysisGroupSwitch(false);

await aiops.explainLogRateSpikesAnalysisGroupsTable.assertSpikeAnalysisTableExists();
await aiops.explainLogRateSpikesAnalysisGroupsTable.assertSpikeAnalysisTableExists();

if (!isTestDataExpectedWithSampleProbability(testData.expected)) {
const analysisGroupsTable =
await aiops.explainLogRateSpikesAnalysisGroupsTable.parseAnalysisTable();
expect(orderBy(analysisGroupsTable, 'group')).to.be.eql(
orderBy(testData.expected.analysisGroupsTable, 'group')
);
}

await ml.testExecution.logTestStep('expand table row');
await aiops.explainLogRateSpikesAnalysisGroupsTable.assertExpandRowButtonExists();
await aiops.explainLogRateSpikesAnalysisGroupsTable.expandRow();

if (!isTestDataExpectedWithSampleProbability(testData.expected)) {
const analysisTable = await aiops.explainLogRateSpikesAnalysisTable.parseAnalysisTable();
expect(orderBy(analysisTable, ['fieldName', 'fieldValue'])).to.be.eql(
orderBy(testData.expected.analysisTable, ['fieldName', 'fieldValue'])
);
}

await ml.testExecution.logTestStep('open the field filter');
await aiops.explainLogRateSpikesPage.assertFieldFilterPopoverButtonExists(false);
await aiops.explainLogRateSpikesPage.clickFieldFilterPopoverButton(true);
await aiops.explainLogRateSpikesPage.assertFieldSelectorFieldNameList(
testData.expected.fieldSelectorPopover
);

await ml.testExecution.logTestStep('filter fields');
await aiops.explainLogRateSpikesPage.setFieldSelectorSearch(testData.fieldSelectorSearch);
await aiops.explainLogRateSpikesPage.assertFieldSelectorFieldNameList([
testData.fieldSelectorSearch,
]);
await aiops.explainLogRateSpikesPage.clickFieldSelectorDisableAllSelectedButton();
await aiops.explainLogRateSpikesPage.assertFieldFilterApplyButtonExists(
!testData.fieldSelectorApplyAvailable
);

if (testData.fieldSelectorApplyAvailable) {
await ml.testExecution.logTestStep('regroup results');
await aiops.explainLogRateSpikesPage.clickFieldFilterApplyButton();
await ml.testExecution.logTestStep('expand table row');
await aiops.explainLogRateSpikesAnalysisGroupsTable.assertExpandRowButtonExists();
await aiops.explainLogRateSpikesAnalysisGroupsTable.expandRow();

if (!isTestDataExpectedWithSampleProbability(testData.expected)) {
const filteredAnalysisGroupsTable =
await aiops.explainLogRateSpikesAnalysisGroupsTable.parseAnalysisTable();
expect(orderBy(filteredAnalysisGroupsTable, 'group')).to.be.eql(
orderBy(testData.expected.filteredAnalysisGroupsTable, 'group')
const analysisTable = await aiops.explainLogRateSpikesAnalysisTable.parseAnalysisTable();
expect(orderBy(analysisTable, ['fieldName', 'fieldValue'])).to.be.eql(
orderBy(testData.expected.analysisTable, ['fieldName', 'fieldValue'])
);
}
}

if (testData.action !== undefined) {
await ml.testExecution.logTestStep('check all table row actions are present');
await aiops.explainLogRateSpikesAnalysisGroupsTable.assertRowActions(
testData.action.tableRowId
await ml.testExecution.logTestStep('open the field filter');
await aiops.explainLogRateSpikesPage.assertFieldFilterPopoverButtonExists(false);
await aiops.explainLogRateSpikesPage.clickFieldFilterPopoverButton(true);
await aiops.explainLogRateSpikesPage.assertFieldSelectorFieldNameList(
testData.expected.fieldSelectorPopover
);

await ml.testExecution.logTestStep('click log pattern analysis action');
await aiops.explainLogRateSpikesAnalysisGroupsTable.clickRowAction(
testData.action.tableRowId,
testData.action.type
await ml.testExecution.logTestStep('filter fields');
await aiops.explainLogRateSpikesPage.setFieldSelectorSearch(testData.fieldSelectorSearch);
await aiops.explainLogRateSpikesPage.assertFieldSelectorFieldNameList([
testData.fieldSelectorSearch,
]);
await aiops.explainLogRateSpikesPage.clickFieldSelectorDisableAllSelectedButton();
await aiops.explainLogRateSpikesPage.assertFieldFilterApplyButtonExists(
!testData.fieldSelectorApplyAvailable
);

await ml.testExecution.logTestStep('check log pattern analysis page loaded correctly');
await aiops.logPatternAnalysisPageProvider.assertLogCategorizationPageExists();
await aiops.logPatternAnalysisPageProvider.assertTotalDocumentCount(
testData.action.expected.totalDocCount
);
await aiops.logPatternAnalysisPageProvider.assertQueryInput(
testData.action.expected.queryBar
);
if (testData.fieldSelectorApplyAvailable) {
await ml.testExecution.logTestStep('regroup results');
await aiops.explainLogRateSpikesPage.clickFieldFilterApplyButton();

if (!isTestDataExpectedWithSampleProbability(testData.expected)) {
const filteredAnalysisGroupsTable =
await aiops.explainLogRateSpikesAnalysisGroupsTable.parseAnalysisTable();
expect(orderBy(filteredAnalysisGroupsTable, 'group')).to.be.eql(
orderBy(testData.expected.filteredAnalysisGroupsTable, 'group')
);
}
}

if (testData.action !== undefined) {
await ml.testExecution.logTestStep('check all table row actions are present');
await aiops.explainLogRateSpikesAnalysisGroupsTable.assertRowActions(
testData.action.tableRowId
);

await ml.testExecution.logTestStep('click log pattern analysis action');
await aiops.explainLogRateSpikesAnalysisGroupsTable.clickRowAction(
testData.action.tableRowId,
testData.action.type
);

await ml.testExecution.logTestStep('check log pattern analysis page loaded correctly');
await aiops.logPatternAnalysisPageProvider.assertLogCategorizationPageExists();
await aiops.logPatternAnalysisPageProvider.assertTotalDocumentCount(
testData.action.expected.totalDocCount
);
await aiops.logPatternAnalysisPageProvider.assertQueryInput(
testData.action.expected.queryBar
);
}
}
});
}

// FLAKY: https://github.com/elastic/kibana/issues/155222
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can probably remove this FLAKY line before merging

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, removed in 2a4b75a. 👍

describe.skip('explain log rate spikes', async function () {
describe('explain log rate spikes', async function () {
for (const testData of explainLogRateSpikesTestData) {
describe(`with '${testData.sourceIndexOrSavedSearch}'`, function () {
before(async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,25 @@ export function ExplainLogRateSpikesPageProvider({
},

async setQueryInput(query: string) {
const aiopsQueryInput = await testSubjects.find('aiopsQueryInput');
await aiopsQueryInput.type(query);
await aiopsQueryInput.pressKeys(browser.keys.ENTER);
await header.waitUntilLoadingHasFinished();
const queryBarText = await aiopsQueryInput.getVisibleText();
expect(queryBarText).to.eql(
query,
`Expected query bar text to be '${query}' (got '${queryBarText}')`
);
await retry.tryForTime(30 * 1000, async () => {
const aiopsQueryInput = await testSubjects.find('aiopsQueryInput');

await aiopsQueryInput.clearValueWithKeyboard();
const queryBarEmpty = await aiopsQueryInput.getVisibleText();
expect(queryBarEmpty).to.eql(
'',
`Expected query bar to be emptied, got '${queryBarEmpty}'`
);

await aiopsQueryInput.type(query);
await aiopsQueryInput.pressKeys(browser.keys.ENTER);
await header.waitUntilLoadingHasFinished();
const queryBarText = await aiopsQueryInput.getVisibleText();
expect(queryBarText).to.eql(
query,
`Expected query bar text to be '${query}' (got '${queryBarText}')`
);
});
},

async assertSamplingProbabilityMissing() {
Expand Down