From 54f61b44cab964c3b701111828b7a75a677ee718 Mon Sep 17 00:00:00 2001 From: Elena Stoeva <59341489+ElenaStoeva@users.noreply.github.com> Date: Fri, 18 Oct 2024 14:54:10 +0100 Subject: [PATCH] [Ingest Pipelines] Fix functional tests for GeoIP databases (#196544) Follow-up to https://github.com/elastic/kibana/pull/190830 ## Summary This PR fixes the functional tests for GeoIP databases. Before, the tests were failing because a value could not be selected in the Type field and the Name field in the add database modal (these fields use EuiSelect for `testsubjects.setValue` did not work). This is fixed by assigning a data-test-subj to every option in the dropdown and clicking on the field and then on the corresponding option. Flaky test runner: https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7165 (cherry picked from commit 37b57a3772e36a933920ebac5de77fd765b235b4) --- .../apps/ingest_pipelines/manage_processors.ts | 11 +++++------ .../page_objects/ingest_pipelines_page.ts | 17 +++++++++-------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/x-pack/test/functional/apps/ingest_pipelines/manage_processors.ts b/x-pack/test/functional/apps/ingest_pipelines/manage_processors.ts index a4951a2829fd0c..5697f57c37038f 100644 --- a/x-pack/test/functional/apps/ingest_pipelines/manage_processors.ts +++ b/x-pack/test/functional/apps/ingest_pipelines/manage_processors.ts @@ -12,10 +12,9 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { const pageObjects = getPageObjects(['common', 'ingestPipelines', 'savedObjects']); const security = getService('security'); const maxMindDatabaseName = 'GeoIP2-Anonymous-IP'; - const ipInfoDatabaseName = 'ASN'; + const ipInfoDatabaseName = 'Free IP to ASN'; - // TODO: Fix flaky tests - describe.skip('Ingest Pipelines: Manage Processors', function () { + describe('Ingest Pipelines: Manage Processors', function () { this.tags('smoke'); before(async () => { await security.testUser.setRoles(['manage_processors_user']); @@ -36,8 +35,8 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { it('Create a MaxMind database', async () => { await pageObjects.ingestPipelines.openCreateDatabaseModal(); await pageObjects.ingestPipelines.fillAddDatabaseForm( - 'MaxMind', - 'GeoIP2 Anonymous IP', + 'maxmind', + maxMindDatabaseName, '123456' ); await pageObjects.ingestPipelines.clickAddDatabaseButton(); @@ -55,7 +54,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { it('Create an IPInfo database', async () => { await pageObjects.ingestPipelines.openCreateDatabaseModal(); - await pageObjects.ingestPipelines.fillAddDatabaseForm('IPInfo', ipInfoDatabaseName); + await pageObjects.ingestPipelines.fillAddDatabaseForm('ipinfo', 'asn'); await pageObjects.ingestPipelines.clickAddDatabaseButton(); // Wait for new row to gets displayed diff --git a/x-pack/test/functional/page_objects/ingest_pipelines_page.ts b/x-pack/test/functional/page_objects/ingest_pipelines_page.ts index b62d34b114f4b2..efbc86128c2249 100644 --- a/x-pack/test/functional/page_objects/ingest_pipelines_page.ts +++ b/x-pack/test/functional/page_objects/ingest_pipelines_page.ts @@ -7,7 +7,6 @@ import path from 'path'; import { WebElementWrapper } from '@kbn/ftr-common-functional-ui-services'; -import expect from '@kbn/expect'; import { FtrProviderContext } from '../ftr_provider_context'; export function IngestPipelinesPageProvider({ getService, getPageObjects }: FtrProviderContext) { @@ -132,21 +131,23 @@ export function IngestPipelinesPageProvider({ getService, getPageObjects }: FtrP }, async fillAddDatabaseForm(databaseType: string, databaseName: string, maxmind?: string) { - await testSubjects.setValue('databaseTypeSelect', databaseType); + await testSubjects.selectValue('databaseTypeSelect', databaseType); - // Wait for the rest of the fields to get displayed - await pageObjects.common.sleep(1000); - expect(await testSubjects.exists('databaseNameSelect')).to.be(true); + await retry.waitFor('Database name field to be displayed', async () => { + return await testSubjects.isDisplayed('databaseNameSelect'); + }); if (maxmind) { await testSubjects.setValue('maxmindField', maxmind); } - await testSubjects.setValue('databaseNameSelect', databaseName); + + await testSubjects.selectValue('databaseNameSelect', databaseName); }, async clickAddDatabaseButton() { - // Wait for button to get enabled - await pageObjects.common.sleep(1000); + await retry.waitFor('Add button to be enabled', async () => { + return await testSubjects.isEnabled('addGeoipDatabaseSubmit'); + }); await testSubjects.click('addGeoipDatabaseSubmit'); },