Skip to content

Commit

Permalink
[Ingest Pipelines] Fix functional tests for GeoIP databases (elastic#…
Browse files Browse the repository at this point in the history
…196544)

Follow-up to elastic#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
  • Loading branch information
ElenaStoeva authored Oct 18, 2024
1 parent 9aaffa9 commit 37b57a3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand All @@ -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();
Expand All @@ -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
Expand Down
17 changes: 9 additions & 8 deletions x-pack/test/functional/page_objects/ingest_pipelines_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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');
},

Expand Down

0 comments on commit 37b57a3

Please sign in to comment.