From 59cf3b7af5154f3dfdcc924b7fc378572a5bff38 Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Thu, 17 Mar 2022 01:22:17 -0400 Subject: [PATCH] [7.17] Made fix to broken test. Deleted all existing pipelines before test starts. FLAKY: https://github.com/elastic/kibana/issues/118593 (#127102) (#127228) * Made fix to broken test. Deleted all existing pipelines before test starts. FLAKY: https://github.com/elastic/kibana/issues/118593 (#127102) (cherry picked from commit 81eec7c36091d7e5fdcc348554366eacf443eec8) * Adjusted test to look for empty state header. Co-authored-by: John Dorlus Co-authored-by: John Dorlus --- .../apps/ingest_pipelines/ingest_pipelines.ts | 17 +++++++++++++---- .../page_objects/ingest_pipelines_page.ts | 9 ++++++++- 2 files changed, 21 insertions(+), 5 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 2310c45e7f4ff..8aff4faaab94f 100644 --- a/x-pack/test/functional/apps/ingest_pipelines/ingest_pipelines.ts +++ b/x-pack/test/functional/apps/ingest_pipelines/ingest_pipelines.ts @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ - +import { IngestDeletePipelineRequest } from '@elastic/elasticsearch/api/types'; import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; @@ -12,6 +12,7 @@ const PIPELINE = { name: 'test_pipeline', description: 'My pipeline description.', version: 1, + emptyState: true, }; export default ({ getPageObjects, getService }: FtrProviderContext) => { @@ -19,6 +20,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { const log = getService('log'); const es = getService('es'); const security = getService('security'); + const retry = getService('retry'); describe('Ingest Pipelines', function () { this.tags('smoke'); @@ -26,14 +28,21 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { before(async () => { await security.testUser.setRoles(['ingest_pipelines_user']); + // Delete all existing pipelines + await es.ingest.deletePipeline({ id: '*' } as IngestDeletePipelineRequest); 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.sectionHeadingText(); - expect(headingText).to.be('Ingest Pipelines'); + await retry.waitForWithTimeout('empty section heading to be visible', 15000, async () => { + return ( + (await await pageObjects.ingestPipelines.emptyStateHeaderText()) === + 'Start by creating a pipeline' + ); + }); + // const headingText = await pageObjects.ingestPipelines.sectionHeadingText(); + // expect(headingText).to.be('Ingest Pipelines'); }); it('Creates a pipeline', async () => { 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 beda5d4410dd0..ff057b6ad8d80 100644 --- a/x-pack/test/functional/page_objects/ingest_pipelines_page.ts +++ b/x-pack/test/functional/page_objects/ingest_pipelines_page.ts @@ -28,14 +28,21 @@ export function IngestPipelinesPageProvider({ getService, getPageObjects }: FtrP version, processors, onFailureProcessors, + emptyState, }: { name: string; description: string; version?: number; processors?: string; onFailureProcessors?: string; + emptyState?: boolean; }) { - await testSubjects.click('createPipelineButton'); + if (emptyState) { + await testSubjects.click('emptyStateCreatePipelineButton'); + } else { + await testSubjects.click('createPipelineButton'); + } + await testSubjects.exists('pipelineForm'); await testSubjects.setValue('nameField > input', name);