[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.

<img width="1401" alt="Screenshot 2023-06-08 at 17 22 14"
src="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 <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Elena Stoeva 2023-06-20 17:13:58 +03:00 committed by GitHub
parent 7047f24c17
commit e73381dada
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 11 deletions

View file

@ -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 });
});
});
};

View file

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