From e73381dada3bd4aaef4e3decbe4be32608d24131 Mon Sep 17 00:00:00 2001 From: Elena Stoeva <59341489+ElenaStoeva@users.noreply.github.com> Date: Tue, 20 Jun 2023 17:13:58 +0300 Subject: [PATCH] [Ingest Pipelines] Fix functional tests (#159336) Fixes https://github.com/elastic/kibana/issues/157511 ## Summary This PR fixes the functional tests for Ingest Pipelines. Apparently, previously the test environment didn't have any automatically generated ingest pipelines and the tests were expecting an empty screen, but now there are three auto-generated managed pipelines, which is why the tests were failing. Screenshot 2023-06-08 at 17 22 14 ### Checklist - [X] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../apps/ingest_pipelines/ingest_pipelines.ts | 28 ++++++++++++++----- .../page_objects/ingest_pipelines_page.ts | 8 +++--- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/x-pack/test/functional/apps/ingest_pipelines/ingest_pipelines.ts b/x-pack/test/functional/apps/ingest_pipelines/ingest_pipelines.ts index 93ae08af403ea..05ea18d710264 100644 --- a/x-pack/test/functional/apps/ingest_pipelines/ingest_pipelines.ts +++ b/x-pack/test/functional/apps/ingest_pipelines/ingest_pipelines.ts @@ -5,11 +5,13 @@ * 2.0. */ -import { IngestDeletePipelineRequest } from '@elastic/elasticsearch/lib/api/types'; +import { IngestPutPipelineRequest } from '@elastic/elasticsearch/lib/api/types'; import expect from '@kbn/expect'; import path from 'path'; import { FtrProviderContext } from '../../ftr_provider_context'; +const TEST_PIPELINE_NAME = 'test'; + const PIPELINE = { name: 'test_pipeline', description: 'My pipeline description.', @@ -26,21 +28,28 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { const es = getService('es'); const security = getService('security'); - // FAILING ES PROMOTION: https://github.com/elastic/kibana/issues/157511 - describe.skip('Ingest Pipelines', function () { + describe('Ingest Pipelines', function () { this.tags('smoke'); before(async () => { await security.testUser.setRoles(['ingest_pipelines_user']); - // Delete all existing pipelines - await es.ingest.deletePipeline({ id: '*' } as IngestDeletePipelineRequest); + // Create a test pipeline + await es.ingest.putPipeline({ + id: TEST_PIPELINE_NAME, + body: { processors: [] }, + } as IngestPutPipelineRequest); await pageObjects.common.navigateToApp('ingestPipelines'); }); it('Loads the app', async () => { log.debug('Checking for section heading to say Ingest Pipelines.'); - const headingText = await pageObjects.ingestPipelines.emptyStateHeaderText(); - expect(headingText).to.be('Start by creating a pipeline'); + const headingText = await pageObjects.ingestPipelines.sectionHeadingText(); + expect(headingText).to.be('Ingest Pipelines'); + }); + + it('Displays the test pipeline in the list of pipelines', async () => { + const pipelines = await pageObjects.ingestPipelines.getPipelinesList(); + expect(pipelines).to.contain(TEST_PIPELINE_NAME); }); describe('create pipeline', () => { @@ -80,5 +89,10 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await security.testUser.restoreDefaults(); }); }); + + after(async () => { + // Delete the test pipeline + await es.ingest.deletePipeline({ id: TEST_PIPELINE_NAME }); + }); }); }; 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 ebee2fbe6d86d..d2a8edb489d90 100644 --- a/x-pack/test/functional/page_objects/ingest_pipelines_page.ts +++ b/x-pack/test/functional/page_objects/ingest_pipelines_page.ts @@ -35,8 +35,8 @@ export function IngestPipelinesPageProvider({ getService, getPageObjects }: FtrP processors?: string; onFailureProcessors?: string; }) { - await testSubjects.click('emptyStateCreatePipelineDropdown'); - await testSubjects.click('emptyStateCreatePipelineButton'); + await testSubjects.click('createPipelineDropdown'); + await testSubjects.click('createNewPipeline'); await testSubjects.exists('pipelineForm'); @@ -73,8 +73,8 @@ export function IngestPipelinesPageProvider({ getService, getPageObjects }: FtrP }, async navigateToCreateFromCsv() { - await testSubjects.click('emptyStateCreatePipelineDropdown'); - await testSubjects.click('emptyStatecreatePipelineFromCsvButton'); + await testSubjects.click('createPipelineDropdown'); + await testSubjects.click('createPipelineFromCsv'); await testSubjects.exists('createFromCsvInstructions'); },