Skip to content

Commit

Permalink
[Ingest Pipelines] Fix functional tests (#159336)
Browse files Browse the repository at this point in the history
Fixes #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.

<img width="1401" alt="Screenshot 2023-06-08 at 17 22 14"
src="https://github.com/elastic/kibana/assets/59341489/8582c4fc-38fe-4ccb-9607-bf4f12b0ae37">

### 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 <[email protected]>
  • Loading branch information
ElenaStoeva and kibanamachine authored Jun 20, 2023
1 parent 7047f24 commit e73381d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 11 deletions.
28 changes: 21 additions & 7 deletions x-pack/test/functional/apps/ingest_pipelines/ingest_pipelines.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.',
Expand All @@ -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', () => {
Expand Down Expand Up @@ -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 });
});
});
};
8 changes: 4 additions & 4 deletions x-pack/test/functional/page_objects/ingest_pipelines_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down Expand Up @@ -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');
},
Expand Down

0 comments on commit e73381d

Please sign in to comment.