Skip to content

Commit

Permalink
Use selectValue and replace sleep
Browse files Browse the repository at this point in the history
  • Loading branch information
ElenaStoeva committed Oct 17, 2024
1 parent 2643391 commit fbcbed1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@ export const DATABASE_TYPE_OPTIONS = [
text: i18n.translate('xpack.ingestPipelines.manageProcessors.geoip.maxmindDatabaseType', {
defaultMessage: 'MaxMind',
}),
'data-test-subj': 'maxMindOption',
},
{
value: 'ipinfo',
text: i18n.translate('xpack.ingestPipelines.manageProcessors.geoip.ipinfoDatabaseType', {
defaultMessage: 'IPInfo',
}),
'data-test-subj': 'ipInfoOption',
},
];
export const GEOIP_NAME_OPTIONS = [
Expand All @@ -32,14 +30,12 @@ export const GEOIP_NAME_OPTIONS = [
text: i18n.translate('xpack.ingestPipelines.manageProcessors.geoip.anonymousIPDatabaseName', {
defaultMessage: 'GeoIP2 Anonymous IP',
}),
'data-test-subj': 'geoIpAnonymousOption',
},
{
value: 'GeoIP2-City',
text: i18n.translate('xpack.ingestPipelines.manageProcessors.geoip.cityDatabaseName', {
defaultMessage: 'GeoIP2 City',
}),
'data-test-subj': 'geoIpCityOption',
},
{
value: 'GeoIP2-Connection-Type',
Expand All @@ -49,35 +45,30 @@ export const GEOIP_NAME_OPTIONS = [
defaultMessage: 'GeoIP2 Connection Type',
}
),
'data-test-subj': 'geoIpConnectionOption',
},
{
value: 'GeoIP2-Country',
text: i18n.translate('xpack.ingestPipelines.manageProcessors.geoip.countryDatabaseName', {
defaultMessage: 'GeoIP2 Country',
}),
'data-test-subj': 'geoIpCountryOption',
},
{
value: 'GeoIP2-Domain',
text: i18n.translate('xpack.ingestPipelines.manageProcessors.geoip.domainDatabaseName', {
defaultMessage: 'GeoIP2 Domain',
}),
'data-test-subj': 'geoIpDomainOption',
},
{
value: 'GeoIP2-Enterprise',
text: i18n.translate('xpack.ingestPipelines.manageProcessors.geoip.enterpriseDatabaseName', {
defaultMessage: 'GeoIP2 Enterprise',
}),
'data-test-subj': 'geoIpEnterpriseOption',
},
{
value: 'GeoIP2-ISP',
text: i18n.translate('xpack.ingestPipelines.manageProcessors.geoip.ispDatabaseName', {
defaultMessage: 'GeoIP2 ISP',
}),
'data-test-subj': 'geoIpIspOption',
},
];
export const IPINFO_NAME_OPTIONS = [
Expand All @@ -86,21 +77,18 @@ export const IPINFO_NAME_OPTIONS = [
text: i18n.translate('xpack.ingestPipelines.manageProcessors.ipinfo.freeAsnDatabaseName', {
defaultMessage: 'Free IP to ASN',
}),
'data-test-subj': 'asnOption',
},
{
value: 'country',
text: i18n.translate('xpack.ingestPipelines.manageProcessors.ipinfo.freeCountryDatabaseName', {
defaultMessage: 'Free IP to Country',
}),
'data-test-subj': 'countryOption',
},
{
value: 'standard_asn',
text: i18n.translate('xpack.ingestPipelines.manageProcessors.ipinfo.asnDatabaseName', {
defaultMessage: 'ASN',
}),
'data-test-subj': 'standardAsnOption',
},
{
value: 'standard_location',
Expand All @@ -110,7 +98,6 @@ export const IPINFO_NAME_OPTIONS = [
defaultMessage: 'IP Geolocation',
}
),
'data-test-subj': 'locationOption',
},
{
value: 'standard_privacy',
Expand All @@ -120,7 +107,6 @@ export const IPINFO_NAME_OPTIONS = [
defaultMessage: 'Privacy Detection',
}
),
'data-test-subj': 'privacyOption',
},
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
it('Create a MaxMind database', async () => {
await pageObjects.ingestPipelines.openCreateDatabaseModal();
await pageObjects.ingestPipelines.fillAddDatabaseForm(
'maxMindOption',
'geoIpAnonymousOption',
'maxmind',
maxMindDatabaseName,
'123456'
);
await pageObjects.ingestPipelines.clickAddDatabaseButton();
Expand All @@ -54,7 +54,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {

it('Create an IPInfo database', async () => {
await pageObjects.ingestPipelines.openCreateDatabaseModal();
await pageObjects.ingestPipelines.fillAddDatabaseForm('ipInfoOption', 'asnOption');
await pageObjects.ingestPipelines.fillAddDatabaseForm('ipinfo', 'asn');
await pageObjects.ingestPipelines.clickAddDatabaseButton();

// Wait for new row to gets displayed
Expand Down
19 changes: 8 additions & 11 deletions x-pack/test/functional/page_objects/ingest_pipelines_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,26 +132,23 @@ export function IngestPipelinesPageProvider({ getService, getPageObjects }: FtrP
},

async fillAddDatabaseForm(databaseType: string, databaseName: string, maxmind?: string) {
await testSubjects.click('databaseTypeSelect');
await pageObjects.common.sleep(1000);
await testSubjects.click(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.click('databaseNameSelect');
await pageObjects.common.sleep(1000);
await testSubjects.click(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 fbcbed1

Please sign in to comment.