diff --git a/x-pack/platform/plugins/shared/streams_app/test/scout/ui/fixtures/page_objects/streams_app.ts b/x-pack/platform/plugins/shared/streams_app/test/scout/ui/fixtures/page_objects/streams_app.ts index 1d3e5fd10a30c..480493047358e 100644 --- a/x-pack/platform/plugins/shared/streams_app/test/scout/ui/fixtures/page_objects/streams_app.ts +++ b/x-pack/platform/plugins/shared/streams_app/test/scout/ui/fixtures/page_objects/streams_app.ts @@ -754,6 +754,13 @@ export class StreamsApp { await expect(this.page.getByTestId('streamsAppSchemaEditorFieldsTableLoaded')).toBeVisible(); } + async typeFieldName(value: string) { + await this.page.testSubj.typeWithDelay('streamsAppSchemaEditorAddFieldFlyoutFieldName', value, { + delay: 75, + }); + await this.page.keyboard.press('Enter'); + } + async searchFields(searchTerm: string) { const searchBox = this.page .getByTestId('streamsAppSchemaEditorControls') diff --git a/x-pack/platform/plugins/shared/streams_app/test/scout/ui/tests/data_management/data_mapping/classic_streams_schema.spec.ts b/x-pack/platform/plugins/shared/streams_app/test/scout/ui/tests/data_management/data_mapping/classic_streams_schema.spec.ts index ec6b6fb909640..fdc0df10bf8ee 100644 --- a/x-pack/platform/plugins/shared/streams_app/test/scout/ui/tests/data_management/data_mapping/classic_streams_schema.spec.ts +++ b/x-pack/platform/plugins/shared/streams_app/test/scout/ui/tests/data_management/data_mapping/classic_streams_schema.spec.ts @@ -54,9 +54,7 @@ test.describe( ).toBeVisible(); const targetFieldName = 'grouped_fields'; - await page.getByTestId('streamsAppSchemaEditorAddFieldFlyoutFieldName').click(); - await page.keyboard.type(targetFieldName); - await page.keyboard.press('Enter'); + await pageObjects.streams.typeFieldName(targetFieldName); await pageObjects.streams.setFieldMappingType('keyword'); await page.getByTestId('streamsAppSchemaEditorAddFieldButton').click(); @@ -72,9 +70,7 @@ test.describe( ).toBeVisible(); const sourceFieldName = 'attributes.source_field'; - await page.getByTestId('streamsAppSchemaEditorAddFieldFlyoutFieldName').click(); - await page.keyboard.type(sourceFieldName); - await page.keyboard.press('Enter'); + await pageObjects.streams.typeFieldName(sourceFieldName); await pageObjects.streams.setFieldMappingType('keyword'); // Expand advanced options and add copy_to @@ -137,10 +133,7 @@ test.describe( ).toBeVisible(); const fieldName = 'attributes.geo_test'; - await page.getByTestId('streamsAppSchemaEditorAddFieldFlyoutFieldName').click(); - await page.keyboard.type(fieldName); - await page.keyboard.press('Enter'); - + await pageObjects.streams.typeFieldName(fieldName); await pageObjects.streams.setFieldMappingType('geo_point'); await page.getByTestId('streamsAppSchemaEditorAddFieldButton').click(); diff --git a/x-pack/platform/plugins/shared/streams_app/test/scout/ui/tests/data_management/data_mapping/data_mapping.spec.ts b/x-pack/platform/plugins/shared/streams_app/test/scout/ui/tests/data_management/data_mapping/data_mapping.spec.ts index 941f58f8917ba..6286f5f16449b 100644 --- a/x-pack/platform/plugins/shared/streams_app/test/scout/ui/tests/data_management/data_mapping/data_mapping.spec.ts +++ b/x-pack/platform/plugins/shared/streams_app/test/scout/ui/tests/data_management/data_mapping/data_mapping.spec.ts @@ -242,10 +242,7 @@ test.describe('Stream data mapping - schema editor', { tag: ['@ess', '@svlOblt'] // Fill in the field name const fieldName = 'attributes.id'; - await page.getByTestId('streamsAppSchemaEditorAddFieldFlyoutFieldName').click(); - await page.keyboard.type(fieldName); - await page.keyboard.press('Enter'); - + await pageObjects.streams.typeFieldName(fieldName); // Select field type await pageObjects.streams.setFieldMappingType('keyword'); diff --git a/x-pack/platform/plugins/shared/streams_app/test/scout/ui/tests/data_management/data_mapping/wired_streams_schema.spec.ts b/x-pack/platform/plugins/shared/streams_app/test/scout/ui/tests/data_management/data_mapping/wired_streams_schema.spec.ts index 8dcbd5ece54ed..511ca8d8fc9e0 100644 --- a/x-pack/platform/plugins/shared/streams_app/test/scout/ui/tests/data_management/data_mapping/wired_streams_schema.spec.ts +++ b/x-pack/platform/plugins/shared/streams_app/test/scout/ui/tests/data_management/data_mapping/wired_streams_schema.spec.ts @@ -56,9 +56,7 @@ test.describe( ).toBeVisible(); const parentFieldName = 'attributes.parent_field'; - await page.getByTestId('streamsAppSchemaEditorAddFieldFlyoutFieldName').click(); - await page.keyboard.type(parentFieldName); - await page.keyboard.press('Enter'); + await pageObjects.streams.typeFieldName(parentFieldName); await pageObjects.streams.setFieldMappingType('keyword'); await page.getByTestId('streamsAppSchemaEditorAddFieldButton').click(); await pageObjects.streams.reviewStagedFieldMappingChanges(); @@ -103,9 +101,7 @@ test.describe( // Add an Otel field that should have type recommendation (IP type) const ecsFieldName = 'resource.attributes.host.ip'; - await page.getByTestId('streamsAppSchemaEditorAddFieldFlyoutFieldName').click(); - await page.keyboard.type(ecsFieldName); - await page.keyboard.press('Enter'); + await pageObjects.streams.typeFieldName(ecsFieldName); // Wait for ECS/Otel recommendation to load and field type to be pre-selected await expect(pageObjects.streams.fieldTypeSuperSelect.valueInputLocator).toHaveValue('ip'); @@ -146,9 +142,7 @@ test.describe( const ecsFieldName = 'attributes.process_id'; const aliasFieldName = 'process_id'; - await page.getByTestId('streamsAppSchemaEditorAddFieldFlyoutFieldName').click(); - await page.keyboard.type(ecsFieldName); - await page.keyboard.press('Enter'); + await pageObjects.streams.typeFieldName(ecsFieldName); await pageObjects.streams.setFieldMappingType('keyword'); // Check if the add button is enabled (form should be valid)