@@ -10,20 +10,42 @@ import { notificationServiceMock, scopedHistoryMock } from 'src/core/public/mock
1010
1111import { LocationDescriptorObject } from 'history' ;
1212import { KibanaContextProvider } from 'src/plugins/kibana_react/public' ;
13- import { registerTestBed , TestBed } from '../../../../../../../../../test_utils' ;
14- import { stubWebWorker } from '../../../../../../../../../test_utils/stub_web_worker' ;
15- import { ProcessorsEditorContextProvider , Props } from '../../../' ;
13+ import { registerTestBed , TestBed } from '../../../../../../../test_utils' ;
14+ import { stubWebWorker } from '../../../../../../../test_utils/stub_web_worker' ;
15+ import {
16+ ProcessorsEditorContextProvider ,
17+ Props ,
18+ GlobalOnFailureProcessorsEditor ,
19+ ProcessorsEditor ,
20+ } from '../' ;
1621import { TestPipelineActions } from '../' ;
1722
1823import {
1924 breadcrumbService ,
2025 uiMetricService ,
2126 documentationService ,
2227 apiService ,
23- } from '../../../../../ services' ;
28+ } from '../../../services' ;
2429
2530stubWebWorker ( ) ;
2631
32+ jest . mock ( '../../../../../../../../src/plugins/kibana_react/public' , ( ) => {
33+ const original = jest . requireActual ( '../../../../../../../../src/plugins/kibana_react/public' ) ;
34+ return {
35+ ...original ,
36+ // Mocking CodeEditor, which uses React Monaco under the hood
37+ CodeEditor : ( props : any ) => (
38+ < input
39+ data-test-subj = { props [ 'data-test-subj' ] || 'mockCodeEditor' }
40+ data-currentvalue = { props . value }
41+ onChange = { ( e : any ) => {
42+ props . onChange ( e . jsonContent ) ;
43+ } }
44+ />
45+ ) ,
46+ } ;
47+ } ) ;
48+
2749jest . mock ( '@elastic/eui' , ( ) => {
2850 const original = jest . requireActual ( '@elastic/eui' ) ;
2951 return {
@@ -40,6 +62,17 @@ jest.mock('@elastic/eui', () => {
4062 } ;
4163} ) ;
4264
65+ jest . mock ( 'react-virtualized' , ( ) => {
66+ const original = jest . requireActual ( 'react-virtualized' ) ;
67+
68+ return {
69+ ...original ,
70+ AutoSizer : ( { children } : { children : any } ) => (
71+ < div > { children ( { height : 500 , width : 500 } ) } </ div >
72+ ) ,
73+ } ;
74+ } ) ;
75+
4376const history = scopedHistoryMock . create ( ) ;
4477history . createHref . mockImplementation ( ( location : LocationDescriptorObject ) => {
4578 return `${ location . pathname } ?${ location . search } ` ;
@@ -52,13 +85,15 @@ const appServices = {
5285 api : apiService ,
5386 notifications : notificationServiceMock . createSetupContract ( ) ,
5487 history,
88+ uiSettings : { } ,
5589} ;
5690
5791const testBedSetup = registerTestBed < TestSubject > (
5892 ( props : Props ) => (
5993 < KibanaContextProvider services = { appServices } >
6094 < ProcessorsEditorContextProvider { ...props } >
6195 < TestPipelineActions />
96+ < ProcessorsEditor /> < GlobalOnFailureProcessorsEditor />
6297 </ ProcessorsEditorContextProvider >
6398 </ KibanaContextProvider >
6499 ) ,
@@ -96,6 +131,13 @@ const createActions = (testBed: TestBed<TestSubject>) => {
96131 component . update ( ) ;
97132 } ,
98133
134+ clickProcessorOutputTab ( ) {
135+ act ( ( ) => {
136+ find ( 'outputTab' ) . simulate ( 'click' ) ;
137+ } ) ;
138+ component . update ( ) ;
139+ } ,
140+
99141 async clickRefreshOutputButton ( ) {
100142 await act ( async ( ) => {
101143 find ( 'refreshOutputButton' ) . simulate ( 'click' ) ;
@@ -122,6 +164,13 @@ const createActions = (testBed: TestBed<TestSubject>) => {
122164 jsonString,
123165 } ) ;
124166 } ,
167+
168+ async clickProcessor ( processorSelector : string ) {
169+ await act ( async ( ) => {
170+ find ( `${ processorSelector } .manageItemButton` ) . simulate ( 'click' ) ;
171+ } ) ;
172+ component . update ( ) ;
173+ } ,
125174 } ;
126175} ;
127176
@@ -147,4 +196,11 @@ type TestSubject =
147196 | 'viewOutputButton'
148197 | 'pipelineExecutionError'
149198 | 'euiFlyoutCloseButton'
150- | 'documentsTab' ;
199+ | 'processorStatusIcon'
200+ | 'documentsTab'
201+ | 'manageItemButton'
202+ | 'processorSettingsForm'
203+ | 'configurationTab'
204+ | 'outputTab'
205+ | 'processorOutputTabContent'
206+ | string ;
0 commit comments