From 640d9e75b86164bc2ecdc5893c4308943bff7413 Mon Sep 17 00:00:00 2001 From: Marco Liberati Date: Thu, 3 Feb 2022 12:41:11 +0100 Subject: [PATCH 01/68] [Lens] Various fixes for Lens embeddables (#123587) * :alchemy: Initial investigation * :bug: Mark heatmap respect disableTriggers * :bug: Make table respect the disableTriggers flag * :bug: Add heatmap and gauges to the supported embeddables list * :alchemy: Debug gauges issues and other embeddables * :label: Add missing column type export * :bug: Fix timeRange prop issue + show validation errors when found * :bug: Fix heatmap issue on load * Update x-pack/plugins/lens/public/embeddable/embeddable.test.tsx Co-authored-by: Marta Bondyra Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Marta Bondyra --- .../common/types/expression_renderers.ts | 1 + .../components/heatmap_component.test.tsx | 7 + .../public/components/heatmap_component.tsx | 176 +++++++++------- .../expression_renderers/heatmap_renderer.tsx | 2 + .../components/columns.tsx | 193 +++++++++--------- .../components/table_basic.test.tsx | 51 +++++ .../components/table_basic.tsx | 32 ++- .../components/types.ts | 1 + .../datatable_visualization/expression.tsx | 3 +- .../public/embeddable/embeddable.test.tsx | 48 ++++- .../lens/public/embeddable/embeddable.tsx | 39 +++- .../embeddable/embeddable_component.tsx | 6 +- x-pack/plugins/lens/public/index.ts | 3 + .../operations/index.ts | 1 + .../public/indexpattern_datasource/types.ts | 1 + 15 files changed, 380 insertions(+), 184 deletions(-) diff --git a/src/plugins/chart_expressions/expression_heatmap/common/types/expression_renderers.ts b/src/plugins/chart_expressions/expression_heatmap/common/types/expression_renderers.ts index 1498c04ca1b79..fa8bc5ee2e19d 100644 --- a/src/plugins/chart_expressions/expression_heatmap/common/types/expression_renderers.ts +++ b/src/plugins/chart_expressions/expression_heatmap/common/types/expression_renderers.ts @@ -32,6 +32,7 @@ export type HeatmapRenderProps = HeatmapExpressionProps & { onSelectRange: (data: BrushEvent['data']) => void; paletteService: PaletteRegistry; uiState: PersistedState; + interactive: boolean; }; export interface ColorStop { diff --git a/src/plugins/chart_expressions/expression_heatmap/public/components/heatmap_component.test.tsx b/src/plugins/chart_expressions/expression_heatmap/public/components/heatmap_component.test.tsx index 59113e5826d24..105bd339cbca4 100644 --- a/src/plugins/chart_expressions/expression_heatmap/public/components/heatmap_component.test.tsx +++ b/src/plugins/chart_expressions/expression_heatmap/public/components/heatmap_component.test.tsx @@ -99,6 +99,7 @@ describe('HeatmapComponent', function () { onSelectRange: jest.fn(), paletteService: palettesRegistry, formatFactory: formatService.deserialize, + interactive: true, }; }); @@ -266,4 +267,10 @@ describe('HeatmapComponent', function () { ]); expect(wrapperProps.onClickValue).toHaveBeenCalled(); }); + + it('does not add callbacks when not interactive', () => { + const component = shallowWithIntl(); + expect(component.find(Settings).first().prop('onElementClick')).toBeUndefined(); + expect(component.find(Settings).first().prop('onBrushEnd')).toBeUndefined(); + }); }); diff --git a/src/plugins/chart_expressions/expression_heatmap/public/components/heatmap_component.tsx b/src/plugins/chart_expressions/expression_heatmap/public/components/heatmap_component.tsx index 969db9263a4e6..197516ce2db90 100644 --- a/src/plugins/chart_expressions/expression_heatmap/public/components/heatmap_component.tsx +++ b/src/plugins/chart_expressions/expression_heatmap/public/components/heatmap_component.tsx @@ -135,6 +135,7 @@ export const HeatmapComponent: FC = memo( onSelectRange, paletteService, uiState, + interactive, }) => { const chartTheme = chartsThemeService.useChartsTheme(); const isDarkTheme = chartsThemeService.useDarkMode(); @@ -145,12 +146,15 @@ export const HeatmapComponent: FC = memo( }); const toggleLegend = useCallback(() => { + if (!interactive) { + return; + } setShowLegend((value) => { const newValue = !value; uiState?.set?.('vis.legendOpen', newValue); return newValue; }); - }, [uiState]); + }, [uiState, interactive]); const setColor = useCallback( (newColor: string | null, seriesLabel: string | number) => { @@ -302,77 +306,30 @@ export const HeatmapComponent: FC = memo( }; }); - const onElementClick = ((e: HeatmapElementEvent[]) => { - const cell = e[0][0]; - const { x, y } = cell.datum; - - const xAxisFieldName = xAxisColumn?.meta?.field; - const timeFieldName = isTimeBasedSwimLane ? xAxisFieldName : ''; - - const points = [ - { - row: table.rows.findIndex((r) => r[xAxisColumn.id] === x), - column: xAxisColumnIndex, - value: x, - }, - ...(yAxisColumn - ? [ - { - row: table.rows.findIndex((r) => r[yAxisColumn.id] === y), - column: yAxisColumnIndex, - value: y, - }, - ] - : []), - ]; - - const context: FilterEvent['data'] = { - data: points.map((point) => ({ - row: point.row, - column: point.column, - value: point.value, - table, - })), - timeFieldName, - }; - onClickValue(context); - }) as ElementClickListener; - - const onBrushEnd = (e: HeatmapBrushEvent) => { - const { x, y } = e; + const onElementClick = useCallback( + (e: HeatmapElementEvent[]) => { + const cell = e[0][0]; + const { x, y } = cell.datum; - const xAxisFieldName = xAxisColumn?.meta?.field; - const timeFieldName = isTimeBasedSwimLane ? xAxisFieldName : ''; + const xAxisFieldName = xAxisColumn?.meta?.field; + const timeFieldName = isTimeBasedSwimLane ? xAxisFieldName : ''; - if (isTimeBasedSwimLane) { - const context: BrushEvent['data'] = { - range: x as number[], - table, - column: xAxisColumnIndex, - timeFieldName, - }; - onSelectRange(context); - } else { - const points: Array<{ row: number; column: number; value: string | number }> = []; - - if (yAxisColumn) { - (y as string[]).forEach((v) => { - points.push({ - row: table.rows.findIndex((r) => r[yAxisColumn.id] === v), - column: yAxisColumnIndex, - value: v, - }); - }); - } - if (xAxisColumn) { - (x as string[]).forEach((v) => { - points.push({ - row: table.rows.findIndex((r) => r[xAxisColumn.id] === v), - column: xAxisColumnIndex, - value: v, - }); - }); - } + const points = [ + { + row: table.rows.findIndex((r) => r[xAxisColumn.id] === x), + column: xAxisColumnIndex, + value: x, + }, + ...(yAxisColumn + ? [ + { + row: table.rows.findIndex((r) => r[yAxisColumn.id] === y), + column: yAxisColumnIndex, + value: y, + }, + ] + : []), + ]; const context: FilterEvent['data'] = { data: points.map((point) => ({ @@ -384,8 +341,79 @@ export const HeatmapComponent: FC = memo( timeFieldName, }; onClickValue(context); - } - }; + }, + [ + isTimeBasedSwimLane, + onClickValue, + table, + xAxisColumn?.id, + xAxisColumn?.meta?.field, + xAxisColumnIndex, + yAxisColumn, + yAxisColumnIndex, + ] + ); + + const onBrushEnd = useCallback( + (e: HeatmapBrushEvent) => { + const { x, y } = e; + + const xAxisFieldName = xAxisColumn?.meta?.field; + const timeFieldName = isTimeBasedSwimLane ? xAxisFieldName : ''; + + if (isTimeBasedSwimLane) { + const context: BrushEvent['data'] = { + range: x as number[], + table, + column: xAxisColumnIndex, + timeFieldName, + }; + onSelectRange(context); + } else { + const points: Array<{ row: number; column: number; value: string | number }> = []; + + if (yAxisColumn) { + (y as string[]).forEach((v) => { + points.push({ + row: table.rows.findIndex((r) => r[yAxisColumn.id] === v), + column: yAxisColumnIndex, + value: v, + }); + }); + } + if (xAxisColumn) { + (x as string[]).forEach((v) => { + points.push({ + row: table.rows.findIndex((r) => r[xAxisColumn.id] === v), + column: xAxisColumnIndex, + value: v, + }); + }); + } + + const context: FilterEvent['data'] = { + data: points.map((point) => ({ + row: point.row, + column: point.column, + value: point.value, + table, + })), + timeFieldName, + }; + onClickValue(context); + } + }, + [ + isTimeBasedSwimLane, + onClickValue, + onSelectRange, + table, + xAxisColumn, + xAxisColumnIndex, + yAxisColumn, + yAxisColumnIndex, + ] + ); const themeOverrides: PartialTheme = { legend: { @@ -458,7 +486,7 @@ export const HeatmapComponent: FC = memo( )} = memo( ? new Date(dateHistogramMeta.timeRange.to).getTime() : NaN, }} - onBrushEnd={onBrushEnd as BrushEndListener} + onBrushEnd={interactive ? (onBrushEnd as BrushEndListener) : undefined} />
@@ -58,6 +59,7 @@ export const heatmapRenderer: ( chartsThemeService={getThemeService()} paletteService={getPaletteService()} uiState={handlers.uiState as PersistedState} + interactive={isInteractive()} />
, diff --git a/x-pack/plugins/lens/public/datatable_visualization/components/columns.tsx b/x-pack/plugins/lens/public/datatable_visualization/components/columns.tsx index a8ba6d553b738..67d95f04869f8 100644 --- a/x-pack/plugins/lens/public/datatable_visualization/components/columns.tsx +++ b/x-pack/plugins/lens/public/datatable_visualization/components/columns.tsx @@ -19,23 +19,27 @@ import type { ColumnConfig } from '../../../common/expressions'; export const createGridColumns = ( bucketColumns: string[], table: Datatable, - handleFilterClick: ( - field: string, - value: unknown, - colIndex: number, - rowIndex: number, - negate?: boolean - ) => void, - handleTransposedColumnClick: ( - bucketValues: Array<{ originalBucketColumn: DatatableColumn; value: unknown }>, - negate?: boolean - ) => void, + handleFilterClick: + | (( + field: string, + value: unknown, + colIndex: number, + rowIndex: number, + negate?: boolean + ) => void) + | undefined, + handleTransposedColumnClick: + | (( + bucketValues: Array<{ originalBucketColumn: DatatableColumn; value: unknown }>, + negate?: boolean + ) => void) + | undefined, isReadOnly: boolean, columnConfig: ColumnConfig, visibleColumns: string[], formatFactory: FormatFactory, onColumnResize: (eventData: { columnId: string; width: number | undefined }) => void, - onColumnHide: (eventData: { columnId: string }) => void, + onColumnHide: ((eventData: { columnId: string }) => void) | undefined, alignments: Record ) => { const columnsReverseLookup = table.columns.reduce< @@ -63,86 +67,87 @@ export const createGridColumns = ( const filterable = bucketLookup.has(field); const { name, index: colIndex } = columnsReverseLookup[field]; - const cellActions = filterable - ? [ - ({ rowIndex, columnId, Component, closePopover }: EuiDataGridColumnCellActionProps) => { - const { rowValue, contentsIsDefined, cellContent } = getContentData({ - rowIndex, - columnId, - }); - - const filterForText = i18n.translate( - 'xpack.lens.table.tableCellFilter.filterForValueText', - { - defaultMessage: 'Filter for value', - } - ); - const filterForAriaLabel = i18n.translate( - 'xpack.lens.table.tableCellFilter.filterForValueAriaLabel', - { - defaultMessage: 'Filter for value: {cellContent}', - values: { - cellContent, - }, - } - ); - - return ( - contentsIsDefined && ( - { - handleFilterClick(field, rowValue, colIndex, rowIndex); - closePopover(); - }} - iconType="plusInCircle" - > - {filterForText} - - ) - ); - }, - ({ rowIndex, columnId, Component, closePopover }: EuiDataGridColumnCellActionProps) => { - const { rowValue, contentsIsDefined, cellContent } = getContentData({ - rowIndex, - columnId, - }); - - const filterOutText = i18n.translate( - 'xpack.lens.table.tableCellFilter.filterOutValueText', - { - defaultMessage: 'Filter out value', - } - ); - const filterOutAriaLabel = i18n.translate( - 'xpack.lens.table.tableCellFilter.filterOutValueAriaLabel', - { - defaultMessage: 'Filter out value: {cellContent}', - values: { - cellContent, - }, - } - ); - - return ( - contentsIsDefined && ( - { - handleFilterClick(field, rowValue, colIndex, rowIndex, true); - closePopover(); - }} - iconType="minusInCircle" - > - {filterOutText} - - ) - ); - }, - ] - : undefined; + const cellActions = + filterable && handleFilterClick + ? [ + ({ rowIndex, columnId, Component, closePopover }: EuiDataGridColumnCellActionProps) => { + const { rowValue, contentsIsDefined, cellContent } = getContentData({ + rowIndex, + columnId, + }); + + const filterForText = i18n.translate( + 'xpack.lens.table.tableCellFilter.filterForValueText', + { + defaultMessage: 'Filter for value', + } + ); + const filterForAriaLabel = i18n.translate( + 'xpack.lens.table.tableCellFilter.filterForValueAriaLabel', + { + defaultMessage: 'Filter for value: {cellContent}', + values: { + cellContent, + }, + } + ); + + return ( + contentsIsDefined && ( + { + handleFilterClick(field, rowValue, colIndex, rowIndex); + closePopover(); + }} + iconType="plusInCircle" + > + {filterForText} + + ) + ); + }, + ({ rowIndex, columnId, Component, closePopover }: EuiDataGridColumnCellActionProps) => { + const { rowValue, contentsIsDefined, cellContent } = getContentData({ + rowIndex, + columnId, + }); + + const filterOutText = i18n.translate( + 'xpack.lens.table.tableCellFilter.filterOutValueText', + { + defaultMessage: 'Filter out value', + } + ); + const filterOutAriaLabel = i18n.translate( + 'xpack.lens.table.tableCellFilter.filterOutValueAriaLabel', + { + defaultMessage: 'Filter out value: {cellContent}', + values: { + cellContent, + }, + } + ); + + return ( + contentsIsDefined && ( + { + handleFilterClick(field, rowValue, colIndex, rowIndex, true); + closePopover(); + }} + iconType="minusInCircle" + > + {filterOutText} + + ) + ); + }, + ] + : undefined; const columnArgs = columnConfig.columns.find(({ columnId }) => columnId === field); const isTransposed = Boolean(columnArgs?.originalColumnId); @@ -163,7 +168,7 @@ export const createGridColumns = ( 'data-test-subj': 'lensDatatableResetWidth', isDisabled: initialWidth == null, }); - if (!isTransposed) { + if (!isTransposed && onColumnHide) { additionalActions.push({ color: 'text', size: 'xs', @@ -178,7 +183,7 @@ export const createGridColumns = ( } if (!isReadOnly) { - if (isTransposed && columnArgs?.bucketValues) { + if (isTransposed && columnArgs?.bucketValues && handleTransposedColumnClick) { const bucketValues = columnArgs?.bucketValues; additionalActions.push({ color: 'text', diff --git a/x-pack/plugins/lens/public/datatable_visualization/components/table_basic.test.tsx b/x-pack/plugins/lens/public/datatable_visualization/components/table_basic.test.tsx index 46ca179e7cdb4..c01419cc2a91e 100644 --- a/x-pack/plugins/lens/public/datatable_visualization/components/table_basic.test.tsx +++ b/x-pack/plugins/lens/public/datatable_visualization/components/table_basic.test.tsx @@ -121,6 +121,7 @@ describe('DatatableComponent', () => { paletteService={chartPluginMock.createPaletteRegistry()} uiSettings={{ get: jest.fn() } as unknown as IUiSettingsClient} renderMode="edit" + interactive /> ) ).toMatchSnapshot(); @@ -141,6 +142,7 @@ describe('DatatableComponent', () => { renderMode="edit" paletteService={chartPluginMock.createPaletteRegistry()} uiSettings={{ get: jest.fn() } as unknown as IUiSettingsClient} + interactive /> ) ).toMatchSnapshot(); @@ -161,6 +163,7 @@ describe('DatatableComponent', () => { renderMode="view" paletteService={chartPluginMock.createPaletteRegistry()} uiSettings={{ get: jest.fn() } as unknown as IUiSettingsClient} + interactive /> ) ).toMatchSnapshot(); @@ -185,6 +188,7 @@ describe('DatatableComponent', () => { renderMode="edit" paletteService={chartPluginMock.createPaletteRegistry()} uiSettings={{ get: jest.fn() } as unknown as IUiSettingsClient} + interactive /> ); @@ -230,6 +234,7 @@ describe('DatatableComponent', () => { renderMode="edit" paletteService={chartPluginMock.createPaletteRegistry()} uiSettings={{ get: jest.fn() } as unknown as IUiSettingsClient} + interactive /> ); @@ -314,6 +319,7 @@ describe('DatatableComponent', () => { renderMode="edit" paletteService={chartPluginMock.createPaletteRegistry()} uiSettings={{ get: jest.fn() } as unknown as IUiSettingsClient} + interactive /> ); @@ -340,6 +346,36 @@ describe('DatatableComponent', () => { }); }); + test('it should not invoke executeTriggerActions if interactivity is set to false', async () => { + const { args, data } = sampleArgs(); + + const wrapper = mountWithIntl( + ({ convert: (x) => x } as IFieldFormat)} + dispatchEvent={onDispatchEvent} + getType={jest.fn(() => ({ type: 'buckets' } as IAggType))} + renderMode="edit" + paletteService={chartPluginMock.createPaletteRegistry()} + uiSettings={{ get: jest.fn() } as unknown as IUiSettingsClient} + interactive={false} + /> + ); + + wrapper.find('[data-test-subj="dataGridRowCell"]').first().simulate('focus'); + + await waitForWrapperUpdate(wrapper); + + expect(wrapper.find('[data-test-subj="lensDatatableFilterOut"]').exists()).toBe(false); + }); + test('it shows emptyPlaceholder for undefined bucketed data', () => { const { args, data } = sampleArgs(); const emptyData: LensMultiTable = { @@ -364,6 +400,7 @@ describe('DatatableComponent', () => { renderMode="edit" paletteService={chartPluginMock.createPaletteRegistry()} uiSettings={{ get: jest.fn() } as unknown as IUiSettingsClient} + interactive /> ); expect(component.find(VisualizationContainer)).toHaveLength(1); @@ -387,6 +424,7 @@ describe('DatatableComponent', () => { renderMode="edit" paletteService={chartPluginMock.createPaletteRegistry()} uiSettings={{ get: jest.fn() } as unknown as IUiSettingsClient} + interactive /> ); @@ -437,6 +475,7 @@ describe('DatatableComponent', () => { renderMode="view" paletteService={chartPluginMock.createPaletteRegistry()} uiSettings={{ get: jest.fn() } as unknown as IUiSettingsClient} + interactive /> ); @@ -467,6 +506,7 @@ describe('DatatableComponent', () => { renderMode="view" paletteService={chartPluginMock.createPaletteRegistry()} uiSettings={{ get: jest.fn() } as unknown as IUiSettingsClient} + interactive /> ); @@ -495,6 +535,7 @@ describe('DatatableComponent', () => { renderMode="view" paletteService={chartPluginMock.createPaletteRegistry()} uiSettings={{ get: jest.fn() } as unknown as IUiSettingsClient} + interactive /> ); @@ -541,6 +582,7 @@ describe('DatatableComponent', () => { renderMode="view" paletteService={chartPluginMock.createPaletteRegistry()} uiSettings={{ get: jest.fn() } as unknown as IUiSettingsClient} + interactive /> ); @@ -567,6 +609,7 @@ describe('DatatableComponent', () => { renderMode="edit" paletteService={chartPluginMock.createPaletteRegistry()} uiSettings={{ get: jest.fn() } as unknown as IUiSettingsClient} + interactive /> ); // mnake a copy of the data, changing only the name of the first column @@ -602,6 +645,7 @@ describe('DatatableComponent', () => { renderMode="view" paletteService={chartPluginMock.createPaletteRegistry()} uiSettings={{ get: jest.fn() } as unknown as IUiSettingsClient} + interactive /> ); @@ -637,6 +681,7 @@ describe('DatatableComponent', () => { renderMode="view" paletteService={chartPluginMock.createPaletteRegistry()} uiSettings={{ get: jest.fn() } as unknown as IUiSettingsClient} + interactive /> ); expect(wrapper.find('[data-test-subj="lnsDataTable-footer-a"]').exists()).toEqual(false); @@ -672,6 +717,7 @@ describe('DatatableComponent', () => { renderMode="view" paletteService={chartPluginMock.createPaletteRegistry()} uiSettings={{ get: jest.fn() } as unknown as IUiSettingsClient} + interactive /> ); @@ -706,6 +752,7 @@ describe('DatatableComponent', () => { renderMode="view" paletteService={chartPluginMock.createPaletteRegistry()} uiSettings={{ get: jest.fn() } as unknown as IUiSettingsClient} + interactive /> ); @@ -728,6 +775,7 @@ describe('DatatableComponent', () => { paletteService={chartPluginMock.createPaletteRegistry()} uiSettings={{ get: jest.fn() } as unknown as IUiSettingsClient} renderMode="edit" + interactive /> ); @@ -762,6 +810,7 @@ describe('DatatableComponent', () => { paletteService={chartPluginMock.createPaletteRegistry()} uiSettings={{ get: jest.fn() } as unknown as IUiSettingsClient} renderMode="edit" + interactive /> ); @@ -786,6 +835,7 @@ describe('DatatableComponent', () => { paletteService: chartPluginMock.createPaletteRegistry(), uiSettings: { get: jest.fn() } as unknown as IUiSettingsClient, renderMode: 'edit' as RenderMode, + interactive: true, }; const wrapper = mount( @@ -821,6 +871,7 @@ describe('DatatableComponent', () => { paletteService={chartPluginMock.createPaletteRegistry()} uiSettings={{ get: jest.fn() } as unknown as IUiSettingsClient} renderMode="edit" + interactive /> ); diff --git a/x-pack/plugins/lens/public/datatable_visualization/components/table_basic.tsx b/x-pack/plugins/lens/public/datatable_visualization/components/table_basic.tsx index 116331771a9dd..403858f4ba48c 100644 --- a/x-pack/plugins/lens/public/datatable_visualization/components/table_basic.tsx +++ b/x-pack/plugins/lens/public/datatable_visualization/components/table_basic.tsx @@ -58,6 +58,8 @@ const PAGE_SIZE_OPTIONS = [DEFAULT_PAGE_SIZE, 20, 30, 50, 100]; export const DatatableComponent = (props: DatatableRenderProps) => { const [firstTable] = Object.values(props.data.tables); + const isInteractive = props.interactive; + const [columnConfig, setColumnConfig] = useState({ columns: props.args.columns, sortingColumnId: props.args.sortingColumnId, @@ -160,13 +162,16 @@ export const DatatableComponent = (props: DatatableRenderProps) => { ); const handleFilterClick = useMemo( - () => createGridFilterHandler(firstTableRef, onClickValue), - [firstTableRef, onClickValue] + () => (isInteractive ? createGridFilterHandler(firstTableRef, onClickValue) : undefined), + [firstTableRef, onClickValue, isInteractive] ); const handleTransposedColumnClick = useMemo( - () => createTransposeColumnFilterHandler(onClickValue, untransposedDataRef), - [onClickValue, untransposedDataRef] + () => + isInteractive + ? createTransposeColumnFilterHandler(onClickValue, untransposedDataRef) + : undefined, + [onClickValue, untransposedDataRef, isInteractive] ); const bucketColumns = useMemo( @@ -206,8 +211,11 @@ export const DatatableComponent = (props: DatatableRenderProps) => { ); const onColumnHide = useMemo( - () => createGridHideHandler(columnConfig, setColumnConfig, onEditAction), - [onEditAction, setColumnConfig, columnConfig] + () => + isInteractive + ? createGridHideHandler(columnConfig, setColumnConfig, onEditAction) + : undefined, + [onEditAction, setColumnConfig, columnConfig, isInteractive] ); const isNumericMap: Record = useMemo(() => { @@ -278,7 +286,7 @@ export const DatatableComponent = (props: DatatableRenderProps) => { ); const trailingControlColumns: EuiDataGridControlColumn[] = useMemo(() => { - if (!hasAtLeastOneRowClickAction || !onRowContextMenuClick) { + if (!hasAtLeastOneRowClickAction || !onRowContextMenuClick || !isInteractive) { return []; } return [ @@ -311,7 +319,13 @@ export const DatatableComponent = (props: DatatableRenderProps) => { }, }, ]; - }, [firstTableRef, onRowContextMenuClick, columnConfig, hasAtLeastOneRowClickAction]); + }, [ + firstTableRef, + onRowContextMenuClick, + columnConfig, + hasAtLeastOneRowClickAction, + isInteractive, + ]); const renderCellValue = useMemo( () => @@ -333,7 +347,7 @@ export const DatatableComponent = (props: DatatableRenderProps) => { [visibleColumns] ); - const sorting = useMemo( + const sorting = useMemo( () => createGridSortingConfig(sortBy, sortDirection as LensGridDirection, onEditAction), [onEditAction, sortBy, sortDirection] ); diff --git a/x-pack/plugins/lens/public/datatable_visualization/components/types.ts b/x-pack/plugins/lens/public/datatable_visualization/components/types.ts index e7be5b78545e8..c5d94549b687e 100644 --- a/x-pack/plugins/lens/public/datatable_visualization/components/types.ts +++ b/x-pack/plugins/lens/public/datatable_visualization/components/types.ts @@ -49,6 +49,7 @@ export type DatatableRenderProps = DatatableProps & { renderMode: RenderMode; paletteService: PaletteRegistry; uiSettings: IUiSettingsClient; + interactive: boolean; /** * A boolean for each table row, which is true if the row active diff --git a/x-pack/plugins/lens/public/datatable_visualization/expression.tsx b/x-pack/plugins/lens/public/datatable_visualization/expression.tsx index 2417e395792e0..51b6f7b8332f5 100644 --- a/x-pack/plugins/lens/public/datatable_visualization/expression.tsx +++ b/x-pack/plugins/lens/public/datatable_visualization/expression.tsx @@ -41,7 +41,7 @@ export const getDatatableRenderer = (dependencies: { handlers: ILensInterpreterRenderHandlers ) => { const resolvedGetType = await dependencies.getType; - const { hasCompatibleActions } = handlers; + const { hasCompatibleActions, isInteractive } = handlers; // An entry for each table row, whether it has any actions attached to // ROW_CLICK_TRIGGER trigger. @@ -81,6 +81,7 @@ export const getDatatableRenderer = (dependencies: { paletteService={dependencies.paletteService} getType={resolvedGetType} rowHasRowClickTriggerActions={rowHasRowClickTriggerActions} + interactive={isInteractive()} uiSettings={dependencies.uiSettings} /> diff --git a/x-pack/plugins/lens/public/embeddable/embeddable.test.tsx b/x-pack/plugins/lens/public/embeddable/embeddable.test.tsx index 17e18392e83e9..5ae3cb571bdbb 100644 --- a/x-pack/plugins/lens/public/embeddable/embeddable.test.tsx +++ b/x-pack/plugins/lens/public/embeddable/embeddable.test.tsx @@ -318,6 +318,52 @@ describe('embeddable', () => { expect(spacesPluginStart.ui.components.getEmbeddableLegacyUrlConflict).toHaveBeenCalled(); }); + it('should not render if timeRange prop is not passed when a referenced data view is time based', async () => { + attributeService = attributeServiceMockFromSavedVis({ + ...savedVis, + references: [ + { type: 'index-pattern', id: '123', name: 'abc' }, + { type: 'index-pattern', id: '123', name: 'def' }, + { type: 'index-pattern', id: '456', name: 'ghi' }, + ], + }); + const embeddable = new Embeddable( + { + timefilter: dataPluginMock.createSetupContract().query.timefilter.timefilter, + attributeService, + expressionRenderer, + basePath, + inspector: inspectorPluginMock.createStartContract(), + indexPatternService: { + get: (id: string) => Promise.resolve({ id, isTimeBased: jest.fn(() => true) }), + } as unknown as IndexPatternsContract, + capabilities: { + canSaveDashboards: true, + canSaveVisualizations: true, + }, + getTrigger, + visualizationMap: {}, + injectFilterReferences: jest.fn(mockInjectFilterReferences), + theme: themeServiceMock.createStartContract(), + documentToExpression: () => + Promise.resolve({ + ast: { + type: 'expression', + chain: [ + { type: 'function', function: 'my', arguments: {} }, + { type: 'function', function: 'expression', arguments: {} }, + ], + }, + errors: undefined, + }), + }, + {} as LensEmbeddableInput + ); + await embeddable.initializeSavedVis({} as LensEmbeddableInput); + embeddable.render(mountpoint); + expect(expressionRenderer).toHaveBeenCalledTimes(0); + }); + it('should initialize output with deduped list of index patterns', async () => { attributeService = attributeServiceMockFromSavedVis({ ...savedVis, @@ -335,7 +381,7 @@ describe('embeddable', () => { basePath, inspector: inspectorPluginMock.createStartContract(), indexPatternService: { - get: (id: string) => Promise.resolve({ id }), + get: (id: string) => Promise.resolve({ id, isTimeBased: () => false }), } as unknown as IndexPatternsContract, capabilities: { canSaveDashboards: true, diff --git a/x-pack/plugins/lens/public/embeddable/embeddable.tsx b/x-pack/plugins/lens/public/embeddable/embeddable.tsx index 2878a484686d2..420416dff111c 100644 --- a/x-pack/plugins/lens/public/embeddable/embeddable.tsx +++ b/x-pack/plugins/lens/public/embeddable/embeddable.tsx @@ -270,11 +270,13 @@ export class Embeddable } switch (this.savedVis.visualizationType) { case 'lnsXY': + case 'lnsHeatmap': return [VIS_EVENT_TO_TRIGGER.filter, VIS_EVENT_TO_TRIGGER.brush]; case 'lnsDatatable': return [VIS_EVENT_TO_TRIGGER.filter, VIS_EVENT_TO_TRIGGER.tableRowContextMenuClick]; case 'lnsPie': return [VIS_EVENT_TO_TRIGGER.filter]; + case 'lnsGauge': case 'lnsMetric': default: return []; @@ -308,6 +310,31 @@ export class Embeddable return ret?.length ? ret : undefined; } + private maybeAddTimeRangeError( + errors: ErrorMessage[] | undefined, + input: LensEmbeddableInput, + indexPatterns: IndexPattern[] + ) { + // if at least one indexPattern is time based, then the Lens embeddable requires the timeRange prop + if ( + input.timeRange == null && + indexPatterns.some((indexPattern) => indexPattern.isTimeBased()) + ) { + return [ + ...(errors || []), + { + shortMessage: i18n.translate('xpack.lens.embeddable.missingTimeRangeParam.shortMessage', { + defaultMessage: `Missing timeRange property`, + }), + longMessage: i18n.translate('xpack.lens.embeddable.missingTimeRangeParam.longMessage', { + defaultMessage: `The timeRange property is required for the given configuration`, + }), + }, + ]; + } + return errors; + } + async initializeSavedVis(input: LensEmbeddableInput) { const unwrapResult: LensUnwrapResult | false = await this.deps.attributeService .unwrapAttributes(input) @@ -334,15 +361,12 @@ export class Embeddable this.expression = expression; this.errors = this.maybeAddConflictError(errors, metaInfo?.sharingSavedObjectProps); - if (this.errors) { - this.logError('validation'); - } await this.initializeOutput(); this.isInitialized = true; } onContainerStateChanged(containerState: LensEmbeddableInput) { - if (this.handleContainerStateChanged(containerState)) this.reload(); + if (this.handleContainerStateChanged(containerState) || this.errors?.length) this.reload(); } handleContainerStateChanged(containerState: LensEmbeddableInput): boolean { @@ -582,6 +606,13 @@ export class Embeddable // the container to pick them up and use them to configure filter bar and // config dropdown correctly. const input = this.getInput(); + + this.errors = this.maybeAddTimeRangeError(this.errors, input, indexPatterns); + + if (this.errors) { + this.logError('validation'); + } + const title = input.hidePanelTitles ? '' : input.title || this.savedVis.title; const savedObjectId = (input as LensByReferenceInput).savedObjectId; this.updateOutput({ diff --git a/x-pack/plugins/lens/public/embeddable/embeddable_component.tsx b/x-pack/plugins/lens/public/embeddable/embeddable_component.tsx index 94473f2be3613..c4bbe3800ab71 100644 --- a/x-pack/plugins/lens/public/embeddable/embeddable_component.tsx +++ b/x-pack/plugins/lens/public/embeddable/embeddable_component.tsx @@ -25,6 +25,8 @@ import type { IndexPatternPersistedState } from '../indexpattern_datasource/type import type { XYState } from '../xy_visualization/types'; import type { PieVisualizationState, MetricState } from '../../common/expressions'; import type { DatatableVisualizationState } from '../datatable_visualization/visualization'; +import type { HeatmapVisualizationState } from '../heatmap_visualization/types'; +import type { GaugeVisualizationState } from '../visualizations/gauge/constants'; type LensAttributes = Omit< Document, @@ -48,7 +50,9 @@ export type TypedLensByValueInput = Omit & { | LensAttributes<'lnsXY', XYState> | LensAttributes<'lnsPie', PieVisualizationState> | LensAttributes<'lnsDatatable', DatatableVisualizationState> - | LensAttributes<'lnsMetric', MetricState>; + | LensAttributes<'lnsMetric', MetricState> + | LensAttributes<'lnsHeatmap', HeatmapVisualizationState> + | LensAttributes<'lnsGauge', GaugeVisualizationState>; }; export type EmbeddableComponentProps = (TypedLensByValueInput | LensByReferenceInput) & { diff --git a/x-pack/plugins/lens/public/index.ts b/x-pack/plugins/lens/public/index.ts index 3e622d8ac9312..463687edd3c6c 100644 --- a/x-pack/plugins/lens/public/index.ts +++ b/x-pack/plugins/lens/public/index.ts @@ -28,6 +28,8 @@ export type { } from '../common/expressions'; export type { ValueLabelConfig } from '../common/types'; export type { DatatableVisualizationState } from './datatable_visualization/visualization'; +export type { HeatmapVisualizationState } from './heatmap_visualization/types'; +export type { GaugeVisualizationState } from './visualizations/gauge/constants'; export type { IndexPatternPersistedState, PersistedIndexPatternLayer, @@ -56,6 +58,7 @@ export type { MathIndexPatternColumn, OverallSumIndexPatternColumn, FormulaPublicApi, + StaticValueIndexPatternColumn, } from './indexpattern_datasource/types'; export type { LensEmbeddableInput } from './embeddable'; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/index.ts b/x-pack/plugins/lens/public/indexpattern_datasource/operations/index.ts index 4474effc8c8c8..05454c4e0751c 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/index.ts +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/index.ts @@ -40,4 +40,5 @@ export type { OverallAverageIndexPatternColumn, FormulaIndexPatternColumn, MathIndexPatternColumn, + StaticValueIndexPatternColumn, } from './definitions'; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/types.ts b/x-pack/plugins/lens/public/indexpattern_datasource/types.ts index 08786b181f3e7..5bb4d58ed20fa 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/types.ts +++ b/x-pack/plugins/lens/public/indexpattern_datasource/types.ts @@ -36,6 +36,7 @@ export type { FormulaIndexPatternColumn, MathIndexPatternColumn, OverallSumIndexPatternColumn, + StaticValueIndexPatternColumn, } from './operations'; export type { FormulaPublicApi } from './operations/definitions/formula/formula_public_api'; From c51daa7daaad08d0cc27887e3d49c1abd5b3dec8 Mon Sep 17 00:00:00 2001 From: Miriam <31922082+MiriamAparicio@users.noreply.github.com> Date: Thu, 3 Feb 2022 11:57:11 +0000 Subject: [PATCH 02/68] Fix validation for duration vars on APM configuration settings (#124336) * Fix validation for duration vars on apm configuration settings * Add unit test and just do the fix if the base package is apm --- .../settings_definition/apm_settings.ts | 8 +-- .../edit_package_policy_page/index.tsx | 7 ++- .../utils/fix_apm_duration_vars.test.ts | 50 +++++++++++++++++++ .../utils/fix_apm_duration_vars.ts | 35 +++++++++++++ .../edit_package_policy_page/utils/index.ts | 1 + .../plugins/fleet/public/constants/index.ts | 8 +++ 6 files changed, 103 insertions(+), 6 deletions(-) create mode 100644 x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/utils/fix_apm_duration_vars.test.ts create mode 100644 x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/utils/fix_apm_duration_vars.ts diff --git a/x-pack/plugins/apm/public/components/fleet_integration/apm_policy_form/settings_definition/apm_settings.ts b/x-pack/plugins/apm/public/components/fleet_integration/apm_policy_form/settings_definition/apm_settings.ts index ec9f740932376..8adda7b5983f1 100644 --- a/x-pack/plugins/apm/public/components/fleet_integration/apm_policy_form/settings_definition/apm_settings.ts +++ b/x-pack/plugins/apm/public/components/fleet_integration/apm_policy_form/settings_definition/apm_settings.ts @@ -78,7 +78,7 @@ export function getApmSettings({ }, { key: 'idle_timeout', - type: 'text', + type: 'duration', labelAppend: OPTIONAL_LABEL, label: i18n.translate( 'xpack.apm.fleet_integration.settings.apm.idleTimeoutLabel', @@ -91,7 +91,7 @@ export function getApmSettings({ }, { key: 'read_timeout', - type: 'text', + type: 'duration', labelAppend: OPTIONAL_LABEL, label: i18n.translate( 'xpack.apm.fleet_integration.settings.apm.readTimeoutLabel', @@ -101,7 +101,7 @@ export function getApmSettings({ }, { key: 'shutdown_timeout', - type: 'text', + type: 'duration', labelAppend: OPTIONAL_LABEL, label: i18n.translate( 'xpack.apm.fleet_integration.settings.apm.shutdownTimeoutLabel', @@ -114,7 +114,7 @@ export function getApmSettings({ }, { key: 'write_timeout', - type: 'text', + type: 'duration', labelAppend: OPTIONAL_LABEL, label: i18n.translate( 'xpack.apm.fleet_integration.settings.apm.writeTimeoutLabel', diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx index 4bce393aebb14..8151215c3cced 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx @@ -64,10 +64,9 @@ import type { } from '../../../../../../common/types/rest_spec'; import type { PackagePolicyEditExtensionComponentProps } from '../../../types'; import { pkgKeyFromPackageInfo, storedPackagePoliciesToAgentInputs } from '../../../services'; - import { EuiButtonWithTooltip } from '../../../../integrations/sections/epm/screens/detail'; -import { hasUpgradeAvailable } from './utils'; +import { fixApmDurationVars, hasUpgradeAvailable } from './utils'; export const EditPackagePolicyPage = memo(() => { const { @@ -232,6 +231,10 @@ export const EditPackagePolicyForm = memo<{ ...basePolicyInputVars, }; } + // Fix duration vars, if it's a migrated setting, and it's a plain old number with no suffix + if (basePackage.name === 'apm') { + newVars = fixApmDurationVars(newVars); + } return { ...restOfInput, streams: streams.map((stream: any) => { diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/utils/fix_apm_duration_vars.test.ts b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/utils/fix_apm_duration_vars.test.ts new file mode 100644 index 0000000000000..ab2a8238e7b37 --- /dev/null +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/utils/fix_apm_duration_vars.test.ts @@ -0,0 +1,50 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { fixApmDurationVars } from './fix_apm_duration_vars'; + +describe('Edit Package Policy - fixApmDurationVars()', () => { + const mockApmVars = { + idle_timeout: { + type: 'text', + value: '45', + }, + read_timeout: { + type: 'text', + value: '3600', + }, + shutdown_timeout: { + type: 'text', + value: '30s', + }, + max_header_bytes: { + type: 'integer', + value: 3, + }, + url: { + type: 'text', + value: 'http://localhost:8200', + }, + }; + describe('when the APM var is a duration var', () => { + it('adds duration unit suffix to APM duration vars ', () => { + const newVars = fixApmDurationVars(mockApmVars); + expect(newVars.idle_timeout.value).toEqual('45s'); + }); + it('doesnt add the suffix if doesnt end with number', () => { + const newVars = fixApmDurationVars(mockApmVars); + expect(newVars.shutdown_timeout.value).toEqual(mockApmVars.shutdown_timeout.value); + }); + }); + describe('when the APM is not a duration var', () => { + it('keeps the same value', () => { + const newVars = fixApmDurationVars(mockApmVars); + expect(newVars.url.value).toEqual(mockApmVars.url.value); + expect(newVars.max_header_bytes.value).toEqual(mockApmVars.max_header_bytes.value); + }); + }); +}); diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/utils/fix_apm_duration_vars.ts b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/utils/fix_apm_duration_vars.ts new file mode 100644 index 0000000000000..bea92f35f52cc --- /dev/null +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/utils/fix_apm_duration_vars.ts @@ -0,0 +1,35 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { PackagePolicyConfigRecord } from '../../../../../integrations/types'; +import { DURATION_APM_SETTINGS_VARS } from '../../../../constants'; + +// Fix duration vars, if it's a migrated setting, and it's a plain old number with no suffix, we should assume seconds +export function fixApmDurationVars(vars: PackagePolicyConfigRecord) { + const { IDLE_TIMEOUT, READ_TIMEOUT, SHUTDOWN_TIMEOUT, TAIL_SAMPLING_INTERVAL, WRITE_TIMEOUT } = + DURATION_APM_SETTINGS_VARS; + // convert vars to array, map each key/value pair into another pair + // and then fromEntries gives back the object + return Object.fromEntries( + Object.entries(vars).map((entry: any) => { + if ( + entry[0] === IDLE_TIMEOUT || + entry[0] === READ_TIMEOUT || + entry[0] === SHUTDOWN_TIMEOUT || + entry[0] === TAIL_SAMPLING_INTERVAL || + entry[0] === WRITE_TIMEOUT + ) { + // we add the unit seconds sufix as default + if (/[0-9]+$/.test(entry[1].value)) { + entry[1] = { ...entry[1], value: entry[1].value + 's' }; + return [entry[0], entry[1]]; + } + } + return entry; + }) + ); +} diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/utils/index.ts b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/utils/index.ts index e8206e9dbbf97..be01b9834a7dc 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/utils/index.ts +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/utils/index.ts @@ -6,3 +6,4 @@ */ export * from './has_upgrade_available'; +export { fixApmDurationVars } from './fix_apm_duration_vars'; diff --git a/x-pack/plugins/fleet/public/constants/index.ts b/x-pack/plugins/fleet/public/constants/index.ts index dddd7552f0151..6fa1a4161a066 100644 --- a/x-pack/plugins/fleet/public/constants/index.ts +++ b/x-pack/plugins/fleet/public/constants/index.ts @@ -29,3 +29,11 @@ export * from './page_paths'; export const INDEX_NAME = '.kibana'; export const CUSTOM_LOGS_INTEGRATION_NAME = 'log'; + +export const DURATION_APM_SETTINGS_VARS = { + IDLE_TIMEOUT: 'idle_timeout', + READ_TIMEOUT: 'read_timeout', + SHUTDOWN_TIMEOUT: 'shutdown_timeout', + TAIL_SAMPLING_INTERVAL: 'tail_sampling_interval', + WRITE_TIMEOUT: 'write_timeout', +}; From e5f8829f4edde75c7e54d7b6919193f3293eb11a Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Thu, 3 Feb 2022 13:19:37 +0100 Subject: [PATCH 03/68] [TSVB] Switch default bar width to 0px (#123926) --- .../public/application/visualizations/views/top_n.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/plugins/vis_types/timeseries/public/application/visualizations/views/top_n.js b/src/plugins/vis_types/timeseries/public/application/visualizations/views/top_n.js index e9ffcd8bc5a86..6b2b25eed2a03 100644 --- a/src/plugins/vis_types/timeseries/public/application/visualizations/views/top_n.js +++ b/src/plugins/vis_types/timeseries/public/application/visualizations/views/top_n.js @@ -74,10 +74,10 @@ export class TopN extends Component { return {}; }; - static calcInnerBarDivStyles = (item, width, isPositive) => { + static calcInnerBarDivStyles = (item, widthWithUnit, isPositive) => { return { backgroundColor: item.color, - width: width + '%', + width: widthWithUnit, float: isPositive ? 'left' : 'right', }; }; @@ -97,8 +97,7 @@ export class TopN extends Component { const renderMode = TopN.getRenderMode(min, max); const key = `${item.id || item.label}`; const lastValue = getLastValue(item.data); - // if result is empty, all bar need to be colored. - const lastValueFormatted = isEmptyValue(lastValue) ? 1 : lastValue; + const lastValueFormatted = isEmptyValue(lastValue) ? 0 : lastValue; const formatter = item.tickFormatter || this.props.tickFormatter; const isPositiveValue = lastValueFormatted >= 0; @@ -106,6 +105,7 @@ export class TopN extends Component { // if both are 0, the division returns NaN causing unexpected behavior. // For this it defaults to 0 const width = 100 * (Math.abs(lastValueFormatted) / intervalLength) || 0; + const widthWithUnit = isEmptyValue(lastValue) ? '1px' : `${width}%`; const label = item.labelFormatted ? labelDateFormatter(item.labelFormatted) : item.label; const styles = reactcss( { @@ -114,7 +114,7 @@ export class TopN extends Component { ...TopN.calcInnerBarStyles(renderMode, isPositiveValue), }, innerBarValue: { - ...TopN.calcInnerBarDivStyles(item, width, isPositiveValue), + ...TopN.calcInnerBarDivStyles(item, widthWithUnit, isPositiveValue), }, label: { maxWidth: this.state.labelMaxWidth, @@ -154,7 +154,7 @@ export class TopN extends Component { const intervalSettings = this.props.series.reduce( (acc, series, index) => { - const value = getLastValue(series.data) ?? 1; + const value = getLastValue(series.data) ?? 0; return { min: !index || value < acc.min ? value : acc.min, From ed2da3f1838b29c49fca999614dcc5648b3e876a Mon Sep 17 00:00:00 2001 From: Stratoula Kalafateli Date: Thu, 3 Feb 2022 14:35:26 +0200 Subject: [PATCH 04/68] [TSVB] Not creates filter by clicking a series agg timeseries chart split by terms (#124031) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../lib/convert_series_to_datatable.test.ts | 21 +++++++++++++++++++ .../lib/convert_series_to_datatable.ts | 12 ++++++++--- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/plugins/vis_types/timeseries/public/application/components/lib/convert_series_to_datatable.test.ts b/src/plugins/vis_types/timeseries/public/application/components/lib/convert_series_to_datatable.test.ts index 3df52223c253a..15151a9e21bc5 100644 --- a/src/plugins/vis_types/timeseries/public/application/components/lib/convert_series_to_datatable.test.ts +++ b/src/plugins/vis_types/timeseries/public/application/components/lib/convert_series_to_datatable.test.ts @@ -210,5 +210,26 @@ describe('convert series to datatables', () => { }); expect(tables.series1.rows).toEqual([...expected1, ...expected2]); }); + + test('for series aggregation split by terms, no column is added', async () => { + const updatedModel = { + ...model, + series: [ + { + ...model.series[0], + metrics: [ + { + field: 'test2', + id: 'series1', + function: 'sum', + type: 'series_agg', + }, + ], + }, + ], + } as TimeseriesVisParams; + const tables = await convertSeriesToDataTable(updatedModel, series, indexPattern); + expect(tables.series1.columns.length).toEqual(2); + }); }); }); diff --git a/src/plugins/vis_types/timeseries/public/application/components/lib/convert_series_to_datatable.ts b/src/plugins/vis_types/timeseries/public/application/components/lib/convert_series_to_datatable.ts index 19a1910afbe2f..8e7c1694357c8 100644 --- a/src/plugins/vis_types/timeseries/public/application/components/lib/convert_series_to_datatable.ts +++ b/src/plugins/vis_types/timeseries/public/application/components/lib/convert_series_to_datatable.ts @@ -9,8 +9,8 @@ import { IndexPattern } from 'src/plugins/data/public'; import { DatatableRow, DatatableColumn, DatatableColumnType } from 'src/plugins/expressions/public'; import { Query } from 'src/plugins/data/common'; import { TimeseriesVisParams } from '../../../types'; -import type { PanelData } from '../../../../common/types'; -import { BUCKET_TYPES } from '../../../../common/enums'; +import type { PanelData, Metric } from '../../../../common/types'; +import { BUCKET_TYPES, TSVB_METRIC_TYPES } from '../../../../common/enums'; import { fetchIndexPattern } from '../../../../common/index_patterns_utils'; import { getDataStart } from '../../../services'; import { X_ACCESSOR_INDEX } from '../../visualizations/constants'; @@ -78,6 +78,10 @@ export const addMetaToColumns = ( }); }; +const hasSeriesAgg = (metrics: Metric[]) => { + return metrics.some((metric) => metric.type === TSVB_METRIC_TYPES.SERIES_AGG); +}; + export const convertSeriesToDataTable = async ( model: TimeseriesVisParams, series: PanelData[], @@ -96,7 +100,9 @@ export const convertSeriesToDataTable = async ( usedIndexPattern = indexPattern; } } - const isGroupedByTerms = layer.split_mode === BUCKET_TYPES.TERMS; + // series aggregation is a special case, splitting by terms doesn't create multiple series per term + const isGroupedByTerms = + layer.split_mode === BUCKET_TYPES.TERMS && !hasSeriesAgg(layer.metrics); const isGroupedByFilters = layer.split_mode === BUCKET_TYPES.FILTERS; const seriesPerLayer = series.filter((s) => s.seriesId === layer.id); let id = X_ACCESSOR_INDEX; From 9d8f817cc5d01fe12390dd08569a3a66501541d5 Mon Sep 17 00:00:00 2001 From: Jonathan Buttner <56361221+jonathan-buttner@users.noreply.github.com> Date: Thu, 3 Feb 2022 07:53:56 -0500 Subject: [PATCH 05/68] adding ignore unavailable and tests (#124401) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../cases/server/services/alerts/index.ts | 1 + .../common/metrics/get_case_metrics_alerts.ts | 50 +++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/x-pack/plugins/cases/server/services/alerts/index.ts b/x-pack/plugins/cases/server/services/alerts/index.ts index 7444159a00bb0..7f966a471c725 100644 --- a/x-pack/plugins/cases/server/services/alerts/index.ts +++ b/x-pack/plugins/cases/server/services/alerts/index.ts @@ -42,6 +42,7 @@ export class AlertService { const res = await this.scopedClusterClient.search({ index: indices, + ignore_unavailable: true, query: { ids: { values: ids } }, size: 0, aggregations: builtAggs, diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/metrics/get_case_metrics_alerts.ts b/x-pack/test/cases_api_integration/security_and_spaces/tests/common/metrics/get_case_metrics_alerts.ts index c711dff7b55a0..1f58d4b72cea8 100644 --- a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/metrics/get_case_metrics_alerts.ts +++ b/x-pack/test/cases_api_integration/security_and_spaces/tests/common/metrics/get_case_metrics_alerts.ts @@ -100,6 +100,56 @@ export default ({ getService }: FtrProviderContext): void => { }); }); + describe('alert details invalid alerts', () => { + let caseId: string; + + before(async () => { + caseId = await createCaseWithAlerts(); + await esArchiver.load('x-pack/test/functional/es_archives/cases/signals/hosts_users'); + }); + + after(async () => { + await esArchiver.unload('x-pack/test/functional/es_archives/cases/signals/hosts_users'); + await deleteAllCaseItems(es); + }); + + it('ignores failures from alerts that the index does not exist', async () => { + const theCase = await createCase(supertest, getPostCaseRequest()); + + // add an alert that has an index and id do not exist + await createComment({ supertest, caseId: theCase.id, params: postCommentAlertReq }); + + const metrics = await getCaseMetrics({ + supertest, + caseId: theCase.id, + features: ['alerts.users', 'alerts.hosts'], + }); + + expect(metrics.alerts?.hosts).to.eql({ + total: 0, + values: [], + }); + expect(metrics.alerts?.users).to.eql({ + total: 0, + values: [], + }); + }); + + it('returns the accurate metrics for the alerts that have valid indices', async () => { + await createComment({ supertest, caseId, params: postCommentAlertReq }); + + const metrics = await getCaseMetrics({ + supertest, + caseId, + features: ['alerts.users', 'alerts.hosts', 'alerts.count'], + }); + + expect(metrics.alerts?.hosts?.total).to.be(3); + expect(metrics.alerts?.users?.total).to.be(4); + expect(metrics.alerts?.count).to.be(7); + }); + }); + describe('alert count', () => { afterEach(async () => { await deleteAllCaseItems(es); From 045fd78fbd5d4aae8f8f5feafe7e6fac22fe216f Mon Sep 17 00:00:00 2001 From: Stratoula Kalafateli Date: Thu, 3 Feb 2022 15:26:21 +0200 Subject: [PATCH 06/68] [XY] Fixes the percentage format for percentiles series (#124098) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- src/plugins/vis_types/xy/public/to_ast.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/vis_types/xy/public/to_ast.ts b/src/plugins/vis_types/xy/public/to_ast.ts index 9e2c7554aaf7c..9dec2f9af5ba4 100644 --- a/src/plugins/vis_types/xy/public/to_ast.ts +++ b/src/plugins/vis_types/xy/public/to_ast.ts @@ -34,6 +34,7 @@ import { XyVisType } from '../common'; import { getEsaggsFn } from './to_ast_esaggs'; import { TimeRangeBounds } from '../../../data/common'; import { getSeriesParams } from './utils/get_series_params'; +import { getSafeId } from './utils/accessors'; const prepareLabel = (data: Labels) => { const label = buildExpressionFunction('label', { @@ -189,8 +190,9 @@ export const toExpressionAst: VisToExpressionAst = async (vis, params (dimensions.y || []).forEach((yDimension) => { const yAgg = responseAggs[yDimension.accessor]; + const aggId = getSafeId(yAgg.id); const seriesParam = (vis.params.seriesParams || []).find( - (param: any) => param.data.id === yAgg.id + (param: any) => param.data.id === aggId ); if (seriesParam) { const usedValueAxis = (vis.params.valueAxes || []).find( From 9df685acbe15ce97cc3882d89a0d6b3c1a41500e Mon Sep 17 00:00:00 2001 From: Uladzislau Lasitsa Date: Thu, 3 Feb 2022 16:58:18 +0300 Subject: [PATCH 07/68] Fix sorting behavior in color ranges when auto max is enabled (#124489) * Fix soring behavior when auto max is enabled * Add some tests --- .../coloring/color_ranges/utils/utils.test.ts | 14 ++++++++++++++ .../coloring/color_ranges/utils/utils.ts | 11 +++++++++-- .../public/shared_components/coloring/utils.ts | 3 ++- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/lens/public/shared_components/coloring/color_ranges/utils/utils.test.ts b/x-pack/plugins/lens/public/shared_components/coloring/color_ranges/utils/utils.test.ts index 582ca454f82ce..d0b650eba0140 100644 --- a/x-pack/plugins/lens/public/shared_components/coloring/color_ranges/utils/utils.test.ts +++ b/x-pack/plugins/lens/public/shared_components/coloring/color_ranges/utils/utils.test.ts @@ -30,6 +30,20 @@ describe('utils', () => { { color: '#ccc', start: 60, end: 80 }, { color: '#bbb', start: 80, end: 90 }, ]); + + colorRanges = [ + { color: '#aaa', start: 55, end: 90 }, + { color: '#bbb', start: 90, end: 60 }, + { color: '#ccc', start: 60, end: Infinity }, + ]; + expect(sortColorRanges(colorRanges)).toEqual([ + { color: '#aaa', start: 55, end: 60 }, + { color: '#ccc', start: 60, end: 90 }, + { color: '#bbb', start: 90, end: Infinity }, + ]); + + colorRanges = [{ color: '#aaa', start: 90, end: 55 }]; + expect(sortColorRanges(colorRanges)).toEqual([{ color: '#aaa', start: 55, end: 90 }]); }); it('calculateMaxStep', () => { diff --git a/x-pack/plugins/lens/public/shared_components/coloring/color_ranges/utils/utils.ts b/x-pack/plugins/lens/public/shared_components/coloring/color_ranges/utils/utils.ts index 6f0f3d5038916..4c8dd17c77c61 100644 --- a/x-pack/plugins/lens/public/shared_components/coloring/color_ranges/utils/utils.ts +++ b/x-pack/plugins/lens/public/shared_components/coloring/color_ranges/utils/utils.ts @@ -27,10 +27,17 @@ export const isLastItem = (accessor: ColorRangeAccessor) => accessor === 'end'; export const sortColorRanges = (colorRanges: ColorRange[]) => { const lastRange = colorRanges[colorRanges.length - 1]; - return [...colorRanges, { start: lastRange.end, color: lastRange.color }] + // we should add last end as new start because we should include it on sorting + return [...colorRanges, { start: lastRange.end, color: lastRange.color, end: undefined }] .sort(({ start: startA }, { start: startB }) => Number(startA) - Number(startB)) .reduce((sortedColorRange, newColorRange, i, array) => { - const color = i === array.length - 2 ? array[i + 1].color : newColorRange.color; + // we should pick correct color for the last range. + // If after sorting we don't change last value we should just take color in array order + // In another case we should get the next one. + let color = newColorRange.color; + if (i === array.length - 2 && array[i + 1].start !== lastRange.end) { + color = array[i + 1].color; + } if (i !== array.length - 1) { sortedColorRange.push({ color, diff --git a/x-pack/plugins/lens/public/shared_components/coloring/utils.ts b/x-pack/plugins/lens/public/shared_components/coloring/utils.ts index d855999ecfcb6..6a90119e4ca71 100644 --- a/x-pack/plugins/lens/public/shared_components/coloring/utils.ts +++ b/x-pack/plugins/lens/public/shared_components/coloring/utils.ts @@ -414,7 +414,8 @@ export function roundValue(value: number, fractionDigits: number = 2) { export function getStepValue(colorStops: ColorStop[], newColorStops: ColorStop[], max: number) { const length = newColorStops.length; // workout the steps from the last 2 items - const dataStep = newColorStops[length - 1].stop - newColorStops[length - 2].stop || 1; + const dataStep = + length > 1 ? newColorStops[length - 1].stop - newColorStops[length - 2].stop || 1 : 1; let step = Number(dataStep.toFixed(2)); if (max < colorStops[length - 1].stop + step) { const diffToMax = max - colorStops[length - 1].stop; From d421e473c8b8c114c612753790e2bed005e745c8 Mon Sep 17 00:00:00 2001 From: Kaarina Tungseth Date: Thu, 3 Feb 2022 08:20:38 -0600 Subject: [PATCH 08/68] [DOCS] Removes tag from 8.0.0-rc2 release notes (#123743) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- docs/CHANGELOG.asciidoc | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/CHANGELOG.asciidoc b/docs/CHANGELOG.asciidoc index 03bccef3b822e..446c305c03b95 100644 --- a/docs/CHANGELOG.asciidoc +++ b/docs/CHANGELOG.asciidoc @@ -20,8 +20,6 @@ Review important information about the {kib} 8.0.0 releases. [[release-notes-8.0.0-rc2]] == {kib} 8.0.0-rc2 -coming::[8.0.0-rc2] - For information about the {kib} 8.0.0-rc2 release, review the following information. [float] From f6a6c8a9c87ee194b44cc800ea31bdffa97f1cee Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Thu, 3 Feb 2022 09:39:41 -0500 Subject: [PATCH 09/68] [Maps][ML] Filter out kbn prop from tooltip (#124300) --- x-pack/plugins/maps/public/index.ts | 2 ++ x-pack/plugins/ml/public/maps/anomaly_source.tsx | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/maps/public/index.ts b/x-pack/plugins/maps/public/index.ts index 5778c8d3b654f..071300b7784fb 100644 --- a/x-pack/plugins/maps/public/index.ts +++ b/x-pack/plugins/maps/public/index.ts @@ -20,6 +20,8 @@ export const plugin: PluginInitializer = ( export { MAP_SAVED_OBJECT_TYPE } from '../common/constants'; export type { PreIndexedShape } from '../common/elasticsearch_util'; +export { GEOJSON_FEATURE_ID_PROPERTY_NAME } from './classes/layers/vector_layer/geojson_vector_layer/assign_feature_ids'; + export type { ITooltipProperty, RenderTooltipContentParams, diff --git a/x-pack/plugins/ml/public/maps/anomaly_source.tsx b/x-pack/plugins/ml/public/maps/anomaly_source.tsx index fa3fce1747a2e..e2d92a730d95a 100644 --- a/x-pack/plugins/ml/public/maps/anomaly_source.tsx +++ b/x-pack/plugins/ml/public/maps/anomaly_source.tsx @@ -15,7 +15,7 @@ import { VectorSourceRequestMeta, } from '../../../maps/common'; import { AbstractSourceDescriptor, MapExtent } from '../../../maps/common/descriptor_types'; -import { ITooltipProperty } from '../../../maps/public'; +import { ITooltipProperty, GEOJSON_FEATURE_ID_PROPERTY_NAME } from '../../../maps/public'; import { AnomalySourceField, AnomalySourceTooltipProperty, @@ -247,6 +247,9 @@ export class AnomalySource implements IVectorSource { async getTooltipProperties(properties: { [p: string]: any } | null): Promise { const tooltipProperties: ITooltipProperty[] = []; for (const key in properties) { + if (key === GEOJSON_FEATURE_ID_PROPERTY_NAME) { + continue; + } if (properties.hasOwnProperty(key)) { const label = ANOMALY_SOURCE_FIELDS[key]?.label; if (label) { From ad7c8de75aef8c5890ea4db4e08d1e465cdd8db7 Mon Sep 17 00:00:00 2001 From: "Christiane (Tina) Heiligers" Date: Thu, 3 Feb 2022 07:56:39 -0700 Subject: [PATCH 10/68] Appends the saved objects documents count to the CoreUsageData service (#124308) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../core/server/kibana-plugin-core-server.md | 2 +- ...re-server.mergesavedobjectmigrationmaps.md | 8 ++++++ .../core_usage_data_service.mock.ts | 1 + .../core_usage_data_service.test.ts | 12 ++++++++ .../core_usage_data_service.ts | 28 +++++++++++++++++-- src/core/server/core_usage_data/types.ts | 1 + src/core/server/server.api.md | 1 + .../collectors/core/core_usage_collector.ts | 10 +++++-- src/plugins/telemetry/schema/oss_plugins.json | 10 +++++-- 9 files changed, 65 insertions(+), 8 deletions(-) diff --git a/docs/development/core/server/kibana-plugin-core-server.md b/docs/development/core/server/kibana-plugin-core-server.md index ede29f5e3d2c8..450af99a5b234 100644 --- a/docs/development/core/server/kibana-plugin-core-server.md +++ b/docs/development/core/server/kibana-plugin-core-server.md @@ -244,7 +244,7 @@ The plugin integrates with the core system via lifecycle events: `setup` | --- | --- | | [APP\_WRAPPER\_CLASS](./kibana-plugin-core-server.app_wrapper_class.md) | The class name for top level \*and\* nested application wrappers to ensure proper layout | | [kibanaResponseFactory](./kibana-plugin-core-server.kibanaresponsefactory.md) | Set of helpers used to create KibanaResponse to form HTTP response on an incoming request. Should be returned as a result of [RequestHandler](./kibana-plugin-core-server.requesthandler.md) execution. | -| [mergeSavedObjectMigrationMaps](./kibana-plugin-core-server.mergesavedobjectmigrationmaps.md) | Merges two saved object migration maps. | +| [mergeSavedObjectMigrationMaps](./kibana-plugin-core-server.mergesavedobjectmigrationmaps.md) | Merges two saved object migration maps.If there is a migration for a given version on only one of the maps, that migration function will be used:mergeSavedObjectMigrationMaps({ '1.2.3': f }, { '4.5.6': g }) -> { '1.2.3': f, '4.5.6': g }If there is a migration for a given version on both maps, the migrations will be composed:mergeSavedObjectMigrationMaps({ '1.2.3': f }, { '1.2.3': g }) -> { '1.2.3': (doc, context) => f(g(doc, context), context) } | | [pollEsNodesVersion](./kibana-plugin-core-server.pollesnodesversion.md) | | | [ServiceStatusLevels](./kibana-plugin-core-server.servicestatuslevels.md) | The current "level" of availability of a service. | | [validBodyOutput](./kibana-plugin-core-server.validbodyoutput.md) | The set of valid body.output | diff --git a/docs/development/core/server/kibana-plugin-core-server.mergesavedobjectmigrationmaps.md b/docs/development/core/server/kibana-plugin-core-server.mergesavedobjectmigrationmaps.md index 52d40097ca487..68cd580b57882 100644 --- a/docs/development/core/server/kibana-plugin-core-server.mergesavedobjectmigrationmaps.md +++ b/docs/development/core/server/kibana-plugin-core-server.mergesavedobjectmigrationmaps.md @@ -6,6 +6,14 @@ Merges two saved object migration maps. +If there is a migration for a given version on only one of the maps, that migration function will be used: + +mergeSavedObjectMigrationMaps({ '1.2.3': f }, { '4.5.6': g }) -> { '1.2.3': f, '4.5.6': g } + +If there is a migration for a given version on both maps, the migrations will be composed: + +mergeSavedObjectMigrationMaps({ '1.2.3': f }, { '1.2.3': g }) -> { '1.2.3': (doc, context) => f(g(doc, context), context) } + Signature: ```typescript diff --git a/src/core/server/core_usage_data/core_usage_data_service.mock.ts b/src/core/server/core_usage_data/core_usage_data_service.mock.ts index 331a3bbb9c028..fd8f219fb2d55 100644 --- a/src/core/server/core_usage_data/core_usage_data_service.mock.ts +++ b/src/core/server/core_usage_data/core_usage_data_service.mock.ts @@ -140,6 +140,7 @@ const createStartContractMock = () => { alias: 'test_index', primaryStoreSizeBytes: 1, storeSizeBytes: 1, + savedObjectsDocsCount: 1, }, ], legacyUrlAliases: { diff --git a/src/core/server/core_usage_data/core_usage_data_service.test.ts b/src/core/server/core_usage_data/core_usage_data_service.test.ts index 59f673bbe3dfa..e6e890b1a7dab 100644 --- a/src/core/server/core_usage_data/core_usage_data_service.test.ts +++ b/src/core/server/core_usage_data/core_usage_data_service.test.ts @@ -218,6 +218,11 @@ describe('CoreUsageDataService', () => { }, ], } as any); + elasticsearch.client.asInternalUser.count.mockResolvedValueOnce({ + body: { + count: '15', + }, + } as any); elasticsearch.client.asInternalUser.cat.indices.mockResolvedValueOnce({ body: [ { @@ -229,6 +234,11 @@ describe('CoreUsageDataService', () => { }, ], } as any); + elasticsearch.client.asInternalUser.count.mockResolvedValueOnce({ + body: { + count: '10', + }, + } as any); elasticsearch.client.asInternalUser.search.mockResolvedValueOnce({ body: { hits: { total: { value: 6 } }, @@ -384,6 +394,7 @@ describe('CoreUsageDataService', () => { "docsCount": 10, "docsDeleted": 10, "primaryStoreSizeBytes": 2000, + "savedObjectsDocsCount": "15", "storeSizeBytes": 1000, }, Object { @@ -391,6 +402,7 @@ describe('CoreUsageDataService', () => { "docsCount": 20, "docsDeleted": 20, "primaryStoreSizeBytes": 4000, + "savedObjectsDocsCount": "10", "storeSizeBytes": 2000, }, ], diff --git a/src/core/server/core_usage_data/core_usage_data_service.ts b/src/core/server/core_usage_data/core_usage_data_service.ts index 0665aed0e1950..824bfdffdceec 100644 --- a/src/core/server/core_usage_data/core_usage_data_service.ts +++ b/src/core/server/core_usage_data/core_usage_data_service.ts @@ -131,11 +131,11 @@ export class CoreUsageDataService return acc.add(index); }, new Set()) .values() - ).map((index) => { + ).map(async (index) => { // The _cat/indices API returns the _index_ and doesn't return a way // to map back from the index to the alias. So we have to make an API - // call for every alias - return elasticsearch.client.asInternalUser.cat + // call for every alias. The document count is the lucene document count. + const catIndicesResults = await elasticsearch.client.asInternalUser.cat .indices({ index, format: 'JSON', @@ -143,6 +143,7 @@ export class CoreUsageDataService }) .then(({ body }) => { const stats = body[0]; + return { alias: kibanaOrTaskManagerIndex(index, kibanaIndex), docsCount: stats['docs.count'] ? parseInt(stats['docs.count'], 10) : 0, @@ -153,6 +154,27 @@ export class CoreUsageDataService : 0, }; }); + // We use the GET /_count API to get the number of saved objects + // to monitor if the cluster will hit the scalling limit of saved object migrations + const savedObjectsCounts = await elasticsearch.client.asInternalUser + .count({ + index, + }) + .then(({ body }) => { + return { + savedObjectsDocsCount: body.count ? body.count : 0, + }; + }); + this.logger.debug( + `Lucene documents count ${catIndicesResults.docsCount} from index ${catIndicesResults.alias}` + ); + this.logger.debug( + `Saved objects documents count ${savedObjectsCounts.savedObjectsDocsCount} from index ${catIndicesResults.alias}` + ); + return { + ...catIndicesResults, + ...savedObjectsCounts, + }; }) ); } diff --git a/src/core/server/core_usage_data/types.ts b/src/core/server/core_usage_data/types.ts index 59e220fac4efe..0b09444da493d 100644 --- a/src/core/server/core_usage_data/types.ts +++ b/src/core/server/core_usage_data/types.ts @@ -177,6 +177,7 @@ export interface CoreServicesUsageData { docsDeleted: number; storeSizeBytes: number; primaryStoreSizeBytes: number; + savedObjectsDocsCount: number; }[]; legacyUrlAliases: { activeCount: number; diff --git a/src/core/server/server.api.md b/src/core/server/server.api.md index 2f68b82ac5635..a722e6eb98b02 100644 --- a/src/core/server/server.api.md +++ b/src/core/server/server.api.md @@ -426,6 +426,7 @@ export interface CoreServicesUsageData { docsDeleted: number; storeSizeBytes: number; primaryStoreSizeBytes: number; + savedObjectsDocsCount: number; }[]; legacyUrlAliases: { activeCount: number; diff --git a/src/plugins/kibana_usage_collection/server/collectors/core/core_usage_collector.ts b/src/plugins/kibana_usage_collection/server/collectors/core/core_usage_collector.ts index b1cf0ecd2213e..a208832baf719 100644 --- a/src/plugins/kibana_usage_collection/server/collectors/core/core_usage_collector.ts +++ b/src/plugins/kibana_usage_collection/server/collectors/core/core_usage_collector.ts @@ -355,14 +355,14 @@ export function getCoreUsageCollector( type: 'long', _meta: { description: - 'The number of documents in the index, including hidden nested documents.', + 'The number of lucene documents in the index, including hidden nested documents.', }, }, docsDeleted: { type: 'long', _meta: { description: - 'The number of deleted documents in the index, including hidden nested documents.', + 'The number of deleted lucene documents in the index, including hidden nested documents.', }, }, alias: { @@ -382,6 +382,12 @@ export function getCoreUsageCollector( description: 'The size in bytes of the index, for primaries and replicas.', }, }, + savedObjectsDocsCount: { + type: 'long', + _meta: { + description: 'The number of saved objects documents in the index.', + }, + }, }, }, legacyUrlAliases: { diff --git a/src/plugins/telemetry/schema/oss_plugins.json b/src/plugins/telemetry/schema/oss_plugins.json index 3269452ca8cc3..dcbf919698243 100644 --- a/src/plugins/telemetry/schema/oss_plugins.json +++ b/src/plugins/telemetry/schema/oss_plugins.json @@ -6248,13 +6248,13 @@ "docsCount": { "type": "long", "_meta": { - "description": "The number of documents in the index, including hidden nested documents." + "description": "The number of lucene documents in the index, including hidden nested documents." } }, "docsDeleted": { "type": "long", "_meta": { - "description": "The number of deleted documents in the index, including hidden nested documents." + "description": "The number of deleted lucene documents in the index, including hidden nested documents." } }, "alias": { @@ -6274,6 +6274,12 @@ "_meta": { "description": "The size in bytes of the index, for primaries and replicas." } + }, + "savedObjectsDocsCount": { + "type": "long", + "_meta": { + "description": "The number of saved objects documents in the index." + } } } } From 4a63ab9b3bee595a392d1ff536b92a6cad5c5d37 Mon Sep 17 00:00:00 2001 From: Stacey Gammon Date: Thu, 3 Feb 2022 10:09:10 -0500 Subject: [PATCH 11/68] Clean up dev docs (#124271) --- dev_docs/api_welcome.mdx | 2 +- dev_docs/getting_started/add_data.mdx | 14 +++++++++++--- dev_docs/kibana_server_core_components.mdx | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/dev_docs/api_welcome.mdx b/dev_docs/api_welcome.mdx index cf88bf7eec0da..1127ecc8603b6 100644 --- a/dev_docs/api_welcome.mdx +++ b/dev_docs/api_welcome.mdx @@ -2,7 +2,7 @@ id: kibDevDocsApiWelcome slug: /kibana-dev-docs/api-meta/welcome title: Welcome -summary: How to use our automatically generated API documentation +description: How to use our automatically generated API documentation date: 2021-02-25 tags: ['kibana','dev', 'contributor', 'api docs'] --- diff --git a/dev_docs/getting_started/add_data.mdx b/dev_docs/getting_started/add_data.mdx index 46822b82fc40d..a94ec511cda5e 100644 --- a/dev_docs/getting_started/add_data.mdx +++ b/dev_docs/getting_started/add_data.mdx @@ -2,14 +2,14 @@ id: kibDevAddData slug: /kibana-dev-docs/getting-started/sample-data title: Add data -summary: Learn how to add data to Kibana +description: Learn how to add data to Kibana date: 2021-08-11 tags: ['kibana', 'onboarding', 'dev', 'architecture', 'tutorials'] --- Building a feature and need an easy way to test it out with some data? Below are three options. -## 1. Add Sample Data from the UI +## Sample data Kibana ships with sample data that you can install at the click of the button. If you are building a feature and need some data to test it out with, sample data is a great option. The only limitation is that this data will not work for Security or Observability solutions (see [#62962](https://github.com/elastic/kibana/issues/62962)). @@ -20,7 +20,7 @@ Kibana ships with sample data that you can install at the click of the button. I ![Sample Data](../assets/sample_data.png) -## CSV Upload +## CSV upload 1. If you don't have any data, navigate to Stack Management > Index Patterns and click the link to the uploader. If you do have data, navigate to the **Machine Learning** application. 2. Click on the **Data Visualizer** tab. @@ -35,3 +35,11 @@ The makelogs script generates sample web server logs. Make sure Elasticsearch is ```sh node scripts/makelogs --auth : ``` + +## Realistic solution data + + + +Security and Observability solution applications only work if data exists in particularly named indices, abiding by our [ECS format](https://www.elastic.co/guide/en/ecs/current/index.html). If you would like to use these applications with realistic data, check out the [oblt_cli tool](https://github.com/elastic/observability-test-environments/blob/master/tools/oblt_cli/README.md). This tool sets you up to connect to a remote Elasticsearch cluster that contains the appropriate data via CCS. + + diff --git a/dev_docs/kibana_server_core_components.mdx b/dev_docs/kibana_server_core_components.mdx index 503d8401d4492..c60e085144fff 100644 --- a/dev_docs/kibana_server_core_components.mdx +++ b/dev_docs/kibana_server_core_components.mdx @@ -2,7 +2,7 @@ id: kibServerAndCoreComponents slug: /kibana-dev-docs/core-intro title: Kibana Server and Core components -summary: An introduction to the Kibana server and core components. +description: An introduction to the Kibana server and core components. date: 2021-02-26 tags: ['kibana','onboarding', 'dev', 'architecture'] --- From 96c4a89074aa920ac860251ecfc783c952b3a8d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20St=C3=BCrmer?= Date: Thu, 3 Feb 2022 16:47:57 +0100 Subject: [PATCH 12/68] [Metrics UI] Allow single values for ip and mac node metadata (#124384) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- x-pack/plugins/infra/common/http_api/metadata_api.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/infra/common/http_api/metadata_api.ts b/x-pack/plugins/infra/common/http_api/metadata_api.ts index a0524af805f00..0f847f19f75d3 100644 --- a/x-pack/plugins/infra/common/http_api/metadata_api.ts +++ b/x-pack/plugins/infra/common/http_api/metadata_api.ts @@ -37,8 +37,8 @@ export const InfraMetadataHostRT = rt.partial({ name: rt.string, hostname: rt.string, id: rt.string, - ip: rt.array(rt.string), - mac: rt.array(rt.string), + ip: rt.union([rt.array(rt.string), rt.string]), + mac: rt.union([rt.array(rt.string), rt.string]), os: InfraMetadataOSRT, architecture: rt.string, containerized: rt.boolean, From 52880b6879325e3d5708e764bf0aa57b34e8c723 Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Thu, 3 Feb 2022 16:48:47 +0100 Subject: [PATCH 13/68] fix tsvb metric contrast (#124509) --- .../vis_types/timeseries/public/application/_variables.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/vis_types/timeseries/public/application/_variables.scss b/src/plugins/vis_types/timeseries/public/application/_variables.scss index 0107c5569d730..b3334c93a9bbe 100644 --- a/src/plugins/vis_types/timeseries/public/application/_variables.scss +++ b/src/plugins/vis_types/timeseries/public/application/_variables.scss @@ -1,7 +1,7 @@ $tvbLineColor: transparentize($euiColorFullShade, .8); $tvbLineColorReversed: transparentize($euiColorEmptyShade, .6); -$tvbTextColor: transparentize($euiColorFullShade, .6); +$tvbTextColor: transparentize($euiColorFullShade, .4); $tvbTextColorReversed: transparentize($euiColorEmptyShade, .4); $tvbValueColor: transparentize($euiColorFullShade, .3); From 1185a33470207a152ddeb4f162703db6c840ac03 Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Thu, 3 Feb 2022 17:00:42 +0100 Subject: [PATCH 14/68] [Lens] Do not refresh session on "now" drift on incoming data (#124389) --- .../indexpattern_datasource/to_expression.ts | 30 ++++++++++++++++++- .../context_middleware/index.test.ts | 21 +++++++++++++ .../context_middleware/index.ts | 3 +- x-pack/plugins/lens/readme.md | 2 ++ 4 files changed, 54 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/to_expression.ts b/x-pack/plugins/lens/public/indexpattern_datasource/to_expression.ts index 432c932b85da8..0d8b57a5502ad 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/to_expression.ts +++ b/x-pack/plugins/lens/public/indexpattern_datasource/to_expression.ts @@ -29,6 +29,15 @@ import { isColumnFormatted, isColumnOfType } from './operations/definitions/help type OriginalColumn = { id: string } & GenericIndexPatternColumn; +declare global { + interface Window { + /** + * Debug setting to make requests complete slower than normal. data.search.aggs.shardDelay.enabled has to be set via settings for this to work + */ + ELASTIC_LENS_DELAY_SECONDS?: number; + } +} + function getExpressionForLayer( layer: IndexPatternLayer, indexPattern: IndexPattern, @@ -139,8 +148,27 @@ function getExpressionForLayer( } }); + if (window.ELASTIC_LENS_DELAY_SECONDS) { + aggs.push( + buildExpression({ + type: 'expression', + chain: [ + buildExpressionFunction('aggShardDelay', { + id: 'the-delay', + enabled: true, + schema: 'metric', + delay: `${window.ELASTIC_LENS_DELAY_SECONDS}s`, + }).toAst(), + ], + }) + ); + } + const idMap = esAggEntries.reduce((currentIdMap, [colId, column], index) => { - const esAggsId = `col-${index}-${index}`; + const esAggsId = window.ELASTIC_LENS_DELAY_SECONDS + ? `col-${index + (column.isBucketed ? 0 : 1)}-${index}` + : `col-${index}-${index}`; + return { ...currentIdMap, [esAggsId]: { diff --git a/x-pack/plugins/lens/public/state_management/context_middleware/index.test.ts b/x-pack/plugins/lens/public/state_management/context_middleware/index.test.ts index 0c3f53cec3a70..f115cb59e6121 100644 --- a/x-pack/plugins/lens/public/state_management/context_middleware/index.test.ts +++ b/x-pack/plugins/lens/public/state_management/context_middleware/index.test.ts @@ -122,5 +122,26 @@ describe('contextMiddleware', () => { expect(store.dispatch).not.toHaveBeenCalled(); expect(next).toHaveBeenCalledWith(action); }); + + it('does not trigger another update on active data update', () => { + const data = mockDataPlugin(); + (data.nowProvider.get as jest.Mock).mockReturnValue(new Date(Date.now() - 30000)); + (data.query.timefilter.timefilter.getTime as jest.Mock).mockReturnValue({ + from: 'now-2m', + to: 'now', + }); + (data.query.timefilter.timefilter.getBounds as jest.Mock).mockReturnValue({ + min: moment(Date.now() - 100000), + max: moment(Date.now() - 30000), + }); + const { next, invoke, store } = createMiddleware(data); + const action = { + type: 'lens/onActiveDataChange', + payload: {}, + }; + invoke(action); + expect(store.dispatch).not.toHaveBeenCalled(); + expect(next).toHaveBeenCalledWith(action); + }); }); }); diff --git a/x-pack/plugins/lens/public/state_management/context_middleware/index.ts b/x-pack/plugins/lens/public/state_management/context_middleware/index.ts index 55d066f6db55b..25dea5527d061 100644 --- a/x-pack/plugins/lens/public/state_management/context_middleware/index.ts +++ b/x-pack/plugins/lens/public/state_management/context_middleware/index.ts @@ -12,6 +12,7 @@ import { setState, LensDispatch, LensStoreDeps, navigateAway } from '..'; import { LensAppState } from '../types'; import { getResolvedDateRange, containsDynamicMath } from '../../utils'; import { subscribeToExternalContext } from './subscribe_to_external_context'; +import { onActiveDataChange } from '../lens_slice'; export const contextMiddleware = (storeDeps: LensStoreDeps) => (store: MiddlewareAPI) => { const unsubscribeFromExternalContext = subscribeToExternalContext( @@ -20,7 +21,7 @@ export const contextMiddleware = (storeDeps: LensStoreDeps) => (store: Middlewar store.dispatch ); return (next: Dispatch) => (action: PayloadAction>) => { - if (!action.payload?.searchSessionId) { + if (!action.payload?.searchSessionId && !onActiveDataChange.match(action)) { updateTimeRange(storeDeps.lensServices.data, store.dispatch); } if (navigateAway.match(action)) { diff --git a/x-pack/plugins/lens/readme.md b/x-pack/plugins/lens/readme.md index 927c4bbef290c..c85005c09754e 100644 --- a/x-pack/plugins/lens/readme.md +++ b/x-pack/plugins/lens/readme.md @@ -24,6 +24,8 @@ Run all tests from the `x-pack` root directory Lens state is kept in the Redux Store. To enable redux logger, open Chrome Developer Tools and type in the console: `window.ELASTIC_LENS_LOGGER=true`. +To simulate long running searches, set `data.search.aggs.shardDelay.enabled` in your `kibana.dev.yml` to true and set the dealy via console in the browser (e.g. for a 20 seconds delay): `window.ELASTIC_LENS_DELAY_SECONDS=20`. + ## UI Terminology Lens has a lot of UI elements – to make it easier to refer to them in issues or bugs, this is a hopefully complete list: From 1f76d8d30ad3d2f6959db2e76057f21c87b80302 Mon Sep 17 00:00:00 2001 From: Walter Rafelsberger Date: Thu, 3 Feb 2022 17:02:45 +0100 Subject: [PATCH 15/68] [ML] Transforms: Fix destination ingest pipeline form input placeholder. (#124519) Fix to pass on an empty array for the form elements options to show the placeholder text. --- .../components/step_details/step_details_form.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_details/step_details_form.tsx b/x-pack/plugins/transform/public/app/sections/create_transform/components/step_details/step_details_form.tsx index e004a074a2922..75ed5c10f0483 100644 --- a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_details/step_details_form.tsx +++ b/x-pack/plugins/transform/public/app/sections/create_transform/components/step_details/step_details_form.tsx @@ -486,18 +486,20 @@ export const StepDetailsForm: FC = React.memo( aria-label={i18n.translate( 'xpack.transform.stepDetailsForm.destinationIngestPipelineAriaLabel', { - defaultMessage: 'Select an ingest pipeline', + defaultMessage: 'Select an ingest pipeline (optional)', } )} placeholder={i18n.translate( 'xpack.transform.stepDetailsForm.destinationIngestPipelineComboBoxPlaceholder', { - defaultMessage: 'Select an ingest pipeline', + defaultMessage: 'Select an ingest pipeline (optional)', } )} singleSelection={{ asPlainText: true }} options={ingestPipelineNames.map((label: string) => ({ label }))} - selectedOptions={[{ label: destinationIngestPipeline }]} + selectedOptions={ + destinationIngestPipeline !== '' ? [{ label: destinationIngestPipeline }] : [] + } onChange={(options) => setDestinationIngestPipeline(options[0]?.label ?? '')} /> From fd041c5fe3d10932f5a1d0f4fa39690eee8d93b7 Mon Sep 17 00:00:00 2001 From: Alexey Antonov Date: Thu, 3 Feb 2022 19:12:57 +0300 Subject: [PATCH 16/68] [Visualize] Coloring tooltips in Heatmap are not properly positioned (#124507) --- .../public/components/heatmap_component.tsx | 115 ++++++++-------- .../public/utils/get_color_picker.tsx | 126 ++++++++++-------- 2 files changed, 133 insertions(+), 108 deletions(-) diff --git a/src/plugins/chart_expressions/expression_heatmap/public/components/heatmap_component.tsx b/src/plugins/chart_expressions/expression_heatmap/public/components/heatmap_component.tsx index 197516ce2db90..bac476045eb95 100644 --- a/src/plugins/chart_expressions/expression_heatmap/public/components/heatmap_component.tsx +++ b/src/plugins/chart_expressions/expression_heatmap/public/components/heatmap_component.tsx @@ -29,7 +29,10 @@ import type { DatatableColumn } from '../../../../expressions/public'; import { ExpressionValueVisDimension } from '../../../../visualizations/public'; import type { HeatmapRenderProps, FilterEvent, BrushEvent } from '../../common'; import { applyPaletteParams, findMinMaxByColumnId, getSortPredicate } from './helpers'; -import { getColorPicker } from '../utils/get_color_picker'; +import { + LegendColorPickerWrapperContext, + LegendColorPickerWrapper, +} from '../utils/get_color_picker'; import { DEFAULT_PALETTE_NAME, defaultPaletteParams } from '../constants'; import { HeatmapIcon } from './heatmap_icon'; import './index.scss'; @@ -172,10 +175,6 @@ export const HeatmapComponent: FC = memo( [uiState] ); - const legendColorPicker = useMemo( - () => getColorPicker(args.legend.position, setColor, uiState), - [args.legend.position, setColor, uiState] - ); const table = data; const valueAccessor = args.valueAccessor ? getAccessor(args.valueAccessor, table.columns) @@ -484,55 +483,63 @@ export const HeatmapComponent: FC = memo( legendPosition={args.legend.position} /> )} - - - `${xValuesFormatter.convert(v) ?? ''}`} - yAxisLabelFormatter={ - yAxisColumn - ? (v) => `${formatFactory(yAxisColumn.meta.params).convert(v) ?? ''}` - : undefined - } - /> - + + + + `${xValuesFormatter.convert(v) ?? ''}`} + yAxisLabelFormatter={ + yAxisColumn + ? (v) => `${formatFactory(yAxisColumn.meta.params).convert(v) ?? ''}` + : undefined + } + /> + + ); } diff --git a/src/plugins/chart_expressions/expression_heatmap/public/utils/get_color_picker.tsx b/src/plugins/chart_expressions/expression_heatmap/public/utils/get_color_picker.tsx index 2f5297c5fd475..771a633456e13 100644 --- a/src/plugins/chart_expressions/expression_heatmap/public/utils/get_color_picker.tsx +++ b/src/plugins/chart_expressions/expression_heatmap/public/utils/get_color_picker.tsx @@ -6,9 +6,9 @@ * Side Public License, v 1. */ -import React, { useCallback } from 'react'; +import React, { createContext, useCallback, useContext } from 'react'; import { LegendColorPicker, Position } from '@elastic/charts'; -import { PopoverAnchorPosition, EuiPopover, EuiOutsideClickDetector } from '@elastic/eui'; +import { PopoverAnchorPosition, EuiWrappingPopover, EuiOutsideClickDetector } from '@elastic/eui'; import type { PersistedState } from '../../../../visualizations/public'; import { ColorPicker } from '../../../../charts/public'; @@ -27,59 +27,77 @@ function getAnchorPosition(legendPosition: Position): PopoverAnchorPosition { } } -export const getColorPicker = - ( - legendPosition: Position, - setColor: (newColor: string | null, seriesKey: string | number) => void, - uiState: PersistedState - ): LegendColorPicker => - ({ anchor, color, onClose, onChange, seriesIdentifiers: [seriesIdentifier] }) => { - const seriesName = seriesIdentifier.key; - const overwriteColors: Record = uiState?.get('vis.colors', {}) ?? {}; - const colorIsOverwritten = seriesName.toString() in overwriteColors; - let keyDownEventOn = false; - const handleChange = (newColor: string | null) => { - if (newColor) { - onChange(newColor); - } - setColor(newColor, seriesName); - // close the popover if no color is applied or the user has clicked a color - if (!newColor || !keyDownEventOn) { - onClose(); - } - }; +export interface LegendColorPickerWrapperContextType { + legendPosition: Position; + setColor: (newColor: string | null, seriesKey: string | number) => void; + uiState: PersistedState; +} - const onKeyDown = (e: React.KeyboardEvent) => { - if (e.keyCode === KEY_CODE_ENTER) { - onClose?.(); - } - keyDownEventOn = true; - }; +export const LegendColorPickerWrapperContext = createContext< + LegendColorPickerWrapperContextType | undefined +>(undefined); - const handleOutsideClick = useCallback(() => { - onClose?.(); - }, [onClose]); +export const LegendColorPickerWrapper: LegendColorPicker = ({ + anchor, + color, + onClose, + onChange, + seriesIdentifiers: [seriesIdentifier], +}) => { + const colorPickerWrappingContext = useContext(LegendColorPickerWrapperContext); + const handleOutsideClick = useCallback(() => { + onClose?.(); + }, [onClose]); + + if (!colorPickerWrappingContext) { + return null; + } + + const { legendPosition, setColor, uiState } = colorPickerWrappingContext; + const seriesName = seriesIdentifier.key; - return ( - - - - - - ); + const overwriteColors: Record = uiState?.get('vis.colors', {}) ?? {}; + const colorIsOverwritten = seriesName.toString() in overwriteColors; + let keyDownEventOn = false; + + const handleChange = (newColor: string | null) => { + if (newColor) { + onChange(newColor); + } + setColor(newColor, seriesName); + // close the popover if no color is applied or the user has clicked a color + if (!newColor || !keyDownEventOn) { + onClose(); + } }; + + const onKeyDown = (e: React.KeyboardEvent) => { + if (e.keyCode === KEY_CODE_ENTER) { + onClose?.(); + } + keyDownEventOn = true; + }; + + return ( + + + + + + ); +}; From 4f6be55f0e6322168d2afd9a7b4ff4d3ea04f230 Mon Sep 17 00:00:00 2001 From: Nicolas Chaulet Date: Thu, 3 Feb 2022 11:53:12 -0500 Subject: [PATCH 17/68] [Fleet] Use a docker registry for fleet integration test (#124405) --- .../docker_registry_helper.ts | 69 +++++++++++++++++++ .../reset_preconfiguration.test.ts | 12 ++-- 2 files changed, 76 insertions(+), 5 deletions(-) create mode 100644 x-pack/plugins/fleet/server/integration_tests/docker_registry_helper.ts diff --git a/x-pack/plugins/fleet/server/integration_tests/docker_registry_helper.ts b/x-pack/plugins/fleet/server/integration_tests/docker_registry_helper.ts new file mode 100644 index 0000000000000..bb34dc3258d05 --- /dev/null +++ b/x-pack/plugins/fleet/server/integration_tests/docker_registry_helper.ts @@ -0,0 +1,69 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { spawn } from 'child_process'; +import type { ChildProcess } from 'child_process'; + +import fetch from 'node-fetch'; + +const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); + +export function useDockerRegistry() { + const packageRegistryPort = process.env.FLEET_PACKAGE_REGISTRY_PORT || '8081'; + + if (!packageRegistryPort.match(/^[0-9]{4}/)) { + throw new Error('Invalid FLEET_PACKAGE_REGISTRY_PORT'); + } + + let dockerProcess: ChildProcess | undefined; + async function startDockerRegistryServer() { + const dockerImage = `docker.elastic.co/package-registry/distribution@sha256:de952debe048d903fc73e8a4472bb48bb95028d440cba852f21b863d47020c61`; + + const args = ['run', '--rm', '-p', `${packageRegistryPort}:8080`, dockerImage]; + + dockerProcess = spawn('docker', args, { stdio: 'inherit' }); + + let isExited = dockerProcess.exitCode !== null; + dockerProcess.once('exit', () => { + isExited = true; + }); + + let retries = 0; + while (!isExited && retries++ <= 20) { + try { + const res = await fetch(`http://localhost:${packageRegistryPort}/`); + if (res.status === 200) { + return; + } + } catch (err) { + // swallow errors + } + + await delay(3000); + } + + dockerProcess.kill(); + throw new Error('Unable to setup docker registry'); + } + + async function cleanupDockerRegistryServer() { + if (dockerProcess && !dockerProcess.killed) { + dockerProcess.kill(); + } + } + + beforeAll(async () => { + jest.setTimeout(5 * 60 * 1000); // 5 minutes timeout + await startDockerRegistryServer(); + }); + + afterAll(async () => { + await cleanupDockerRegistryServer(); + }); + + return `http://localhost:${packageRegistryPort}`; +} diff --git a/x-pack/plugins/fleet/server/integration_tests/reset_preconfiguration.test.ts b/x-pack/plugins/fleet/server/integration_tests/reset_preconfiguration.test.ts index 9efbacfae17bf..4a2b4f2495e96 100644 --- a/x-pack/plugins/fleet/server/integration_tests/reset_preconfiguration.test.ts +++ b/x-pack/plugins/fleet/server/integration_tests/reset_preconfiguration.test.ts @@ -14,6 +14,8 @@ import type { HttpMethod } from 'src/core/test_helpers/kbn_server'; import type { AgentPolicySOAttributes } from '../types'; +import { useDockerRegistry } from './docker_registry_helper'; + const logFilePath = Path.join(__dirname, 'logs.log'); type Root = ReturnType; @@ -46,6 +48,8 @@ describe('Fleet preconfiguration reset', () => { let esServer: kbnTestServer.TestElasticsearchUtils; let kbnServer: kbnTestServer.TestKibanaUtils; + const registryUrl = useDockerRegistry(); + const startServers = async () => { const { startES } = kbnTestServer.createTestServers({ adjustTimeout: (t) => jest.setTimeout(t), @@ -63,6 +67,7 @@ describe('Fleet preconfiguration reset', () => { { xpack: { fleet: { + registryUrl, packages: [ { name: 'fleet_server', @@ -195,8 +200,7 @@ describe('Fleet preconfiguration reset', () => { await stopServers(); }); - // FLAKY: https://github.com/elastic/kibana/issues/123103 - describe.skip('Reset all policy', () => { + describe('Reset all policy', () => { it('Works and reset all preconfigured policies', async () => { const resetAPI = getSupertestWithAdminUser( kbnServer.root, @@ -225,9 +229,7 @@ describe('Fleet preconfiguration reset', () => { }); }); - // FLAKY: https://github.com/elastic/kibana/issues/123104 - // FLAKY: https://github.com/elastic/kibana/issues/123105 - describe.skip('Reset one preconfigured policy', () => { + describe('Reset one preconfigured policy', () => { const POLICY_ID = 'test-12345'; it('Works and reset one preconfigured policies if the policy is already deleted (with a ghost package policy)', async () => { From 21710dfb773e892b9ab0ed1e81a576c536a824bb Mon Sep 17 00:00:00 2001 From: Sergi Massaneda Date: Thu, 3 Feb 2022 18:03:25 +0100 Subject: [PATCH 18/68] [SecuritySolution] Close field editor when page context is lost (#124378) * close field editor when context is lost * tests added * typecheck clean * close editor when timeline is unmounted --- .../components/events_viewer/index.test.tsx | 23 +++ .../common/components/events_viewer/index.tsx | 15 +- .../create_field_button/index.test.tsx | 38 +++- .../components/create_field_button/index.tsx | 25 ++- .../__snapshots__/index.test.tsx.snap | 1 + .../body/column_headers/index.test.tsx | 183 ++++++++---------- .../timeline/body/column_headers/index.tsx | 30 ++- .../components/timeline/body/index.test.tsx | 1 + .../components/timeline/body/index.tsx | 7 +- 9 files changed, 208 insertions(+), 115 deletions(-) diff --git a/x-pack/plugins/security_solution/public/common/components/events_viewer/index.test.tsx b/x-pack/plugins/security_solution/public/common/components/events_viewer/index.test.tsx index 9dd8bf59893c0..2ecae44487908 100644 --- a/x-pack/plugins/security_solution/public/common/components/events_viewer/index.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/events_viewer/index.test.tsx @@ -33,6 +33,11 @@ jest.mock('../../../timelines/containers', () => ({ jest.mock('../../components/url_state/normalize_time_range.ts'); +const mockUseCreateFieldButton = jest.fn().mockReturnValue(<>); +jest.mock('../../../timelines/components/create_field_button', () => ({ + useCreateFieldButton: (...params: unknown[]) => mockUseCreateFieldButton(...params), +})); + const mockUseResizeObserver: jest.Mock = useResizeObserver as jest.Mock; jest.mock('use-resize-observer/polyfilled'); mockUseResizeObserver.mockImplementation(() => ({})); @@ -87,4 +92,22 @@ describe('StatefulEventsViewer', () => { expect(wrapper.find(`InspectButtonContainer`).exists()).toBe(true); }); }); + + test('it closes field editor when unmounted', async () => { + const mockCloseEditor = jest.fn(); + mockUseCreateFieldButton.mockImplementation((_, __, fieldEditorActionsRef) => { + fieldEditorActionsRef.current = { closeEditor: mockCloseEditor }; + return <>; + }); + + const wrapper = mount( + + + + ); + expect(mockCloseEditor).not.toHaveBeenCalled(); + + wrapper.unmount(); + expect(mockCloseEditor).toHaveBeenCalled(); + }); }); diff --git a/x-pack/plugins/security_solution/public/common/components/events_viewer/index.tsx b/x-pack/plugins/security_solution/public/common/components/events_viewer/index.tsx index 97b0424168f0a..9fa91ed25c995 100644 --- a/x-pack/plugins/security_solution/public/common/components/events_viewer/index.tsx +++ b/x-pack/plugins/security_solution/public/common/components/events_viewer/index.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import React, { useCallback, useMemo, useEffect } from 'react'; +import React, { useRef, useCallback, useMemo, useEffect } from 'react'; import { connect, ConnectedProps, useDispatch } from 'react-redux'; import deepEqual from 'fast-deep-equal'; import styled from 'styled-components'; @@ -29,7 +29,10 @@ import { CellValueElementProps } from '../../../timelines/components/timeline/ce import { FIELDS_WITHOUT_CELL_ACTIONS } from '../../lib/cell_actions/constants'; import { useKibana } from '../../lib/kibana'; import { GraphOverlay } from '../../../timelines/components/graph_overlay'; -import { useCreateFieldButton } from '../../../timelines/components/create_field_button'; +import { + CreateFieldEditorActions, + useCreateFieldButton, +} from '../../../timelines/components/create_field_button'; const EMPTY_CONTROL_COLUMNS: ControlColumnProps[] = []; @@ -121,6 +124,8 @@ const StatefulEventsViewerComponent: React.FC = ({ const tGridEventRenderedViewEnabled = useIsExperimentalFeatureEnabled( 'tGridEventRenderedViewEnabled' ); + const editorActionsRef = useRef(null); + useEffect(() => { if (createTimeline != null) { createTimeline({ @@ -137,6 +142,10 @@ const StatefulEventsViewerComponent: React.FC = ({ } return () => { deleteEventQuery({ id, inputId: 'global' }); + if (editorActionsRef.current) { + // eslint-disable-next-line react-hooks/exhaustive-deps + editorActionsRef.current.closeEditor(); + } }; // eslint-disable-next-line react-hooks/exhaustive-deps }, []); @@ -167,7 +176,7 @@ const StatefulEventsViewerComponent: React.FC = ({ }, [id, timelineQuery, globalQuery]); const bulkActions = useMemo(() => ({ onAlertStatusActionSuccess }), [onAlertStatusActionSuccess]); - const createFieldComponent = useCreateFieldButton(scopeId, id); + const createFieldComponent = useCreateFieldButton(scopeId, id, editorActionsRef); return ( <> diff --git a/x-pack/plugins/security_solution/public/timelines/components/create_field_button/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/create_field_button/index.test.tsx index 6f3f3e8b87bc8..0afb2bf641351 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/create_field_button/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/create_field_button/index.test.tsx @@ -6,8 +6,8 @@ */ import { render, fireEvent, act, screen } from '@testing-library/react'; -import React from 'react'; -import { CreateFieldButton } from './index'; +import React, { MutableRefObject } from 'react'; +import { CreateFieldButton, CreateFieldEditorActions } from './index'; import { indexPatternFieldEditorPluginMock, Start, @@ -108,4 +108,38 @@ describe('CreateFieldButton', () => { fireEvent.click(screen.getByRole('button')); expect(onClickParam).toHaveBeenCalled(); }); + + it("stores 'closeEditor' in the actions ref when editor is open", async () => { + const mockCloseEditor = jest.fn(); + useKibanaMock().services.data.dataViews.get = () => Promise.resolve({} as DataView); + useKibanaMock().services.dataViewFieldEditor.openEditor = () => mockCloseEditor; + + const editorActionsRef: MutableRefObject = React.createRef(); + await act(async () => { + render( + undefined} + timelineId={TimelineId.detectionsPage} + editorActionsRef={editorActionsRef} + />, + { + wrapper: TestProviders, + } + ); + await runAllPromises(); + }); + + expect(editorActionsRef?.current).toBeNull(); + + fireEvent.click(screen.getByRole('button')); + + expect(mockCloseEditor).not.toHaveBeenCalled(); + expect(editorActionsRef?.current?.closeEditor).toBeDefined(); + + editorActionsRef!.current!.closeEditor(); + + expect(mockCloseEditor).toHaveBeenCalled(); + expect(editorActionsRef!.current).toBeNull(); + }); }); diff --git a/x-pack/plugins/security_solution/public/timelines/components/create_field_button/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/create_field_button/index.tsx index 04f23605efac5..8979a78d7aa46 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/create_field_button/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/create_field_button/index.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import React, { useCallback, useEffect, useMemo, useState } from 'react'; +import React, { MutableRefObject, useCallback, useEffect, useMemo, useState } from 'react'; import { EuiButton } from '@elastic/eui'; import styled from 'styled-components'; @@ -23,17 +23,21 @@ import { useDeepEqualSelector } from '../../../common/hooks/use_selector'; import { DEFAULT_COLUMN_MIN_WIDTH } from '../timeline/body/constants'; import { defaultColumnHeaderType } from '../timeline/body/column_headers/default_headers'; +export type CreateFieldEditorActions = { closeEditor: () => void } | null; +type CreateFieldEditorActionsRef = MutableRefObject; + interface CreateFieldButtonProps { selectedDataViewId: string; onClick: () => void; timelineId: TimelineId; + editorActionsRef?: CreateFieldEditorActionsRef; } const StyledButton = styled(EuiButton)` margin-left: ${({ theme }) => theme.eui.paddingSizes.m}; `; export const CreateFieldButton = React.memo( - ({ selectedDataViewId, onClick: onClickParam, timelineId }) => { + ({ selectedDataViewId, onClick: onClickParam, timelineId, editorActionsRef }) => { const [dataView, setDataView] = useState(null); const dispatch = useDispatch(); @@ -52,7 +56,7 @@ export const CreateFieldButton = React.memo( const onClick = useCallback(() => { if (dataView) { - dataViewFieldEditor?.openEditor({ + const closeFieldEditor = dataViewFieldEditor?.openEditor({ ctx: { dataView }, onSave: async (field: DataViewField) => { // Fetch the updated list of fields @@ -72,6 +76,14 @@ export const CreateFieldButton = React.memo( ); }, }); + if (editorActionsRef) { + editorActionsRef.current = { + closeEditor: () => { + editorActionsRef.current = null; + closeFieldEditor(); + }, + }; + } } onClickParam(); }, [ @@ -82,6 +94,7 @@ export const CreateFieldButton = React.memo( selectedDataViewId, dispatch, timelineId, + editorActionsRef, ]); if ( @@ -116,7 +129,8 @@ CreateFieldButton.displayName = 'CreateFieldButton'; */ export const useCreateFieldButton = ( sourcererScope: SourcererScopeName, - timelineId: TimelineId + timelineId: TimelineId, + editorActionsRef?: CreateFieldEditorActionsRef ) => { const scopeIdSelector = useMemo(() => sourcererSelectors.scopeIdSelector(), []); const { missingPatterns, selectedDataViewId } = useDeepEqualSelector((state) => @@ -133,9 +147,10 @@ export const useCreateFieldButton = ( selectedDataViewId={selectedDataViewId} onClick={onClick} timelineId={timelineId} + editorActionsRef={editorActionsRef} /> ); return CreateFieldButtonComponent; - }, [missingPatterns.length, selectedDataViewId, timelineId]); + }, [missingPatterns.length, selectedDataViewId, timelineId, editorActionsRef]); }; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/__snapshots__/index.test.tsx.snap b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/__snapshots__/index.test.tsx.snap index 644a3c95baf08..2d625f678721b 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/__snapshots__/index.test.tsx.snap +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/__snapshots__/index.test.tsx.snap @@ -658,6 +658,7 @@ exports[`ColumnHeaders rendering renders correctly against snapshot 1`] = ` ] } onSelectAll={[Function]} + show={true} showEventsSelect={false} showSelectAllCheckbox={false} sort={ diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/index.test.tsx index 59bdcf808ca42..aec28732f38af 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/index.test.tsx @@ -16,7 +16,7 @@ import { Sort } from '../sort'; import { TestProviders } from '../../../../../common/mock/test_providers'; import { useMountAppended } from '../../../../../common/utils/use_mount_appended'; -import { ColumnHeadersComponent } from '.'; +import { ColumnHeadersComponent, ColumnHeadersComponentProps } from '.'; import { cloneDeep } from 'lodash/fp'; import { timelineActions } from '../../../../store/timeline'; import { TimelineTabs } from '../../../../../../common/types/timeline'; @@ -27,6 +27,11 @@ import { HeaderActions } from '../actions/header_actions'; jest.mock('../../../../../common/lib/kibana'); +const mockUseCreateFieldButton = jest.fn().mockReturnValue(<>); +jest.mock('../../../create_field_button', () => ({ + useCreateFieldButton: (...params: unknown[]) => mockUseCreateFieldButton(...params), +})); + const mockDispatch = jest.fn(); jest.mock('react-redux', () => { const original = jest.requireActual('react-redux'); @@ -46,33 +51,34 @@ describe('ColumnHeaders', () => { ...x, headerCellRender: HeaderActions, })); + const sort: Sort[] = [ + { + columnId: '@timestamp', + columnType: 'number', + sortDirection: Direction.desc, + }, + ]; + const defaultProps: ColumnHeadersComponentProps = { + actionsColumnWidth, + browserFields: mockBrowserFields, + columnHeaders: defaultHeaders, + isSelectAllChecked: false, + onSelectAll: jest.fn, + show: true, + showEventsSelect: false, + showSelectAllCheckbox: false, + sort, + tabType: TimelineTabs.query, + timelineId, + leadingControlColumns, + trailingControlColumns: [], + }; describe('rendering', () => { - const sort: Sort[] = [ - { - columnId: '@timestamp', - columnType: 'number', - sortDirection: Direction.desc, - }, - ]; - test('renders correctly against snapshot', () => { const wrapper = shallow( - + ); expect(wrapper.find('ColumnHeadersComponent')).toMatchSnapshot(); @@ -81,20 +87,7 @@ describe('ColumnHeaders', () => { test('it renders the field browser', () => { const wrapper = mount( - + ); @@ -104,20 +97,7 @@ describe('ColumnHeaders', () => { test('it renders every column header', () => { const wrapper = mount( - + ); @@ -166,18 +146,7 @@ describe('ColumnHeaders', () => { const wrapper = mount( ); @@ -210,18 +179,7 @@ describe('ColumnHeaders', () => { const wrapper = mount( ); @@ -249,18 +207,11 @@ describe('ColumnHeaders', () => { const wrapper = mount( ); @@ -287,18 +238,13 @@ describe('ColumnHeaders', () => { const wrapper = mount( ); @@ -307,4 +253,43 @@ describe('ColumnHeaders', () => { expect(wrapper.exists('[data-test-subj="test-header-action-cell"]')).toBeTruthy(); }); }); + + describe('Field Editor', () => { + test('Closes field editor when the timeline is unmounted', () => { + const mockCloseEditor = jest.fn(); + mockUseCreateFieldButton.mockImplementation((_, __, fieldEditorActionsRef) => { + fieldEditorActionsRef.current = { closeEditor: mockCloseEditor }; + return <>; + }); + + const wrapper = mount( + + + + ); + expect(mockCloseEditor).not.toHaveBeenCalled(); + + wrapper.unmount(); + expect(mockCloseEditor).toHaveBeenCalled(); + }); + + test('Closes field editor when the timeline is closed', () => { + const mockCloseEditor = jest.fn(); + mockUseCreateFieldButton.mockImplementation((_, __, fieldEditorActionsRef) => { + fieldEditorActionsRef.current = { closeEditor: mockCloseEditor }; + return <>; + }); + + const Proxy = (props: ColumnHeadersComponentProps) => ( + + + + ); + const wrapper = mount(); + expect(mockCloseEditor).not.toHaveBeenCalled(); + + wrapper.setProps({ ...defaultProps, show: false }); + expect(mockCloseEditor).toHaveBeenCalled(); + }); + }); }); diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/index.tsx index 80a9022105d2c..ca1cdef903de8 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/index.tsx @@ -5,7 +5,7 @@ * 2.0. */ import deepEqual from 'fast-deep-equal'; -import React, { useState, useEffect, useCallback, useMemo } from 'react'; +import React, { useState, useEffect, useCallback, useMemo, useRef } from 'react'; import { Droppable, DraggableChildrenFn } from 'react-beautiful-dnd'; import { DragEffects } from '../../../../../common/components/drag_and_drop/draggable_wrapper'; @@ -34,15 +34,16 @@ import { Sort } from '../sort'; import { ColumnHeader } from './column_header'; import { SourcererScopeName } from '../../../../../common/store/sourcerer/model'; -import { useCreateFieldButton } from '../../../create_field_button'; +import { CreateFieldEditorActions, useCreateFieldButton } from '../../../create_field_button'; -interface Props { +export interface ColumnHeadersComponentProps { actionsColumnWidth: number; browserFields: BrowserFields; columnHeaders: ColumnHeaderOptions[]; isEventViewer?: boolean; isSelectAllChecked: boolean; onSelectAll: OnSelectAll; + show: boolean; showEventsSelect: boolean; showSelectAllCheckbox: boolean; sort: Sort[]; @@ -92,6 +93,7 @@ export const ColumnHeadersComponent = ({ isEventViewer = false, isSelectAllChecked, onSelectAll, + show, showEventsSelect, showSelectAllCheckbox, sort, @@ -99,8 +101,24 @@ export const ColumnHeadersComponent = ({ timelineId, leadingControlColumns, trailingControlColumns, -}: Props) => { +}: ColumnHeadersComponentProps) => { const [draggingIndex, setDraggingIndex] = useState(null); + const fieldEditorActionsRef = useRef(null); + + useEffect(() => { + return () => { + if (fieldEditorActionsRef.current) { + // eslint-disable-next-line react-hooks/exhaustive-deps + fieldEditorActionsRef.current.closeEditor(); + } + }; + }, []); + + useEffect(() => { + if (!show && fieldEditorActionsRef.current) { + fieldEditorActionsRef.current.closeEditor(); + } + }, [show]); const renderClone: DraggableChildrenFn = useCallback( (dragProvided, _dragSnapshot, rubric) => { @@ -174,7 +192,8 @@ export const ColumnHeadersComponent = ({ const createFieldComponent = useCreateFieldButton( SourcererScopeName.timeline, - timelineId as TimelineId + timelineId as TimelineId, + fieldEditorActionsRef ); const LeadingHeaderActions = useMemo(() => { @@ -300,6 +319,7 @@ export const ColumnHeaders = React.memo( prevProps.isEventViewer === nextProps.isEventViewer && prevProps.isSelectAllChecked === nextProps.isSelectAllChecked && prevProps.onSelectAll === nextProps.onSelectAll && + prevProps.show === nextProps.show && prevProps.showEventsSelect === nextProps.showEventsSelect && prevProps.showSelectAllCheckbox === nextProps.showSelectAllCheckbox && deepEqual(prevProps.sort, nextProps.sort) && diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/index.test.tsx index 5467dbab9845c..db927e67ccc67 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/index.test.tsx @@ -146,6 +146,7 @@ describe('Body', () => { selectedEventIds: {}, setSelected: jest.fn() as unknown as StatefulBodyProps['setSelected'], sort: mockSort, + show: true, showCheckboxes: false, tabType: TimelineTabs.query, totalPages: 1, diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/index.tsx index 7e7192610a222..7257d4246f6fe 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/index.tsx @@ -89,6 +89,7 @@ export const BodyComponent = React.memo( setSelected, clearSelected, onRuleChange, + show, showCheckboxes, refetch, renderCellValue, @@ -244,6 +245,7 @@ export const BodyComponent = React.memo( isEventViewer={isEventViewer} isSelectAllChecked={isSelectAllChecked} onSelectAll={onSelectAll} + show={show} showEventsSelect={false} showSelectAllCheckbox={showCheckboxes} sort={sort} @@ -298,7 +300,8 @@ export const BodyComponent = React.memo( prevProps.renderCellValue === nextProps.renderCellValue && prevProps.rowRenderers === nextProps.rowRenderers && prevProps.showCheckboxes === nextProps.showCheckboxes && - prevProps.tabType === nextProps.tabType + prevProps.tabType === nextProps.tabType && + prevProps.show === nextProps.show ); BodyComponent.displayName = 'BodyComponent'; @@ -321,6 +324,7 @@ const makeMapStateToProps = () => { pinnedEventIds, selectedEventIds, showCheckboxes, + show, } = timeline; return { @@ -333,6 +337,7 @@ const makeMapStateToProps = () => { pinnedEventIds, selectedEventIds, showCheckboxes, + show, }; }; return mapStateToProps; From d091e17d16a7c8a56bee9987872ad4c725e07ef5 Mon Sep 17 00:00:00 2001 From: Shahzad Date: Thu, 3 Feb 2022 18:13:20 +0100 Subject: [PATCH 19/68] [Uptime] Fix uptime telemetry expensive query calls (#124281) --- .../plugins/uptime/public/state/api/utils.ts | 2 ++ .../telemetry/kibana_telemetry_adapter.ts | 19 +++++++++++++++---- .../server/lib/adapters/telemetry/types.ts | 1 + .../rest_api/telemetry/log_page_view.ts | 15 +++++++++++---- .../apis/uptime/rest/telemetry_collectors.ts | 18 +++++++++++++----- .../uptime/rest/telemetry_collectors_fleet.ts | 1 + 6 files changed, 43 insertions(+), 13 deletions(-) diff --git a/x-pack/plugins/uptime/public/state/api/utils.ts b/x-pack/plugins/uptime/public/state/api/utils.ts index 8dcef2239ca22..c0b403d8884e8 100644 --- a/x-pack/plugins/uptime/public/state/api/utils.ts +++ b/x-pack/plugins/uptime/public/state/api/utils.ts @@ -109,6 +109,8 @@ class ApiService { body: JSON.stringify(data), }); + this.addInspectorRequest?.({ data: response, status: FETCH_STATUS.SUCCESS, loading: false }); + if (decodeType) { const decoded = decodeType.decode(response); if (isRight(decoded)) { diff --git a/x-pack/plugins/uptime/server/lib/adapters/telemetry/kibana_telemetry_adapter.ts b/x-pack/plugins/uptime/server/lib/adapters/telemetry/kibana_telemetry_adapter.ts index f72af3311affe..de09c686d4441 100644 --- a/x-pack/plugins/uptime/server/lib/adapters/telemetry/kibana_telemetry_adapter.ts +++ b/x-pack/plugins/uptime/server/lib/adapters/telemetry/kibana_telemetry_adapter.ts @@ -11,6 +11,7 @@ import { CollectorFetchContext, UsageCollectionSetup } from 'src/plugins/usage_c import { PageViewParams, UptimeTelemetry, Usage } from './types'; import { savedObjectsAdapter } from '../../saved_objects/saved_objects'; import { UptimeESClient, createUptimeESClient } from '../../lib'; +import { createEsQuery } from '../../../../common/utils/es_search'; interface UptimeTelemetryCollector { [key: number]: UptimeTelemetry; @@ -215,7 +216,7 @@ export class KibanaTelemetryAdapter { savedObjectsClient: SavedObjectsClientContract ) { const dynamicSettings = await savedObjectsAdapter.getUptimeDynamicSettings(savedObjectsClient); - const params = { + const params = createEsQuery({ index: dynamicSettings.heartbeatIndices, body: { query: { @@ -229,6 +230,11 @@ export class KibanaTelemetryAdapter { }, }, }, + { + exists: { + field: 'summary', + }, + }, ], }, }, @@ -271,9 +277,9 @@ export class KibanaTelemetryAdapter { }, }, }, - }; + }); - const { body: result } = await callCluster.search(params); + const { body: result } = await callCluster.search(params, 'telemetryLog'); const numberOfUniqueMonitors: number = result?.aggregations?.unique_monitors?.value ?? 0; const numberOfUniqueLocations: number = result?.aggregations?.unique_locations?.value ?? 0; @@ -318,6 +324,11 @@ export class KibanaTelemetryAdapter { }, }, }, + { + exists: { + field: 'summary', + }, + }, { term: { 'monitor.fleet_managed': true, @@ -356,7 +367,7 @@ export class KibanaTelemetryAdapter { }, }; - const { body: result } = await callCluster.search(params); + const { body: result } = await callCluster.search(params, 'telemetryLogFleet'); const numberOfUniqueMonitors: number = result?.aggregations?.unique_monitors?.value ?? 0; const monitorNameStats = result?.aggregations?.monitor_name; diff --git a/x-pack/plugins/uptime/server/lib/adapters/telemetry/types.ts b/x-pack/plugins/uptime/server/lib/adapters/telemetry/types.ts index eceee3505dd7e..7095ae8e38ab5 100644 --- a/x-pack/plugins/uptime/server/lib/adapters/telemetry/types.ts +++ b/x-pack/plugins/uptime/server/lib/adapters/telemetry/types.ts @@ -12,6 +12,7 @@ export interface PageViewParams { autoRefreshEnabled: boolean; autorefreshInterval: number; refreshTelemetryHistory?: boolean; + refreshEsData?: boolean; } export interface Stats { diff --git a/x-pack/plugins/uptime/server/rest_api/telemetry/log_page_view.ts b/x-pack/plugins/uptime/server/rest_api/telemetry/log_page_view.ts index ec7de05dd2cf1..eb3447d85424b 100644 --- a/x-pack/plugins/uptime/server/rest_api/telemetry/log_page_view.ts +++ b/x-pack/plugins/uptime/server/rest_api/telemetry/log_page_view.ts @@ -21,18 +21,25 @@ export const createLogPageViewRoute: UMRestApiRouteFactory = () => ({ dateEnd: schema.string(), autoRefreshEnabled: schema.boolean(), autorefreshInterval: schema.number(), + refreshEsData: schema.maybe(schema.boolean()), refreshTelemetryHistory: schema.maybe(schema.boolean()), }), }, handler: async ({ savedObjectsClient, uptimeEsClient, request }): Promise => { const pageView = request.body as PageViewParams; if (pageView.refreshTelemetryHistory) { + // this is primarily only used for API testing KibanaTelemetryAdapter.clearLocalTelemetry(); } - await KibanaTelemetryAdapter.countNoOfUniqueMonitorAndLocations( - uptimeEsClient, - savedObjectsClient - ); + + if (pageView.refreshEsData) { + // this is primarily only used for API testing + + await KibanaTelemetryAdapter.countNoOfUniqueMonitorAndLocations( + uptimeEsClient, + savedObjectsClient + ); + } await KibanaTelemetryAdapter.countNoOfUniqueFleetManagedMonitors(uptimeEsClient); return KibanaTelemetryAdapter.countPageView(pageView as PageViewParams); }, diff --git a/x-pack/test/api_integration/apis/uptime/rest/telemetry_collectors.ts b/x-pack/test/api_integration/apis/uptime/rest/telemetry_collectors.ts index de65fe6deb985..e9aa339f62e14 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/telemetry_collectors.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/telemetry_collectors.ts @@ -14,8 +14,7 @@ export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); const es = getService('es'); - // FAILING ES PROMOTION: https://github.com/elastic/kibana/issues/111240 - describe.skip('telemetry collectors heartbeat', () => { + describe('telemetry collectors heartbeat', () => { before('generating data', async () => { await getService('esArchiver').load('x-pack/test/functional/es_archives/uptime/blank'); @@ -69,7 +68,7 @@ export default function ({ getService }: FtrProviderContext) { 'downMonitorId', 1, 1, - 1, + 10 * 1000, { observer, monitor: { @@ -79,7 +78,15 @@ export default function ({ getService }: FtrProviderContext) { 'down' ); - await makeChecksWithStatus(es, 'mixMonitorId', 1, 1, 1, { observer: observer2 }, 'down'); + await makeChecksWithStatus( + es, + 'mixMonitorId', + 1, + 1, + 30 * 1000, + { observer: observer2 }, + 'down' + ); await es.indices.refresh(); }); @@ -103,6 +110,7 @@ export default function ({ getService }: FtrProviderContext) { dateEnd: 'now/d', autoRefreshEnabled: true, refreshTelemetryHistory: true, + refreshEsData: true, }) .expect(200); @@ -111,7 +119,7 @@ export default function ({ getService }: FtrProviderContext) { monitor_page: 1, no_of_unique_monitors: 4, settings_page: 0, - monitor_frequency: [120, 0.001, 60, 60], + monitor_frequency: [10, 30, 60, 60], monitor_name_stats: { min_length: 7, max_length: 22, avg_length: 12 }, no_of_unique_observer_locations: 3, observer_location_name_stats: { min_length: 2, max_length: 7, avg_length: 4.8 }, diff --git a/x-pack/test/api_integration/apis/uptime/rest/telemetry_collectors_fleet.ts b/x-pack/test/api_integration/apis/uptime/rest/telemetry_collectors_fleet.ts index daf70c3fbb724..84d6d71a4ab6d 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/telemetry_collectors_fleet.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/telemetry_collectors_fleet.ts @@ -175,6 +175,7 @@ export default function ({ getService }: FtrProviderContext) { dateEnd: 'now/d', autoRefreshEnabled: true, refreshTelemetryHistory: true, + refreshEsData: true, }) .expect(200); From 941d31c4c7b082db859c422afc2b7356f4196207 Mon Sep 17 00:00:00 2001 From: Tim Sullivan Date: Thu, 3 Feb 2022 10:14:06 -0700 Subject: [PATCH 20/68] [Reporting] Fix incorrect event log value for byteSize (#124458) * [Reporting] Fix incorrect event log value for byteSize * add event log test --- .../server/lib/tasks/execute_report.ts | 4 +- .../__snapshots__/event_log.snap | 11 +++ .../reporting_and_security/event_log.ts | 87 +++++++++++++++++++ .../reporting_and_security/index.ts | 1 + 4 files changed, 101 insertions(+), 2 deletions(-) create mode 100644 x-pack/test/reporting_api_integration/reporting_and_security/__snapshots__/event_log.snap create mode 100644 x-pack/test/reporting_api_integration/reporting_and_security/event_log.ts diff --git a/x-pack/plugins/reporting/server/lib/tasks/execute_report.ts b/x-pack/plugins/reporting/server/lib/tasks/execute_report.ts index dd3f93ad2c0c6..dbd11943f70e4 100644 --- a/x-pack/plugins/reporting/server/lib/tasks/execute_report.ts +++ b/x-pack/plugins/reporting/server/lib/tasks/execute_report.ts @@ -358,13 +358,13 @@ export class ExecuteReportTask implements ReportingTask { stream.end(); - eventLog.logExecutionComplete({ byteSize: stream.bytesWritten }); - await promisify(finished)(stream, { readable: false }); report._seq_no = stream.getSeqNo()!; report._primary_term = stream.getPrimaryTerm()!; + eventLog.logExecutionComplete({ byteSize: stream.bytesWritten }); + if (output) { this.logger.debug(`Job output size: ${stream.bytesWritten} bytes.`); report = await this._completeJob(report, { diff --git a/x-pack/test/reporting_api_integration/reporting_and_security/__snapshots__/event_log.snap b/x-pack/test/reporting_api_integration/reporting_and_security/__snapshots__/event_log.snap new file mode 100644 index 0000000000000..603ab78db8c13 --- /dev/null +++ b/x-pack/test/reporting_api_integration/reporting_and_security/__snapshots__/event_log.snap @@ -0,0 +1,11 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Reporting APIs Report generation event logging creates a completed action for a PDF report 1`] = ` +"\\"_id\\",\\"_index\\",\\"_score\\",category,\\"category.keyword\\",currency,\\"customer_first_name\\",\\"customer_first_name.keyword\\",\\"customer_full_name\\",\\"customer_full_name.keyword\\",\\"customer_gender\\",\\"customer_id\\",\\"customer_last_name\\",\\"customer_last_name.keyword\\",\\"customer_phone\\",\\"day_of_week\\",\\"day_of_week_i\\",email,\\"geoip.city_name\\",\\"geoip.continent_name\\",\\"geoip.country_iso_code\\",\\"geoip.location\\",\\"geoip.region_name\\",manufacturer,\\"manufacturer.keyword\\",\\"order_date\\",\\"order_id\\",\\"products._id\\",\\"products._id.keyword\\",\\"products.base_price\\",\\"products.base_unit_price\\",\\"products.category\\",\\"products.category.keyword\\",\\"products.created_on\\",\\"products.discount_amount\\",\\"products.discount_percentage\\",\\"products.manufacturer\\",\\"products.manufacturer.keyword\\",\\"products.min_price\\",\\"products.price\\",\\"products.product_id\\",\\"products.product_name\\",\\"products.product_name.keyword\\",\\"products.quantity\\",\\"products.sku\\",\\"products.tax_amount\\",\\"products.taxful_price\\",\\"products.taxless_price\\",\\"products.unit_discount_amount\\",sku,\\"taxful_total_price\\",\\"taxless_total_price\\",\\"total_quantity\\",\\"total_unique_products\\",type,user +zQMtOW0BH63Xcmy432DJ,ecommerce,1,\\"Men's Clothing\\",\\"Men's Clothing\\",EUR,Eddie,Eddie,\\"Eddie Underwood\\",\\"Eddie Underwood\\",MALE,38,Underwood,Underwood,\\"(empty)\\",Monday,0,\\"eddie@underwood-family.zzz\\",Cairo,Africa,EG,\\"POINT (31.3 30.1)\\",\\"Cairo Governorate\\",\\"Elitelligence, Oceanavigations\\",\\"Elitelligence, Oceanavigations\\",\\"Jul 7, 2019 @ 00:00:00.000\\",584677,\\"sold_product_584677_6283, sold_product_584677_19400\\",\\"sold_product_584677_6283, sold_product_584677_19400\\",\\"11.992, 24.984\\",\\"11.992, 24.984\\",\\"Men's Clothing, Men's Clothing\\",\\"Men's Clothing, Men's Clothing\\",\\"Dec 26, 2016 @ 00:00:00.000, Dec 26, 2016 @ 00:00:00.000\\",\\"0, 0\\",\\"0, 0\\",\\"Elitelligence, Oceanavigations\\",\\"Elitelligence, Oceanavigations\\",\\"6.352, 11.75\\",\\"11.992, 24.984\\",\\"6,283, 19,400\\",\\"Basic T-shirt - dark blue/white, Sweatshirt - grey multicolor\\",\\"Basic T-shirt - dark blue/white, Sweatshirt - grey multicolor\\",\\"1, 1\\",\\"ZO0549605496, ZO0299602996\\",\\"0, 0\\",\\"11.992, 24.984\\",\\"11.992, 24.984\\",\\"0, 0\\",\\"ZO0549605496, ZO0299602996\\",\\"36.969\\",\\"36.969\\",2,2,order,eddie +zgMtOW0BH63Xcmy432DJ,ecommerce,1,\\"Women's Clothing\\",\\"Women's Clothing\\",EUR,Mary,Mary,\\"Mary Bailey\\",\\"Mary Bailey\\",FEMALE,20,Bailey,Bailey,\\"(empty)\\",Sunday,6,\\"mary@bailey-family.zzz\\",Dubai,Asia,AE,\\"POINT (55.3 25.3)\\",Dubai,\\"Champion Arts, Pyramidustries\\",\\"Champion Arts, Pyramidustries\\",\\"Jul 6, 2019 @ 00:00:00.000\\",584021,\\"sold_product_584021_11238, sold_product_584021_20149\\",\\"sold_product_584021_11238, sold_product_584021_20149\\",\\"24.984, 28.984\\",\\"24.984, 28.984\\",\\"Women's Clothing, Women's Clothing\\",\\"Women's Clothing, Women's Clothing\\",\\"Dec 25, 2016 @ 00:00:00.000, Dec 25, 2016 @ 00:00:00.000\\",\\"0, 0\\",\\"0, 0\\",\\"Champion Arts, Pyramidustries\\",\\"Champion Arts, Pyramidustries\\",\\"11.75, 15.648\\",\\"24.984, 28.984\\",\\"11,238, 20,149\\",\\"Denim dress - black denim, Shorts - black\\",\\"Denim dress - black denim, Shorts - black\\",\\"1, 1\\",\\"ZO0489604896, ZO0185501855\\",\\"0, 0\\",\\"24.984, 28.984\\",\\"24.984, 28.984\\",\\"0, 0\\",\\"ZO0489604896, ZO0185501855\\",\\"53.969\\",\\"53.969\\",2,2,order,mary +zwMtOW0BH63Xcmy432DJ,ecommerce,1,\\"Women's Shoes, Women's Clothing\\",\\"Women's Shoes, Women's Clothing\\",EUR,Gwen,Gwen,\\"Gwen Butler\\",\\"Gwen Butler\\",FEMALE,26,Butler,Butler,\\"(empty)\\",Sunday,6,\\"gwen@butler-family.zzz\\",\\"Los Angeles\\",\\"North America\\",US,\\"POINT (-118.2 34.1)\\",California,\\"Low Tide Media, Oceanavigations\\",\\"Low Tide Media, Oceanavigations\\",\\"Jul 6, 2019 @ 00:00:00.000\\",584058,\\"sold_product_584058_22794, sold_product_584058_23386\\",\\"sold_product_584058_22794, sold_product_584058_23386\\",\\"100, 100\\",\\"100, 100\\",\\"Women's Shoes, Women's Clothing\\",\\"Women's Shoes, Women's Clothing\\",\\"Dec 25, 2016 @ 00:00:00.000, Dec 25, 2016 @ 00:00:00.000\\",\\"0, 0\\",\\"0, 0\\",\\"Low Tide Media, Oceanavigations\\",\\"Low Tide Media, Oceanavigations\\",\\"46, 54\\",\\"100, 100\\",\\"22,794, 23,386\\",\\"Boots - Midnight Blue, Short coat - white/black\\",\\"Boots - Midnight Blue, Short coat - white/black\\",\\"1, 1\\",\\"ZO0374603746, ZO0272202722\\",\\"0, 0\\",\\"100, 100\\",\\"100, 100\\",\\"0, 0\\",\\"ZO0374603746, ZO0272202722\\",200,200,2,2,order,gwen +0AMtOW0BH63Xcmy432DJ,ecommerce,1,\\"Women's Shoes, Women's Clothing\\",\\"Women's Shoes, Women's Clothing\\",EUR,Diane,Diane,\\"Diane Chandler\\",\\"Diane Chandler\\",FEMALE,22,Chandler,Chandler,\\"(empty)\\",Sunday,6,\\"diane@chandler-family.zzz\\",\\"-\\",Europe,GB,\\"POINT (-0.1 51.5)\\",\\"-\\",\\"Primemaster, Oceanavigations\\",\\"Primemaster, Oceanavigations\\",\\"Jul 6, 2019 @ 00:00:00.000\\",584093,\\"sold_product_584093_12304, sold_product_584093_19587\\",\\"sold_product_584093_12304, sold_product_584093_19587\\",\\"75, 100\\",\\"75, 100\\",\\"Women's Shoes, Women's Clothing\\",\\"Women's Shoes, Women's Clothing\\",\\"Dec 25, 2016 @ 00:00:00.000, Dec 25, 2016 @ 00:00:00.000\\",\\"0, 0\\",\\"0, 0\\",\\"Primemaster, Oceanavigations\\",\\"Primemaster, Oceanavigations\\",\\"34.5, 47\\",\\"75, 100\\",\\"12,304, 19,587\\",\\"High heeled sandals - argento, Classic coat - black\\",\\"High heeled sandals - argento, Classic coat - black\\",\\"1, 1\\",\\"ZO0360303603, ZO0272002720\\",\\"0, 0\\",\\"75, 100\\",\\"75, 100\\",\\"0, 0\\",\\"ZO0360303603, ZO0272002720\\",175,175,2,2,order,diane +0QMtOW0BH63Xcmy432DJ,ecommerce,1,\\"Men's Clothing, Men's Accessories\\",\\"Men's Clothing, Men's Accessories\\",EUR,Eddie,Eddie,\\"Eddie Weber\\",\\"Eddie Weber\\",MALE,38,Weber,Weber,\\"(empty)\\",Monday,0,\\"eddie@weber-family.zzz\\",Cairo,Africa,EG,\\"POINT (31.3 30.1)\\",\\"Cairo Governorate\\",Elitelligence,Elitelligence,\\"Jun 30, 2019 @ 00:00:00.000\\",574916,\\"sold_product_574916_11262, sold_product_574916_15713\\",\\"sold_product_574916_11262, sold_product_574916_15713\\",\\"60, 20.984\\",\\"60, 20.984\\",\\"Men's Clothing, Men's Accessories\\",\\"Men's Clothing, Men's Accessories\\",\\"Dec 19, 2016 @ 00:00:00.000, Dec 19, 2016 @ 00:00:00.000\\",\\"0, 0\\",\\"0, 0\\",\\"Elitelligence, Elitelligence\\",\\"Elitelligence, Elitelligence\\",\\"28.203, 10.703\\",\\"60, 20.984\\",\\"11,262, 15,713\\",\\"Winter jacket - black, Watch - green\\",\\"Winter jacket - black, Watch - green\\",\\"1, 1\\",\\"ZO0542505425, ZO0601306013\\",\\"0, 0\\",\\"60, 20.984\\",\\"60, 20.984\\",\\"0, 0\\",\\"ZO0542505425, ZO0601306013\\",81,81,2,2,order,eddie +" +`; diff --git a/x-pack/test/reporting_api_integration/reporting_and_security/event_log.ts b/x-pack/test/reporting_api_integration/reporting_and_security/event_log.ts new file mode 100644 index 0000000000000..d063655180e75 --- /dev/null +++ b/x-pack/test/reporting_api_integration/reporting_and_security/event_log.ts @@ -0,0 +1,87 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { omit } from 'lodash'; +import expect from '@kbn/expect'; +import { FtrProviderContext } from '../ftr_provider_context'; + +// eslint-disable-next-line import/no-default-export +export default function ({ getService }: FtrProviderContext) { + const reportingAPI = getService('reportingAPI'); + const es = getService('es'); + + describe('Report generation event logging', () => { + before(async () => { + await reportingAPI.initEcommerce(); + }); + + after(async () => { + await reportingAPI.teardownEcommerce(); + }); + + it('creates a completed action for a PDF report', async () => { + const res = await reportingAPI.generateCsv({ + browserTimezone: 'UTC', + title: 'Test-PDF', + objectType: 'search', + searchSource: { + version: true, + fields: [{ field: '*', include_unmapped: 'true' }], + index: '5193f870-d861-11e9-a311-0fa548c5f953', + }, + columns: [], + version: '7.16.0', + }); + expect(res.status).to.eql(200); + expect(res.body.path).to.match(/download/); + + const { path } = res.body; + + // wait for the the pending job to complete + await reportingAPI.waitForJobToFinish(path); + + const csvFile = await reportingAPI.getCompletedJobOutput(path); + expectSnapshot(csvFile).toMatch(); + + // search for the raw event log data + const events = await es.search<{ event: any; kibana: { reporting: any } }>({ + index: '.kibana-event-log*', + filter_path: 'hits.hits._source.event,hits.hits._source.kibana', + query: { + bool: { + filter: [ + { + bool: { + must: [ + { term: { 'event.provider': 'reporting' } }, + { term: { 'event.action': 'execute-complete' } }, + ], + }, + }, + ], + }, + }, + sort: [{ '@timestamp': { order: 'desc' } }] as unknown as string[], + size: 1, + }); + + // validate the log has the expected fields with expected values + const logSource = events.hits.hits[0]._source; + expect(omit(logSource?.kibana.reporting, 'id')).to.eql({ + byteSize: 5943, + jobType: 'csv_searchsource', + }); + expect(omit(logSource?.event, ['duration', 'start', 'end'])).to.eql({ + action: 'execute-complete', + kind: 'metrics', + outcome: 'success', + provider: 'reporting', + timezone: 'UTC', + }); + }); + }); +} diff --git a/x-pack/test/reporting_api_integration/reporting_and_security/index.ts b/x-pack/test/reporting_api_integration/reporting_and_security/index.ts index 02a2915fffd60..e2f70eed3a508 100644 --- a/x-pack/test/reporting_api_integration/reporting_and_security/index.ts +++ b/x-pack/test/reporting_api_integration/reporting_and_security/index.ts @@ -24,6 +24,7 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) { loadTestFile(require.resolve('./bwc_existing_indexes')); loadTestFile(require.resolve('./security_roles_privileges')); loadTestFile(require.resolve('./download_csv_dashboard')); + loadTestFile(require.resolve('./event_log')); loadTestFile(require.resolve('./generate_csv_discover')); loadTestFile(require.resolve('./network_policy')); loadTestFile(require.resolve('./spaces')); From 54810f8b7cfa54e53bbb0c4c3e4e127d1513f2d2 Mon Sep 17 00:00:00 2001 From: Philipp Kahr Date: Thu, 3 Feb 2022 18:18:33 +0100 Subject: [PATCH 21/68] [APM] RUM documentation link is broken (#124478) * Link that is not a 404 --- .../common/tutorial/instructions/apm_agent_instructions.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/apm/common/tutorial/instructions/apm_agent_instructions.ts b/x-pack/plugins/apm/common/tutorial/instructions/apm_agent_instructions.ts index daac81298008e..695cf38bf2da2 100644 --- a/x-pack/plugins/apm/common/tutorial/instructions/apm_agent_instructions.ts +++ b/x-pack/plugins/apm/common/tutorial/instructions/apm_agent_instructions.ts @@ -257,10 +257,10 @@ export const createJsAgentInstructions = (apmServerUrl = '') => [ { defaultMessage: 'APM Server disables RUM support by default. See the [documentation]({documentationLink}) \ -for details on how to enable RUM support.', +for details on how to enable RUM support. When using the APM integration with Fleet, RUM support is automatically enabled.', values: { documentationLink: - '{config.docs.base_url}guide/en/apm/server/{config.docs.version}/configuration-rum.html', + '{config.docs.base_url}guide/en/apm/guide/{config.docs.version}/configuration-rum.html', }, } ), From bb4509cf3bba264e19e884b55f39564364876756 Mon Sep 17 00:00:00 2001 From: Marco Liberati Date: Thu, 3 Feb 2022 18:35:24 +0100 Subject: [PATCH 22/68] :wrench: Use the new Records field from Lens (#124276) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../sample_data/data_sets/ecommerce/saved_objects.ts | 10 +++++----- .../sample_data/data_sets/logs/saved_objects.ts | 4 ++-- x-pack/plugins/data_visualizer/kibana.json | 1 + .../field_data_row/action_menu/lens_utils.ts | 9 +++++---- x-pack/plugins/osquery/kibana.json | 2 +- .../osquery/public/packs/pack_queries_status_table.tsx | 3 ++- 6 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/plugins/home/server/services/sample_data/data_sets/ecommerce/saved_objects.ts b/src/plugins/home/server/services/sample_data/data_sets/ecommerce/saved_objects.ts index 25923f247ca8b..c2f56c1d6049d 100644 --- a/src/plugins/home/server/services/sample_data/data_sets/ecommerce/saved_objects.ts +++ b/src/plugins/home/server/services/sample_data/data_sets/ecommerce/saved_objects.ts @@ -544,7 +544,7 @@ export const getSavedObjects = (): SavedObject[] => [ label: 'Tx. last week', operationType: 'count', scale: 'ratio', - sourceField: 'Records', + sourceField: '___records___', timeShift: '1w', }, 'ddc92e50-4d5c-413e-b91b-3e504889fa65': { @@ -554,7 +554,7 @@ export const getSavedObjects = (): SavedObject[] => [ label: 'Transactions', operationType: 'count', scale: 'ratio', - sourceField: 'Records', + sourceField: '___records___', }, 'eadae280-2da3-4d1d-a0e1-f9733f89c15b': { customLabel: true, @@ -743,7 +743,7 @@ export const getSavedObjects = (): SavedObject[] => [ label: 'Count of records', operationType: 'count', scale: 'ratio', - sourceField: 'Records', + sourceField: '___records___', }, '9f61a7df-198e-4754-b34c-81ed544136ba': { dataType: 'string', @@ -1070,7 +1070,7 @@ export const getSavedObjects = (): SavedObject[] => [ label: 'Items', operationType: 'count', scale: 'ratio', - sourceField: 'Records', + sourceField: '___records___', }, 'd77cdd24-dedc-48dd-9a4b-d34c6f1a6c46': { customLabel: true, @@ -1186,7 +1186,7 @@ export const getSavedObjects = (): SavedObject[] => [ label: 'Items', operationType: 'count', scale: 'ratio', - sourceField: 'Records', + sourceField: '___records___', }, 'd77cdd24-dedc-48dd-9a4b-d34c6f1a6c46': { customLabel: true, diff --git a/src/plugins/home/server/services/sample_data/data_sets/logs/saved_objects.ts b/src/plugins/home/server/services/sample_data/data_sets/logs/saved_objects.ts index 840fc6e2c175c..aa2a0d077e30a 100644 --- a/src/plugins/home/server/services/sample_data/data_sets/logs/saved_objects.ts +++ b/src/plugins/home/server/services/sample_data/data_sets/logs/saved_objects.ts @@ -249,7 +249,7 @@ export const getSavedObjects = (): SavedObject[] => [ label: 'Part of count() / overall_sum(count())', operationType: 'count', scale: 'ratio', - sourceField: 'Records', + sourceField: '___records___', }, 'b5f3dc78-dba8-4db8-87b6-24a0b9cca260X1': { customLabel: true, @@ -258,7 +258,7 @@ export const getSavedObjects = (): SavedObject[] => [ label: 'Part of count() / overall_sum(count())', operationType: 'count', scale: 'ratio', - sourceField: 'Records', + sourceField: '___records___', }, 'b5f3dc78-dba8-4db8-87b6-24a0b9cca260X2': { customLabel: true, diff --git a/x-pack/plugins/data_visualizer/kibana.json b/x-pack/plugins/data_visualizer/kibana.json index 03f21bcde469d..aee54c216150c 100644 --- a/x-pack/plugins/data_visualizer/kibana.json +++ b/x-pack/plugins/data_visualizer/kibana.json @@ -30,6 +30,7 @@ "esUiShared", "fieldFormats", "uiActions", + "lens", "cloud" ], "owner": { diff --git a/x-pack/plugins/data_visualizer/public/application/common/components/field_data_row/action_menu/lens_utils.ts b/x-pack/plugins/data_visualizer/public/application/common/components/field_data_row/action_menu/lens_utils.ts index 3db1795456127..10ee347750e10 100644 --- a/x-pack/plugins/data_visualizer/public/application/common/components/field_data_row/action_menu/lens_utils.ts +++ b/x-pack/plugins/data_visualizer/public/application/common/components/field_data_row/action_menu/lens_utils.ts @@ -17,6 +17,7 @@ import type { TypedLensByValueInput, XYLayerConfig, } from '../../../../../../../lens/public'; +import { DOCUMENT_FIELD_NAME as RECORDS_FIELD } from '../../../../../../../lens/common/constants'; import { FieldVisConfig } from '../../stats_table/types'; import { JOB_FIELD_TYPES } from '../../../../../../common/constants'; @@ -52,7 +53,7 @@ export function getNumberSettings(item: FieldVisConfig, defaultIndexPattern: Ind label: COUNT, dataType: 'number', isBucketed: false, - sourceField: 'Records', + sourceField: RECORDS_FIELD, operationType: 'count', }, }; @@ -107,7 +108,7 @@ export function getDateSettings(item: FieldVisConfig) { label: COUNT, operationType: 'count', scale: 'ratio', - sourceField: 'Records', + sourceField: RECORDS_FIELD, }, col1: { dataType: 'date', @@ -148,7 +149,7 @@ export function getKeywordSettings(item: FieldVisConfig) { label: COUNT, dataType: 'number', isBucketed: false, - sourceField: 'Records', + sourceField: RECORDS_FIELD, operationType: 'count', }, }; @@ -181,7 +182,7 @@ export function getBooleanSettings(item: FieldVisConfig) { label: COUNT, dataType: 'number', isBucketed: false, - sourceField: 'Records', + sourceField: RECORDS_FIELD, operationType: 'count', }, }; diff --git a/x-pack/plugins/osquery/kibana.json b/x-pack/plugins/osquery/kibana.json index a499b2b75ee68..63f75b233f73b 100644 --- a/x-pack/plugins/osquery/kibana.json +++ b/x-pack/plugins/osquery/kibana.json @@ -8,7 +8,7 @@ }, "kibanaVersion": "kibana", "optionalPlugins": ["fleet", "home", "usageCollection", "lens"], - "requiredBundles": ["esUiShared", "fleet", "kibanaUtils", "kibanaReact"], + "requiredBundles": ["esUiShared", "fleet", "kibanaUtils", "kibanaReact", "lens"], "requiredPlugins": [ "actions", "data", diff --git a/x-pack/plugins/osquery/public/packs/pack_queries_status_table.tsx b/x-pack/plugins/osquery/public/packs/pack_queries_status_table.tsx index 2bfe75e2833aa..8b8d361611a2d 100644 --- a/x-pack/plugins/osquery/public/packs/pack_queries_status_table.tsx +++ b/x-pack/plugins/osquery/public/packs/pack_queries_status_table.tsx @@ -30,6 +30,7 @@ import { PieVisualizationState, TermsIndexPatternColumn, } from '../../../lens/public'; +import { DOCUMENT_FIELD_NAME as RECORDS_FIELD } from '../../../lens/common/constants'; import { FilterStateStore, DataView } from '../../../../../src/plugins/data/common'; import { useKibana } from '../common/lib/kibana'; import { OsqueryManagerPackagePolicyInputStream } from '../../common/types'; @@ -91,7 +92,7 @@ function getLensAttributes( }, } as TermsIndexPatternColumn, 'ed999e9d-204c-465b-897f-fe1a125b39ed': { - sourceField: 'Records', + sourceField: RECORDS_FIELD, isBucketed: false, dataType: 'number', scale: 'ratio', From af9d3a1602732adabbdac67b87907665518f86d0 Mon Sep 17 00:00:00 2001 From: Abdul Wahab Zahid Date: Thu, 3 Feb 2022 18:58:20 +0100 Subject: [PATCH 23/68] Use `formatErrors` from utils instead of the default io-ts PathReporter for a concise report of schema validation errors. (#124555) --- .../plugins/uptime/public/state/api/utils.ts | 36 ++----------------- .../synthetics_service/monitor_validation.ts | 6 ++-- 2 files changed, 6 insertions(+), 36 deletions(-) diff --git a/x-pack/plugins/uptime/public/state/api/utils.ts b/x-pack/plugins/uptime/public/state/api/utils.ts index c0b403d8884e8..833a6845d6343 100644 --- a/x-pack/plugins/uptime/public/state/api/utils.ts +++ b/x-pack/plugins/uptime/public/state/api/utils.ts @@ -5,41 +5,11 @@ * 2.0. */ -import { PathReporter } from 'io-ts/lib/PathReporter'; import { isRight } from 'fp-ts/lib/Either'; +import { formatErrors } from '@kbn/securitysolution-io-ts-utils'; import { HttpFetchQuery, HttpSetup } from 'src/core/public'; -import * as t from 'io-ts'; import { FETCH_STATUS, AddInspectorRequest } from '../../../../observability/public'; -function isObject(value: unknown) { - const type = typeof value; - return value != null && (type === 'object' || type === 'function'); -} - -/** - * @deprecated Use packages/kbn-securitysolution-io-ts-utils/src/format_errors/index.ts - */ -export const formatErrors = (errors: t.Errors): string[] => { - return errors.map((error) => { - if (error.message != null) { - return error.message; - } else { - const keyContext = error.context - .filter( - (entry) => entry.key != null && !Number.isInteger(+entry.key) && entry.key.trim() !== '' - ) - .map((entry) => entry.key) - .join('.'); - - const nameContext = error.context.find((entry) => entry.type?.name?.length > 0); - const suppliedValue = - keyContext !== '' ? keyContext : nameContext != null ? nameContext.type.name : ''; - const value = isObject(error.value) ? JSON.stringify(error.value) : error.value; - return `Invalid value "${value}" supplied to "${suppliedValue}"`; - } - }); -}; - class ApiService { private static instance: ApiService; private _http!: HttpSetup; @@ -118,7 +88,7 @@ class ApiService { } else { // eslint-disable-next-line no-console console.warn( - `API ${apiUrl} is not returning expected response, ${PathReporter.report(decoded)}` + `API ${apiUrl} is not returning expected response, ${formatErrors(decoded.left)}` ); } } @@ -138,7 +108,7 @@ class ApiService { } else { // eslint-disable-next-line no-console console.warn( - `API ${apiUrl} is not returning expected response, ${PathReporter.report(decoded)}` + `API ${apiUrl} is not returning expected response, ${formatErrors(decoded.left)}` ); } } diff --git a/x-pack/plugins/uptime/server/rest_api/synthetics_service/monitor_validation.ts b/x-pack/plugins/uptime/server/rest_api/synthetics_service/monitor_validation.ts index 9f14c414e5cad..446eaa5847319 100644 --- a/x-pack/plugins/uptime/server/rest_api/synthetics_service/monitor_validation.ts +++ b/x-pack/plugins/uptime/server/rest_api/synthetics_service/monitor_validation.ts @@ -6,7 +6,7 @@ */ import { isLeft } from 'fp-ts/lib/Either'; -import { PathReporter } from 'io-ts/lib/PathReporter'; +import { formatErrors } from '@kbn/securitysolution-io-ts-utils'; import { BrowserFieldsCodec, @@ -49,7 +49,7 @@ export function validateMonitor(monitorFields: MonitorFields): { return { valid: false, reason: `Monitor type is invalid`, - details: PathReporter.report(decodedType).join(' | '), + details: formatErrors(decodedType.left).join(' | '), payload: monitorFields, }; } @@ -72,7 +72,7 @@ export function validateMonitor(monitorFields: MonitorFields): { return { valid: false, reason: `Monitor is not a valid monitor of type ${monitorType}`, - details: PathReporter.report(decodedMonitor).join(' | '), + details: formatErrors(decodedMonitor.left).join(' | '), payload: monitorFields, }; } From 52f0ea20fe49efdfd6bbb23469b7872c876d1c99 Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Thu, 3 Feb 2022 19:05:19 +0100 Subject: [PATCH 24/68] [TSVB] Fix series containing colon (#123897) --- .../vis_types/timeseries/common/constants.ts | 1 + .../components/lib/get_click_filter_data.test.ts | 5 +++-- .../components/lib/get_click_filter_data.ts | 3 ++- .../components/vis_types/top_n/vis.js | 5 +++-- .../application/components/vis_with_splits.js | 5 +++-- .../lib/vis_data/helpers/get_splits.test.ts | 16 ++++++++-------- .../server/lib/vis_data/helpers/get_splits.ts | 5 +++-- .../vis_data/response_processors/series/math.js | 3 ++- .../response_processors/series/math.test.js | 2 +- .../response_processors/series/percentile.js | 3 ++- .../series/percentile.test.js | 4 ++-- .../series/percentile_rank.js | 3 ++- .../series/percentile_rank.test.ts | 4 ++-- .../response_processors/series/series_agg.js | 3 ++- .../response_processors/table/series_agg.ts | 3 ++- 15 files changed, 38 insertions(+), 27 deletions(-) diff --git a/src/plugins/vis_types/timeseries/common/constants.ts b/src/plugins/vis_types/timeseries/common/constants.ts index 30fb814990925..cbaf275cc0092 100644 --- a/src/plugins/vis_types/timeseries/common/constants.ts +++ b/src/plugins/vis_types/timeseries/common/constants.ts @@ -11,6 +11,7 @@ export const UI_SETTINGS = { ALLOW_STRING_INDICES: 'metrics:allowStringIndices', ALLOW_CHECKING_FOR_FAILED_SHARDS: 'metrics:allowCheckingForFailedShards', }; +export const SERIES_SEPARATOR = '╰┄►'; export const INDEXES_SEPARATOR = ','; export const AUTO_INTERVAL = 'auto'; export const ROUTES = { diff --git a/src/plugins/vis_types/timeseries/public/application/components/lib/get_click_filter_data.test.ts b/src/plugins/vis_types/timeseries/public/application/components/lib/get_click_filter_data.test.ts index 80c84ff125817..f79665fdca5ec 100644 --- a/src/plugins/vis_types/timeseries/public/application/components/lib/get_click_filter_data.test.ts +++ b/src/plugins/vis_types/timeseries/public/application/components/lib/get_click_filter_data.test.ts @@ -9,6 +9,7 @@ import { XYChartSeriesIdentifier, GeometryValue } from '@elastic/charts'; import { getClickFilterData } from './get_click_filter_data'; import type { TSVBTables } from './types'; import { TimeseriesVisParams } from '../../../types'; +import { SERIES_SEPARATOR } from '../../../../common/constants'; describe('getClickFilterData', () => { test('gets the correct data for a group by everything timeseries chart', () => { @@ -102,7 +103,7 @@ describe('getClickFilterData', () => { }, { key: 'groupId{yaxis_6e0353a0-ad9b-11eb-b112-89cce8e43380_main_group}spec{61ca57f1-469d-11e7-af02-69e470af7417:1}yAccessor{1}splitAccessors{}', - specId: '61ca57f1-469d-11e7-af02-69e470af7417:1', + specId: '61ca57f1-469d-11e7-af02-69e470af7417╰┄►1', }, ], ] as Array<[GeometryValue, XYChartSeriesIdentifier]>; @@ -199,7 +200,7 @@ describe('getClickFilterData', () => { expect(data[1].column).toEqual(2); expect(data[1].row).toEqual(10); // expect(data).toEqual([]); - const splitValue = points[0][1].specId.split(':'); + const splitValue = points[0][1].specId.split(SERIES_SEPARATOR); expect(data[1].value).toEqual(parseInt(splitValue[1], 10)); }); }); diff --git a/src/plugins/vis_types/timeseries/public/application/components/lib/get_click_filter_data.ts b/src/plugins/vis_types/timeseries/public/application/components/lib/get_click_filter_data.ts index a6e35aa6e1032..a3da470f6155c 100644 --- a/src/plugins/vis_types/timeseries/public/application/components/lib/get_click_filter_data.ts +++ b/src/plugins/vis_types/timeseries/public/application/components/lib/get_click_filter_data.ts @@ -11,6 +11,7 @@ import { X_ACCESSOR_INDEX } from '../../visualizations/constants'; import { BUCKET_TYPES } from '../../../../common/enums'; import { TimeseriesVisParams } from '../../../types'; import type { TSVBTables } from './types'; +import { SERIES_SEPARATOR } from '../../../../common/constants'; export const getClickFilterData = ( points: Array<[GeometryValue, XYChartSeriesIdentifier]>, @@ -23,7 +24,7 @@ export const getClickFilterData = ( const { specId } = point[1]; // specId for a split series has the format // 61ca57f1-469d-11e7-af02-69e470af7417:Men's Accessories, : - const [layerId, splitLabel] = specId.split(':'); + const [layerId, splitLabel] = specId.split(SERIES_SEPARATOR); const table = tables[layerId]; const layer = model.series.filter(({ id }) => id === layerId); diff --git a/src/plugins/vis_types/timeseries/public/application/components/vis_types/top_n/vis.js b/src/plugins/vis_types/timeseries/public/application/components/vis_types/top_n/vis.js index 5eb850a753384..20caa14ea8cb6 100644 --- a/src/plugins/vis_types/timeseries/public/application/components/vis_types/top_n/vis.js +++ b/src/plugins/vis_types/timeseries/public/application/components/vis_types/top_n/vis.js @@ -20,6 +20,7 @@ import { sortBy, first, get } from 'lodash'; import { DATA_FORMATTERS } from '../../../../../common/enums'; import { getOperator, shouldOperate } from '../../../../../common/operators_utils'; import { ExternalUrlErrorModal } from '../../lib/external_url_error_modal'; +import { SERIES_SEPARATOR } from '../../../../../common/constants'; function sortByDirection(data, direction, fn) { if (direction === 'desc') { @@ -32,7 +33,7 @@ function sortSeries(visData, model) { const series = get(visData, `${model.id}.series`, []); return model.series.reduce((acc, item) => { const itemSeries = series.filter((s) => { - const id = first(s.id.split(/:/)); + const id = first(s.id.split(SERIES_SEPARATOR)); return id === item.id; }); const direction = item.terms_direction || 'desc'; @@ -47,7 +48,7 @@ function TopNVisualization(props) { const { backgroundColor, model, visData, fieldFormatMap, getConfig } = props; const series = sortSeries(visData, model).map((item) => { - const id = first(item.id.split(/:/)); + const id = first(item.id.split(SERIES_SEPARATOR)); const seriesConfig = model.series.find((s) => s.id === id); if (seriesConfig) { const tickFormatter = diff --git a/src/plugins/vis_types/timeseries/public/application/components/vis_with_splits.js b/src/plugins/vis_types/timeseries/public/application/components/vis_with_splits.js index b8ce63bd35dca..8f700228cc71e 100644 --- a/src/plugins/vis_types/timeseries/public/application/components/vis_with_splits.js +++ b/src/plugins/vis_types/timeseries/public/application/components/vis_with_splits.js @@ -13,6 +13,7 @@ import { labelDateFormatter } from './lib/label_date_formatter'; import { findIndex, first } from 'lodash'; import { getValueOrEmpty } from '../../../common/empty_label'; import { getSplitByTermsColor } from '../lib/get_split_by_terms_color'; +import { SERIES_SEPARATOR } from '../../../common/constants'; export function visWithSplits(WrappedComponent) { function SplitVisComponent(props) { @@ -43,12 +44,12 @@ export function visWithSplits(WrappedComponent) { ); if (!model || !visData || !visData[model.id]) return ; - if (visData[model.id].series.every((s) => s.id.split(':').length === 1)) { + if (visData[model.id].series.every((s) => s.id.split(SERIES_SEPARATOR).length === 1)) { return ; } const splitsVisData = visData[model.id].series.reduce((acc, series) => { - const [seriesId, splitId] = series.id.split(':'); + const [seriesId, splitId] = series.id.split(SERIES_SEPARATOR); const seriesModel = model.series.find((s) => s.id === seriesId); if (!seriesModel) return acc; diff --git a/src/plugins/vis_types/timeseries/server/lib/vis_data/helpers/get_splits.test.ts b/src/plugins/vis_types/timeseries/server/lib/vis_data/helpers/get_splits.test.ts index 5dbeb915df28c..d6bdd452825fd 100644 --- a/src/plugins/vis_types/timeseries/server/lib/vis_data/helpers/get_splits.test.ts +++ b/src/plugins/vis_types/timeseries/server/lib/vis_data/helpers/get_splits.test.ts @@ -79,7 +79,7 @@ describe('getSplits(resp, panel, series)', () => { expect(await getSplits(resp, panel, series, undefined, () => [])).toEqual([ { - id: 'SERIES:example-01', + id: 'SERIES╰┄►example-01', key: 'example-01', label: 'example-01', labelFormatted: '', @@ -90,7 +90,7 @@ describe('getSplits(resp, panel, series)', () => { SIBAGG: { value: 1 }, }, { - id: 'SERIES:example-02', + id: 'SERIES╰┄►example-02', key: 'example-02', label: 'example-02', labelFormatted: '', @@ -138,7 +138,7 @@ describe('getSplits(resp, panel, series)', () => { const panel = { type: 'top_n' } as Panel; expect(await getSplits(resp, panel, series, undefined, () => [])).toEqual([ { - id: 'SERIES:example-01', + id: 'SERIES╰┄►example-01', key: 'example-01', label: '--example-01--', labelFormatted: '', @@ -149,7 +149,7 @@ describe('getSplits(resp, panel, series)', () => { SIBAGG: { value: 1 }, }, { - id: 'SERIES:example-02', + id: 'SERIES╰┄►example-02', key: 'example-02', label: '--example-02--', labelFormatted: '', @@ -200,7 +200,7 @@ describe('getSplits(resp, panel, series)', () => { expect(await getSplits(resp, panel, series, undefined, () => [])).toEqual([ { - id: 'SERIES:example-01', + id: 'SERIES╰┄►example-01', key: 'example-01', key_as_string: 'false', label: '--example-01--', @@ -212,7 +212,7 @@ describe('getSplits(resp, panel, series)', () => { SIBAGG: { value: 1 }, }, { - id: 'SERIES:example-02', + id: 'SERIES╰┄►example-02', key: 'example-02', key_as_string: 'true', label: '--example-02--', @@ -256,7 +256,7 @@ describe('getSplits(resp, panel, series)', () => { expect(await getSplits(resp, panel, series, undefined, () => [])).toEqual([ { - id: 'SERIES:filter-1', + id: 'SERIES╰┄►filter-1', key: 'filter-1', label: '200s', meta: { bucketSize: 10 }, @@ -265,7 +265,7 @@ describe('getSplits(resp, panel, series)', () => { timeseries: { buckets: [] }, }, { - id: 'SERIES:filter-2', + id: 'SERIES╰┄►filter-2', key: 'filter-2', label: '300s', splitByLabel: 'Count', diff --git a/src/plugins/vis_types/timeseries/server/lib/vis_data/helpers/get_splits.ts b/src/plugins/vis_types/timeseries/server/lib/vis_data/helpers/get_splits.ts index 6be53ef3f03ff..1754fa6569dcd 100644 --- a/src/plugins/vis_types/timeseries/server/lib/vis_data/helpers/get_splits.ts +++ b/src/plugins/vis_types/timeseries/server/lib/vis_data/helpers/get_splits.ts @@ -11,6 +11,7 @@ import { get, isPlainObject } from 'lodash'; import { overwrite } from '../helpers'; import { calculateLabel } from '../../../../common/calculate_label'; +import { SERIES_SEPARATOR } from '../../../../common/constants'; import { getLastMetric } from './get_last_metric'; import { formatKey } from './format_key'; @@ -66,7 +67,7 @@ export async function getSplits { const bucket = get(resp, `aggregations.${series.id}.buckets.${filter.id}`); - bucket.id = `${series.id}:${filter.id}`; + bucket.id = `${series.id}${SERIES_SEPARATOR}${filter.id}`; bucket.key = filter.id; bucket.splitByLabel = splitByLabel; bucket.color = filter.color; diff --git a/src/plugins/vis_types/timeseries/server/lib/vis_data/response_processors/series/math.js b/src/plugins/vis_types/timeseries/server/lib/vis_data/response_processors/series/math.js index a6addc8ba0e53..46dde6653647d 100644 --- a/src/plugins/vis_types/timeseries/server/lib/vis_data/response_processors/series/math.js +++ b/src/plugins/vis_types/timeseries/server/lib/vis_data/response_processors/series/math.js @@ -7,6 +7,7 @@ */ import { convertIntervalToUnit } from '../../helpers/unit_to_seconds'; +import { SERIES_SEPARATOR } from '../../../../../common/constants'; const percentileValueMatch = /\[([0-9\.]+)\]$/; import { startsWith, flatten, values, first, last } from 'lodash'; @@ -20,7 +21,7 @@ export function mathAgg(resp, panel, series, meta, extractFields) { // Filter the results down to only the ones that match the series.id. Sometimes // there will be data from other series mixed in. results = results.filter((s) => { - if (s.id.split(/:/)[0] === series.id) { + if (s.id.split(SERIES_SEPARATOR)[0] === series.id) { return false; } return true; diff --git a/src/plugins/vis_types/timeseries/server/lib/vis_data/response_processors/series/math.test.js b/src/plugins/vis_types/timeseries/server/lib/vis_data/response_processors/series/math.test.js index d8508f6b735a0..14c66866d323a 100644 --- a/src/plugins/vis_types/timeseries/server/lib/vis_data/response_processors/series/math.test.js +++ b/src/plugins/vis_types/timeseries/server/lib/vis_data/response_processors/series/math.test.js @@ -93,7 +93,7 @@ describe('math(resp, panel, series)', () => { expect(results).toHaveLength(1); expect(results[0]).toEqual({ - id: 'test:example-01', + id: 'test╰┄►example-01', label: 'example-01', color: 'rgb(255, 0, 0)', stack: false, diff --git a/src/plugins/vis_types/timeseries/server/lib/vis_data/response_processors/series/percentile.js b/src/plugins/vis_types/timeseries/server/lib/vis_data/response_processors/series/percentile.js index fe8a6ff9cd2f6..a0fe57ea5cfcf 100644 --- a/src/plugins/vis_types/timeseries/server/lib/vis_data/response_processors/series/percentile.js +++ b/src/plugins/vis_types/timeseries/server/lib/vis_data/response_processors/series/percentile.js @@ -11,6 +11,7 @@ import { getDefaultDecoration } from '../../helpers/get_default_decoration'; import { getSplits } from '../../helpers/get_splits'; import { getLastMetric } from '../../helpers/get_last_metric'; import { TSVB_METRIC_TYPES } from '../../../../../common/enums'; +import { SERIES_SEPARATOR } from '../../../../../common/constants'; export function percentile(resp, panel, series, meta, extractFields) { return (next) => async (results) => { @@ -23,7 +24,7 @@ export function percentile(resp, panel, series, meta, extractFields) { (await getSplits(resp, panel, series, meta, extractFields)).forEach((split) => { metric.percentiles.forEach((percentile) => { const percentileValue = percentile.value ? percentile.value : 0; - const id = `${split.id}:${percentile.id}`; + const id = `${split.id}${SERIES_SEPARATOR}${percentile.id}`; const data = split.timeseries.buckets.map((bucket) => { const higherMetric = { ...metric, percent: percentileValue }; const serieData = [bucket.key, getAggValue(bucket, higherMetric)]; diff --git a/src/plugins/vis_types/timeseries/server/lib/vis_data/response_processors/series/percentile.test.js b/src/plugins/vis_types/timeseries/server/lib/vis_data/response_processors/series/percentile.test.js index de304913d6c69..ea1efdcd0c41b 100644 --- a/src/plugins/vis_types/timeseries/server/lib/vis_data/response_processors/series/percentile.test.js +++ b/src/plugins/vis_types/timeseries/server/lib/vis_data/response_processors/series/percentile.test.js @@ -83,7 +83,7 @@ describe('percentile(resp, panel, series)', () => { expect(results).toHaveLength(2); - expect(results[0]).toHaveProperty('id', 'test:10-90'); + expect(results[0]).toHaveProperty('id', 'test╰┄►10-90'); expect(results[0]).toHaveProperty('color', '#000028'); expect(results[0]).toHaveProperty('label', 'Percentile of cpu'); expect(results[0]).toHaveProperty('lines'); @@ -100,7 +100,7 @@ describe('percentile(resp, panel, series)', () => { [2, 1.2, 5.3], ]); - expect(results[1]).toHaveProperty('id', 'test:50'); + expect(results[1]).toHaveProperty('id', 'test╰┄►50'); expect(results[1]).toHaveProperty('color', 'rgb(255, 0, 0)'); expect(results[1]).toHaveProperty('label', '(50) Percentile of cpu'); expect(results[1]).toHaveProperty('stack', false); diff --git a/src/plugins/vis_types/timeseries/server/lib/vis_data/response_processors/series/percentile_rank.js b/src/plugins/vis_types/timeseries/server/lib/vis_data/response_processors/series/percentile_rank.js index ce81ec46693e2..0720c6e19a9c0 100644 --- a/src/plugins/vis_types/timeseries/server/lib/vis_data/response_processors/series/percentile_rank.js +++ b/src/plugins/vis_types/timeseries/server/lib/vis_data/response_processors/series/percentile_rank.js @@ -12,6 +12,7 @@ import { getSplits } from '../../helpers/get_splits'; import { getLastMetric } from '../../helpers/get_last_metric'; import { toPercentileNumber } from '../../../../../common/to_percentile_number'; import { TSVB_METRIC_TYPES } from '../../../../../common/enums'; +import { SERIES_SEPARATOR } from '../../../../../common/constants'; export function percentileRank(resp, panel, series, meta, extractFields) { return (next) => async (results) => { @@ -33,7 +34,7 @@ export function percentileRank(resp, panel, series, meta, extractFields) { results.push({ data, - id: `${split.id}:${percentileRank}:${index}`, + id: `${split.id}${SERIES_SEPARATOR}${percentileRank}${SERIES_SEPARATOR}${index}`, label: `(${percentileRank || 0}) ${split.label}`, color: series.split_mode === 'everything' && metric.colors diff --git a/src/plugins/vis_types/timeseries/server/lib/vis_data/response_processors/series/percentile_rank.test.ts b/src/plugins/vis_types/timeseries/server/lib/vis_data/response_processors/series/percentile_rank.test.ts index 79c3eab91c3c9..758c37130cdd4 100644 --- a/src/plugins/vis_types/timeseries/server/lib/vis_data/response_processors/series/percentile_rank.test.ts +++ b/src/plugins/vis_types/timeseries/server/lib/vis_data/response_processors/series/percentile_rank.test.ts @@ -75,7 +75,7 @@ describe('percentile_rank(resp, panel, series, meta, extractFields)', () => { expect(results).toHaveLength(2); - expect(results[0]).toHaveProperty('id', 'test:1000:0'); + expect(results[0]).toHaveProperty('id', 'test╰┄►1000╰┄►0'); expect(results[0]).toHaveProperty('color', '#000028'); expect(results[0]).toHaveProperty('label', '(1000) Percentile Rank of cpu'); expect(results[0].data).toEqual([ @@ -83,7 +83,7 @@ describe('percentile_rank(resp, panel, series, meta, extractFields)', () => { [2, 1], ]); - expect(results[1]).toHaveProperty('id', 'test:500:1'); + expect(results[1]).toHaveProperty('id', 'test╰┄►500╰┄►1'); expect(results[1]).toHaveProperty('color', '#0000FF'); expect(results[1]).toHaveProperty('label', '(500) Percentile Rank of cpu'); expect(results[1].data).toEqual([ diff --git a/src/plugins/vis_types/timeseries/server/lib/vis_data/response_processors/series/series_agg.js b/src/plugins/vis_types/timeseries/server/lib/vis_data/response_processors/series/series_agg.js index a803439c7581f..532f5fd07f597 100644 --- a/src/plugins/vis_types/timeseries/server/lib/vis_data/response_processors/series/series_agg.js +++ b/src/plugins/vis_types/timeseries/server/lib/vis_data/response_processors/series/series_agg.js @@ -9,6 +9,7 @@ import { last, first } from 'lodash'; import { SeriesAgg } from './_series_agg'; import { getDefaultDecoration } from '../../helpers/get_default_decoration'; import { calculateLabel } from '../../../../../common/calculate_label'; +import { SERIES_SEPARATOR } from '../../../../../common/constants'; export function seriesAgg(resp, panel, series, meta, extractFields) { return (next) => async (results) => { @@ -19,7 +20,7 @@ export function seriesAgg(resp, panel, series, meta, extractFields) { // Filter out the seires with the matching metric and store them // in targetSeries results = results.filter((s) => { - if (s.id.split(/:/)[0] === series.id) { + if (s.id.split(SERIES_SEPARATOR)[0] === series.id) { targetSeries.push(s.data); return false; } diff --git a/src/plugins/vis_types/timeseries/server/lib/vis_data/response_processors/table/series_agg.ts b/src/plugins/vis_types/timeseries/server/lib/vis_data/response_processors/table/series_agg.ts index d360bb97333c7..b4bc082bab849 100644 --- a/src/plugins/vis_types/timeseries/server/lib/vis_data/response_processors/table/series_agg.ts +++ b/src/plugins/vis_types/timeseries/server/lib/vis_data/response_processors/table/series_agg.ts @@ -9,6 +9,7 @@ import { last } from 'lodash'; import { calculateLabel } from '../../../../../common/calculate_label'; +import { SERIES_SEPARATOR } from '../../../../../common/constants'; // @ts-expect-error no typed yet import { SeriesAgg } from './_series_agg'; @@ -26,7 +27,7 @@ export const seriesAgg: TableResponseProcessorsFunction = // Filter out the seires with the matching metric and store them // in targetSeries results = results.filter((s) => { - if (s.id && s.id.split(/:/)[0] === series.id) { + if (s.id && s.id.split(SERIES_SEPARATOR)[0] === series.id) { targetSeries.push(s.data!); return false; } From 7369e2f48d4dc3ed5edbc96d9714a80a638db092 Mon Sep 17 00:00:00 2001 From: Shahzad Date: Thu, 3 Feb 2022 21:00:31 +0100 Subject: [PATCH 25/68] [Uptime] Added test now mode for monitors (#123712) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../uptime/common/constants/rest_api.ts | 1 + .../common/runtime_types/monitor/state.ts | 2 + .../uptime/common/runtime_types/ping/ping.ts | 1 + .../browser/browser_test_results.tsx | 2 +- .../use_browser_run_once_monitors.test.tsx | 2 +- .../browser/use_browser_run_once_monitors.ts | 37 +++++-- .../simple/simple_test_results.tsx | 2 +- .../simple/use_simple_run_once_monitors.ts | 23 +++- .../test_now_mode/test_result_header.tsx | 6 +- .../test_now_mode/use_tick_tick.ts | 15 ++- .../columns/monitor_status_column.test.tsx | 17 ++- .../columns/monitor_status_column.tsx | 100 ++++++++++++++---- .../progress/browser_monitor_progress.tsx | 89 ++++++++++++++++ .../columns/progress/monitor_progress.tsx | 61 +++++++++++ .../progress/simple_monitor_progress.tsx | 62 +++++++++++ .../columns/progress/use_updated_monitor.ts | 44 ++++++++ .../monitor_list/columns/test_now_col.tsx | 60 +++++++++++ .../monitor_list/monitor_list.test.tsx | 17 ++- .../overview/monitor_list/monitor_list.tsx | 92 ++++++++++++---- .../monitor_list/monitor_list_container.tsx | 16 ++- .../overview/monitor_list/translations.ts | 4 + .../public/lib/__mocks__/uptime_store.mock.ts | 4 + .../public/state/actions/monitor_list.ts | 16 +++ .../public/state/api/monitor_management.ts | 10 ++ .../uptime/public/state/effects/index.ts | 8 +- .../public/state/effects/monitor_list.ts | 26 ++++- .../uptime/public/state/reducers/index.ts | 2 + .../public/state/reducers/monitor_list.ts | 79 +++++++++++++- .../public/state/reducers/test_now_runs.ts | 82 ++++++++++++++ .../search/refine_potential_matches.ts | 2 + .../synthetics_service/synthetics_service.ts | 36 ++++++- .../plugins/uptime/server/rest_api/index.ts | 2 + .../synthetics_service/add_monitor.ts | 4 + .../synthetics_service/edit_monitor.ts | 4 + .../synthetics_service/test_now_monitor.ts | 48 +++++++++ 35 files changed, 895 insertions(+), 81 deletions(-) create mode 100644 x-pack/plugins/uptime/public/components/overview/monitor_list/columns/progress/browser_monitor_progress.tsx create mode 100644 x-pack/plugins/uptime/public/components/overview/monitor_list/columns/progress/monitor_progress.tsx create mode 100644 x-pack/plugins/uptime/public/components/overview/monitor_list/columns/progress/simple_monitor_progress.tsx create mode 100644 x-pack/plugins/uptime/public/components/overview/monitor_list/columns/progress/use_updated_monitor.ts create mode 100644 x-pack/plugins/uptime/public/components/overview/monitor_list/columns/test_now_col.tsx create mode 100644 x-pack/plugins/uptime/public/state/reducers/test_now_runs.ts create mode 100644 x-pack/plugins/uptime/server/rest_api/synthetics_service/test_now_monitor.ts diff --git a/x-pack/plugins/uptime/common/constants/rest_api.ts b/x-pack/plugins/uptime/common/constants/rest_api.ts index 2c369579b0150..f1b0b69ba61ec 100644 --- a/x-pack/plugins/uptime/common/constants/rest_api.ts +++ b/x-pack/plugins/uptime/common/constants/rest_api.ts @@ -41,4 +41,5 @@ export enum API_URLS { SERVICE_LOCATIONS = '/internal/uptime/service/locations', SYNTHETICS_MONITORS = '/internal/uptime/service/monitors', RUN_ONCE_MONITOR = '/internal/uptime/service/monitors/run_once', + TRIGGER_MONITOR = '/internal/uptime/service/monitors/trigger', } diff --git a/x-pack/plugins/uptime/common/runtime_types/monitor/state.ts b/x-pack/plugins/uptime/common/runtime_types/monitor/state.ts index fc2cd42500d6c..d43fd5ad001f2 100644 --- a/x-pack/plugins/uptime/common/runtime_types/monitor/state.ts +++ b/x-pack/plugins/uptime/common/runtime_types/monitor/state.ts @@ -27,6 +27,7 @@ export const StateType = t.intersection([ monitor: t.intersection([ t.partial({ name: t.string, + duration: t.type({ us: t.number }), }), t.type({ type: t.string, @@ -73,6 +74,7 @@ export const MonitorSummaryType = t.intersection([ t.partial({ histogram: HistogramType, minInterval: t.number, + configId: t.string, }), ]); diff --git a/x-pack/plugins/uptime/common/runtime_types/ping/ping.ts b/x-pack/plugins/uptime/common/runtime_types/ping/ping.ts index f4a9fe31b2885..989d6d8ef941a 100644 --- a/x-pack/plugins/uptime/common/runtime_types/ping/ping.ts +++ b/x-pack/plugins/uptime/common/runtime_types/ping/ping.ts @@ -220,6 +220,7 @@ export const PingType = t.intersection([ service: t.partial({ name: t.string, }), + config_id: t.string, }), ]); diff --git a/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/browser/browser_test_results.tsx b/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/browser/browser_test_results.tsx index d5dd333f7f6c7..5dc893356b214 100644 --- a/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/browser/browser_test_results.tsx +++ b/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/browser/browser_test_results.tsx @@ -20,7 +20,7 @@ interface Props { export const BrowserTestRunResult = ({ monitorId }: Props) => { const { data, loading, stepEnds, journeyStarted, summaryDoc, stepListData } = useBrowserRunOnceMonitors({ - monitorId, + configId: monitorId, }); const hits = data?.hits.hits; diff --git a/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/browser/use_browser_run_once_monitors.test.tsx b/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/browser/use_browser_run_once_monitors.test.tsx index 3a126e6f69e99..f467bb642a13e 100644 --- a/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/browser/use_browser_run_once_monitors.test.tsx +++ b/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/browser/use_browser_run_once_monitors.test.tsx @@ -26,7 +26,7 @@ describe('useBrowserRunOnceMonitors', function () { }, }); - const { result } = renderHook(() => useBrowserRunOnceMonitors({ monitorId: 'test-id' }), { + const { result } = renderHook(() => useBrowserRunOnceMonitors({ configId: 'test-id' }), { wrapper: WrappedHelper, }); diff --git a/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/browser/use_browser_run_once_monitors.ts b/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/browser/use_browser_run_once_monitors.ts index 41f2b1cbe11f8..d051eaebe392e 100644 --- a/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/browser/use_browser_run_once_monitors.ts +++ b/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/browser/use_browser_run_once_monitors.ts @@ -15,10 +15,12 @@ import { fetchJourneySteps } from '../../../../state/api/journey'; import { isStepEnd } from '../../../synthetics/check_steps/steps_list'; export const useBrowserEsResults = ({ - monitorId, + configId, + testRunId, lastRefresh, }: { - monitorId: string; + configId: string; + testRunId?: string; lastRefresh: number; }) => { const { settings } = useSelector(selectDynamicSettings); @@ -37,7 +39,7 @@ export const useBrowserEsResults = ({ filter: [ { term: { - config_id: monitorId, + config_id: configId, }, }, { @@ -45,28 +47,47 @@ export const useBrowserEsResults = ({ 'synthetics.type': ['heartbeat/summary', 'journey/start'], }, }, + ...(testRunId + ? [ + { + term: { + test_run_id: testRunId, + }, + }, + ] + : []), ], }, }, }, size: 10, }), - [monitorId, settings?.heartbeatIndices, lastRefresh], + [configId, settings?.heartbeatIndices, lastRefresh], { name: 'TestRunData' } ); }; -export const useBrowserRunOnceMonitors = ({ monitorId }: { monitorId: string }) => { - const { refreshTimer, lastRefresh } = useTickTick(); +export const useBrowserRunOnceMonitors = ({ + configId, + testRunId, + skipDetails = false, + refresh = true, +}: { + configId: string; + testRunId?: string; + refresh?: boolean; + skipDetails?: boolean; +}) => { + const { refreshTimer, lastRefresh } = useTickTick(3 * 1000, refresh); const [checkGroupId, setCheckGroupId] = useState(''); const [stepEnds, setStepEnds] = useState([]); const [summary, setSummary] = useState(); - const { data, loading } = useBrowserEsResults({ monitorId, lastRefresh }); + const { data, loading } = useBrowserEsResults({ configId, testRunId, lastRefresh }); const { data: stepListData } = useFetcher(() => { - if (checkGroupId) { + if (checkGroupId && !skipDetails) { return fetchJourneySteps({ checkGroup: checkGroupId, }); diff --git a/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/simple/simple_test_results.tsx b/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/simple/simple_test_results.tsx index 97097285d0bbc..507082c7fefb1 100644 --- a/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/simple/simple_test_results.tsx +++ b/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/simple/simple_test_results.tsx @@ -15,7 +15,7 @@ interface Props { } export function SimpleTestResults({ monitorId }: Props) { const [summaryDocs, setSummaryDocs] = useState([]); - const { summaryDoc, loading } = useSimpleRunOnceMonitors({ monitorId }); + const { summaryDoc, loading } = useSimpleRunOnceMonitors({ configId: monitorId }); useEffect(() => { if (summaryDoc) { diff --git a/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/simple/use_simple_run_once_monitors.ts b/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/simple/use_simple_run_once_monitors.ts index 816f9b019c45a..fc43844103f25 100644 --- a/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/simple/use_simple_run_once_monitors.ts +++ b/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/simple/use_simple_run_once_monitors.ts @@ -12,8 +12,14 @@ import { Ping } from '../../../../../common/runtime_types'; import { createEsParams, useEsSearch } from '../../../../../../observability/public'; import { useTickTick } from '../use_tick_tick'; -export const useSimpleRunOnceMonitors = ({ monitorId }: { monitorId: string }) => { - const { refreshTimer, lastRefresh } = useTickTick(); +export const useSimpleRunOnceMonitors = ({ + configId, + testRunId, +}: { + configId: string; + testRunId?: string; +}) => { + const { refreshTimer, lastRefresh } = useTickTick(2 * 1000, false); const { settings } = useSelector(selectDynamicSettings); @@ -31,7 +37,7 @@ export const useSimpleRunOnceMonitors = ({ monitorId }: { monitorId: string }) = filter: [ { term: { - config_id: monitorId, + config_id: configId, }, }, { @@ -39,13 +45,22 @@ export const useSimpleRunOnceMonitors = ({ monitorId }: { monitorId: string }) = field: 'summary', }, }, + ...(testRunId + ? [ + { + term: { + test_run_id: testRunId, + }, + }, + ] + : []), ], }, }, }, size: 10, }), - [monitorId, settings?.heartbeatIndices, lastRefresh], + [configId, settings?.heartbeatIndices, lastRefresh], { name: 'TestRunData' } ); diff --git a/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/test_result_header.tsx b/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/test_result_header.tsx index 51b120c3c7e5e..00caa48e5dc08 100644 --- a/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/test_result_header.tsx +++ b/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/test_result_header.tsx @@ -63,7 +63,7 @@ export function TestResultHeader({ doc, title, summaryDocs, journeyStarted, isCo - {journeyStarted ? IN_PROGRESS : PENDING_LABEL} + {journeyStarted ? IN_PROGRESS_LABEL : PENDING_LABEL} @@ -86,7 +86,7 @@ export function TestResultHeader({ doc, title, summaryDocs, journeyStarted, isCo ); } -const PENDING_LABEL = i18n.translate('xpack.uptime.monitorManagement.pending', { +export const PENDING_LABEL = i18n.translate('xpack.uptime.monitorManagement.pending', { defaultMessage: 'PENDING', }); @@ -98,7 +98,7 @@ const COMPLETED_LABEL = i18n.translate('xpack.uptime.monitorManagement.completed defaultMessage: 'COMPLETED', }); -const IN_PROGRESS = i18n.translate('xpack.uptime.monitorManagement.inProgress', { +export const IN_PROGRESS_LABEL = i18n.translate('xpack.uptime.monitorManagement.inProgress', { defaultMessage: 'IN PROGRESS', }); diff --git a/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/use_tick_tick.ts b/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/use_tick_tick.ts index ff9b9f3f6154d..ce6d88806144c 100644 --- a/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/use_tick_tick.ts +++ b/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/use_tick_tick.ts @@ -8,13 +8,18 @@ import { useEffect, useState, useContext } from 'react'; import { UptimeRefreshContext } from '../../../contexts'; -export function useTickTick() { - const { refreshApp, lastRefresh } = useContext(UptimeRefreshContext); +export function useTickTick(interval?: number, refresh = true) { + const { refreshApp } = useContext(UptimeRefreshContext); + + const [nextTick, setNextTick] = useState(Date.now()); const [tickTick] = useState(() => setInterval(() => { - refreshApp(); - }, 5 * 1000) + if (refresh) { + refreshApp(); + } + setNextTick(Date.now()); + }, interval ?? 5 * 1000) ); useEffect(() => { @@ -23,5 +28,5 @@ export function useTickTick() { }; }, [tickTick]); - return { refreshTimer: tickTick, lastRefresh }; + return { refreshTimer: tickTick, lastRefresh: nextTick }; } diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_status_column.test.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_status_column.test.tsx index c05cc1e4b2a92..02fe666b79464 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_status_column.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_status_column.test.tsx @@ -229,7 +229,12 @@ describe('MonitorListStatusColumn', () => { it('provides expected tooltip and display times', async () => { const { getByText } = render( - + ); @@ -244,7 +249,12 @@ describe('MonitorListStatusColumn', () => { it('can handle a non-numeric timestamp value', () => { const { getByText } = render( - + ); @@ -259,6 +269,7 @@ describe('MonitorListStatusColumn', () => { ping.observer!.geo!.name! === 'Islamabad')} /> @@ -278,6 +289,7 @@ describe('MonitorListStatusColumn', () => { status="up" timestamp={new Date().toString()} summaryPings={summaryPings} + monitorType="http" /> ); @@ -295,6 +307,7 @@ describe('MonitorListStatusColumn', () => { diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_status_column.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_status_column.tsx index 6960bb5632852..60baedaa7830c 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_status_column.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_status_column.tsx @@ -5,13 +5,23 @@ * 2.0. */ -import React, { useContext } from 'react'; -import moment from 'moment'; +import React, { useCallback, useContext } from 'react'; +import moment, { Moment } from 'moment'; import { i18n } from '@kbn/i18n'; import styled from 'styled-components'; -import { EuiFlexGroup, EuiFlexItem, EuiText, EuiToolTip, EuiBadge, EuiSpacer } from '@elastic/eui'; +import { + EuiFlexGroup, + EuiFlexItem, + EuiText, + EuiToolTip, + EuiBadge, + EuiSpacer, + EuiHighlight, + EuiHorizontalRule, +} from '@elastic/eui'; +import { useDispatch, useSelector } from 'react-redux'; import { parseTimestamp } from '../parse_timestamp'; -import { Ping } from '../../../../../common/runtime_types'; +import { DataStream, Ping } from '../../../../../common/runtime_types'; import { STATUS, SHORT_TIMESPAN_LOCALE, @@ -22,10 +32,18 @@ import { import { UptimeThemeContext } from '../../../../contexts'; import { euiStyled } from '../../../../../../../../src/plugins/kibana_react/common'; import { STATUS_DOWN_LABEL, STATUS_UP_LABEL } from '../../../common/translations'; +import { MonitorProgress } from './progress/monitor_progress'; +import { refreshedMonitorSelector } from '../../../../state/reducers/monitor_list'; +import { testNowRunSelector } from '../../../../state/reducers/test_now_runs'; +import { clearTestNowMonitorAction } from '../../../../state/actions'; interface MonitorListStatusColumnProps { + configId?: string; + monitorId?: string; status: string; + monitorType: string; timestamp: string; + duration?: number; summaryPings: Ping[]; } @@ -63,7 +81,7 @@ export const getShortTimeStamp = (timeStamp: moment.Moment, relative = false) => shortTimestamp = timeStamp.fromNow(); } - // Reset it so, it does't impact other part of the app + // Reset it so, it doesn't impact other part of the app moment.locale(prevLocale); return shortTimestamp; } else { @@ -144,7 +162,11 @@ export const getLocationStatus = (summaryPings: Ping[], status: string) => { }; export const MonitorListStatusColumn = ({ + monitorType, + configId, + monitorId, status, + duration, summaryPings = [], timestamp: tsString, }: MonitorListStatusColumnProps) => { @@ -156,16 +178,39 @@ export const MonitorListStatusColumn = ({ const { statusMessage, locTooltip } = getLocationStatus(summaryPings, status); + const dispatch = useDispatch(); + + const stopProgressTrack = useCallback(() => { + if (configId) { + dispatch(clearTestNowMonitorAction(configId)); + } + }, [configId, dispatch]); + + const refreshedMonitorIds = useSelector(refreshedMonitorSelector); + + const testNowRun = useSelector(testNowRunSelector(configId)); + return (
- + - - {getHealthMessage(status)} - + {testNowRun && configId && testNowRun?.testRunId ? ( + + ) : ( + + {getHealthMessage(status)} + + )} @@ -183,20 +228,39 @@ export const MonitorListStatusColumn = ({ - {timestamp.toLocaleString()} - + <> + + {timestamp.fromNow()} + + + + {timestamp.toLocaleString()} + + } > - - Checked {getShortTimeStamp(timestamp)} - + {monitorId && refreshedMonitorIds?.includes(monitorId) ? ( + + {getCheckedLabel(timestamp)} + + ) : ( + + {getCheckedLabel(timestamp)} + + )}
); }; +const getCheckedLabel = (timestamp: Moment) => { + return i18n.translate('xpack.uptime.monitorList.statusColumn.checkedTimestamp', { + defaultMessage: 'Checked {timestamp}', + values: { timestamp: getShortTimeStamp(timestamp) }, + }); +}; + const PaddedText = euiStyled(EuiText)` padding-right: ${(props) => props.theme.eui.paddingSizes.xs}; `; diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/progress/browser_monitor_progress.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/progress/browser_monitor_progress.tsx new file mode 100644 index 0000000000000..c0453573693c4 --- /dev/null +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/progress/browser_monitor_progress.tsx @@ -0,0 +1,89 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { EuiBadge, EuiProgress } from '@elastic/eui'; +import React, { useEffect, useState } from 'react'; +import { useBrowserRunOnceMonitors } from '../../../../monitor_management/test_now_mode/browser/use_browser_run_once_monitors'; +import { + IN_PROGRESS_LABEL, + PENDING_LABEL, +} from '../../../../monitor_management/test_now_mode/test_result_header'; + +export const BrowserMonitorProgress = ({ + configId, + testRunId, + duration, + isUpdating, + updateMonitorStatus, +}: { + configId: string; + testRunId: string; + duration: number; + isUpdating: boolean; + updateMonitorStatus: () => void; +}) => { + const { journeyStarted, summaryDoc, data } = useBrowserRunOnceMonitors({ + configId, + testRunId, + refresh: false, + skipDetails: true, + }); + + const [startTime, setStartTime] = useState(Date.now()); + const [passedTime, setPassedTime] = useState(0); + + useEffect(() => { + if (summaryDoc) { + updateMonitorStatus(); + } + }, [updateMonitorStatus, summaryDoc]); + + useEffect(() => { + const interVal = setInterval(() => { + if (journeyStarted) { + setPassedTime((Date.now() - startTime) * 1000); + } + }, 500); + const startTimeValue = startTime; + return () => { + if ((Date.now() - startTimeValue) * 1000 > duration) { + clearInterval(interVal); + } + }; + }, [data, duration, journeyStarted, startTime]); + + useEffect(() => { + if (journeyStarted) { + setStartTime(Date.now()); + } + }, [journeyStarted]); + + if (isUpdating || passedTime > duration) { + return ( + <> + {IN_PROGRESS_LABEL} + + + ); + } + + return ( + + {journeyStarted ? ( + <> + {IN_PROGRESS_LABEL} + + + ) : ( + <> + {PENDING_LABEL} + + + )} + + ); +}; diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/progress/monitor_progress.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/progress/monitor_progress.tsx new file mode 100644 index 0000000000000..e4fc0cf90e87b --- /dev/null +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/progress/monitor_progress.tsx @@ -0,0 +1,61 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { useEffect } from 'react'; +import { useSelector } from 'react-redux'; +import { SimpleMonitorProgress } from './simple_monitor_progress'; +import { BrowserMonitorProgress } from './browser_monitor_progress'; +import { DataStream } from '../../../../../../common/runtime_types'; +import { useUpdatedMonitor } from './use_updated_monitor'; +import { refreshedMonitorSelector } from '../../../../../state/reducers/monitor_list'; + +export const MonitorProgress = ({ + monitorId, + configId, + testRunId, + duration, + monitorType, + stopProgressTrack, +}: { + monitorId: string; + configId: string; + testRunId: string; + duration: number; + monitorType: DataStream; + stopProgressTrack: () => void; +}) => { + const { updateMonitorStatus, isUpdating } = useUpdatedMonitor({ + testRunId, + monitorId, + }); + + const refreshedMonitorId = useSelector(refreshedMonitorSelector); + + useEffect(() => { + if (refreshedMonitorId.includes(monitorId)) { + stopProgressTrack(); + } + }, [isUpdating, monitorId, refreshedMonitorId, stopProgressTrack]); + + return monitorType === 'browser' ? ( + + ) : ( + + ); +}; diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/progress/simple_monitor_progress.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/progress/simple_monitor_progress.tsx new file mode 100644 index 0000000000000..d51ae3f4e9dff --- /dev/null +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/progress/simple_monitor_progress.tsx @@ -0,0 +1,62 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { EuiBadge, EuiProgress } from '@elastic/eui'; +import React, { useEffect, useRef, useState } from 'react'; +import { useSimpleRunOnceMonitors } from '../../../../monitor_management/test_now_mode/simple/use_simple_run_once_monitors'; +import { IN_PROGRESS_LABEL } from '../../../../monitor_management/test_now_mode/test_result_header'; + +export const SimpleMonitorProgress = ({ + monitorId, + testRunId, + duration, + isUpdating, + updateMonitorStatus, +}: { + monitorId: string; + testRunId: string; + duration: number; + isUpdating: boolean; + updateMonitorStatus: () => void; +}) => { + const { summaryDoc, data } = useSimpleRunOnceMonitors({ + configId: monitorId, + testRunId, + }); + + const startTime = useRef(Date.now()); + + const [passedTime, setPassedTime] = useState(Date.now()); + + useEffect(() => { + if (summaryDoc) { + updateMonitorStatus(); + } + }, [updateMonitorStatus, summaryDoc]); + + useEffect(() => { + setPassedTime(Date.now() - startTime.current); + }, [data]); + + const passedTimeMicro = passedTime * 1000; + + if (isUpdating || passedTimeMicro > duration) { + return ( + <> + {IN_PROGRESS_LABEL} + + + ); + } + + return ( + + {IN_PROGRESS_LABEL} + + + ); +}; diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/progress/use_updated_monitor.ts b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/progress/use_updated_monitor.ts new file mode 100644 index 0000000000000..b76971d4079e3 --- /dev/null +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/progress/use_updated_monitor.ts @@ -0,0 +1,44 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { useCallback } from 'react'; +import { useDispatch, useSelector } from 'react-redux'; +import { getUpdatedMonitor, setUpdatingMonitorId } from '../../../../../state/actions'; +import { isUpdatingMonitorSelector } from '../../../../../state/reducers/monitor_list'; + +export const useUpdatedMonitor = ({ + testRunId, + monitorId, +}: { + testRunId: string; + monitorId: string; +}) => { + const dispatch = useDispatch(); + + const isUpdatingMonitors = useSelector(isUpdatingMonitorSelector); + + const updateMonitorStatus = useCallback(() => { + if (testRunId) { + dispatch( + getUpdatedMonitor.get({ + dateRangeStart: 'now-10m', + dateRangeEnd: 'now', + filters: JSON.stringify({ + bool: { + should: [{ match_phrase: { test_run_id: testRunId } }], + minimum_should_match: 1, + }, + }), + pageSize: 1, + }) + ); + dispatch(setUpdatingMonitorId(monitorId)); + } + }, [dispatch, monitorId, testRunId]); + + return { updateMonitorStatus, isUpdating: isUpdatingMonitors.includes(monitorId) }; +}; diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/test_now_col.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/test_now_col.tsx new file mode 100644 index 0000000000000..de32c874ae24c --- /dev/null +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/test_now_col.tsx @@ -0,0 +1,60 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { i18n } from '@kbn/i18n'; +import { useDispatch, useSelector } from 'react-redux'; +import { EuiButtonIcon, EuiLoadingSpinner, EuiToolTip } from '@elastic/eui'; +import { testNowMonitorAction } from '../../../../state/actions'; +import { testNowRunSelector } from '../../../../state/reducers/test_now_runs'; + +export const TestNowColumn = ({ + monitorId, + configId, +}: { + monitorId: string; + configId?: string; +}) => { + const dispatch = useDispatch(); + + const testNowRun = useSelector(testNowRunSelector(configId)); + + if (!configId) { + return <>--; + } + + const testNowClick = () => { + dispatch(testNowMonitorAction.get(configId)); + }; + + if (testNowRun && testNowRun.status === 'loading') { + return ; + } + + return ( + + testNowClick()} + isDisabled={Boolean(testNowRun)} + aria-label={TEST_NOW_ARIA_LABEL} + /> + + ); +}; + +export const TEST_NOW_ARIA_LABEL = i18n.translate('xpack.uptime.monitorList.testNow.AriaLabel', { + defaultMessage: 'CLick to run test now', +}); + +export const TEST_NOW_LABEL = i18n.translate('xpack.uptime.monitorList.testNow.label', { + defaultMessage: 'Test now', +}); + +export const TEST_SCHEDULED_LABEL = i18n.translate('xpack.uptime.monitorList.testNow.scheduled', { + defaultMessage: 'Test is already scheduled', +}); diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list.test.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list.test.tsx index de077931167c1..0eafd3c2fd52a 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list.test.tsx @@ -16,7 +16,6 @@ import { MonitorSummary, } from '../../../../common/runtime_types'; import { MonitorListComponent, noItemsMessage } from './monitor_list'; -import * as redux from 'react-redux'; import moment from 'moment'; import { IHttpFetchError, ResponseErrorBody } from '../../../../../../../src/core/public'; import { mockMoment } from '../../../lib/helper/test_helpers'; @@ -56,7 +55,7 @@ const testFooPings: Ping[] = [ const testFooSummary: MonitorSummary = { monitor_id: 'foo', state: { - monitor: { type: 'http' }, + monitor: { type: 'http', duration: { us: 1000 } }, summaryPings: testFooPings, summary: { up: 1, @@ -91,7 +90,7 @@ const testBarPings: Ping[] = [ const testBarSummary: MonitorSummary = { monitor_id: 'bar', state: { - monitor: { type: 'http' }, + monitor: { type: 'http', duration: { us: 1000 } }, summaryPings: testBarPings, summary: { up: 2, @@ -129,12 +128,6 @@ describe('MonitorList component', () => { }; beforeEach(() => { - const useDispatchSpy = jest.spyOn(redux, 'useDispatch'); - useDispatchSpy.mockReturnValue(jest.fn()); - - const useSelectorSpy = jest.spyOn(redux, 'useSelector'); - useSelectorSpy.mockReturnValue(true); - localStorageMock = { getItem: jest.fn().mockImplementation(() => '25'), setItem: jest.fn(), @@ -156,6 +149,7 @@ describe('MonitorList component', () => { }} pageSize={10} setPageSize={jest.fn()} + refreshedMonitorIds={[]} /> ); expect(await findByText(NO_DATA_MESSAGE)).toBeInTheDocument(); @@ -170,6 +164,7 @@ describe('MonitorList component', () => { }} pageSize={10} setPageSize={jest.fn()} + refreshedMonitorIds={[]} /> ); @@ -190,6 +185,7 @@ describe('MonitorList component', () => { }} pageSize={10} setPageSize={jest.fn()} + refreshedMonitorIds={[]} /> ); @@ -226,6 +222,7 @@ describe('MonitorList component', () => { }} pageSize={10} setPageSize={jest.fn()} + refreshedMonitorIds={[]} /> ); @@ -254,6 +251,7 @@ describe('MonitorList component', () => { }} pageSize={10} setPageSize={jest.fn()} + refreshedMonitorIds={[]} /> ); @@ -283,6 +281,7 @@ describe('MonitorList component', () => { }} pageSize={10} setPageSize={jest.fn()} + refreshedMonitorIds={[]} /> ); diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list.tsx index fd9c072b9004f..2dd4ed7bed481 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list.tsx @@ -32,15 +32,19 @@ import { CertStatusColumn } from './columns/cert_status_column'; import { MonitorListHeader } from './monitor_list_header'; import { TAGS_LABEL, URL_LABEL } from '../../common/translations'; import { EnableMonitorAlert } from './columns/enable_alert'; -import { STATUS_ALERT_COLUMN } from './translations'; +import { STATUS_ALERT_COLUMN, TEST_NOW_COLUMN } from './translations'; import { MonitorNameColumn } from './columns/monitor_name_col'; import { MonitorTags } from '../../common/monitor_tags'; import { useMonitorHistogram } from './use_monitor_histogram'; +import { euiStyled } from '../../../../../../../src/plugins/kibana_react/common'; +import { TestNowColumn } from './columns/test_now_col'; +import { useUptimeSettingsContext } from '../../../contexts/uptime_settings_context'; interface Props extends MonitorListProps { pageSize: number; setPageSize: (val: number) => void; monitorList: MonitorList; + refreshedMonitorIds: string[]; } export const noItemsMessage = (loading: boolean, filters?: string) => { @@ -52,8 +56,15 @@ export const MonitorListComponent: ({ filters, monitorList: { list, error, loading }, pageSize, + refreshedMonitorIds, setPageSize, -}: Props) => any = ({ filters, monitorList: { list, error, loading }, pageSize, setPageSize }) => { +}: Props) => any = ({ + filters, + refreshedMonitorIds = [], + monitorList: { list, error, loading }, + pageSize, + setPageSize, +}) => { const [expandedDrawerIds, updateExpandedDrawerIds] = useState([]); const { width } = useWindowSize(); const [hideExtraColumns, setHideExtraColumns] = useState(false); @@ -94,6 +105,8 @@ export const MonitorListComponent: ({ }, {}); }; + const { config } = useUptimeSettingsContext(); + const columns = [ ...[ { @@ -103,12 +116,27 @@ export const MonitorListComponent: ({ mobileOptions: { fullWidth: true, }, - render: (status: string, { state: { timestamp, summaryPings } }: MonitorSummary) => { + render: ( + status: string, + { + monitor_id: monitorId, + state: { + timestamp, + summaryPings, + monitor: { type, duration }, + }, + configId, + }: MonitorSummary + ) => { return ( ); }, @@ -166,20 +194,31 @@ export const MonitorListComponent: ({ }, ] : []), - ...[ - { - align: 'center' as const, - field: '', - name: STATUS_ALERT_COLUMN, - width: '100px', - render: (item: MonitorSummary) => ( - - ), - }, - ], + { + align: 'center' as const, + field: '', + name: STATUS_ALERT_COLUMN, + width: '100px', + render: (item: MonitorSummary) => ( + + ), + }, + ...(config.ui?.monitorManagement?.enabled + ? [ + { + align: 'center' as const, + field: '', + name: TEST_NOW_COLUMN, + width: '100px', + render: (item: MonitorSummary) => ( + + ), + }, + ] + : []), ...(!hideExtraColumns ? [ { @@ -205,7 +244,7 @@ export const MonitorListComponent: ({ ]; return ( - + toggleDrawer(monitorId), 'aria-label': labels.getExpandDrawerLabel(monitorId), }) - : undefined + : ({ monitor_id: monitorId }) => ({ + className: refreshedMonitorIds.includes(monitorId) ? 'refresh-row' : undefined, + }) } /> @@ -253,6 +294,17 @@ export const MonitorListComponent: ({
- + ); }; + +const WrapperPanel = euiStyled(EuiPanel)` + &&& { + .refresh-row{ + background-color: #f0f4fb; + -webkit-transition: background-color 3000ms linear; + -ms-transition: background-color 3000ms linear; + transition: background-color 3000ms linear; + } + } +`; diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_container.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_container.tsx index e753d07f9db39..d01f9365a7ac0 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_container.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_container.tsx @@ -7,7 +7,7 @@ import React, { useContext, useEffect, useState } from 'react'; import { useSelector, useDispatch } from 'react-redux'; -import { getMonitorList } from '../../../state/actions'; +import { clearRefreshedMonitorId, getMonitorList } from '../../../state/actions'; import { esKuerySelector, monitorListSelector } from '../../../state/selectors'; import { MonitorListComponent } from './monitor_list'; import { useUrlParams } from '../../../hooks'; @@ -15,6 +15,7 @@ import { UptimeRefreshContext } from '../../../contexts'; import { getConnectorsAction, getMonitorAlertsAction } from '../../../state/alerts/alerts'; import { useMappingCheck } from '../../../hooks/use_mapping_check'; import { useOverviewFilterCheck } from '../../../hooks/use_overview_filter_check'; +import { refreshedMonitorSelector } from '../../../state/reducers/monitor_list'; export interface MonitorListProps { filters?: string; @@ -43,6 +44,8 @@ export const MonitorList: React.FC = (props) => { const { lastRefresh } = useContext(UptimeRefreshContext); + const refreshedMonitorIds = useSelector(refreshedMonitorSelector); + const monitorList = useSelector(monitorListSelector); useMappingCheck(monitorList.error); @@ -81,12 +84,23 @@ export const MonitorList: React.FC = (props) => { dispatch(getConnectorsAction.get()); }, [dispatch]); + useEffect(() => { + if (refreshedMonitorIds) { + refreshedMonitorIds.forEach((id) => { + setTimeout(() => { + dispatch(clearRefreshedMonitorId(id)); + }, 5 * 1000); + }); + } + }, [dispatch, refreshedMonitorIds]); + return ( ); }; diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/translations.ts b/x-pack/plugins/uptime/public/components/overview/monitor_list/translations.ts index fdb50bc295dda..ba006884a42cb 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/translations.ts +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/translations.ts @@ -73,3 +73,7 @@ export const RESPONSE_ANOMALY_SCORE = i18n.translate( export const STATUS_ALERT_COLUMN = i18n.translate('xpack.uptime.monitorList.statusAlert.label', { defaultMessage: 'Status alert', }); + +export const TEST_NOW_COLUMN = i18n.translate('xpack.uptime.monitorList.testNow.label', { + defaultMessage: 'Test now', +}); diff --git a/x-pack/plugins/uptime/public/lib/__mocks__/uptime_store.mock.ts b/x-pack/plugins/uptime/public/lib/__mocks__/uptime_store.mock.ts index 9593a84f08dad..bc09ef0514ef3 100644 --- a/x-pack/plugins/uptime/public/lib/__mocks__/uptime_store.mock.ts +++ b/x-pack/plugins/uptime/public/lib/__mocks__/uptime_store.mock.ts @@ -59,6 +59,7 @@ export const mockState: AppState = { summaries: [], }, loading: false, + refreshedMonitorIds: [], }, monitorManagementList: { list: { @@ -115,4 +116,7 @@ export const mockState: AppState = { cacheSize: 0, hitCount: [], }, + testNowRuns: { + testNowRuns: [], + }, }; diff --git a/x-pack/plugins/uptime/public/state/actions/monitor_list.ts b/x-pack/plugins/uptime/public/state/actions/monitor_list.ts index a85c0004545e4..b86853dcfbefe 100644 --- a/x-pack/plugins/uptime/public/state/actions/monitor_list.ts +++ b/x-pack/plugins/uptime/public/state/actions/monitor_list.ts @@ -7,9 +7,25 @@ import { createAction } from 'redux-actions'; import { FetchMonitorStatesQueryArgs, MonitorSummariesResult } from '../../../common/runtime_types'; +import { createAsyncAction } from './utils'; +import { TestNowResponse } from '../api'; export const getMonitorList = createAction('GET_MONITOR_LIST'); export const getMonitorListSuccess = createAction( 'GET_MONITOR_LIST_SUCCESS' ); export const getMonitorListFailure = createAction('GET_MONITOR_LIST_FAIL'); + +export const setUpdatingMonitorId = createAction('SET_UPDATING_MONITOR_ID'); +export const clearRefreshedMonitorId = createAction('CLEAR_REFRESH_MONITOR_ID'); + +export const testNowMonitorAction = createAsyncAction( + 'TEST_NOW_MONITOR_ACTION' +); + +export const clearTestNowMonitorAction = createAction('CLEAR_TEST_NOW_MONITOR_ACTION'); + +export const getUpdatedMonitor = createAsyncAction< + FetchMonitorStatesQueryArgs, + MonitorSummariesResult +>('GET_UPDATED_MONITOR'); diff --git a/x-pack/plugins/uptime/public/state/api/monitor_management.ts b/x-pack/plugins/uptime/public/state/api/monitor_management.ts index 06a49df596d13..ec2806907baa1 100644 --- a/x-pack/plugins/uptime/public/state/api/monitor_management.ts +++ b/x-pack/plugins/uptime/public/state/api/monitor_management.ts @@ -67,3 +67,13 @@ export const runOnceMonitor = async ({ }): Promise<{ errors: Array<{ error: Error }> }> => { return await apiService.post(API_URLS.RUN_ONCE_MONITOR + `/${id}`, monitor); }; + +export interface TestNowResponse { + errors?: Array<{ error: Error }>; + testRunId: string; + monitorId: string; +} + +export const testNowMonitor = async (configId: string): Promise => { + return await apiService.get(API_URLS.TRIGGER_MONITOR + `/${configId}`); +}; diff --git a/x-pack/plugins/uptime/public/state/effects/index.ts b/x-pack/plugins/uptime/public/state/effects/index.ts index b1a51c5df096c..07b04f8c27c3d 100644 --- a/x-pack/plugins/uptime/public/state/effects/index.ts +++ b/x-pack/plugins/uptime/public/state/effects/index.ts @@ -7,7 +7,11 @@ import { fork } from 'redux-saga/effects'; import { fetchMonitorDetailsEffect } from './monitor'; -import { fetchMonitorListEffect } from './monitor_list'; +import { + fetchMonitorListEffect, + fetchRunNowMonitorEffect, + fetchUpdatedMonitorEffect, +} from './monitor_list'; import { fetchMonitorManagementEffect } from './monitor_management'; import { fetchMonitorStatusEffect } from './monitor_status'; import { fetchDynamicSettingsEffect, setDynamicSettingsEffect } from './dynamic_settings'; @@ -27,6 +31,7 @@ import { export function* rootEffect() { yield fork(fetchMonitorDetailsEffect); yield fork(fetchMonitorListEffect); + yield fork(fetchUpdatedMonitorEffect); yield fork(fetchMonitorManagementEffect); yield fork(fetchMonitorStatusEffect); yield fork(fetchDynamicSettingsEffect); @@ -42,4 +47,5 @@ export function* rootEffect() { yield fork(fetchScreenshotBlocks); yield fork(generateBlockStatsOnPut); yield fork(pruneBlockCache); + yield fork(fetchRunNowMonitorEffect); } diff --git a/x-pack/plugins/uptime/public/state/effects/monitor_list.ts b/x-pack/plugins/uptime/public/state/effects/monitor_list.ts index 154d32ca47a7e..35322c3768190 100644 --- a/x-pack/plugins/uptime/public/state/effects/monitor_list.ts +++ b/x-pack/plugins/uptime/public/state/effects/monitor_list.ts @@ -5,9 +5,15 @@ * 2.0. */ -import { takeLatest } from 'redux-saga/effects'; -import { getMonitorList, getMonitorListSuccess, getMonitorListFailure } from '../actions'; -import { fetchMonitorList } from '../api'; +import { takeEvery, takeLatest } from 'redux-saga/effects'; +import { + getMonitorList, + getMonitorListSuccess, + getMonitorListFailure, + getUpdatedMonitor, + testNowMonitorAction, +} from '../actions'; +import { fetchMonitorList, testNowMonitor } from '../api'; import { fetchEffectFactory } from './fetch_effect'; export function* fetchMonitorListEffect() { @@ -16,3 +22,17 @@ export function* fetchMonitorListEffect() { fetchEffectFactory(fetchMonitorList, getMonitorListSuccess, getMonitorListFailure) ); } + +export function* fetchUpdatedMonitorEffect() { + yield takeLatest( + getUpdatedMonitor.get, + fetchEffectFactory(fetchMonitorList, getUpdatedMonitor.success, getUpdatedMonitor.fail) + ); +} + +export function* fetchRunNowMonitorEffect() { + yield takeEvery( + testNowMonitorAction.get, + fetchEffectFactory(testNowMonitor, testNowMonitorAction.success, testNowMonitorAction.fail) + ); +} diff --git a/x-pack/plugins/uptime/public/state/reducers/index.ts b/x-pack/plugins/uptime/public/state/reducers/index.ts index 0142d271159ce..2b6986c88b746 100644 --- a/x-pack/plugins/uptime/public/state/reducers/index.ts +++ b/x-pack/plugins/uptime/public/state/reducers/index.ts @@ -23,6 +23,7 @@ import { journeyReducer } from './journey'; import { networkEventsReducer } from './network_events'; import { syntheticsReducer } from './synthetics'; import { monitorManagementListReducer } from './monitor_management'; +import { testNowRunsReducer } from './test_now_runs'; export const rootReducer = combineReducers({ monitor: monitorReducer, @@ -42,4 +43,5 @@ export const rootReducer = combineReducers({ journeys: journeyReducer, networkEvents: networkEventsReducer, synthetics: syntheticsReducer, + testNowRuns: testNowRunsReducer, }); diff --git a/x-pack/plugins/uptime/public/state/reducers/monitor_list.ts b/x-pack/plugins/uptime/public/state/reducers/monitor_list.ts index 2e833bd033c46..8083b50367fe7 100644 --- a/x-pack/plugins/uptime/public/state/reducers/monitor_list.ts +++ b/x-pack/plugins/uptime/public/state/reducers/monitor_list.ts @@ -7,13 +7,24 @@ import { handleActions, Action } from 'redux-actions'; import { IHttpFetchError, ResponseErrorBody } from 'src/core/public'; -import { getMonitorList, getMonitorListSuccess, getMonitorListFailure } from '../actions'; +import { + getMonitorList, + getMonitorListSuccess, + getMonitorListFailure, + getUpdatedMonitor, + clearRefreshedMonitorId, + setUpdatingMonitorId, +} from '../actions'; import { MonitorSummariesResult } from '../../../common/runtime_types'; +import { AppState } from '../index'; +import { TestNowResponse } from '../api'; export interface MonitorList { - error?: IHttpFetchError; loading: boolean; + refreshedMonitorIds?: string[]; + isUpdating?: string[]; list: MonitorSummariesResult; + error?: IHttpFetchError; } export const initialState: MonitorList = { @@ -23,9 +34,13 @@ export const initialState: MonitorList = { summaries: [], }, loading: false, + refreshedMonitorIds: [], }; -type Payload = MonitorSummariesResult & IHttpFetchError; +type Payload = MonitorSummariesResult & + IHttpFetchError & + string & + TestNowResponse; export const monitorListReducer = handleActions( { @@ -50,6 +65,64 @@ export const monitorListReducer = handleActions( error: action.payload, loading: false, }), + [String(setUpdatingMonitorId)]: (state: MonitorList, action: Action) => ({ + ...state, + isUpdating: [...(state.isUpdating ?? []), action.payload], + }), + [String(getUpdatedMonitor.get)]: (state: MonitorList) => ({ + ...state, + }), + [String(getUpdatedMonitor.success)]: ( + state: MonitorList, + action: Action + ) => { + const summaries = state.list.summaries; + + const newSummary = action.payload.summaries?.[0]; + + if (!newSummary) { + return { ...state, isUpdating: [] }; + } + + return { + ...state, + loading: false, + error: undefined, + isUpdating: state.isUpdating?.filter((item) => item !== newSummary.monitor_id), + refreshedMonitorIds: [...(state.refreshedMonitorIds ?? []), newSummary.monitor_id], + list: { + ...state.list, + summaries: summaries.map((summary) => { + if (summary.monitor_id === newSummary.monitor_id) { + return newSummary; + } + return summary; + }), + }, + }; + }, + [String(getUpdatedMonitor.fail)]: ( + state: MonitorList, + action: Action> + ) => ({ + ...state, + error: action.payload, + loading: false, + isUpdating: [], + }), + [String(clearRefreshedMonitorId)]: (state: MonitorList, action: Action) => ({ + ...state, + refreshedMonitorIds: (state.refreshedMonitorIds ?? []).filter( + (item) => item !== action.payload + ), + }), }, initialState ); + +export const refreshedMonitorSelector = ({ monitorList }: AppState) => { + return monitorList.refreshedMonitorIds ?? []; +}; + +export const isUpdatingMonitorSelector = ({ monitorList }: AppState) => + monitorList.isUpdating ?? []; diff --git a/x-pack/plugins/uptime/public/state/reducers/test_now_runs.ts b/x-pack/plugins/uptime/public/state/reducers/test_now_runs.ts new file mode 100644 index 0000000000000..4b0ce493ba13c --- /dev/null +++ b/x-pack/plugins/uptime/public/state/reducers/test_now_runs.ts @@ -0,0 +1,82 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { createReducer, PayloadAction } from '@reduxjs/toolkit'; +import { WritableDraft } from 'immer/dist/types/types-external'; +import { clearTestNowMonitorAction, testNowMonitorAction } from '../actions'; +import { TestNowResponse } from '../api'; +import { AppState } from '../index'; + +export enum TestRunStats { + LOADING = 'loading', + IN_PROGRESS = 'in-progress', + COMPLETED = 'completed', +} + +interface TestNowRun { + monitorId: string; + testRunId?: string; + status: TestRunStats; +} + +export interface TestNowRunsState { + testNowRuns: TestNowRun[]; +} + +export const initialState: TestNowRunsState = { + testNowRuns: [], +}; + +export const testNowRunsReducer = createReducer(initialState, (builder) => { + builder + .addCase( + String(testNowMonitorAction.get), + (state: WritableDraft, action: PayloadAction) => ({ + ...state, + testNowRuns: [ + ...state.testNowRuns, + { monitorId: action.payload, status: TestRunStats.LOADING }, + ], + }) + ) + .addCase( + String(testNowMonitorAction.success), + (state: WritableDraft, { payload }: PayloadAction) => ({ + ...state, + testNowRuns: state.testNowRuns.map((tRun) => + tRun.monitorId === payload.monitorId + ? { + monitorId: payload.monitorId, + testRunId: payload.testRunId, + status: TestRunStats.IN_PROGRESS, + } + : tRun + ), + }) + ) + .addCase( + String(testNowMonitorAction.fail), + (state: WritableDraft, action: PayloadAction) => ({ + ...state, + testNowRuns: [...(state.testNowRuns ?? [])], + }) + ) + .addCase( + String(clearTestNowMonitorAction), + (state: WritableDraft, action: PayloadAction) => ({ + ...state, + testNowRuns: state.testNowRuns.filter((tRun) => tRun.monitorId !== action.payload), + }) + ); +}); + +export const testNowRunsSelector = ({ testNowRuns }: AppState) => testNowRuns.testNowRuns; + +export const testNowRunSelector = + (monitorId?: string) => + ({ testNowRuns }: AppState) => + testNowRuns.testNowRuns.find((tRun) => monitorId && monitorId === tRun.monitorId); diff --git a/x-pack/plugins/uptime/server/lib/requests/search/refine_potential_matches.ts b/x-pack/plugins/uptime/server/lib/requests/search/refine_potential_matches.ts index f8357e8066573..5a714fd2514d8 100644 --- a/x-pack/plugins/uptime/server/lib/requests/search/refine_potential_matches.ts +++ b/x-pack/plugins/uptime/server/lib/requests/search/refine_potential_matches.ts @@ -83,11 +83,13 @@ export const summaryPingsToSummary = (summaryPings: Ping[]): MonitorSummary => { const latest = summaryPings[summaryPings.length - 1]; return { monitor_id: latest.monitor.id, + configId: latest.config_id, state: { timestamp: latest.timestamp, monitor: { name: latest.monitor?.name, type: latest.monitor?.type, + duration: latest.monitor?.duration, }, url: latest.url ?? {}, summary: { diff --git a/x-pack/plugins/uptime/server/lib/synthetics_service/synthetics_service.ts b/x-pack/plugins/uptime/server/lib/synthetics_service/synthetics_service.ts index 79164cade9aa4..20f11fe3b8900 100644 --- a/x-pack/plugins/uptime/server/lib/synthetics_service/synthetics_service.ts +++ b/x-pack/plugins/uptime/server/lib/synthetics_service/synthetics_service.ts @@ -179,7 +179,15 @@ export class SyntheticsService { }; } - async pushConfigs(request?: KibanaRequest, configs?: SyntheticsMonitorWithId[]) { + async pushConfigs( + request?: KibanaRequest, + configs?: Array< + SyntheticsMonitorWithId & { + fields_under_root?: boolean; + fields?: { config_id: string }; + } + > + ) { const monitors = this.formatConfigs(configs || (await this.getMonitorConfigs())); if (monitors.length === 0) { this.logger.debug('No monitor found which can be pushed to service.'); @@ -226,6 +234,32 @@ export class SyntheticsService { } } + async triggerConfigs( + request?: KibanaRequest, + configs?: Array< + SyntheticsMonitorWithId & { + fields_under_root?: boolean; + fields?: { config_id: string; test_run_id: string }; + } + > + ) { + const monitors = this.formatConfigs(configs || (await this.getMonitorConfigs())); + if (monitors.length === 0) { + return; + } + const data = { + monitors, + output: await this.getOutput(request), + }; + + try { + return await this.apiClient.runOnce(data); + } catch (e) { + this.logger.error(e); + throw e; + } + } + async deleteConfigs(request: KibanaRequest, configs: SyntheticsMonitorWithId[]) { const data = { monitors: this.formatConfigs(configs), diff --git a/x-pack/plugins/uptime/server/rest_api/index.ts b/x-pack/plugins/uptime/server/rest_api/index.ts index 383d999f29cc6..780a67c0941e1 100644 --- a/x-pack/plugins/uptime/server/rest_api/index.ts +++ b/x-pack/plugins/uptime/server/rest_api/index.ts @@ -37,6 +37,7 @@ import { addSyntheticsMonitorRoute } from './synthetics_service/add_monitor'; import { editSyntheticsMonitorRoute } from './synthetics_service/edit_monitor'; import { deleteSyntheticsMonitorRoute } from './synthetics_service/delete_monitor'; import { runOnceSyntheticsMonitorRoute } from './synthetics_service/run_once_monitor'; +import { testNowMonitorRoute } from './synthetics_service/test_now_monitor'; export * from './types'; export { createRouteWithAuth } from './create_route_with_auth'; @@ -69,4 +70,5 @@ export const restApiRoutes: UMRestApiRouteFactory[] = [ editSyntheticsMonitorRoute, deleteSyntheticsMonitorRoute, runOnceSyntheticsMonitorRoute, + testNowMonitorRoute, ]; diff --git a/x-pack/plugins/uptime/server/rest_api/synthetics_service/add_monitor.ts b/x-pack/plugins/uptime/server/rest_api/synthetics_service/add_monitor.ts index 1750466b6c3e6..38def648f6e5c 100644 --- a/x-pack/plugins/uptime/server/rest_api/synthetics_service/add_monitor.ts +++ b/x-pack/plugins/uptime/server/rest_api/synthetics_service/add_monitor.ts @@ -38,6 +38,10 @@ export const addSyntheticsMonitorRoute: UMRestApiRouteFactory = () => ({ { ...newMonitor.attributes, id: newMonitor.id, + fields: { + config_id: newMonitor.id, + }, + fields_under_root: true, }, ]); diff --git a/x-pack/plugins/uptime/server/rest_api/synthetics_service/edit_monitor.ts b/x-pack/plugins/uptime/server/rest_api/synthetics_service/edit_monitor.ts index a95876d8d3ea6..530716f709f64 100644 --- a/x-pack/plugins/uptime/server/rest_api/synthetics_service/edit_monitor.ts +++ b/x-pack/plugins/uptime/server/rest_api/synthetics_service/edit_monitor.ts @@ -47,6 +47,10 @@ export const editSyntheticsMonitorRoute: UMRestApiRouteFactory = () => ({ { ...(editMonitor.attributes as SyntheticsMonitor), id: editMonitor.id, + fields: { + config_id: editMonitor.id, + }, + fields_under_root: true, }, ]); diff --git a/x-pack/plugins/uptime/server/rest_api/synthetics_service/test_now_monitor.ts b/x-pack/plugins/uptime/server/rest_api/synthetics_service/test_now_monitor.ts new file mode 100644 index 0000000000000..2ad270db213fb --- /dev/null +++ b/x-pack/plugins/uptime/server/rest_api/synthetics_service/test_now_monitor.ts @@ -0,0 +1,48 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { schema } from '@kbn/config-schema'; +import { v4 as uuidv4 } from 'uuid'; +import { SyntheticsMonitor } from '../../../common/runtime_types'; +import { UMRestApiRouteFactory } from '../types'; +import { API_URLS } from '../../../common/constants'; +import { syntheticsMonitorType } from '../../lib/saved_objects/synthetics_monitor'; + +export const testNowMonitorRoute: UMRestApiRouteFactory = () => ({ + method: 'GET', + path: API_URLS.TRIGGER_MONITOR + '/{monitorId}', + validate: { + params: schema.object({ + monitorId: schema.string({ minLength: 1, maxLength: 1024 }), + }), + }, + handler: async ({ request, savedObjectsClient, response, server }): Promise => { + const { monitorId } = request.params; + const monitor = await savedObjectsClient.get( + syntheticsMonitorType, + monitorId + ); + + const { syntheticsService } = server; + + const testRunId = uuidv4(); + + const errors = await syntheticsService.triggerConfigs(request, [ + { + ...monitor.attributes, + id: monitorId, + fields_under_root: true, + fields: { config_id: monitorId, test_run_id: testRunId }, + }, + ]); + + if (errors && errors?.length > 0) { + return { errors, testRunId, monitorId }; + } + + return { testRunId, monitorId }; + }, +}); From f84adb73796a0bb349266b730c7312b8f6792390 Mon Sep 17 00:00:00 2001 From: Brandon Kobel Date: Thu, 3 Feb 2022 14:56:40 -0800 Subject: [PATCH 26/68] Adding snapshot tests for the AAD mappings (#124142) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../experimental_rule_field_map.test.ts | 29 +++ .../technical_rule_field_map.test.ts | 233 ++++++++++++++++++ 2 files changed, 262 insertions(+) create mode 100644 x-pack/plugins/rule_registry/common/assets/field_maps/experimental_rule_field_map.test.ts create mode 100644 x-pack/plugins/rule_registry/common/assets/field_maps/technical_rule_field_map.test.ts diff --git a/x-pack/plugins/rule_registry/common/assets/field_maps/experimental_rule_field_map.test.ts b/x-pack/plugins/rule_registry/common/assets/field_maps/experimental_rule_field_map.test.ts new file mode 100644 index 0000000000000..d3ed9ff937a0c --- /dev/null +++ b/x-pack/plugins/rule_registry/common/assets/field_maps/experimental_rule_field_map.test.ts @@ -0,0 +1,29 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { experimentalRuleFieldMap } from './experimental_rule_field_map'; + +// This test purely exists to see what the resultant mappings are and +// make it obvious when some dependency results in the mappings changing +it('matches snapshot', () => { + expect(experimentalRuleFieldMap).toMatchInlineSnapshot(` + Object { + "kibana.alert.evaluation.threshold": Object { + "scaling_factor": 100, + "type": "scaled_float", + }, + "kibana.alert.evaluation.value": Object { + "scaling_factor": 100, + "type": "scaled_float", + }, + "kibana.alert.instance.id": Object { + "required": true, + "type": "keyword", + }, + } + `); +}); diff --git a/x-pack/plugins/rule_registry/common/assets/field_maps/technical_rule_field_map.test.ts b/x-pack/plugins/rule_registry/common/assets/field_maps/technical_rule_field_map.test.ts new file mode 100644 index 0000000000000..916174f225415 --- /dev/null +++ b/x-pack/plugins/rule_registry/common/assets/field_maps/technical_rule_field_map.test.ts @@ -0,0 +1,233 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { technicalRuleFieldMap } from './technical_rule_field_map'; + +// This test purely exists to see what the resultant mappings are and +// make it obvious when some dependency results in the mappings changing +it('matches snapshot', () => { + expect(technicalRuleFieldMap).toMatchInlineSnapshot(` + Object { + "@timestamp": Object { + "array": false, + "required": true, + "type": "date", + }, + "ecs.version": Object { + "array": false, + "required": false, + "type": "keyword", + }, + "event.action": Object { + "array": false, + "required": false, + "type": "keyword", + }, + "event.kind": Object { + "array": false, + "required": false, + "type": "keyword", + }, + "kibana.alert.action_group": Object { + "array": false, + "required": false, + "type": "keyword", + }, + "kibana.alert.duration.us": Object { + "type": "long", + }, + "kibana.alert.end": Object { + "type": "date", + }, + "kibana.alert.reason": Object { + "array": false, + "required": false, + "type": "keyword", + }, + "kibana.alert.risk_score": Object { + "array": false, + "required": false, + "type": "float", + }, + "kibana.alert.rule.author": Object { + "array": false, + "required": false, + "type": "keyword", + }, + "kibana.alert.rule.category": Object { + "array": false, + "required": true, + "type": "keyword", + }, + "kibana.alert.rule.consumer": Object { + "required": true, + "type": "keyword", + }, + "kibana.alert.rule.created_at": Object { + "array": false, + "required": false, + "type": "date", + }, + "kibana.alert.rule.created_by": Object { + "array": false, + "required": false, + "type": "keyword", + }, + "kibana.alert.rule.description": Object { + "array": false, + "required": false, + "type": "keyword", + }, + "kibana.alert.rule.enabled": Object { + "array": false, + "required": false, + "type": "keyword", + }, + "kibana.alert.rule.execution.uuid": Object { + "array": false, + "required": false, + "type": "keyword", + }, + "kibana.alert.rule.from": Object { + "array": false, + "required": false, + "type": "keyword", + }, + "kibana.alert.rule.interval": Object { + "array": false, + "required": false, + "type": "keyword", + }, + "kibana.alert.rule.license": Object { + "array": false, + "required": false, + "type": "keyword", + }, + "kibana.alert.rule.name": Object { + "array": false, + "required": true, + "type": "keyword", + }, + "kibana.alert.rule.note": Object { + "array": false, + "required": false, + "type": "keyword", + }, + "kibana.alert.rule.parameters": Object { + "ignore_above": 4096, + "type": "flattened", + }, + "kibana.alert.rule.producer": Object { + "required": true, + "type": "keyword", + }, + "kibana.alert.rule.references": Object { + "array": true, + "required": false, + "type": "keyword", + }, + "kibana.alert.rule.rule_id": Object { + "array": false, + "required": false, + "type": "keyword", + }, + "kibana.alert.rule.rule_name_override": Object { + "array": false, + "required": false, + "type": "keyword", + }, + "kibana.alert.rule.rule_type_id": Object { + "required": true, + "type": "keyword", + }, + "kibana.alert.rule.tags": Object { + "array": true, + "required": false, + "type": "keyword", + }, + "kibana.alert.rule.to": Object { + "array": false, + "required": false, + "type": "keyword", + }, + "kibana.alert.rule.type": Object { + "array": false, + "required": false, + "type": "keyword", + }, + "kibana.alert.rule.updated_at": Object { + "array": false, + "required": false, + "type": "date", + }, + "kibana.alert.rule.updated_by": Object { + "array": false, + "required": false, + "type": "keyword", + }, + "kibana.alert.rule.uuid": Object { + "array": false, + "required": true, + "type": "keyword", + }, + "kibana.alert.rule.version": Object { + "array": false, + "required": false, + "type": "keyword", + }, + "kibana.alert.severity": Object { + "type": "keyword", + }, + "kibana.alert.start": Object { + "type": "date", + }, + "kibana.alert.status": Object { + "required": true, + "type": "keyword", + }, + "kibana.alert.system_status": Object { + "array": false, + "required": false, + "type": "keyword", + }, + "kibana.alert.uuid": Object { + "required": true, + "type": "keyword", + }, + "kibana.alert.workflow_reason": Object { + "array": false, + "required": false, + "type": "keyword", + }, + "kibana.alert.workflow_status": Object { + "array": false, + "required": false, + "type": "keyword", + }, + "kibana.alert.workflow_user": Object { + "array": false, + "required": false, + "type": "keyword", + }, + "kibana.space_ids": Object { + "array": true, + "required": true, + "type": "keyword", + }, + "kibana.version": Object { + "array": false, + "required": false, + "type": "version", + }, + "tags": Object { + "array": true, + "required": false, + "type": "keyword", + }, + } + `); +}); From cc0380a4613b27129a888dde673bd2d412d62b73 Mon Sep 17 00:00:00 2001 From: Spencer Date: Thu, 3 Feb 2022 16:00:38 -0800 Subject: [PATCH 27/68] [ci-stats] send test results to ci-stats service (#123740) * [ci-stats] send test results to ci-stats service * move export to export type --- package.json | 1 + packages/kbn-dev-utils/BUILD.bazel | 2 + .../ci_stats_reporter/ci_stats_reporter.ts | 105 +++++++++--- .../ci_stats_test_group_types.ts | 90 ++++++++++ .../src/ci_stats_reporter/index.ts | 1 + packages/kbn-pm/dist/index.js | 49 +++++- packages/kbn-test/BUILD.bazel | 7 +- packages/kbn-test/jest-preset.js | 6 + .../kbn-test/jest_integration/jest-preset.js | 6 + .../functional_test_runner.ts | 6 +- .../src/functional_test_runner/index.ts | 3 +- .../__fixtures__/failure_hooks/config.js | 1 + .../__fixtures__/simple_project/config.js | 3 + .../lib/config/config.ts | 2 + .../lib/config/schema.ts | 1 + .../lib/failure_metadata.test.ts | 61 ------- .../lib/failure_metadata.ts | 93 ----------- .../src/functional_test_runner/lib/index.ts | 2 +- .../functional_test_runner/lib/lifecycle.ts | 8 + .../mocha/reporter/ci_stats_ftr_reporter.ts | 157 ++++++++++++++++++ .../lib/mocha/reporter/reporter.js | 22 ++- .../lib/test_metadata.ts | 41 +++++ .../functional_test_runner/public_types.ts | 8 +- .../src/jest/ci_stats_jest_reporter.ts | 120 +++++++++++++ packages/kbn-test/src/mocha/index.ts | 2 +- .../functional/services/common/screenshots.ts | 42 ++++- 26 files changed, 629 insertions(+), 210 deletions(-) create mode 100644 packages/kbn-dev-utils/src/ci_stats_reporter/ci_stats_test_group_types.ts delete mode 100644 packages/kbn-test/src/functional_test_runner/lib/failure_metadata.test.ts delete mode 100644 packages/kbn-test/src/functional_test_runner/lib/failure_metadata.ts create mode 100644 packages/kbn-test/src/functional_test_runner/lib/mocha/reporter/ci_stats_ftr_reporter.ts create mode 100644 packages/kbn-test/src/functional_test_runner/lib/test_metadata.ts create mode 100644 packages/kbn-test/src/jest/ci_stats_jest_reporter.ts diff --git a/package.json b/package.json index 860f5ebc57990..83babf74c561d 100644 --- a/package.json +++ b/package.json @@ -455,6 +455,7 @@ "@emotion/babel-preset-css-prop": "^11.2.0", "@emotion/jest": "^11.3.0", "@istanbuljs/schema": "^0.1.2", + "@jest/console": "^26.6.2", "@jest/reporters": "^26.6.2", "@kbn/babel-code-parser": "link:bazel-bin/packages/kbn-babel-code-parser", "@kbn/babel-preset": "link:bazel-bin/packages/kbn-babel-preset", diff --git a/packages/kbn-dev-utils/BUILD.bazel b/packages/kbn-dev-utils/BUILD.bazel index 7d7ba29871ef0..65e0957fe5d90 100644 --- a/packages/kbn-dev-utils/BUILD.bazel +++ b/packages/kbn-dev-utils/BUILD.bazel @@ -45,6 +45,7 @@ NPM_MODULE_EXTRA_FILES = [ RUNTIME_DEPS = [ "//packages/kbn-utils", + "//packages/kbn-std", "@npm//@babel/core", "@npm//axios", "@npm//chalk", @@ -67,6 +68,7 @@ RUNTIME_DEPS = [ TYPES_DEPS = [ "//packages/kbn-utils:npm_module_types", + "//packages/kbn-std:npm_module_types", "@npm//@babel/parser", "@npm//@babel/types", "@npm//@types/babel__core", diff --git a/packages/kbn-dev-utils/src/ci_stats_reporter/ci_stats_reporter.ts b/packages/kbn-dev-utils/src/ci_stats_reporter/ci_stats_reporter.ts index 3dff5acdc228a..f16cdcc80f286 100644 --- a/packages/kbn-dev-utils/src/ci_stats_reporter/ci_stats_reporter.ts +++ b/packages/kbn-dev-utils/src/ci_stats_reporter/ci_stats_reporter.ts @@ -11,16 +11,28 @@ import Os from 'os'; import Fs from 'fs'; import Path from 'path'; import crypto from 'crypto'; + import execa from 'execa'; -import Axios from 'axios'; +import Axios, { AxiosRequestConfig } from 'axios'; // @ts-expect-error not "public", but necessary to prevent Jest shimming from breaking things import httpAdapter from 'axios/lib/adapters/http'; import { ToolingLog } from '../tooling_log'; import { parseConfig, Config } from './ci_stats_config'; +import type { CiStatsTestGroupInfo, CiStatsTestRun } from './ci_stats_test_group_types'; const BASE_URL = 'https://ci-stats.kibana.dev'; +/** Container for metadata that can be attached to different ci-stats objects */ +export interface CiStatsMetadata { + /** + * Arbitrary key-value pairs which can be attached to CiStatsTiming and CiStatsMetric + * objects stored in the ci-stats service + */ + [key: string]: string | string[] | number | boolean | undefined; +} + +/** A ci-stats metric record */ export interface CiStatsMetric { /** Top-level categorization for the metric, e.g. "page load bundle size" */ group: string; @@ -40,13 +52,7 @@ export interface CiStatsMetric { meta?: CiStatsMetadata; } -export interface CiStatsMetadata { - /** - * Arbitrary key-value pairs which can be attached to CiStatsTiming and CiStatsMetric - * objects stored in the ci-stats service - */ - [key: string]: string | string[] | number | boolean | undefined; -} +/** A ci-stats timing event */ export interface CiStatsTiming { /** Top-level categorization for the timing, e.g. "scripts/foo", process type, etc. */ group: string; @@ -58,13 +64,7 @@ export interface CiStatsTiming { meta?: CiStatsMetadata; } -interface ReqOptions { - auth: boolean; - path: string; - body: any; - bodyDesc: string; -} - +/** Options for reporting timings to ci-stats */ export interface TimingsOptions { /** list of timings to record */ timings: CiStatsTiming[]; @@ -74,10 +74,41 @@ export interface TimingsOptions { kibanaUuid?: string | null; } +/** Options for reporting metrics to ci-stats */ export interface MetricsOptions { /** Default metadata to add to each metric */ defaultMeta?: CiStatsMetadata; } + +/** Options for reporting tests to ci-stats */ +export interface CiStatsReportTestsOptions { + /** + * Information about the group of tests that were run + */ + group: CiStatsTestGroupInfo; + /** + * Information about each test that ran, including failure information + */ + testRuns: CiStatsTestRun[]; +} + +/* @internal */ +interface ReportTestsResponse { + buildId: string; + groupId: string; + testRunCount: number; +} + +/* @internal */ +interface ReqOptions { + auth: boolean; + path: string; + body: any; + bodyDesc: string; + query?: AxiosRequestConfig['params']; +} + +/** Object that helps report data to the ci-stats service */ export class CiStatsReporter { /** * Create a CiStatsReporter by inspecting the ENV for the necessary config @@ -86,7 +117,7 @@ export class CiStatsReporter { return new CiStatsReporter(parseConfig(log), log); } - constructor(private config: Config | undefined, private log: ToolingLog) {} + constructor(private readonly config: Config | undefined, private readonly log: ToolingLog) {} /** * Determine if CI_STATS is explicitly disabled by the environment. To determine @@ -165,7 +196,7 @@ export class CiStatsReporter { this.log.debug('CIStatsReporter committerHash: %s', defaultMeta.committerHash); - return await this.req({ + return !!(await this.req({ auth: !!buildId, path: '/v1/timings', body: { @@ -175,7 +206,7 @@ export class CiStatsReporter { timings, }, bodyDesc: timings.length === 1 ? `${timings.length} timing` : `${timings.length} timings`, - }); + })); } /** @@ -188,12 +219,11 @@ export class CiStatsReporter { } const buildId = this.config?.buildId; - if (!buildId) { - throw new Error(`CiStatsReporter can't be authorized without a buildId`); + throw new Error(`metrics can't be reported without a buildId`); } - return await this.req({ + return !!(await this.req({ auth: true, path: '/v1/metrics', body: { @@ -204,6 +234,30 @@ export class CiStatsReporter { bodyDesc: `metrics: ${metrics .map(({ group, id, value }) => `[${group}/${id}=${value}]`) .join(' ')}`, + })); + } + + /** + * Send test reports to ci-stats + */ + async reportTests({ group, testRuns }: CiStatsReportTestsOptions) { + if (!this.config?.buildId || !this.config?.apiToken) { + throw new Error( + 'unable to report tests unless buildId is configured and auth config available' + ); + } + + return await this.req({ + auth: true, + path: '/v1/test_group', + query: { + buildId: this.config?.buildId, + }, + bodyDesc: `[${group.name}/${group.type}] test groups with ${testRuns.length} tests`, + body: [ + JSON.stringify({ group }), + ...testRuns.map((testRun) => JSON.stringify({ testRun })), + ].join('\n'), }); } @@ -241,7 +295,7 @@ export class CiStatsReporter { } } - private async req({ auth, body, bodyDesc, path }: ReqOptions) { + private async req({ auth, body, bodyDesc, path, query }: ReqOptions) { let attempt = 0; const maxAttempts = 5; @@ -251,23 +305,24 @@ export class CiStatsReporter { Authorization: `token ${this.config.apiToken}`, }; } else if (auth) { - throw new Error('this.req() shouldnt be called with auth=true if this.config is defined'); + throw new Error('this.req() shouldnt be called with auth=true if this.config is not defined'); } while (true) { attempt += 1; try { - await Axios.request({ + const resp = await Axios.request({ method: 'POST', url: path, baseURL: BASE_URL, headers, data: body, + params: query, adapter: httpAdapter, }); - return true; + return resp.data; } catch (error) { if (!error?.request) { // not an axios error, must be a usage error that we should notify user about diff --git a/packages/kbn-dev-utils/src/ci_stats_reporter/ci_stats_test_group_types.ts b/packages/kbn-dev-utils/src/ci_stats_reporter/ci_stats_test_group_types.ts new file mode 100644 index 0000000000000..147d4e19325b2 --- /dev/null +++ b/packages/kbn-dev-utils/src/ci_stats_reporter/ci_stats_test_group_types.ts @@ -0,0 +1,90 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import type { CiStatsMetadata } from './ci_stats_reporter'; + +export type CiStatsTestResult = 'fail' | 'pass' | 'skip'; +export type CiStatsTestType = + | 'after all hook' + | 'after each hook' + | 'before all hook' + | 'before each hook' + | 'test'; + +export interface CiStatsTestRun { + /** + * ISO-8601 formatted datetime representing when the tests started running + */ + startTime: string; + /** + * Duration of the tests in milliseconds + */ + durationMs: number; + /** + * A sequence number, this is used to order the tests in a specific test run + */ + seq: number; + /** + * The type of this "test run", usually this is just "test" but when reporting issues in hooks it can be set to the type of hook + */ + type: CiStatsTestType; + /** + * "fail", "pass" or "skip", the result of the tests + */ + result: CiStatsTestResult; + /** + * The list of suite names containing this test, the first being the outermost suite + */ + suites: string[]; + /** + * The name of this specific test run + */ + name: string; + /** + * Relative path from the root of the repo contianing this test + */ + file: string; + /** + * Error message if the test failed + */ + error?: string; + /** + * Debug output/stdout produced by the test + */ + stdout?: string; + /** + * Screenshots captured during the test run + */ + screenshots?: Array<{ + name: string; + base64Png: string; + }>; +} + +export interface CiStatsTestGroupInfo { + /** + * ISO-8601 formatted datetime representing when the group of tests started running + */ + startTime: string; + /** + * The number of miliseconds that the tests ran for + */ + durationMs: number; + /** + * The type of tests run in this group, any value is valid but test groups are groupped by type in the UI so use something consistent + */ + type: string; + /** + * The name of this specific group (within the "type") + */ + name: string; + /** + * Arbitrary metadata associated with this group. We currently look for a ciGroup metadata property for highlighting that when appropriate + */ + meta: CiStatsMetadata; +} diff --git a/packages/kbn-dev-utils/src/ci_stats_reporter/index.ts b/packages/kbn-dev-utils/src/ci_stats_reporter/index.ts index 318a2921517f1..cf80d06613dbf 100644 --- a/packages/kbn-dev-utils/src/ci_stats_reporter/index.ts +++ b/packages/kbn-dev-utils/src/ci_stats_reporter/index.ts @@ -10,3 +10,4 @@ export * from './ci_stats_reporter'; export type { Config } from './ci_stats_config'; export * from './ship_ci_stats_cli'; export { getTimeReporter } from './report_time'; +export * from './ci_stats_test_group_types'; diff --git a/packages/kbn-pm/dist/index.js b/packages/kbn-pm/dist/index.js index d4105a5edd7a5..d0fe0f269f6fa 100644 --- a/packages/kbn-pm/dist/index.js +++ b/packages/kbn-pm/dist/index.js @@ -9049,7 +9049,9 @@ var _ci_stats_config = __webpack_require__(218); */ // @ts-expect-error not "public", but necessary to prevent Jest shimming from breaking things const BASE_URL = 'https://ci-stats.kibana.dev'; +/** Container for metadata that can be attached to different ci-stats objects */ +/** Object that helps report data to the ci-stats service */ class CiStatsReporter { /** * Create a CiStatsReporter by inspecting the ENV for the necessary config @@ -9146,7 +9148,7 @@ class CiStatsReporter { totalMem: _os.default.totalmem() }; this.log.debug('CIStatsReporter committerHash: %s', defaultMeta.committerHash); - return await this.req({ + return !!(await this.req({ auth: !!buildId, path: '/v1/timings', body: { @@ -9156,7 +9158,7 @@ class CiStatsReporter { timings }, bodyDesc: timings.length === 1 ? `${timings.length} timing` : `${timings.length} timings` - }); + })); } /** * Report metrics data to the ci-stats service. If running outside of CI this method @@ -9174,10 +9176,10 @@ class CiStatsReporter { const buildId = (_this$config4 = this.config) === null || _this$config4 === void 0 ? void 0 : _this$config4.buildId; if (!buildId) { - throw new Error(`CiStatsReporter can't be authorized without a buildId`); + throw new Error(`metrics can't be reported without a buildId`); } - return await this.req({ + return !!(await this.req({ auth: true, path: '/v1/metrics', body: { @@ -9190,6 +9192,35 @@ class CiStatsReporter { id, value }) => `[${group}/${id}=${value}]`).join(' ')}` + })); + } + /** + * Send test reports to ci-stats + */ + + + async reportTests({ + group, + testRuns + }) { + var _this$config5, _this$config6, _this$config7; + + if (!((_this$config5 = this.config) !== null && _this$config5 !== void 0 && _this$config5.buildId) || !((_this$config6 = this.config) !== null && _this$config6 !== void 0 && _this$config6.apiToken)) { + throw new Error('unable to report tests unless buildId is configured and auth config available'); + } + + return await this.req({ + auth: true, + path: '/v1/test_group', + query: { + buildId: (_this$config7 = this.config) === null || _this$config7 === void 0 ? void 0 : _this$config7.buildId + }, + bodyDesc: `[${group.name}/${group.type}] test groups with ${testRuns.length} tests`, + body: [JSON.stringify({ + group + }), ...testRuns.map(testRun => JSON.stringify({ + testRun + }))].join('\n') }); } /** @@ -9239,7 +9270,8 @@ class CiStatsReporter { auth, body, bodyDesc, - path + path, + query }) { let attempt = 0; const maxAttempts = 5; @@ -9250,22 +9282,23 @@ class CiStatsReporter { Authorization: `token ${this.config.apiToken}` }; } else if (auth) { - throw new Error('this.req() shouldnt be called with auth=true if this.config is defined'); + throw new Error('this.req() shouldnt be called with auth=true if this.config is not defined'); } while (true) { attempt += 1; try { - await _axios.default.request({ + const resp = await _axios.default.request({ method: 'POST', url: path, baseURL: BASE_URL, headers, data: body, + params: query, adapter: _http.default }); - return true; + return resp.data; } catch (error) { var _error$response; diff --git a/packages/kbn-test/BUILD.bazel b/packages/kbn-test/BUILD.bazel index 69addd9e3c4c7..67299f4afdeb7 100644 --- a/packages/kbn-test/BUILD.bazel +++ b/packages/kbn-test/BUILD.bazel @@ -41,8 +41,10 @@ RUNTIME_DEPS = [ "//packages/kbn-std", "//packages/kbn-utils", "@npm//@elastic/elasticsearch", - "@npm//axios", "@npm//@babel/traverse", + "@npm//@jest/console", + "@npm//@jest/reporters", + "@npm//axios", "@npm//chance", "@npm//dedent", "@npm//del", @@ -58,7 +60,6 @@ RUNTIME_DEPS = [ "@npm//jest-cli", "@npm//jest-snapshot", "@npm//jest-styled-components", - "@npm//@jest/reporters", "@npm//joi", "@npm//mustache", "@npm//normalize-path", @@ -81,6 +82,8 @@ TYPES_DEPS = [ "//packages/kbn-std:npm_module_types", "//packages/kbn-utils", "@npm//@elastic/elasticsearch", + "@npm//@jest/console", + "@npm//@jest/reporters", "@npm//axios", "@npm//elastic-apm-node", "@npm//del", diff --git a/packages/kbn-test/jest-preset.js b/packages/kbn-test/jest-preset.js index e2607100babc5..3c9b222e98df5 100644 --- a/packages/kbn-test/jest-preset.js +++ b/packages/kbn-test/jest-preset.js @@ -55,6 +55,12 @@ module.exports = { rootDirectory: '.', }, ], + [ + '@kbn/test/target_node/jest/ci_stats_jest_reporter', + { + testGroupType: 'Jest Unit Tests', + }, + ], ], // The paths to modules that run some code to configure or set up the testing environment before each test diff --git a/packages/kbn-test/jest_integration/jest-preset.js b/packages/kbn-test/jest_integration/jest-preset.js index 7504dec9e7a20..be007262477d3 100644 --- a/packages/kbn-test/jest_integration/jest-preset.js +++ b/packages/kbn-test/jest_integration/jest-preset.js @@ -21,6 +21,12 @@ module.exports = { reporters: [ 'default', ['@kbn/test/target_node/jest/junit_reporter', { reportName: 'Jest Integration Tests' }], + [ + '@kbn/test/target_node/jest/ci_stats_jest_reporter', + { + testGroupType: 'Jest Integration Tests', + }, + ], ], coverageReporters: !!process.env.CI ? [['json', { file: 'jest-integration.json' }]] diff --git a/packages/kbn-test/src/functional_test_runner/functional_test_runner.ts b/packages/kbn-test/src/functional_test_runner/functional_test_runner.ts index ea55a2672d670..85c474c2f1bec 100644 --- a/packages/kbn-test/src/functional_test_runner/functional_test_runner.ts +++ b/packages/kbn-test/src/functional_test_runner/functional_test_runner.ts @@ -13,7 +13,7 @@ import { Suite, Test } from './fake_mocha_types'; import { Lifecycle, LifecyclePhase, - FailureMetadata, + TestMetadata, readConfigFile, ProviderCollection, readProviderSpec, @@ -27,7 +27,7 @@ import { export class FunctionalTestRunner { public readonly lifecycle = new Lifecycle(); - public readonly failureMetadata = new FailureMetadata(this.lifecycle); + public readonly testMetadata = new TestMetadata(this.lifecycle); private closed = false; private readonly esVersion: EsVersion; @@ -181,7 +181,7 @@ export class FunctionalTestRunner { const coreProviders = readProviderSpec('Service', { lifecycle: () => this.lifecycle, log: () => this.log, - failureMetadata: () => this.failureMetadata, + testMetadata: () => this.testMetadata, config: () => config, dockerServers: () => dockerServers, esVersion: () => this.esVersion, diff --git a/packages/kbn-test/src/functional_test_runner/index.ts b/packages/kbn-test/src/functional_test_runner/index.ts index 1718b5f7a4bc5..e67e72fd5801a 100644 --- a/packages/kbn-test/src/functional_test_runner/index.ts +++ b/packages/kbn-test/src/functional_test_runner/index.ts @@ -7,7 +7,8 @@ */ export { FunctionalTestRunner } from './functional_test_runner'; -export { readConfigFile, Config, EsVersion } from './lib'; +export { readConfigFile, Config, EsVersion, Lifecycle, LifecyclePhase } from './lib'; +export type { ScreenshotRecord } from './lib'; export { runFtrCli } from './cli'; export * from './lib/docker_servers'; export * from './public_types'; diff --git a/packages/kbn-test/src/functional_test_runner/integration_tests/__fixtures__/failure_hooks/config.js b/packages/kbn-test/src/functional_test_runner/integration_tests/__fixtures__/failure_hooks/config.js index 1375e5a3df2fd..6e25e4c073ab0 100644 --- a/packages/kbn-test/src/functional_test_runner/integration_tests/__fixtures__/failure_hooks/config.js +++ b/packages/kbn-test/src/functional_test_runner/integration_tests/__fixtures__/failure_hooks/config.js @@ -35,6 +35,7 @@ export default function () { }, mochaReporter: { captureLogOutput: false, + sendToCiStats: false, }, }; } diff --git a/packages/kbn-test/src/functional_test_runner/integration_tests/__fixtures__/simple_project/config.js b/packages/kbn-test/src/functional_test_runner/integration_tests/__fixtures__/simple_project/config.js index 7163058b78523..4c87b53b5753b 100644 --- a/packages/kbn-test/src/functional_test_runner/integration_tests/__fixtures__/simple_project/config.js +++ b/packages/kbn-test/src/functional_test_runner/integration_tests/__fixtures__/simple_project/config.js @@ -10,4 +10,7 @@ import { resolve } from 'path'; export default () => ({ testFiles: [resolve(__dirname, 'tests.js')], + mochaReporter: { + sendToCiStats: false, + }, }); diff --git a/packages/kbn-test/src/functional_test_runner/lib/config/config.ts b/packages/kbn-test/src/functional_test_runner/lib/config/config.ts index 1d4af9c33fb79..d6248b9628e73 100644 --- a/packages/kbn-test/src/functional_test_runner/lib/config/config.ts +++ b/packages/kbn-test/src/functional_test_runner/lib/config/config.ts @@ -20,6 +20,7 @@ interface Options { } export class Config { + public readonly path: string; private [$values]: Record; constructor(options: Options) { @@ -29,6 +30,7 @@ export class Config { throw new TypeError('path is a required option'); } + this.path = path; const { error, value } = schema.validate(settings, { abortEarly: false, context: { diff --git a/packages/kbn-test/src/functional_test_runner/lib/config/schema.ts b/packages/kbn-test/src/functional_test_runner/lib/config/schema.ts index a9ceaa643a60f..e51ebc4538343 100644 --- a/packages/kbn-test/src/functional_test_runner/lib/config/schema.ts +++ b/packages/kbn-test/src/functional_test_runner/lib/config/schema.ts @@ -152,6 +152,7 @@ export const schema = Joi.object() mochaReporter: Joi.object() .keys({ captureLogOutput: Joi.boolean().default(!!process.env.CI), + sendToCiStats: Joi.boolean().default(!!process.env.CI), }) .default(), diff --git a/packages/kbn-test/src/functional_test_runner/lib/failure_metadata.test.ts b/packages/kbn-test/src/functional_test_runner/lib/failure_metadata.test.ts deleted file mode 100644 index b40f6a5c83688..0000000000000 --- a/packages/kbn-test/src/functional_test_runner/lib/failure_metadata.test.ts +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import { Lifecycle } from './lifecycle'; -import { FailureMetadata } from './failure_metadata'; -import { Test } from '../fake_mocha_types'; - -it('collects metadata for the current test', async () => { - const lifecycle = new Lifecycle(); - const failureMetadata = new FailureMetadata(lifecycle); - - const test1 = {} as Test; - await lifecycle.beforeEachRunnable.trigger(test1); - failureMetadata.add({ foo: 'bar' }); - - expect(failureMetadata.get(test1)).toMatchInlineSnapshot(` - Object { - "foo": "bar", - } - `); - - const test2 = {} as Test; - await lifecycle.beforeEachRunnable.trigger(test2); - failureMetadata.add({ test: 2 }); - - expect(failureMetadata.get(test1)).toMatchInlineSnapshot(` - Object { - "foo": "bar", - } - `); - expect(failureMetadata.get(test2)).toMatchInlineSnapshot(` - Object { - "test": 2, - } - `); -}); - -it('adds messages to the messages state', () => { - const lifecycle = new Lifecycle(); - const failureMetadata = new FailureMetadata(lifecycle); - - const test1 = {} as Test; - lifecycle.beforeEachRunnable.trigger(test1); - failureMetadata.addMessages(['foo', 'bar']); - failureMetadata.addMessages(['baz']); - - expect(failureMetadata.get(test1)).toMatchInlineSnapshot(` - Object { - "messages": Array [ - "foo", - "bar", - "baz", - ], - } - `); -}); diff --git a/packages/kbn-test/src/functional_test_runner/lib/failure_metadata.ts b/packages/kbn-test/src/functional_test_runner/lib/failure_metadata.ts deleted file mode 100644 index a766c73f4c727..0000000000000 --- a/packages/kbn-test/src/functional_test_runner/lib/failure_metadata.ts +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import Path from 'path'; - -import { REPO_ROOT } from '@kbn/utils'; - -import { Lifecycle } from './lifecycle'; - -interface Metadata { - [key: string]: unknown; -} - -export class FailureMetadata { - // mocha's global types mean we can't import Mocha or it will override the global jest types.............. - private currentRunnable?: any; - private readonly allMetadata = new Map(); - - constructor(lifecycle: Lifecycle) { - if (!process.env.GCS_UPLOAD_PREFIX && process.env.CI) { - throw new Error( - 'GCS_UPLOAD_PREFIX environment variable is not set and must always be set on CI' - ); - } - - lifecycle.beforeEachRunnable.add((runnable) => { - this.currentRunnable = runnable; - }); - } - - add(metadata: Metadata | ((current: Metadata) => Metadata)) { - if (!this.currentRunnable) { - throw new Error('no current runnable to associate metadata with'); - } - - const current = this.allMetadata.get(this.currentRunnable); - this.allMetadata.set(this.currentRunnable, { - ...current, - ...(typeof metadata === 'function' ? metadata(current || {}) : metadata), - }); - } - - addMessages(messages: string[]) { - this.add((current) => ({ - messages: [...(Array.isArray(current.messages) ? current.messages : []), ...messages], - })); - } - - /** - * @param name Name to label the URL with - * @param repoPath absolute path, within the repo, that will be uploaded - */ - addScreenshot(name: string, repoPath: string) { - const prefix = process.env.GCS_UPLOAD_PREFIX; - - if (!prefix) { - return; - } - - const slash = prefix.endsWith('/') ? '' : '/'; - const urlPath = Path.relative(REPO_ROOT, repoPath) - .split(Path.sep) - .map((c) => encodeURIComponent(c)) - .join('/'); - - if (urlPath.startsWith('..')) { - throw new Error( - `Only call addUploadLink() with paths that are within the repo root, received ${repoPath} and repo root is ${REPO_ROOT}` - ); - } - - const url = `https://storage.googleapis.com/${prefix}${slash}${urlPath}`; - const screenshot = { - name, - url, - }; - - this.add((current) => ({ - screenshots: [...(Array.isArray(current.screenshots) ? current.screenshots : []), screenshot], - })); - - return screenshot; - } - - get(runnable: any) { - return this.allMetadata.get(runnable); - } -} diff --git a/packages/kbn-test/src/functional_test_runner/lib/index.ts b/packages/kbn-test/src/functional_test_runner/lib/index.ts index 98b5fec0597e4..e387fd156fe8a 100644 --- a/packages/kbn-test/src/functional_test_runner/lib/index.ts +++ b/packages/kbn-test/src/functional_test_runner/lib/index.ts @@ -12,7 +12,7 @@ export { readConfigFile, Config } from './config'; export { readProviderSpec, ProviderCollection } from './providers'; // @internal export { runTests, setupMocha } from './mocha'; -export { FailureMetadata } from './failure_metadata'; +export * from './test_metadata'; export * from './docker_servers'; export { SuiteTracker } from './suite_tracker'; diff --git a/packages/kbn-test/src/functional_test_runner/lib/lifecycle.ts b/packages/kbn-test/src/functional_test_runner/lib/lifecycle.ts index 17dcaa8d7447d..e683ec23a8d84 100644 --- a/packages/kbn-test/src/functional_test_runner/lib/lifecycle.ts +++ b/packages/kbn-test/src/functional_test_runner/lib/lifecycle.ts @@ -11,15 +11,23 @@ import { LifecyclePhase } from './lifecycle_phase'; import { Suite, Test } from '../fake_mocha_types'; export class Lifecycle { + /** lifecycle phase that will run handlers once before tests execute */ public readonly beforeTests = new LifecyclePhase<[Suite]>({ singular: true, }); + /** lifecycle phase that runs handlers before each runnable (test and hooks) */ public readonly beforeEachRunnable = new LifecyclePhase<[Test]>(); + /** lifecycle phase that runs handlers before each suite */ public readonly beforeTestSuite = new LifecyclePhase<[Suite]>(); + /** lifecycle phase that runs handlers before each test */ public readonly beforeEachTest = new LifecyclePhase<[Test]>(); + /** lifecycle phase that runs handlers after each suite */ public readonly afterTestSuite = new LifecyclePhase<[Suite]>(); + /** lifecycle phase that runs handlers after a test fails */ public readonly testFailure = new LifecyclePhase<[Error, Test]>(); + /** lifecycle phase that runs handlers after a hook fails */ public readonly testHookFailure = new LifecyclePhase<[Error, Test]>(); + /** lifecycle phase that runs handlers at the very end of execution */ public readonly cleanup = new LifecyclePhase<[]>({ singular: true, }); diff --git a/packages/kbn-test/src/functional_test_runner/lib/mocha/reporter/ci_stats_ftr_reporter.ts b/packages/kbn-test/src/functional_test_runner/lib/mocha/reporter/ci_stats_ftr_reporter.ts new file mode 100644 index 0000000000000..61eb7eccce430 --- /dev/null +++ b/packages/kbn-test/src/functional_test_runner/lib/mocha/reporter/ci_stats_ftr_reporter.ts @@ -0,0 +1,157 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import * as Path from 'path'; + +import { REPO_ROOT } from '@kbn/utils'; +import { CiStatsReporter, CiStatsReportTestsOptions, CiStatsTestType } from '@kbn/dev-utils'; + +import { Config } from '../../config'; +import { Runner } from '../../../fake_mocha_types'; +import { TestMetadata, ScreenshotRecord } from '../../test_metadata'; +import { Lifecycle } from '../../lifecycle'; +import { getSnapshotOfRunnableLogs } from '../../../../mocha'; + +interface Suite { + _beforeAll: Runnable[]; + _beforeEach: Runnable[]; + _afterEach: Runnable[]; + _afterAll: Runnable[]; +} + +interface Runnable { + isFailed(): boolean; + isPending(): boolean; + duration?: number; + titlePath(): string[]; + file: string; + title: string; + parent: Suite; + _screenshots?: ScreenshotRecord[]; +} + +function getHookType(hook: Runnable): CiStatsTestType { + if (hook.parent._afterAll.includes(hook)) { + return 'after all hook'; + } + if (hook.parent._afterEach.includes(hook)) { + return 'after each hook'; + } + if (hook.parent._beforeEach.includes(hook)) { + return 'before each hook'; + } + if (hook.parent._beforeAll.includes(hook)) { + return 'before all hook'; + } + + throw new Error(`unable to determine hook type, hook is not owned by it's parent`); +} + +export function setupCiStatsFtrTestGroupReporter({ + config, + lifecycle, + runner, + testMetadata, + reporter, +}: { + config: Config; + lifecycle: Lifecycle; + runner: Runner; + testMetadata: TestMetadata; + reporter: CiStatsReporter; +}) { + let startMs: number | undefined; + runner.on('start', () => { + startMs = Date.now(); + }); + + const start = Date.now(); + const group: CiStatsReportTestsOptions['group'] = { + startTime: new Date(start).toJSON(), + durationMs: 0, + type: config.path.startsWith('x-pack') ? 'X-Pack Functional Tests' : 'Functional Tests', + name: Path.relative(REPO_ROOT, config.path), + meta: { + ciGroup: config.get('suiteTags.include').find((t: string) => t.startsWith('ciGroup')), + tags: [ + ...config.get('suiteTags.include'), + ...config.get('suiteTags.exclude').map((t: string) => `-${t}`), + ].filter((t) => !t.startsWith('ciGroup')), + }, + }; + + const testRuns: CiStatsReportTestsOptions['testRuns'] = []; + function trackRunnable( + runnable: Runnable, + { error, type }: { error?: Error; type: CiStatsTestType } + ) { + testRuns.push({ + startTime: new Date(Date.now() - (runnable.duration ?? 0)).toJSON(), + durationMs: runnable.duration ?? 0, + seq: testRuns.length + 1, + file: Path.relative(REPO_ROOT, runnable.file), + name: runnable.title, + suites: runnable.titlePath().slice(0, -1), + result: runnable.isFailed() ? 'fail' : runnable.isPending() ? 'skip' : 'pass', + type, + error: error?.stack, + stdout: getSnapshotOfRunnableLogs(runnable), + screenshots: testMetadata.getScreenshots(runnable).map((s) => ({ + base64Png: s.base64Png, + name: s.name, + })), + }); + } + + const errors = new Map(); + runner.on('fail', (test: Runnable, error: Error) => { + errors.set(test, error); + }); + + runner.on('hook end', (hook: Runnable) => { + if (hook.isFailed()) { + const error = errors.get(hook); + if (!error) { + throw new Error(`no error recorded for failed hook`); + } + + trackRunnable(hook, { + type: getHookType(hook), + error, + }); + } + }); + + runner.on('test end', (test: Runnable) => { + const error = errors.get(test); + if (test.isFailed() && !error) { + throw new Error('no error recorded for failed test'); + } + + trackRunnable(test, { + type: 'test', + error, + }); + }); + + runner.on('end', () => { + if (!startMs) { + throw new Error('startMs was not defined'); + } + + // update the durationMs + group.durationMs = Date.now() - startMs; + }); + + lifecycle.cleanup.add(async () => { + await reporter.reportTests({ + group, + testRuns, + }); + }); +} diff --git a/packages/kbn-test/src/functional_test_runner/lib/mocha/reporter/reporter.js b/packages/kbn-test/src/functional_test_runner/lib/mocha/reporter/reporter.js index d6045b71bf3a7..84299cba14eaa 100644 --- a/packages/kbn-test/src/functional_test_runner/lib/mocha/reporter/reporter.js +++ b/packages/kbn-test/src/functional_test_runner/lib/mocha/reporter/reporter.js @@ -9,7 +9,7 @@ import { format } from 'util'; import Mocha from 'mocha'; -import { ToolingLogTextWriter } from '@kbn/dev-utils'; +import { ToolingLogTextWriter, CiStatsReporter } from '@kbn/dev-utils'; import moment from 'moment'; import { recordLog, snapshotLogsForRunnable, setupJUnitReportGeneration } from '../../../../mocha'; @@ -17,11 +17,13 @@ import * as colors from './colors'; import * as symbols from './symbols'; import { ms } from './ms'; import { writeEpilogue } from './write_epilogue'; +import { setupCiStatsFtrTestGroupReporter } from './ci_stats_ftr_reporter'; export function MochaReporterProvider({ getService }) { const log = getService('log'); const config = getService('config'); - const failureMetadata = getService('failureMetadata'); + const lifecycle = getService('lifecycle'); + const testMetadata = getService('testMetadata'); let originalLogWriters; let reporterCaptureStartTime; @@ -45,9 +47,23 @@ export function MochaReporterProvider({ getService }) { if (config.get('junit.enabled') && config.get('junit.reportName')) { setupJUnitReportGeneration(runner, { reportName: config.get('junit.reportName'), - getTestMetadata: (t) => failureMetadata.get(t), }); } + + if (config.get('mochaReporter.sendToCiStats')) { + const reporter = CiStatsReporter.fromEnv(log); + if (!reporter.hasBuildConfig()) { + log.warning('ci-stats reporter config is not available so test results will not be sent'); + } else { + setupCiStatsFtrTestGroupReporter({ + reporter, + config, + lifecycle, + runner, + testMetadata, + }); + } + } } onStart = () => { diff --git a/packages/kbn-test/src/functional_test_runner/lib/test_metadata.ts b/packages/kbn-test/src/functional_test_runner/lib/test_metadata.ts new file mode 100644 index 0000000000000..5789231f87044 --- /dev/null +++ b/packages/kbn-test/src/functional_test_runner/lib/test_metadata.ts @@ -0,0 +1,41 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { Lifecycle } from './lifecycle'; + +export interface ScreenshotRecord { + name: string; + base64Png: string; + baselinePath?: string; + failurePath?: string; +} + +export class TestMetadata { + // mocha's global types mean we can't import Mocha or it will override the global jest types.............. + private currentRunnable?: any; + + constructor(lifecycle: Lifecycle) { + lifecycle.beforeEachRunnable.add((runnable) => { + this.currentRunnable = runnable; + }); + } + + addScreenshot(screenshot: ScreenshotRecord) { + this.currentRunnable._screenshots = (this.currentRunnable._screenshots || []).concat( + screenshot + ); + } + + getScreenshots(test: any): ScreenshotRecord[] { + if (!test || typeof test !== 'object' || !test._screenshots) { + return []; + } + + return test._screenshots.slice(); + } +} diff --git a/packages/kbn-test/src/functional_test_runner/public_types.ts b/packages/kbn-test/src/functional_test_runner/public_types.ts index 6cb6d5adf4b19..426fdda74d313 100644 --- a/packages/kbn-test/src/functional_test_runner/public_types.ts +++ b/packages/kbn-test/src/functional_test_runner/public_types.ts @@ -8,10 +8,10 @@ import type { ToolingLog } from '@kbn/dev-utils'; -import type { Config, Lifecycle, FailureMetadata, DockerServersService, EsVersion } from './lib'; +import type { Config, Lifecycle, TestMetadata, DockerServersService, EsVersion } from './lib'; import type { Test, Suite } from './fake_mocha_types'; -export { Lifecycle, Config, FailureMetadata }; +export { Lifecycle, Config, TestMetadata }; export interface AsyncInstance { /** @@ -57,7 +57,7 @@ export interface GenericFtrProviderContext< * @param serviceName */ hasService( - serviceName: 'config' | 'log' | 'lifecycle' | 'failureMetadata' | 'dockerServers' | 'esVersion' + serviceName: 'config' | 'log' | 'lifecycle' | 'testMetadata' | 'dockerServers' | 'esVersion' ): true; hasService(serviceName: K): serviceName is K; hasService(serviceName: string): serviceName is Extract; @@ -71,7 +71,7 @@ export interface GenericFtrProviderContext< getService(serviceName: 'log'): ToolingLog; getService(serviceName: 'lifecycle'): Lifecycle; getService(serviceName: 'dockerServers'): DockerServersService; - getService(serviceName: 'failureMetadata'): FailureMetadata; + getService(serviceName: 'testMetadata'): TestMetadata; getService(serviceName: 'esVersion'): EsVersion; getService(serviceName: T): ServiceMap[T]; diff --git a/packages/kbn-test/src/jest/ci_stats_jest_reporter.ts b/packages/kbn-test/src/jest/ci_stats_jest_reporter.ts new file mode 100644 index 0000000000000..94675d87a3a24 --- /dev/null +++ b/packages/kbn-test/src/jest/ci_stats_jest_reporter.ts @@ -0,0 +1,120 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import * as Path from 'path'; + +import getopts from 'getopts'; +import { CiStatsReporter, ToolingLog, CiStatsReportTestsOptions } from '@kbn/dev-utils'; +import type { Config } from '@jest/types'; +import { BaseReporter, Test, TestResult } from '@jest/reporters'; +import { ConsoleBuffer } from '@jest/console'; + +type LogEntry = ConsoleBuffer[0]; + +interface ReporterOptions { + testGroupType: string; +} + +function formatConsoleLine({ type, message, origin }: LogEntry) { + const originLines = origin.split('\n'); + + return `console.${type}: ${message}${originLines[0] ? `\n ${originLines[0]}` : ''}`; +} + +/** + * Jest reporter that reports tests to CI Stats + * @class JestJUnitReporter + */ + +// eslint-disable-next-line import/no-default-export +export default class CiStatsJestReporter extends BaseReporter { + private reporter: CiStatsReporter | undefined; + private readonly testGroupType: string; + private readonly reportName: string; + private readonly rootDir: string; + private startTime: number | undefined; + + private group: CiStatsReportTestsOptions['group'] | undefined; + private readonly testRuns: CiStatsReportTestsOptions['testRuns'] = []; + + constructor(config: Config.GlobalConfig, options: ReporterOptions) { + super(); + + this.rootDir = config.rootDir; + this.testGroupType = options?.testGroupType; + if (!this.testGroupType) { + throw new Error('missing testGroupType reporter option'); + } + + const configArg = getopts(process.argv).config; + if (typeof configArg !== 'string') { + throw new Error('expected to find a single --config arg'); + } + this.reportName = configArg; + } + + async onRunStart() { + const reporter = CiStatsReporter.fromEnv( + new ToolingLog({ + level: 'info', + writeTo: process.stdout, + }) + ); + + if (!reporter.hasBuildConfig()) { + return; + } + + this.startTime = Date.now(); + this.reporter = reporter; + this.group = { + name: this.reportName, + type: this.testGroupType, + startTime: new Date(this.startTime).toJSON(), + meta: {}, + durationMs: 0, + }; + } + + async onTestFileResult(_: Test, testResult: TestResult) { + if (!this.reporter || !this.group) { + return; + } + + let elapsedTime = 0; + for (const t of testResult.testResults) { + const startTime = new Date(testResult.perfStats.start + elapsedTime).toJSON(); + elapsedTime += t.duration ?? 0; + this.testRuns.push({ + startTime, + durationMs: t.duration ?? 0, + seq: this.testRuns.length + 1, + file: Path.relative(this.rootDir, testResult.testFilePath), + name: t.title, + result: t.status === 'failed' ? 'fail' : t.status === 'passed' ? 'pass' : 'skip', + suites: t.ancestorTitles, + type: 'test', + error: t.failureMessages.join('\n\n'), + stdout: testResult.console?.map(formatConsoleLine).join('\n'), + }); + } + } + + async onRunComplete() { + if (!this.reporter || !this.group || !this.testRuns.length || !this.startTime) { + return; + } + + this.group.durationMs = Date.now() - this.startTime; + + await this.reporter.reportTests({ + group: this.group, + testRuns: this.testRuns, + }); + } +} diff --git a/packages/kbn-test/src/mocha/index.ts b/packages/kbn-test/src/mocha/index.ts index 4ada51c7ae013..1be65d60a9842 100644 --- a/packages/kbn-test/src/mocha/index.ts +++ b/packages/kbn-test/src/mocha/index.ts @@ -11,7 +11,7 @@ export { setupJUnitReportGeneration } from './junit_report_generation'; // @ts-ignore not typed yet // @internal -export { recordLog, snapshotLogsForRunnable } from './log_cache'; +export { recordLog, snapshotLogsForRunnable, getSnapshotOfRunnableLogs } from './log_cache'; // @ts-ignore not typed yet // @internal export { escapeCdata } from './xml'; diff --git a/test/functional/services/common/screenshots.ts b/test/functional/services/common/screenshots.ts index 0f2ab8e6edfbe..d5f901300941f 100644 --- a/test/functional/services/common/screenshots.ts +++ b/test/functional/services/common/screenshots.ts @@ -22,7 +22,7 @@ const writeFileAsync = promisify(writeFile); export class ScreenshotsService extends FtrService { private readonly log = this.ctx.getService('log'); private readonly config = this.ctx.getService('config'); - private readonly failureMetadata = this.ctx.getService('failureMetadata'); + private readonly testMetadata = this.ctx.getService('testMetadata'); private readonly browser = this.ctx.getService('browser'); private readonly SESSION_DIRECTORY = resolve(this.config.get('screenshots.directory'), 'session'); @@ -51,11 +51,17 @@ export class ScreenshotsService extends FtrService { async compareAgainstBaseline(name: string, updateBaselines: boolean, el?: WebElementWrapper) { this.log.debug('compareAgainstBaseline'); const sessionPath = resolve(this.SESSION_DIRECTORY, `${name}.png`); - await this.capture(sessionPath, el); - const baselinePath = resolve(this.BASELINE_DIRECTORY, `${name}.png`); const failurePath = resolve(this.FAILURE_DIRECTORY, `${name}.png`); + await this.capture({ + path: sessionPath, + name, + el, + baselinePath, + failurePath, + }); + if (updateBaselines) { this.log.debug('Updating baseline snapshot'); // Make the directory if it doesn't exist @@ -76,22 +82,42 @@ export class ScreenshotsService extends FtrService { async take(name: string, el?: WebElementWrapper, subDirectories: string[] = []) { const path = resolve(this.SESSION_DIRECTORY, ...subDirectories, `${name}.png`); - await this.capture(path, el); - this.failureMetadata.addScreenshot(name, path); + await this.capture({ path, name, el }); } async takeForFailure(name: string, el?: WebElementWrapper) { const path = resolve(this.FAILURE_DIRECTORY, `${name}.png`); - await this.capture(path, el); - this.failureMetadata.addScreenshot(`failure[${name}]`, path); + await this.capture({ + path, + name: `failure[${name}]`, + el, + }); } - private async capture(path: string, el?: WebElementWrapper) { + private async capture({ + path, + el, + name, + baselinePath, + failurePath, + }: { + path: string; + name: string; + el?: WebElementWrapper; + baselinePath?: string; + failurePath?: string; + }) { try { this.log.info(`Taking screenshot "${path}"`); const screenshot = await (el ? el.takeScreenshot() : this.browser.takeScreenshot()); await mkdirAsync(dirname(path), { recursive: true }); await writeFileAsync(path, screenshot, 'base64'); + this.testMetadata.addScreenshot({ + name, + base64Png: Buffer.isBuffer(screenshot) ? screenshot.toString('base64') : screenshot, + baselinePath, + failurePath, + }); } catch (err) { this.log.error('SCREENSHOT FAILED'); this.log.error(err); From a5b4b822ce9abfb0b7976cc6ce09aa6cb060c8de Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Fri, 4 Feb 2022 03:27:39 +0000 Subject: [PATCH 28/68] chore(NA): splits types from code on @kbn/test (#124469) * chore(NA): splits types from code on @kbn/test * chore(NA): create new @kbn/test-jest-helpers * chore(NA): move wrong files into @kbn/test * chore(NA): remove @kbn/test/jest references Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- package.json | 3 + packages/BUILD.bazel | 3 + .../elastic-eslint-config-kibana/.eslintrc.js | 5 + packages/kbn-es-archiver/BUILD.bazel | 2 +- packages/kbn-i18n/GUIDELINE.md | 2 +- packages/kbn-test-jest-helpers/BUILD.bazel | 182 ++++++++++++++++++ .../jest.config.js} | 6 +- packages/kbn-test-jest-helpers/package.json | 10 + .../src}/enzyme_helpers.tsx | 3 +- .../src}/find_test_subject.ts | 1 + .../src}/index.ts | 2 - .../src}/jsdom_svg_mocks.ts | 0 .../src}/random.ts | 1 + .../src}/redux_helpers.tsx | 0 .../src}/router_helpers.tsx | 0 .../src}/stub_browser_storage.test.ts | 0 .../src}/stub_browser_storage.ts | 0 .../src}/stub_web_worker.ts | 0 .../src}/testbed/README.md | 0 .../src}/testbed/index.ts | 1 + .../src}/testbed/mount_component.tsx | 1 + .../src}/testbed/testbed.ts | 3 +- .../src}/testbed/types.ts | 1 + packages/kbn-test-jest-helpers/tsconfig.json | 16 ++ packages/kbn-test/BUILD.bazel | 29 ++- packages/kbn-test/jest/package.json | 4 - packages/kbn-test/package.json | 1 - packages/kbn-test/src/index.ts | 2 +- .../src/jest/{utils => }/get_url.test.ts | 0 .../kbn-test/src/jest/{utils => }/get_url.ts | 0 .../application/ui/app_container.test.tsx | 2 +- .../chrome/ui/header/collapsible_nav.test.tsx | 2 +- .../public/chrome/ui/header/header.test.tsx | 2 +- .../status/components/status_badge.test.tsx | 2 +- .../status/components/version_header.test.tsx | 2 +- .../fatal_errors/fatal_errors_screen.test.tsx | 2 +- .../notifications/toasts/error_toast.test.tsx | 2 +- .../public/theme/core_theme_provider.test.tsx | 2 +- .../server/preboot/preboot_service.test.ts | 2 +- .../page_footer/page_footer.test.tsx | 2 +- .../page_subtitle/page_subtitle.test.tsx | 2 +- .../page_title/page_title.test.tsx | 2 +- .../management_app/advanced_settings.test.tsx | 2 +- .../components/field/field.test.tsx | 2 +- .../components/form/form.test.tsx | 2 +- .../components/search/search.test.tsx | 2 +- .../components/gauge_component.test.tsx | 2 +- .../components/heatmap_component.test.tsx | 2 +- .../public/utils/get_color_picker.test.tsx | 2 +- .../legacy/console_editor/editor.test.tsx | 2 +- .../library_notification_popover.test.tsx | 2 +- .../embeddable/dashboard_container.test.tsx | 2 +- .../dashboard_empty_screen.test.tsx | 2 +- .../embeddable/grid/dashboard_grid.test.tsx | 2 +- .../viewport/dashboard_viewport.test.tsx | 2 +- .../application/top_nav/clone_modal.test.js | 2 +- .../application/top_nav/save_modal.test.js | 2 +- .../query_string/query_string_manager.test.ts | 2 +- .../state_sync/connect_to_query_state.test.ts | 2 +- .../state_sync/sync_state_with_url.test.ts | 2 +- .../filter_editor/filter_editor.test.tsx | 2 +- .../language_switcher.test.tsx | 2 +- .../no_data_popover.test.tsx | 2 +- .../shard_failure_description.test.tsx | 2 +- .../shard_failure_modal.test.tsx | 2 +- .../shard_failure_open_modal_button.test.tsx | 2 +- .../shard_failure_table.test.tsx | 2 +- .../components/data_view.test.tsx | 2 +- .../empty_index_list_prompt.test.tsx | 2 +- .../empty_index_pattern_prompt.test.tsx | 2 +- .../public/test_utils/test_utils.ts | 6 +- .../field_editor.helpers.ts | 2 +- .../field_editor_flyout_content.helpers.ts | 2 +- .../field_editor_flyout_preview.helpers.ts | 2 +- .../helpers/common_actions.ts | 2 +- .../client_integration/helpers/index.ts | 4 +- .../editors/color/color.test.tsx | 2 +- .../static_lookup/static_lookup.test.tsx | 2 +- .../samples/samples.test.tsx | 2 +- .../public/plugin.test.tsx | 2 +- .../components/action_bar/action_bar.test.tsx | 2 +- .../context_error_message.test.tsx | 2 +- .../application/context/context_app.test.tsx | 2 +- .../context/context_app_content.test.tsx | 2 +- .../application/doc/components/doc.test.tsx | 2 +- .../components/chart/discover_chart.test.tsx | 2 +- .../main/components/chart/histogram.test.tsx | 2 +- .../document_explorere_callout.test.tsx | 2 +- .../hits_counter/hits_counter.test.tsx | 2 +- .../layout/discover_documents.test.tsx | 2 +- .../layout/discover_layout.test.tsx | 2 +- .../loading_spinner/loading_spinner.test.tsx | 2 +- .../components/no_results/no_results.test.tsx | 2 +- .../sidebar/change_indexpattern.test.tsx | 2 +- .../sidebar/discover_field.test.tsx | 2 +- .../sidebar/discover_field_details.test.tsx | 2 +- .../sidebar/discover_field_search.test.tsx | 2 +- .../sidebar/discover_index_pattern.test.tsx | 2 +- ...discover_index_pattern_management.test.tsx | 2 +- .../sidebar/discover_sidebar.test.tsx | 2 +- .../discover_sidebar_responsive.test.tsx | 2 +- .../skip_bottom_button.test.tsx | 2 +- .../top_nav/discover_topnav.test.tsx | 2 +- .../top_nav/open_options_popover.test.tsx | 2 +- .../main/discover_main_app.test.tsx | 2 +- .../discover_grid/discover_grid.test.tsx | 2 +- .../discover_grid_cell_actions.test.tsx | 2 +- .../discover_grid_document_selection.test.tsx | 2 +- .../discover_grid_expand_button.test.tsx | 2 +- .../discover_grid_flyout.test.tsx | 2 +- .../table_header/table_header.test.tsx | 2 +- .../doc_table/components/table_row.test.tsx | 2 +- .../doc_table/doc_table_wrapper.test.tsx | 2 +- .../doc_viewer_source/source.test.tsx | 2 +- .../doc_viewer_table/legacy/table.test.tsx | 2 +- ...saved_search_url_conflict_callout.test.tsx | 2 +- .../public/utils/with_query_params.test.tsx | 2 +- .../embeddable_child_panel.test.tsx | 2 +- .../lib/panel/embeddable_panel.test.tsx | 2 +- .../add_panel/add_panel_flyout.test.tsx | 2 +- .../saved_object_finder_create_new.test.tsx | 2 +- .../customize_panel_action.test.ts | 2 +- .../tests/customize_panel_modal.test.tsx | 2 +- .../cron_editor/cron_editor.test.tsx | 2 +- .../forms/hook_form_lib/shared_imports.ts | 7 +- .../components/add_data/add_data.test.tsx | 2 +- .../manage_data/manage_data.test.tsx | 2 +- .../components/recently_accessed.test.js | 2 +- .../tutorial/instruction_set.test.js | 2 +- .../components/tutorial/introduction.test.js | 2 +- .../tutorial/saved_objects_installer.test.js | 2 +- .../components/tutorial/tutorial.test.js | 2 +- .../components/editor/controls_tab.test.tsx | 2 +- .../editor/list_control_editor.test.tsx | 2 +- .../components/editor/options_tab.test.tsx | 2 +- .../editor/range_control_editor.test.tsx | 2 +- .../components/vis/input_control_vis.test.tsx | 2 +- .../components/vis/list_control.test.tsx | 2 +- .../components/vis/range_control.test.tsx | 2 +- .../public/ui/inspector_panel.test.tsx | 2 +- .../theme/kibana_theme_provider.test.tsx | 2 +- .../server/elasticsearch_service.test.ts | 2 +- .../components/add_data/add_data.test.tsx | 2 +- .../manage_data/manage_data.test.tsx | 2 +- .../components/news_feed/news_feed.test.tsx | 2 +- .../components/overview/overview.test.tsx | 2 +- .../public/code_editor/code_editor.test.tsx | 2 +- .../overview_page_footer.test.tsx | 2 +- .../no_data_page/no_data_page.test.tsx | 2 +- .../table_list_view/table_list_view.test.tsx | 2 +- .../theme/kibana_theme_provider.test.tsx | 2 +- .../url/kbn_url_tracker.test.ts | 2 +- .../state_management/url/url_tracker.test.ts | 2 +- .../public/state_sync/state_sync.test.ts | 2 +- ...eate_session_storage_state_storage.test.ts | 2 +- .../hashed_item_store.test.ts | 2 +- .../public/storage/hashed_item_store/mock.ts | 2 +- .../theme/kibana_theme_provider.test.tsx | 2 +- .../public/top_nav_menu/top_nav_menu.test.tsx | 2 +- .../top_nav_menu/top_nav_menu_item.test.tsx | 2 +- .../saved_object_save_modal.test.tsx | 2 +- .../object_view/components/inspect.test.tsx | 2 +- .../object_view/saved_object_view.test.tsx | 2 +- .../components/delete_confirm_modal.test.tsx | 2 +- .../components/export_modal.test.tsx | 2 +- .../objects_table/components/flyout.test.tsx | 2 +- .../components/import_mode_control.test.tsx | 2 +- .../components/import_summary.test.tsx | 2 +- .../components/overwrite_modal.test.tsx | 2 +- .../components/relationships.test.tsx | 2 +- .../objects_table/components/table.test.tsx | 2 +- .../saved_objects_table.test.tsx | 2 +- .../public/components/opt_in_banner.test.tsx | 2 +- .../public/components/opt_in_message.test.tsx | 2 +- .../opted_in_notice_banner.test.tsx | 2 +- .../components/opt_in_example_flyout.test.tsx | 2 +- .../telemetry_management_section.test.tsx | 4 +- .../number_list/number_list.test.tsx | 2 +- .../components/controls/date_ranges.test.tsx | 2 +- .../controls/palette_picker.test.tsx | 2 +- .../components/controls/percentiles.test.tsx | 2 +- .../public/components/controls/size.test.tsx | 2 +- .../controls/top_aggregate.test.tsx | 2 +- .../options/long_legend_options.test.tsx | 2 +- .../options/percentage_mode.test.tsx | 2 +- .../public/editor/components/heatmap.test.tsx | 2 +- .../pie/public/editor/components/pie.test.tsx | 2 +- .../components/truncate_labels.test.tsx | 2 +- .../components/add_delete_buttons.test.tsx | 2 +- .../components/aggs/agg_select.test.tsx | 2 +- .../components/aggs/filter_ratio.test.js | 2 +- .../components/aggs/histogram_support.test.js | 2 +- .../percentile_rank/multi_value_row.test.tsx | 2 +- .../components/aggs/percentile_ui.test.tsx | 2 +- .../components/color_rules.test.tsx | 2 +- .../components/palette_picker.test.tsx | 2 +- .../panel_config/timeseries.test.tsx | 2 +- .../components/vis_types/gauge/series.test.js | 2 +- .../vis_types/metric/series.test.js | 2 +- .../public/vislib/lib/chart_title.test.js | 2 +- .../vislib/public/vislib/lib/dispatch.test.js | 2 +- .../vislib/public/vislib/lib/handler.test.js | 2 +- .../public/vislib/lib/layout/layout.test.js | 2 +- .../vislib/public/vislib/vis.test.js | 2 +- .../vislib/visualizations/chart.test.js | 2 +- .../vislib/visualizations/gauge_chart.test.js | 2 +- .../vislib/visualizations/pie_chart.test.js | 2 +- .../point_series/heatmap_chart.test.js | 2 +- .../common/truncate_labels.test.tsx | 2 +- .../metrics_axes/value_axes_panel.test.tsx | 2 +- .../point_series/point_series.test.tsx | 2 +- .../xy/public/utils/get_color_picker.test.tsx | 2 +- .../visualize_editor_common.test.tsx | 2 +- .../agg_based_selection.test.tsx | 2 +- .../group_selection/group_selection.test.tsx | 2 +- .../public/wizard/new_vis_modal.test.tsx | 2 +- .../empty_value/empty_value.test.tsx | 2 +- x-pack/plugins/cloud/public/plugin.test.ts | 2 +- .../fixtures/auto_follow_pattern.ts | 2 +- .../fixtures/follower_index.ts | 2 +- .../follower_indices_list.test.js | 2 +- .../auto_follow_pattern_add.helpers.js | 2 +- .../auto_follow_pattern_edit.helpers.js | 2 +- .../auto_follow_pattern_list.helpers.js | 2 +- .../helpers/follower_index_add.helpers.js | 2 +- .../helpers/follower_index_edit.helpers.js | 2 +- .../helpers/follower_index_list.helpers.js | 2 +- .../helpers/home.helpers.js | 2 +- .../client_integration/helpers/index.js | 2 +- ...onnected_search_session_indicator.test.tsx | 2 +- .../components/edit_flyout/overrides.test.js | 2 +- .../analytics/analytics_logic.test.ts | 2 +- .../test_helpers/shared_columns_tests.tsx | 2 +- .../api_logs/api_logs_logic.test.ts | 2 +- .../add_domain/add_domain_logic.test.ts | 2 +- .../automatic_crawl_scheduler_logic.test.ts | 2 +- .../manage_crawls_popover_logic.test.ts | 2 +- .../crawler/crawl_detail_logic.test.ts | 2 +- .../crawler/crawler_domains_logic.test.ts | 2 +- .../components/crawler/crawler_logic.test.ts | 2 +- .../crawler_single_domain_logic.test.ts | 2 +- .../credentials/credentials_logic.test.ts | 2 +- .../components/suggestions_logic.test.tsx | 2 +- .../curations/curation/curation_logic.test.ts | 2 +- .../curations/curations_logic.test.ts | 2 +- .../curation_suggestion_logic.test.ts | 2 +- .../ignored_queries_logic.test.ts | 2 +- .../curations_settings.test.tsx | 2 +- .../curations_settings_logic.test.ts | 2 +- .../document_creation_logic.test.ts | 2 +- .../documents/document_detail_logic.test.ts | 2 +- .../components/engine/engine_logic.test.ts | 2 +- .../engine_creation_logic.test.ts | 2 +- .../engine_overview_logic.test.ts | 2 +- .../components/engines/engines_logic.test.ts | 2 +- .../log_retention/log_retention_logic.test.ts | 2 +- .../meta_engine_creation_logic.test.ts | 2 +- .../relevance_tuning_logic.test.ts | 2 +- .../result_settings_logic.test.ts | 2 +- .../sample_response_logic.test.ts | 2 +- .../role_mappings/role_mappings_logic.test.ts | 2 +- .../sample_engine_creation_cta_logic.test.ts | 2 +- .../reindex_job/reindex_job_logic.test.ts | 2 +- .../schema/schema_base_logic.test.ts | 2 +- .../components/schema/schema_logic.test.ts | 2 +- .../components/search/search_logic.test.ts | 2 +- .../search_ui/search_ui_logic.test.ts | 2 +- .../source_engines_logic.test.ts | 2 +- .../synonyms/synonyms_logic.test.ts | 2 +- .../recursively_fetch_engines/index.test.ts | 2 +- ...dpoint_inline_editable_table_logic.test.ts | 2 +- .../test_helpers/error_handling.ts | 2 +- .../views/api_keys/api_keys_logic.test.ts | 2 +- .../add_source/add_source_logic.test.ts | 2 +- .../display_settings_logic.test.ts | 2 +- .../components/schema/schema_logic.test.ts | 2 +- .../synchronization_logic.test.ts | 2 +- .../views/groups/group_logic.test.ts | 2 +- .../views/groups/groups_logic.test.ts | 2 +- .../oauth_authorize_logic.test.ts | 2 +- .../role_mappings/role_mappings_logic.test.ts | 2 +- .../search_authorize_logic.test.ts | 2 +- .../views/security/security_logic.test.ts | 2 +- .../components/branding_section.test.tsx | 2 +- .../views/settings/settings_logic.test.ts | 2 +- .../agent_enrollment_flyout.test.tsx | 2 +- .../public/services/utils.test.ts | 2 +- .../public/components/search_bar.test.tsx | 2 +- .../components/settings/settings.test.tsx | 2 +- .../client_integration/app/app.helpers.tsx | 2 +- .../edit_policy/features/edit_warning.test.ts | 2 +- .../edit_policy/features/frozen_phase.test.ts | 2 +- .../cloud_aware_behavior.helpers.ts | 2 +- .../form_validation/validation.helpers.ts | 2 +- .../edit_policy/init_test_bed.tsx | 2 +- .../helpers/actions/errors_actions.ts | 2 +- .../helpers/actions/forcemerge_actions.ts | 2 +- .../helpers/actions/form_set_value_action.ts | 2 +- .../helpers/actions/form_toggle_action.ts | 2 +- .../form_toggle_and_set_value_action.ts | 2 +- .../helpers/actions/index_priority_actions.ts | 2 +- .../helpers/actions/min_age_actions.ts | 2 +- .../actions/node_allocation_actions.ts | 2 +- .../helpers/actions/phases.ts | 2 +- .../helpers/actions/readonly_actions.ts | 2 +- .../helpers/actions/replicas_action.ts | 2 +- .../helpers/actions/request_flyout_actions.ts | 2 +- .../helpers/actions/rollover_actions.ts | 2 +- .../helpers/actions/save_policy_action.ts | 2 +- .../actions/searchable_snapshot_actions.ts | 2 +- .../helpers/actions/shrink_actions.ts | 2 +- .../actions/snapshot_policy_actions.ts | 2 +- .../helpers/actions/toggle_phase_action.ts | 2 +- .../__jest__/extend_index_management.test.tsx | 2 +- .../__jest__/policy_table.test.tsx | 2 +- .../client_integration/helpers/index.ts | 4 +- .../home/data_streams_tab.helpers.ts | 7 +- .../client_integration/home/home.helpers.ts | 2 +- .../client_integration/home/home.test.ts | 2 +- .../home/index_templates_tab.helpers.ts | 7 +- .../home/indices_tab.helpers.ts | 7 +- .../home/indices_tab.test.ts | 2 +- .../template_clone.helpers.ts | 2 +- .../template_create.helpers.ts | 2 +- .../template_edit.helpers.ts | 2 +- .../template_form.helpers.ts | 2 +- .../__jest__/components/index_table.test.js | 2 +- .../component_template_create.helpers.ts | 2 +- .../component_template_details.helpers.ts | 2 +- .../component_template_edit.helpers.ts | 2 +- .../component_template_form.helpers.ts | 2 +- .../component_template_list.helpers.ts | 2 +- .../client_integration/helpers/index.ts | 2 +- .../client_integration/helpers/index.ts | 4 +- .../helpers/mappings_editor.helpers.tsx | 2 +- .../load_mappings_provider.test.tsx | 2 +- .../test/fixtures/template.ts | 2 +- .../inventory/components/expression.test.tsx | 2 +- .../components/expression.test.tsx | 2 +- .../components/expression.test.tsx | 2 +- .../components/expression_chart.test.tsx | 2 +- .../components/expression_row.test.tsx | 2 +- .../logs/log_view_configuration.test.tsx | 2 +- .../metric_detail/hooks/metrics_time.test.tsx | 2 +- .../client_integration/helpers/index.ts | 2 +- .../helpers/pipeline_form.helpers.ts | 2 +- .../helpers/pipelines_clone.helpers.ts | 2 +- .../helpers/pipelines_create.helpers.ts | 2 +- .../pipelines_create_from_csv.helpers.ts | 2 +- .../helpers/pipelines_edit.helpers.ts | 2 +- .../helpers/pipelines_list.helpers.ts | 7 +- .../pipeline_processors_editor.helpers.tsx | 2 +- .../__jest__/processors/processor.helpers.tsx | 4 +- .../__jest__/test_pipeline.helpers.tsx | 4 +- .../load_from_json/modal_provider.test.tsx | 2 +- .../components/cell_value.test.tsx | 2 +- .../components/dimension_editor.test.tsx | 2 +- .../components/table_basic.test.tsx | 2 +- .../components/toolbar.test.tsx | 2 +- .../debounced_component.test.tsx | 2 +- .../datapanel.test.tsx | 2 +- .../dimension_panel/dimension_panel.test.tsx | 2 +- .../dimension_panel/reference_editor.test.tsx | 2 +- .../field_item.test.tsx | 2 +- .../fields_accordion.test.tsx | 2 +- .../layerpanel.test.tsx | 2 +- .../dimension_editor.test.tsx | 2 +- .../plugins/lens/public/mocks/store_mocks.tsx | 2 +- .../get_legend_action.test.tsx | 2 +- .../axis_title_settings.test.tsx | 2 +- .../color_ranges/color_ranges.test.tsx | 2 +- .../coloring/palette_configuration.test.tsx | 2 +- .../legend_location_settings.test.tsx | 2 +- .../legend_settings_popover.test.tsx | 2 +- .../value_labels_settings.test.tsx | 2 +- .../toolbar_component/gauge_toolbar.test.tsx | 2 +- .../xy_visualization/expression.test.tsx | 2 +- .../get_legend_action.test.tsx | 2 +- .../axis_settings_popover.test.tsx | 2 +- .../fill_opacity_option.test.tsx | 2 +- .../line_curve_option.test.tsx | 2 +- .../missing_value_option.test.tsx | 2 +- .../visual_options_popover.test.tsx | 2 +- .../xy_config_panel/xy_config_panel.test.tsx | 2 +- .../__jest__/upload_license.test.tsx | 2 +- .../license_management/__jest__/util/util.js | 2 +- .../pipeline_editor/pipeline_editor.test.js | 2 +- .../pipeline_list/add_role_alert.test.js | 2 +- .../pipeline_list/alert_call_out.test.js | 2 +- .../confirm_delete_modal.test.js | 2 +- .../enable_monitoring_alert.test.js | 2 +- .../pipeline_list/pipeline_list.test.js | 2 +- .../pipeline_list/pipelines_table.test.js | 2 +- .../index.test.tsx | 2 +- .../annotations_table.test.js | 2 +- .../anomalies_table/anomaly_details.test.js | 2 +- .../entity_cell/entity_cell.test.tsx | 2 +- .../full_time_range_selector.test.tsx | 2 +- .../rule_editor/actions_section.test.js | 2 +- .../detector_description_list.test.js | 2 +- .../rule_editor/condition_expression.test.js | 2 +- .../rule_editor/conditions_section.test.js | 2 +- .../rule_editor/rule_editor_flyout.test.js | 2 +- .../rule_editor/scope_expression.test.js | 2 +- .../rule_editor/scope_section.test.js | 2 +- .../add_to_filter_list_link.test.js | 2 +- .../delete_rule_modal.test.js | 2 +- .../edit_condition_link.test.js | 2 +- .../rule_action_panel.test.js | 2 +- .../validate_job/validate_job_view.test.js | 2 +- .../use_create_analytics_form.test.tsx | 2 +- .../explorer_chart_distribution.test.js | 2 +- .../explorer_chart_info_tooltip.test.js | 2 +- .../explorer_chart_single_metric.test.js | 2 +- .../edit/calendar_form/calendar_form.test.js | 2 +- .../edit/events_table/events_table.test.js | 2 +- .../edit/import_modal/import_modal.test.js | 2 +- .../imported_events/imported_events.test.js | 2 +- .../calendars/edit/new_calendar.test.js | 2 +- .../new_event_modal/new_event_modal.test.js | 2 +- .../calendars/list/calendars_list.test.js | 2 +- .../settings/calendars/list/header.test.js | 2 +- .../calendars/list/table/table.test.js | 2 +- .../add_item_popover/add_item_popover.test.js | 2 +- .../delete_filter_list_modal.test.js | 2 +- .../edit_description_popover.test.js | 2 +- .../edit/edit_filter_list.test.js | 2 +- .../settings/filter_lists/edit/header.test.js | 2 +- .../filter_lists/edit/toolbar.test.js | 2 +- .../filter_lists/list/filter_lists.test.js | 2 +- .../settings/filter_lists/list/header.test.js | 2 +- .../settings/filter_lists/list/table.test.js | 2 +- .../application/settings/settings.test.tsx | 2 +- .../timeseries_chart/timeseries_chart.test.js | 2 +- .../public/alerts/alert_form.test.tsx | 2 +- .../cluster/overview/helpers.test.js | 2 +- .../elasticsearch/nodes/cells.test.js | 2 +- .../components/no_data/checker_errors.test.js | 2 +- .../collection_enabled.test.js | 2 +- .../collection_interval.test.js | 2 +- .../explanations/exporters/exporters.test.js | 2 +- .../plugin_enabled/plugin_enabled.test.js | 2 +- .../public/components/no_data/no_data.test.js | 2 +- .../no_data/reasons/reason_found.test.js | 2 +- .../no_data/reasons/we_tried.test.js | 2 +- .../page_loading/page_loading.test.js | 2 +- .../summary_status/summary_status.test.js | 2 +- .../add/remote_clusters_add.helpers.tsx | 2 +- .../add/remote_clusters_add.test.ts | 2 +- .../edit/remote_clusters_edit.helpers.tsx | 2 +- .../edit/remote_clusters_edit.test.tsx | 2 +- .../client_integration/helpers/index.ts | 2 +- .../helpers/remote_clusters_actions.ts | 2 +- .../list/remote_clusters_list.helpers.js | 2 +- .../fixtures/remote_cluster.js | 2 +- .../__test__/report_listing.test.helpers.tsx | 2 +- .../reporting_panel_content.test.tsx | 2 +- x-pack/plugins/rollup/fixtures/job.js | 2 +- .../detail_panel/detail_panel.test.js | 2 +- .../sections/job_list/job_list.test.js | 2 +- .../job_list/job_table/job_table.test.js | 2 +- .../test/client_integration/helpers/index.js | 2 +- .../helpers/job_clone.helpers.js | 2 +- .../helpers/job_create.helpers.js | 2 +- .../helpers/job_list.helpers.js | 2 +- .../runtime_fields/public/test_utils.ts | 4 +- .../empty_tree_placeholder.test.tsx | 2 +- .../highlight_details_flyout.test.tsx | 2 +- .../license_warning_notice.test.ts | 2 +- .../profile_loading_placeholder.test.tsx | 2 +- .../editor/editor.test.tsx | 2 +- .../__jest__/profile_tree.test.tsx | 2 +- .../searchprofiler_tabs.test.ts | 2 +- .../account_management_page.test.tsx | 2 +- .../access_agreement_page.test.tsx | 2 +- .../authentication_state_page.test.tsx | 2 +- .../logged_out/logged_out_page.test.tsx | 2 +- .../components/login_form/login_form.test.tsx | 2 +- .../authentication/login/login_page.test.tsx | 2 +- .../overwritten_session_page.test.tsx | 2 +- .../role_combo_box/role_combo_box.test.tsx | 2 +- .../delete_provider/delete_provider.test.tsx | 2 +- .../section_loading/section_loading.test.tsx | 2 +- .../edit_role_mapping_page.test.tsx | 4 +- .../mapping_info_panel.test.tsx | 2 +- .../add_role_template_button.test.tsx | 2 +- .../role_selector/role_selector.test.tsx | 2 +- .../role_template_editor.test.tsx | 2 +- .../add_rule_button.test.tsx | 2 +- .../field_rule_editor.test.tsx | 2 +- .../json_rule_editor.test.tsx | 4 +- .../rule_editor_panel.test.tsx | 4 +- .../rule_group_editor.test.tsx | 2 +- .../visual_rule_editor.test.tsx | 2 +- .../role_mappings_grid_page.test.tsx | 2 +- .../collapsible_panel.test.tsx | 2 +- .../edit_role/delete_role_button.test.tsx | 2 +- .../roles/edit_role/edit_role_page.test.tsx | 2 +- .../privileges/es/cluster_privileges.test.tsx | 2 +- .../es/elasticsearch_privileges.test.tsx | 2 +- .../es/index_privilege_form.test.tsx | 2 +- .../privileges/es/index_privileges.test.tsx | 2 +- .../feature_table/__fixtures__/index.ts | 2 +- .../feature_table/feature_table.test.tsx | 2 +- .../feature_table_expanded_row.test.tsx | 2 +- .../feature_table/sub_feature_form.test.tsx | 2 +- .../feature_table_cell.test.tsx | 2 +- .../privilege_summary/__fixtures__/index.ts | 2 +- .../privilege_summary.test.tsx | 2 +- .../privilege_summary_table.test.tsx | 2 +- .../space_column_header.test.tsx | 2 +- .../privilege_display.test.tsx | 2 +- .../privilege_space_form.test.tsx | 2 +- .../privilege_space_table.test.tsx | 2 +- .../space_aware_privilege_section.test.tsx | 2 +- .../spaces_popover_list.test.tsx | 2 +- .../roles/roles_grid/roles_grid_page.test.tsx | 2 +- .../change_password_form.test.tsx | 2 +- .../confirm_delete_users.test.tsx | 2 +- .../users/users_grid/users_grid_page.test.tsx | 2 +- .../nav_control_component.test.tsx | 2 +- .../nav_control/nav_control_service.test.ts | 2 +- .../security_checkup_service.test.ts | 2 +- .../authorization_service.test.ts | 2 +- .../elasticsearch_service.test.ts | 2 +- .../session_management_service.test.ts | 2 +- .../empty_value/empty_value.test.tsx | 2 +- .../exceptions/error_callout.test.tsx | 2 +- .../viewer/exceptions_utility.test.tsx | 2 +- .../common/components/links/index.test.tsx | 2 +- .../components/ml_popover/ml_popover.test.tsx | 2 +- .../delete_timeline_modal.test.tsx | 2 +- .../delete_timeline_modal/index.test.tsx | 2 +- .../note_previews/index.test.tsx | 2 +- .../open_timeline/open_timeline.test.tsx | 2 +- .../open_timeline_modal_body.test.tsx | 2 +- .../open_timeline/search_row/index.test.tsx | 2 +- .../timelines_table/actions_columns.test.tsx | 2 +- .../timelines_table/common_columns.test.tsx | 2 +- .../timelines_table/extended_columns.test.tsx | 2 +- .../icon_header_columns.test.tsx | 2 +- .../timelines_table/index.test.tsx | 2 +- .../open_timeline/title_row/index.test.tsx | 2 +- .../helpers/home.helpers.ts | 2 +- .../client_integration/helpers/index.ts | 4 +- .../helpers/policy_add.helpers.ts | 2 +- .../helpers/policy_edit.helpers.ts | 2 +- .../helpers/policy_form.helpers.ts | 2 +- .../helpers/repository_add.helpers.ts | 2 +- .../helpers/repository_edit.helpers.ts | 2 +- .../helpers/restore_snapshot.helpers.ts | 2 +- .../helpers/snapshot_list.helpers.ts | 2 +- .../snapshot_restore/test/fixtures/policy.ts | 2 +- .../test/fixtures/repository.ts | 2 +- .../test/fixtures/snapshot.ts | 2 +- .../advanced_settings_subtitle.test.tsx | 2 +- .../advanced_settings_title.test.tsx | 2 +- .../components/copy_mode_control.test.tsx | 2 +- .../copy_to_space_flyout_internal.test.tsx | 2 +- .../components/resolve_all_conflicts.test.tsx | 2 +- .../legacy_url_conflict_internal.test.tsx | 2 +- .../confirm_delete_modal.test.tsx | 2 +- .../unauthorized_prompt.test.tsx | 2 +- .../confirm_alter_active_space_modal.test.tsx | 2 +- .../customize_space/customize_space.test.tsx | 2 +- .../customize_space_avatar.test.tsx | 2 +- .../edit_space/delete_spaces_button.test.tsx | 2 +- .../enabled_features.test.tsx | 2 +- .../edit_space/manage_space_page.test.tsx | 2 +- .../edit_space/reserved_space_badge.test.tsx | 2 +- .../section_panel/section_panel.test.tsx | 2 +- .../spaces_grid/spaces_grid_page.test.tsx | 2 +- .../components/manage_spaces_button.test.tsx | 2 +- .../nav_control/nav_control_popover.test.tsx | 2 +- .../share_to_space_flyout_internal.test.tsx | 2 +- .../space_list/space_list_internal.test.tsx | 2 +- .../space_selector/space_selector.test.tsx | 2 +- .../spaces_manager/spaces_manager.test.ts | 2 +- .../default_space_service.test.ts | 2 +- .../components/index_select_popover.test.tsx | 2 +- .../alert_types/es_query/expression.test.tsx | 2 +- .../alert_types/threshold/expression.test.tsx | 2 +- .../threshold/visualization.test.tsx | 2 +- .../empty_value/empty_value.test.tsx | 2 +- .../components/add_message_variables.test.tsx | 2 +- .../email/email_connector.test.tsx | 2 +- .../email/email_params.test.tsx | 2 +- .../email/exchange_form.test.tsx | 2 +- .../es_index/es_index_connector.test.tsx | 2 +- .../es_index/es_index_params.test.tsx | 2 +- .../jira/jira_connectors.test.tsx | 2 +- .../pagerduty/pagerduty_connectors.test.tsx | 2 +- .../pagerduty/pagerduty_params.test.tsx | 2 +- .../resilient/resilient_connectors.test.tsx | 2 +- .../server_log/server_log_params.test.tsx | 2 +- .../servicenow/servicenow_connectors.test.tsx | 2 +- .../servicenow_itsm_params.test.tsx | 2 +- .../servicenow/servicenow_sir_params.test.tsx | 2 +- .../servicenow/update_connector.test.tsx | 2 +- .../slack/slack_connectors.test.tsx | 2 +- .../slack/slack_params.test.tsx | 2 +- .../swimlane/swimlane_connectors.test.tsx | 2 +- .../swimlane/swimlane_params.test.tsx | 2 +- .../teams/teams_connectors.test.tsx | 2 +- .../teams/teams_params.test.tsx | 2 +- .../webhook/webhook_connectors.test.tsx | 2 +- .../webhook/webhook_params.test.tsx | 2 +- ...son_editor_with_message_variables.test.tsx | 2 +- .../text_area_with_message_variables.test.tsx | 2 +- ...text_field_with_message_variables.test.tsx | 2 +- .../public/application/home.test.tsx | 2 +- .../action_connector_form.test.tsx | 2 +- .../action_form.test.tsx | 2 +- .../action_type_form.test.tsx | 2 +- .../action_type_menu.test.tsx | 2 +- .../connector_add_flyout.test.tsx | 2 +- .../connector_add_modal.test.tsx | 2 +- .../connector_edit_flyout.test.tsx | 2 +- .../connectors_selection.test.tsx | 2 +- .../test_connector_form.test.tsx | 2 +- .../actions_connectors_list.test.tsx | 2 +- .../components/alert_details.test.tsx | 2 +- .../components/alert_details_route.test.tsx | 2 +- .../alert_details/components/alerts.test.tsx | 2 +- .../sections/alert_form/alert_add.test.tsx | 2 +- .../alert_form/alert_conditions.test.tsx | 2 +- .../alert_conditions_group.test.tsx | 2 +- .../sections/alert_form/alert_edit.test.tsx | 2 +- .../sections/alert_form/alert_form.test.tsx | 2 +- .../alert_form/alert_notify_when.test.tsx | 2 +- .../components/alerts_list.test.tsx | 2 +- .../collapsed_item_actions.test.tsx | 2 +- .../components/rule_enabled_switch.test.tsx | 2 +- .../execution_duration_chart.test.tsx | 2 +- .../expression_items/threshold.test.tsx | 2 +- .../common/expression_items/value.test.tsx | 2 +- .../public/custom_time_range_action.test.ts | 2 +- .../public/custom_time_range_badge.test.ts | 2 +- .../client_integration/app/app.helpers.tsx | 2 +- .../es_deprecation_logs.helpers.ts | 2 +- .../es_deprecations.helpers.ts | 2 +- .../kibana_deprecations.helpers.ts | 7 +- .../overview/overview.helpers.ts | 2 +- .../common/charts/chart_empty_state.test.tsx | 2 +- .../common/charts/chart_wrapper.test.tsx | 4 +- .../common/charts/donut_chart.test.tsx | 2 +- .../common/charts/donut_chart_legend.test.tsx | 2 +- .../charts/donut_chart_legend_row.test.tsx | 2 +- .../components/common/location_link.test.tsx | 2 +- .../common/monitor_page_link.test.tsx | 2 +- .../monitor/ml/confirm_delete.test.tsx | 2 +- .../monitor/ping_list/expanded_row.test.tsx | 2 +- .../monitor/ping_list/ping_headers.test.tsx | 2 +- .../availability_reporting/tag_label.test.tsx | 2 +- .../status_by_location.test.tsx | 2 +- .../alerts/alert_field_number.test.tsx | 2 +- .../down_number_select.test.tsx | 2 +- .../time_expression_select.test.tsx | 2 +- .../add_filter_btn.test.tsx | 2 +- .../old_alert_callout.test.tsx | 2 +- .../integration_group.test.tsx | 2 +- .../integration_link.test.tsx | 2 +- .../most_recent_error.test.tsx | 2 +- .../monitor_list_page_size_select.test.tsx | 2 +- .../overview/snapshot/snapshot.test.tsx | 2 +- .../overview/snapshot_heading.test.tsx | 2 +- .../overview/synthetics_callout.test.tsx | 2 +- .../synthetics/console_event.test.tsx | 2 +- .../synthetics/empty_journey.test.tsx | 2 +- .../public/lib/helper/enzyme_helpers.tsx | 2 +- x-pack/plugins/watcher/__fixtures__/watch.ts | 2 +- .../watcher/__fixtures__/watch_history.ts | 2 +- .../client_integration/helpers/index.ts | 4 +- .../helpers/watch_create_json.helpers.ts | 2 +- .../helpers/watch_create_threshold.helpers.ts | 2 +- .../helpers/watch_edit.helpers.ts | 2 +- .../helpers/watch_list.helpers.ts | 7 +- .../helpers/watch_status.helpers.ts | 7 +- .../client_integration/watch_edit.test.ts | 2 +- yarn.lock | 12 ++ 680 files changed, 971 insertions(+), 687 deletions(-) create mode 100644 packages/kbn-test-jest-helpers/BUILD.bazel rename packages/{kbn-test/src/jest/index.ts => kbn-test-jest-helpers/jest.config.js} (74%) create mode 100644 packages/kbn-test-jest-helpers/package.json rename packages/{kbn-test/src/jest/utils => kbn-test-jest-helpers/src}/enzyme_helpers.tsx (98%) rename packages/{kbn-test/src/jest/utils => kbn-test-jest-helpers/src}/find_test_subject.ts (97%) rename packages/{kbn-test/src/jest/utils => kbn-test-jest-helpers/src}/index.ts (96%) rename packages/{kbn-test/src/jest/utils => kbn-test-jest-helpers/src}/jsdom_svg_mocks.ts (100%) rename packages/{kbn-test/src/jest/utils => kbn-test-jest-helpers/src}/random.ts (91%) rename packages/{kbn-test/src/jest/utils => kbn-test-jest-helpers/src}/redux_helpers.tsx (100%) rename packages/{kbn-test/src/jest/utils => kbn-test-jest-helpers/src}/router_helpers.tsx (100%) rename packages/{kbn-test/src/jest/utils => kbn-test-jest-helpers/src}/stub_browser_storage.test.ts (100%) rename packages/{kbn-test/src/jest/utils => kbn-test-jest-helpers/src}/stub_browser_storage.ts (100%) rename packages/{kbn-test/src/jest/utils => kbn-test-jest-helpers/src}/stub_web_worker.ts (100%) rename packages/{kbn-test/src/jest/utils => kbn-test-jest-helpers/src}/testbed/README.md (100%) rename packages/{kbn-test/src/jest/utils => kbn-test-jest-helpers/src}/testbed/index.ts (96%) rename packages/{kbn-test/src/jest/utils => kbn-test-jest-helpers/src}/testbed/mount_component.tsx (97%) rename packages/{kbn-test/src/jest/utils => kbn-test-jest-helpers/src}/testbed/testbed.ts (98%) rename packages/{kbn-test/src/jest/utils => kbn-test-jest-helpers/src}/testbed/types.ts (99%) create mode 100644 packages/kbn-test-jest-helpers/tsconfig.json delete mode 100644 packages/kbn-test/jest/package.json rename packages/kbn-test/src/jest/{utils => }/get_url.test.ts (100%) rename packages/kbn-test/src/jest/{utils => }/get_url.ts (100%) diff --git a/package.json b/package.json index 83babf74c561d..00df514df765a 100644 --- a/package.json +++ b/package.json @@ -475,6 +475,7 @@ "@kbn/storybook": "link:bazel-bin/packages/kbn-storybook", "@kbn/telemetry-tools": "link:bazel-bin/packages/kbn-telemetry-tools", "@kbn/test": "link:bazel-bin/packages/kbn-test", + "@kbn/test-jest-helpers": "link:bazel-bin/packages/kbn-test-jest-helpers", "@kbn/test-subj-selector": "link:bazel-bin/packages/kbn-test-subj-selector", "@loaders.gl/polyfills": "^2.3.5", "@mapbox/vector-tile": "1.3.1", @@ -611,6 +612,8 @@ "@types/kbn__std": "link:bazel-bin/packages/kbn-std/npm_module_types", "@types/kbn__storybook": "link:bazel-bin/packages/kbn-storybook/npm_module_types", "@types/kbn__telemetry-tools": "link:bazel-bin/packages/kbn-telemetry-tools/npm_module_types", + "@types/kbn__test": "link:bazel-bin/packages/kbn-test/npm_module_types", + "@types/kbn__test-jest-helpers": "link:bazel-bin/packages/kbn-test-jest-helpers/npm_module_types", "@types/kbn__ui-shared-deps-npm": "link:bazel-bin/packages/kbn-ui-shared-deps-npm/npm_module_types", "@types/kbn__ui-shared-deps-src": "link:bazel-bin/packages/kbn-ui-shared-deps-src/npm_module_types", "@types/kbn__ui-theme": "link:bazel-bin/packages/kbn-ui-theme/npm_module_types", diff --git a/packages/BUILD.bazel b/packages/BUILD.bazel index 3b95f652f5bc5..7e6d06922aed2 100644 --- a/packages/BUILD.bazel +++ b/packages/BUILD.bazel @@ -61,6 +61,7 @@ filegroup( "//packages/kbn-storybook:build", "//packages/kbn-telemetry-tools:build", "//packages/kbn-test:build", + "//packages/kbn-test-jest-helpers:build", "//packages/kbn-test-subj-selector:build", "//packages/kbn-timelion-grammar:build", "//packages/kbn-tinymath:build", @@ -126,6 +127,8 @@ filegroup( "//packages/kbn-std:build_types", "//packages/kbn-storybook:build_types", "//packages/kbn-telemetry-tools:build_types", + "//packages/kbn-test:build_types", + "//packages/kbn-test-jest-helpers:build_types", "//packages/kbn-ui-shared-deps-npm:build_types", "//packages/kbn-ui-shared-deps-src:build_types", "//packages/kbn-ui-theme:build_types", diff --git a/packages/elastic-eslint-config-kibana/.eslintrc.js b/packages/elastic-eslint-config-kibana/.eslintrc.js index 8193380d662d8..d27192774e17d 100644 --- a/packages/elastic-eslint-config-kibana/.eslintrc.js +++ b/packages/elastic-eslint-config-kibana/.eslintrc.js @@ -96,6 +96,11 @@ module.exports = { to: false, disallowedMessage: `Use "@kbn/ui-theme" to access theme vars.` })), + { + from: '@kbn/test/jest', + to: '@kbn/test-jest-helpers', + disallowedMessage: `import from @kbn/test-jest-helpers instead` + }, ], ], diff --git a/packages/kbn-es-archiver/BUILD.bazel b/packages/kbn-es-archiver/BUILD.bazel index 06a0ca02da04a..fed3f248c0995 100644 --- a/packages/kbn-es-archiver/BUILD.bazel +++ b/packages/kbn-es-archiver/BUILD.bazel @@ -45,7 +45,7 @@ RUNTIME_DEPS = [ TYPES_DEPS = [ "//packages/kbn-dev-utils:npm_module_types", - "//packages/kbn-test", + "//packages/kbn-test:npm_module_types", "//packages/kbn-utils:npm_module_types", "@npm//@elastic/elasticsearch", "@npm//aggregate-error", diff --git a/packages/kbn-i18n/GUIDELINE.md b/packages/kbn-i18n/GUIDELINE.md index 7ffc4b078c79b..98f6f176d0be8 100644 --- a/packages/kbn-i18n/GUIDELINE.md +++ b/packages/kbn-i18n/GUIDELINE.md @@ -506,7 +506,7 @@ Testing React component that uses the `injectI18n` higher-order component is mor With shallow rendering only top level component is rendered, that is a wrapper itself, not the original component. Since we want to test the rendering of the original component, we need to access it via the wrapper's `WrappedComponent` property. Its value will be the component we passed into `injectI18n()`. -When testing such component, use the `shallowWithIntl` helper function defined in `@kbn/test/jest` and pass the component's `WrappedComponent` property to render the wrapped component. This will shallow render the component with Enzyme and inject the necessary context and props to use the `intl` mock defined in `test_utils/mocks/intl`. +When testing such component, use the `shallowWithIntl` helper function defined in `@kbn/test-jest-helpers` and pass the component's `WrappedComponent` property to render the wrapped component. This will shallow render the component with Enzyme and inject the necessary context and props to use the `intl` mock defined in `test_utils/mocks/intl`. Use the `mountWithIntl` helper function to mount render the component. diff --git a/packages/kbn-test-jest-helpers/BUILD.bazel b/packages/kbn-test-jest-helpers/BUILD.bazel new file mode 100644 index 0000000000000..c713e24592944 --- /dev/null +++ b/packages/kbn-test-jest-helpers/BUILD.bazel @@ -0,0 +1,182 @@ +load("@npm//@bazel/typescript:index.bzl", "ts_config") +load("@npm//@babel/cli:index.bzl", "babel") +load("@build_bazel_rules_nodejs//:index.bzl", "js_library") +load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project") + +PKG_BASE_NAME = "kbn-test-jest-helpers" +PKG_REQUIRE_NAME = "@kbn/test-jest-helpers" +TYPES_PKG_REQUIRE_NAME = "@types/kbn__test-jest-helpers" + +SOURCE_FILES = glob( + [ + "src/**/*" + ], + exclude = [ + "**/*.test.*", + "**/*.snap", + "**/__fixture__/**", + "**/__fixtures__/**", + "**/__snapshots__/**", + ] +) + +SRCS = SOURCE_FILES + +filegroup( + name = "srcs", + srcs = SRCS, +) + +NPM_MODULE_EXTRA_FILES = [ + "jest.config.js", + "package.json", +] + +RUNTIME_DEPS = [ + "//packages/kbn-dev-utils", + "//packages/kbn-i18n-react", + "//packages/kbn-std", + "//packages/kbn-utils", + "@npm//@elastic/elasticsearch", + "@npm//axios", + "@npm//@babel/traverse", + "@npm//chance", + "@npm//dedent", + "@npm//del", + "@npm//enzyme", + "@npm//execa", + "@npm//exit-hook", + "@npm//form-data", + "@npm//getopts", + "@npm//globby", + "@npm//he", + "@npm//history", + "@npm//jest", + "@npm//jest-cli", + "@npm//jest-snapshot", + "@npm//jest-styled-components", + "@npm//@jest/reporters", + "@npm//joi", + "@npm//mustache", + "@npm//normalize-path", + "@npm//parse-link-header", + "@npm//prettier", + "@npm//react", + "@npm//react-dom", + "@npm//react-redux", + "@npm//react-router-dom", + "@npm//redux", + "@npm//rxjs", + "@npm//semver", + "@npm//strip-ansi", + "@npm//xmlbuilder", + "@npm//xml2js", +] + +TYPES_DEPS = [ + "//packages/kbn-dev-utils:npm_module_types", + "//packages/kbn-i18n-react:npm_module_types", + "//packages/kbn-std:npm_module_types", + "//packages/kbn-utils:npm_module_types", + "@npm//@elastic/elasticsearch", + "@npm//axios", + "@npm//elastic-apm-node", + "@npm//del", + "@npm//exit-hook", + "@npm//form-data", + "@npm//getopts", + "@npm//jest", + "@npm//jest-cli", + "@npm//jest-snapshot", + "@npm//redux", + "@npm//rxjs", + "@npm//xmlbuilder", + "@npm//@types/chance", + "@npm//@types/dedent", + "@npm//@types/enzyme", + "@npm//@types/he", + "@npm//@types/history", + "@npm//@types/jest", + "@npm//@types/joi", + "@npm//@types/lodash", + "@npm//@types/mustache", + "@npm//@types/normalize-path", + "@npm//@types/node", + "@npm//@types/parse-link-header", + "@npm//@types/prettier", + "@npm//@types/react", + "@npm//@types/react-dom", + "@npm//@types/react-redux", + "@npm//@types/react-router-dom", + "@npm//@types/semver", + "@npm//@types/xml2js", +] + +jsts_transpiler( + name = "target_node", + srcs = SRCS, + build_pkg_name = package_name(), +) + +ts_config( + name = "tsconfig", + src = "tsconfig.json", + deps = [ + "//:tsconfig.base.json", + "//:tsconfig.bazel.json", + ], +) + +ts_project( + name = "tsc_types", + args = ['--pretty'], + srcs = SRCS, + deps = TYPES_DEPS, + declaration = True, + declaration_map = True, + emit_declaration_only = True, + out_dir = "target_types", + source_map = True, + root_dir = "src", + tsconfig = ":tsconfig", +) + +js_library( + name = PKG_BASE_NAME, + srcs = NPM_MODULE_EXTRA_FILES, + deps = RUNTIME_DEPS + [":target_node"], + package_name = PKG_REQUIRE_NAME, + visibility = ["//visibility:public"], +) + +pkg_npm( + name = "npm_module", + deps = [ + ":%s" % PKG_BASE_NAME, + ] +) + +filegroup( + name = "build", + srcs = [ + ":npm_module", + ], + visibility = ["//visibility:public"], +) + +pkg_npm_types( + name = "npm_module_types", + srcs = SRCS, + deps = [":tsc_types"], + package_name = TYPES_PKG_REQUIRE_NAME, + tsconfig = ":tsconfig", + visibility = ["//visibility:public"], +) + +filegroup( + name = "build_types", + srcs = [ + ":npm_module_types", + ], + visibility = ["//visibility:public"], +) diff --git a/packages/kbn-test/src/jest/index.ts b/packages/kbn-test-jest-helpers/jest.config.js similarity index 74% rename from packages/kbn-test/src/jest/index.ts rename to packages/kbn-test-jest-helpers/jest.config.js index a50ff5c59e798..5c5d5c6395999 100644 --- a/packages/kbn-test/src/jest/index.ts +++ b/packages/kbn-test-jest-helpers/jest.config.js @@ -6,4 +6,8 @@ * Side Public License, v 1. */ -export * from './utils'; +module.exports = { + preset: '@kbn/test', + rootDir: '../..', + roots: ['/packages/kbn-test-jest-helpers'], +}; diff --git a/packages/kbn-test-jest-helpers/package.json b/packages/kbn-test-jest-helpers/package.json new file mode 100644 index 0000000000000..afab6001d605d --- /dev/null +++ b/packages/kbn-test-jest-helpers/package.json @@ -0,0 +1,10 @@ +{ + "name": "@kbn/test-jest-helpers", + "version": "1.0.0", + "private": true, + "license": "SSPL-1.0 OR Elastic License 2.0", + "main": "./target_node", + "kibana": { + "devOnly": true + } +} diff --git a/packages/kbn-test/src/jest/utils/enzyme_helpers.tsx b/packages/kbn-test-jest-helpers/src/enzyme_helpers.tsx similarity index 98% rename from packages/kbn-test/src/jest/utils/enzyme_helpers.tsx rename to packages/kbn-test-jest-helpers/src/enzyme_helpers.tsx index 696a1d1b63163..222689d621b5d 100644 --- a/packages/kbn-test/src/jest/utils/enzyme_helpers.tsx +++ b/packages/kbn-test-jest-helpers/src/enzyme_helpers.tsx @@ -14,6 +14,7 @@ */ import { I18nProvider, InjectedIntl, intlShape, __IntlProvider } from '@kbn/i18n-react'; +// eslint-disable-next-line import/no-extraneous-dependencies import { mount, ReactWrapper, render, shallow } from 'enzyme'; import React, { ReactElement, ValidationMap } from 'react'; import { act as reactAct } from 'react-dom/test-utils'; @@ -118,7 +119,7 @@ export function renderWithIntl( context?: any; childContextTypes?: ValidationMap; } = {} -) { +): any { const options = getOptions(context, childContextTypes, props); return render(nodeWithIntlProp(node), options); diff --git a/packages/kbn-test/src/jest/utils/find_test_subject.ts b/packages/kbn-test-jest-helpers/src/find_test_subject.ts similarity index 97% rename from packages/kbn-test/src/jest/utils/find_test_subject.ts rename to packages/kbn-test-jest-helpers/src/find_test_subject.ts index ef3a744fbd99c..9d519f5197cd7 100644 --- a/packages/kbn-test/src/jest/utils/find_test_subject.ts +++ b/packages/kbn-test-jest-helpers/src/find_test_subject.ts @@ -6,6 +6,7 @@ * Side Public License, v 1. */ +// eslint-disable-next-line import/no-extraneous-dependencies import { ReactWrapper } from 'enzyme'; type Matcher = '=' | '~=' | '|=' | '^=' | '$=' | '*='; diff --git a/packages/kbn-test/src/jest/utils/index.ts b/packages/kbn-test-jest-helpers/src/index.ts similarity index 96% rename from packages/kbn-test/src/jest/utils/index.ts rename to packages/kbn-test-jest-helpers/src/index.ts index a797a801eaf94..3594df854cbe4 100644 --- a/packages/kbn-test/src/jest/utils/index.ts +++ b/packages/kbn-test-jest-helpers/src/index.ts @@ -8,8 +8,6 @@ export * from './enzyme_helpers'; -export * from './get_url'; - export * from './find_test_subject'; export * from './jsdom_svg_mocks'; diff --git a/packages/kbn-test/src/jest/utils/jsdom_svg_mocks.ts b/packages/kbn-test-jest-helpers/src/jsdom_svg_mocks.ts similarity index 100% rename from packages/kbn-test/src/jest/utils/jsdom_svg_mocks.ts rename to packages/kbn-test-jest-helpers/src/jsdom_svg_mocks.ts diff --git a/packages/kbn-test/src/jest/utils/random.ts b/packages/kbn-test-jest-helpers/src/random.ts similarity index 91% rename from packages/kbn-test/src/jest/utils/random.ts rename to packages/kbn-test-jest-helpers/src/random.ts index 4aa8a30555e0c..9f4efccf810f8 100644 --- a/packages/kbn-test/src/jest/utils/random.ts +++ b/packages/kbn-test-jest-helpers/src/random.ts @@ -6,6 +6,7 @@ * Side Public License, v 1. */ +// eslint-disable-next-line import/no-extraneous-dependencies import Chance from 'chance'; const chance = new Chance(); diff --git a/packages/kbn-test/src/jest/utils/redux_helpers.tsx b/packages/kbn-test-jest-helpers/src/redux_helpers.tsx similarity index 100% rename from packages/kbn-test/src/jest/utils/redux_helpers.tsx rename to packages/kbn-test-jest-helpers/src/redux_helpers.tsx diff --git a/packages/kbn-test/src/jest/utils/router_helpers.tsx b/packages/kbn-test-jest-helpers/src/router_helpers.tsx similarity index 100% rename from packages/kbn-test/src/jest/utils/router_helpers.tsx rename to packages/kbn-test-jest-helpers/src/router_helpers.tsx diff --git a/packages/kbn-test/src/jest/utils/stub_browser_storage.test.ts b/packages/kbn-test-jest-helpers/src/stub_browser_storage.test.ts similarity index 100% rename from packages/kbn-test/src/jest/utils/stub_browser_storage.test.ts rename to packages/kbn-test-jest-helpers/src/stub_browser_storage.test.ts diff --git a/packages/kbn-test/src/jest/utils/stub_browser_storage.ts b/packages/kbn-test-jest-helpers/src/stub_browser_storage.ts similarity index 100% rename from packages/kbn-test/src/jest/utils/stub_browser_storage.ts rename to packages/kbn-test-jest-helpers/src/stub_browser_storage.ts diff --git a/packages/kbn-test/src/jest/utils/stub_web_worker.ts b/packages/kbn-test-jest-helpers/src/stub_web_worker.ts similarity index 100% rename from packages/kbn-test/src/jest/utils/stub_web_worker.ts rename to packages/kbn-test-jest-helpers/src/stub_web_worker.ts diff --git a/packages/kbn-test/src/jest/utils/testbed/README.md b/packages/kbn-test-jest-helpers/src/testbed/README.md similarity index 100% rename from packages/kbn-test/src/jest/utils/testbed/README.md rename to packages/kbn-test-jest-helpers/src/testbed/README.md diff --git a/packages/kbn-test/src/jest/utils/testbed/index.ts b/packages/kbn-test-jest-helpers/src/testbed/index.ts similarity index 96% rename from packages/kbn-test/src/jest/utils/testbed/index.ts rename to packages/kbn-test-jest-helpers/src/testbed/index.ts index a283bfc53f4ef..f063f5003fd1c 100644 --- a/packages/kbn-test/src/jest/utils/testbed/index.ts +++ b/packages/kbn-test-jest-helpers/src/testbed/index.ts @@ -14,4 +14,5 @@ export type { SetupFunc, SyncSetupFunc, AsyncSetupFunc, + EuiTableMetaData, } from './types'; diff --git a/packages/kbn-test/src/jest/utils/testbed/mount_component.tsx b/packages/kbn-test-jest-helpers/src/testbed/mount_component.tsx similarity index 97% rename from packages/kbn-test/src/jest/utils/testbed/mount_component.tsx rename to packages/kbn-test-jest-helpers/src/testbed/mount_component.tsx index 2ac482abc0fb2..5c5fd3f2237d1 100644 --- a/packages/kbn-test/src/jest/utils/testbed/mount_component.tsx +++ b/packages/kbn-test-jest-helpers/src/testbed/mount_component.tsx @@ -8,6 +8,7 @@ import React, { ComponentType } from 'react'; import { Store } from 'redux'; +// eslint-disable-next-line import/no-extraneous-dependencies import { ReactWrapper } from 'enzyme'; import { act } from 'react-dom/test-utils'; diff --git a/packages/kbn-test/src/jest/utils/testbed/testbed.ts b/packages/kbn-test-jest-helpers/src/testbed/testbed.ts similarity index 98% rename from packages/kbn-test/src/jest/utils/testbed/testbed.ts rename to packages/kbn-test-jest-helpers/src/testbed/testbed.ts index b10f331da10d6..87efb9e61b345 100644 --- a/packages/kbn-test/src/jest/utils/testbed/testbed.ts +++ b/packages/kbn-test-jest-helpers/src/testbed/testbed.ts @@ -7,6 +7,7 @@ */ import { Component as ReactComponent } from 'react'; +// eslint-disable-next-line import/no-extraneous-dependencies import { ComponentType, HTMLAttributes, ReactWrapper } from 'enzyme'; import { findTestSubject } from '../find_test_subject'; @@ -41,7 +42,7 @@ const defaultConfig: TestBedConfig = { * * @example ```typescript - import { registerTestBed } from '@kbn/test/jest'; + import { registerTestBed } from '@kbn/test-jest-helpers'; import { RemoteClusterList } from '../../app/sections/remote_cluster_list'; import { remoteClustersStore } from '../../app/store'; diff --git a/packages/kbn-test/src/jest/utils/testbed/types.ts b/packages/kbn-test-jest-helpers/src/testbed/types.ts similarity index 99% rename from packages/kbn-test/src/jest/utils/testbed/types.ts rename to packages/kbn-test-jest-helpers/src/testbed/types.ts index 11f8c802a9751..ff548f3af5f58 100644 --- a/packages/kbn-test/src/jest/utils/testbed/types.ts +++ b/packages/kbn-test-jest-helpers/src/testbed/types.ts @@ -7,6 +7,7 @@ */ import { Store } from 'redux'; +// eslint-disable-next-line import/no-extraneous-dependencies import { ReactWrapper as GenericReactWrapper } from 'enzyme'; import { LocationDescriptor } from 'history'; diff --git a/packages/kbn-test-jest-helpers/tsconfig.json b/packages/kbn-test-jest-helpers/tsconfig.json new file mode 100644 index 0000000000000..7a1121c9e91f1 --- /dev/null +++ b/packages/kbn-test-jest-helpers/tsconfig.json @@ -0,0 +1,16 @@ +{ + "extends": "../../tsconfig.bazel.json", + "compilerOptions": { + "declaration": true, + "declarationMap": true, + "emitDeclarationOnly": true, + "outDir": "./target_types", + "stripInternal": true, + "rootDir": "src", + "sourceMap": true, + "sourceRoot": "../../../../../../packages/kbn-test-jest-helpers/src", + "types": ["jest", "node"] + }, + "include": ["src/**/*"], + "exclude": ["**/__fixtures__/**/*"] +} diff --git a/packages/kbn-test/BUILD.bazel b/packages/kbn-test/BUILD.bazel index 67299f4afdeb7..33d299058168d 100644 --- a/packages/kbn-test/BUILD.bazel +++ b/packages/kbn-test/BUILD.bazel @@ -1,10 +1,11 @@ -load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project") +load("@npm//@bazel/typescript:index.bzl", "ts_config") load("@npm//@babel/cli:index.bzl", "babel") -load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm") -load("//src/dev/bazel:index.bzl", "jsts_transpiler") +load("@build_bazel_rules_nodejs//:index.bzl", "js_library") +load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project") PKG_BASE_NAME = "kbn-test" PKG_REQUIRE_NAME = "@kbn/test" +TYPES_PKG_REQUIRE_NAME = "@types/kbn__test" SOURCE_FILES = glob( [ @@ -27,7 +28,6 @@ filegroup( ) NPM_MODULE_EXTRA_FILES = [ - "jest/package.json", "jest-preset.js", "jest_integration/jest-preset.js", "jest.config.js", @@ -80,7 +80,7 @@ TYPES_DEPS = [ "//packages/kbn-dev-utils:npm_module_types", "//packages/kbn-i18n-react:npm_module_types", "//packages/kbn-std:npm_module_types", - "//packages/kbn-utils", + "//packages/kbn-utils:npm_module_types", "@npm//@elastic/elasticsearch", "@npm//@jest/console", "@npm//@jest/reporters", @@ -148,7 +148,7 @@ ts_project( js_library( name = PKG_BASE_NAME, srcs = NPM_MODULE_EXTRA_FILES, - deps = RUNTIME_DEPS + [":target_node", ":tsc_types"], + deps = RUNTIME_DEPS + [":target_node"], package_name = PKG_REQUIRE_NAME, visibility = ["//visibility:public"], ) @@ -167,3 +167,20 @@ filegroup( ], visibility = ["//visibility:public"], ) + +pkg_npm_types( + name = "npm_module_types", + srcs = SRCS, + deps = [":tsc_types"], + package_name = TYPES_PKG_REQUIRE_NAME, + tsconfig = ":tsconfig", + visibility = ["//visibility:public"], +) + +filegroup( + name = "build_types", + srcs = [ + ":npm_module_types", + ], + visibility = ["//visibility:public"], +) diff --git a/packages/kbn-test/jest/package.json b/packages/kbn-test/jest/package.json deleted file mode 100644 index aa0ba83873684..0000000000000 --- a/packages/kbn-test/jest/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "main": "../target_node/jest", - "types": "../target_types/jest/index.d.ts" -} diff --git a/packages/kbn-test/package.json b/packages/kbn-test/package.json index a94b3198e24a4..5f5e475e392c4 100644 --- a/packages/kbn-test/package.json +++ b/packages/kbn-test/package.json @@ -5,7 +5,6 @@ "private": true, "license": "SSPL-1.0 OR Elastic License 2.0", "main": "./target_node", - "types": "./target_types", "kibana": { "devOnly": true } diff --git a/packages/kbn-test/src/index.ts b/packages/kbn-test/src/index.ts index a3772665b8891..b619a9eb9208a 100644 --- a/packages/kbn-test/src/index.ts +++ b/packages/kbn-test/src/index.ts @@ -49,7 +49,7 @@ export { CI_PARALLEL_PROCESS_PREFIX } from './ci_parallel_process_prefix'; export * from './functional_test_runner'; -export { getUrl } from './jest/utils/get_url'; +export { getUrl } from './jest/get_url'; export { runCheckJestConfigsCli } from './jest/run_check_jest_configs_cli'; diff --git a/packages/kbn-test/src/jest/utils/get_url.test.ts b/packages/kbn-test/src/jest/get_url.test.ts similarity index 100% rename from packages/kbn-test/src/jest/utils/get_url.test.ts rename to packages/kbn-test/src/jest/get_url.test.ts diff --git a/packages/kbn-test/src/jest/utils/get_url.ts b/packages/kbn-test/src/jest/get_url.ts similarity index 100% rename from packages/kbn-test/src/jest/utils/get_url.ts rename to packages/kbn-test/src/jest/get_url.ts diff --git a/src/core/public/application/ui/app_container.test.tsx b/src/core/public/application/ui/app_container.test.tsx index 9fc07530a0095..4434f6c1751e0 100644 --- a/src/core/public/application/ui/app_container.test.tsx +++ b/src/core/public/application/ui/app_container.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { act } from 'react-dom/test-utils'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { themeServiceMock } from '../../theme/theme_service.mock'; import { AppContainer } from './app_container'; diff --git a/src/core/public/chrome/ui/header/collapsible_nav.test.tsx b/src/core/public/chrome/ui/header/collapsible_nav.test.tsx index abc2fb5cc3356..0102343ca6eb7 100644 --- a/src/core/public/chrome/ui/header/collapsible_nav.test.tsx +++ b/src/core/public/chrome/ui/header/collapsible_nav.test.tsx @@ -10,7 +10,7 @@ import { mount, ReactWrapper } from 'enzyme'; import React from 'react'; import { BehaviorSubject } from 'rxjs'; import sinon from 'sinon'; -import { StubBrowserStorage } from '@kbn/test/jest'; +import { StubBrowserStorage } from '@kbn/test-jest-helpers'; import { ChromeNavLink, DEFAULT_APP_CATEGORIES } from '../../..'; import { httpServiceMock } from '../../../http/http_service.mock'; import { ChromeRecentlyAccessedHistoryItem } from '../../recently_accessed'; diff --git a/src/core/public/chrome/ui/header/header.test.tsx b/src/core/public/chrome/ui/header/header.test.tsx index 2692f2dbd194f..4790dec0f3515 100644 --- a/src/core/public/chrome/ui/header/header.test.tsx +++ b/src/core/public/chrome/ui/header/header.test.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { act } from 'react-dom/test-utils'; import { BehaviorSubject } from 'rxjs'; -import { StubBrowserStorage, mountWithIntl } from '@kbn/test/jest'; +import { StubBrowserStorage, mountWithIntl } from '@kbn/test-jest-helpers'; import { httpServiceMock } from '../../../http/http_service.mock'; import { applicationServiceMock } from '../../../mocks'; import { Header } from './header'; diff --git a/src/core/public/core_app/status/components/status_badge.test.tsx b/src/core/public/core_app/status/components/status_badge.test.tsx index b0870e51d98d1..5c908cf5021cc 100644 --- a/src/core/public/core_app/status/components/status_badge.test.tsx +++ b/src/core/public/core_app/status/components/status_badge.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { StatusBadge, StatusWithoutMessage } from './status_badge'; const getStatus = (parts: Partial = {}): StatusWithoutMessage => ({ diff --git a/src/core/public/core_app/status/components/version_header.test.tsx b/src/core/public/core_app/status/components/version_header.test.tsx index d51927f83550b..172a720a51751 100644 --- a/src/core/public/core_app/status/components/version_header.test.tsx +++ b/src/core/public/core_app/status/components/version_header.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { mountWithIntl, findTestSubject } from '@kbn/test/jest'; +import { mountWithIntl, findTestSubject } from '@kbn/test-jest-helpers'; import type { ServerVersion } from '../../../../types/status'; import { VersionHeader } from './version_header'; diff --git a/src/core/public/fatal_errors/fatal_errors_screen.test.tsx b/src/core/public/fatal_errors/fatal_errors_screen.test.tsx index 7c9abed79f4b7..b460e62b1151d 100644 --- a/src/core/public/fatal_errors/fatal_errors_screen.test.tsx +++ b/src/core/public/fatal_errors/fatal_errors_screen.test.tsx @@ -10,7 +10,7 @@ import { EuiCallOut } from '@elastic/eui'; import testSubjSelector from '@kbn/test-subj-selector'; import React from 'react'; import * as Rx from 'rxjs'; -import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; +import { mountWithIntl, shallowWithIntl } from '@kbn/test-jest-helpers'; import { FatalErrorsScreen } from './fatal_errors_screen'; diff --git a/src/core/public/notifications/toasts/error_toast.test.tsx b/src/core/public/notifications/toasts/error_toast.test.tsx index e0f917fb7f078..2af342c2107a7 100644 --- a/src/core/public/notifications/toasts/error_toast.test.tsx +++ b/src/core/public/notifications/toasts/error_toast.test.tsx @@ -8,7 +8,7 @@ import { shallow } from 'enzyme'; import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { ErrorToast } from './error_toast'; diff --git a/src/core/public/theme/core_theme_provider.test.tsx b/src/core/public/theme/core_theme_provider.test.tsx index a0f0faf13b9da..1ce26650dcccd 100644 --- a/src/core/public/theme/core_theme_provider.test.tsx +++ b/src/core/public/theme/core_theme_provider.test.tsx @@ -12,7 +12,7 @@ import type { ReactWrapper } from 'enzyme'; import { of, BehaviorSubject } from 'rxjs'; import { useEuiTheme } from '@elastic/eui'; import type { UseEuiTheme } from '@elastic/eui'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { CoreThemeProvider } from './core_theme_provider'; import type { CoreTheme } from './types'; diff --git a/src/core/server/preboot/preboot_service.test.ts b/src/core/server/preboot/preboot_service.test.ts index 77242f0c5765f..8a95f4bc9ab0e 100644 --- a/src/core/server/preboot/preboot_service.test.ts +++ b/src/core/server/preboot/preboot_service.test.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { REPO_ROOT } from '@kbn/utils'; import { LoggerFactory } from '@kbn/logging'; import { Env } from '@kbn/config'; diff --git a/src/plugins/advanced_settings/public/component_registry/page_footer/page_footer.test.tsx b/src/plugins/advanced_settings/public/component_registry/page_footer/page_footer.test.tsx index dbe5db1ebe2eb..b65c5c5020533 100644 --- a/src/plugins/advanced_settings/public/component_registry/page_footer/page_footer.test.tsx +++ b/src/plugins/advanced_settings/public/component_registry/page_footer/page_footer.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { shallowWithI18nProvider } from '@kbn/test/jest'; +import { shallowWithI18nProvider } from '@kbn/test-jest-helpers'; import { PageFooter } from './page_footer'; diff --git a/src/plugins/advanced_settings/public/component_registry/page_subtitle/page_subtitle.test.tsx b/src/plugins/advanced_settings/public/component_registry/page_subtitle/page_subtitle.test.tsx index 0ffb9ae64e29f..792721490256f 100644 --- a/src/plugins/advanced_settings/public/component_registry/page_subtitle/page_subtitle.test.tsx +++ b/src/plugins/advanced_settings/public/component_registry/page_subtitle/page_subtitle.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { shallowWithI18nProvider } from '@kbn/test/jest'; +import { shallowWithI18nProvider } from '@kbn/test-jest-helpers'; import { PageSubtitle } from './page_subtitle'; diff --git a/src/plugins/advanced_settings/public/component_registry/page_title/page_title.test.tsx b/src/plugins/advanced_settings/public/component_registry/page_title/page_title.test.tsx index e6142fe916ca7..05d44f3aee84d 100644 --- a/src/plugins/advanced_settings/public/component_registry/page_title/page_title.test.tsx +++ b/src/plugins/advanced_settings/public/component_registry/page_title/page_title.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { shallowWithI18nProvider } from '@kbn/test/jest'; +import { shallowWithI18nProvider } from '@kbn/test-jest-helpers'; import { PageTitle } from './page_title'; diff --git a/src/plugins/advanced_settings/public/management_app/advanced_settings.test.tsx b/src/plugins/advanced_settings/public/management_app/advanced_settings.test.tsx index 91f4a5e6be471..a804b55938861 100644 --- a/src/plugins/advanced_settings/public/management_app/advanced_settings.test.tsx +++ b/src/plugins/advanced_settings/public/management_app/advanced_settings.test.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { Observable } from 'rxjs'; import { ReactWrapper } from 'enzyme'; -import { mountWithI18nProvider, shallowWithI18nProvider } from '@kbn/test/jest'; +import { mountWithI18nProvider, shallowWithI18nProvider } from '@kbn/test-jest-helpers'; import dedent from 'dedent'; import { PublicUiSettingsParams, diff --git a/src/plugins/advanced_settings/public/management_app/components/field/field.test.tsx b/src/plugins/advanced_settings/public/management_app/components/field/field.test.tsx index b77a687b50cd9..70d6a7a83d25f 100644 --- a/src/plugins/advanced_settings/public/management_app/components/field/field.test.tsx +++ b/src/plugins/advanced_settings/public/management_app/components/field/field.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { I18nProvider } from '@kbn/i18n-react'; -import { shallowWithI18nProvider, mountWithI18nProvider } from '@kbn/test/jest'; +import { shallowWithI18nProvider, mountWithI18nProvider } from '@kbn/test-jest-helpers'; import { mount, ReactWrapper } from 'enzyme'; import { FieldSetting } from '../../types'; import { UiSettingsType } from '../../../../../../core/public'; diff --git a/src/plugins/advanced_settings/public/management_app/components/form/form.test.tsx b/src/plugins/advanced_settings/public/management_app/components/form/form.test.tsx index a371831dcb007..7d598aa182695 100644 --- a/src/plugins/advanced_settings/public/management_app/components/form/form.test.tsx +++ b/src/plugins/advanced_settings/public/management_app/components/form/form.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { shallowWithI18nProvider, mountWithI18nProvider } from '@kbn/test/jest'; +import { shallowWithI18nProvider, mountWithI18nProvider } from '@kbn/test-jest-helpers'; import { UiSettingsType } from '../../../../../../core/public'; import { themeServiceMock } from '../../../../../../core/public/mocks'; diff --git a/src/plugins/advanced_settings/public/management_app/components/search/search.test.tsx b/src/plugins/advanced_settings/public/management_app/components/search/search.test.tsx index 18684fa45f3a7..cef5978945bc8 100644 --- a/src/plugins/advanced_settings/public/management_app/components/search/search.test.tsx +++ b/src/plugins/advanced_settings/public/management_app/components/search/search.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { shallowWithI18nProvider, mountWithI18nProvider } from '@kbn/test/jest'; +import { shallowWithI18nProvider, mountWithI18nProvider } from '@kbn/test-jest-helpers'; import { findTestSubject } from '@elastic/eui/lib/test'; diff --git a/src/plugins/chart_expressions/expression_gauge/public/components/gauge_component.test.tsx b/src/plugins/chart_expressions/expression_gauge/public/components/gauge_component.test.tsx index 935c4d66a4506..ffb0328a1c97c 100644 --- a/src/plugins/chart_expressions/expression_gauge/public/components/gauge_component.test.tsx +++ b/src/plugins/chart_expressions/expression_gauge/public/components/gauge_component.test.tsx @@ -11,7 +11,7 @@ import { chartPluginMock } from '../../../../charts/public/mocks'; import { fieldFormatsServiceMock } from '../../../../field_formats/public/mocks'; import type { Datatable } from '../../../../expressions/public'; import { DatatableColumn, DatatableRow } from 'src/plugins/expressions/common'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { GaugeRenderProps, GaugeArguments, GaugeLabelMajorMode, ColorStop } from '../../common'; import GaugeComponent from './gauge_component'; import { Chart, Goal } from '@elastic/charts'; diff --git a/src/plugins/chart_expressions/expression_heatmap/public/components/heatmap_component.test.tsx b/src/plugins/chart_expressions/expression_heatmap/public/components/heatmap_component.test.tsx index 105bd339cbca4..30d9e9d9b90f4 100644 --- a/src/plugins/chart_expressions/expression_heatmap/public/components/heatmap_component.test.tsx +++ b/src/plugins/chart_expressions/expression_heatmap/public/components/heatmap_component.test.tsx @@ -12,7 +12,7 @@ import { chartPluginMock } from '../../../../charts/public/mocks'; import { EmptyPlaceholder } from '../../../../charts/public'; import { fieldFormatsServiceMock } from '../../../../field_formats/public/mocks'; import type { Datatable } from '../../../../expressions/public'; -import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; +import { mountWithIntl, shallowWithIntl } from '@kbn/test-jest-helpers'; import { findTestSubject } from '@elastic/eui/lib/test'; import { act } from 'react-dom/test-utils'; import { HeatmapRenderProps, HeatmapArguments } from '../../common'; diff --git a/src/plugins/chart_expressions/expression_pie/public/utils/get_color_picker.test.tsx b/src/plugins/chart_expressions/expression_pie/public/utils/get_color_picker.test.tsx index 6a2177ee573b0..1a9c785ed6dae 100644 --- a/src/plugins/chart_expressions/expression_pie/public/utils/get_color_picker.test.tsx +++ b/src/plugins/chart_expressions/expression_pie/public/utils/get_color_picker.test.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { LegendColorPickerProps } from '@elastic/charts'; import { EuiPopover } from '@elastic/eui'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { ReactWrapper } from 'enzyme'; import { LegendColorPickerWrapper, diff --git a/src/plugins/console/public/application/containers/editor/legacy/console_editor/editor.test.tsx b/src/plugins/console/public/application/containers/editor/legacy/console_editor/editor.test.tsx index d39ffb9755445..37da5f93ff675 100644 --- a/src/plugins/console/public/application/containers/editor/legacy/console_editor/editor.test.tsx +++ b/src/plugins/console/public/application/containers/editor/legacy/console_editor/editor.test.tsx @@ -16,7 +16,7 @@ import * as sinon from 'sinon'; import { serviceContextMock } from '../../../../contexts/services_context.mock'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { ServicesContextProvider, EditorContextProvider, diff --git a/src/plugins/dashboard/public/application/actions/library_notification_popover.test.tsx b/src/plugins/dashboard/public/application/actions/library_notification_popover.test.tsx index a2a55404072eb..1dc490836808b 100644 --- a/src/plugins/dashboard/public/application/actions/library_notification_popover.test.tsx +++ b/src/plugins/dashboard/public/application/actions/library_notification_popover.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { DashboardContainer } from '../embeddable/dashboard_container'; import { embeddablePluginMock } from '../../../../embeddable/public/mocks'; diff --git a/src/plugins/dashboard/public/application/embeddable/dashboard_container.test.tsx b/src/plugins/dashboard/public/application/embeddable/dashboard_container.test.tsx index 5f50cfd842b67..761db3ca47ff8 100644 --- a/src/plugins/dashboard/public/application/embeddable/dashboard_container.test.tsx +++ b/src/plugins/dashboard/public/application/embeddable/dashboard_container.test.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { mount } from 'enzyme'; -import { findTestSubject, nextTick } from '@kbn/test/jest'; +import { findTestSubject, nextTick } from '@kbn/test-jest-helpers'; import { DashboardContainer, DashboardContainerServices } from './dashboard_container'; import { getSampleDashboardInput, getSampleDashboardPanel } from '../test_helpers'; import { I18nProvider } from '@kbn/i18n-react'; diff --git a/src/plugins/dashboard/public/application/embeddable/empty_screen/dashboard_empty_screen.test.tsx b/src/plugins/dashboard/public/application/embeddable/empty_screen/dashboard_empty_screen.test.tsx index 3b4e2c06ab0a8..0b3a569813845 100644 --- a/src/plugins/dashboard/public/application/embeddable/empty_screen/dashboard_empty_screen.test.tsx +++ b/src/plugins/dashboard/public/application/embeddable/empty_screen/dashboard_empty_screen.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { findTestSubject } from '@elastic/eui/lib/test'; import { DashboardEmptyScreen, DashboardEmptyScreenProps } from './dashboard_empty_screen'; import { coreMock } from '../../../../../../core/public/mocks'; diff --git a/src/plugins/dashboard/public/application/embeddable/grid/dashboard_grid.test.tsx b/src/plugins/dashboard/public/application/embeddable/grid/dashboard_grid.test.tsx index 59f346caf4b0d..4717082cbe0d0 100644 --- a/src/plugins/dashboard/public/application/embeddable/grid/dashboard_grid.test.tsx +++ b/src/plugins/dashboard/public/application/embeddable/grid/dashboard_grid.test.tsx @@ -10,7 +10,7 @@ import sizeMe from 'react-sizeme'; import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { skip } from 'rxjs/operators'; import { DashboardGrid, DashboardGridProps } from './dashboard_grid'; import { DashboardContainer, DashboardContainerServices } from '../dashboard_container'; diff --git a/src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.test.tsx b/src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.test.tsx index d9de67ee9455d..9075a7f90b103 100644 --- a/src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.test.tsx +++ b/src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.test.tsx @@ -11,7 +11,7 @@ import React from 'react'; import { skip } from 'rxjs/operators'; import { mount } from 'enzyme'; import { I18nProvider } from '@kbn/i18n-react'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { DashboardViewport, DashboardViewportProps } from './dashboard_viewport'; import { DashboardContainer, DashboardContainerServices } from '../dashboard_container'; import { getSampleDashboardInput } from '../../test_helpers'; diff --git a/src/plugins/dashboard/public/application/top_nav/clone_modal.test.js b/src/plugins/dashboard/public/application/top_nav/clone_modal.test.js index d7e35df65a7d2..0aab14334a997 100644 --- a/src/plugins/dashboard/public/application/top_nav/clone_modal.test.js +++ b/src/plugins/dashboard/public/application/top_nav/clone_modal.test.js @@ -8,7 +8,7 @@ import React from 'react'; import sinon from 'sinon'; -import { shallowWithI18nProvider, mountWithI18nProvider } from '@kbn/test/jest'; +import { shallowWithI18nProvider, mountWithI18nProvider } from '@kbn/test-jest-helpers'; import { findTestSubject } from '@elastic/eui/lib/test'; import { DashboardCloneModal } from './clone_modal'; diff --git a/src/plugins/dashboard/public/application/top_nav/save_modal.test.js b/src/plugins/dashboard/public/application/top_nav/save_modal.test.js index a532506595a3d..5a8cb8d56db69 100644 --- a/src/plugins/dashboard/public/application/top_nav/save_modal.test.js +++ b/src/plugins/dashboard/public/application/top_nav/save_modal.test.js @@ -7,7 +7,7 @@ */ import React from 'react'; -import { shallowWithI18nProvider } from '@kbn/test/jest'; +import { shallowWithI18nProvider } from '@kbn/test-jest-helpers'; jest.mock('../../../../saved_objects/public', () => ({ SavedObjectSaveModal: () => null, diff --git a/src/plugins/data/public/query/query_string/query_string_manager.test.ts b/src/plugins/data/public/query/query_string/query_string_manager.test.ts index 54f0eb06fb04e..32852b4fe7c32 100644 --- a/src/plugins/data/public/query/query_string/query_string_manager.test.ts +++ b/src/plugins/data/public/query/query_string/query_string_manager.test.ts @@ -8,7 +8,7 @@ import { QueryStringManager } from './query_string_manager'; import { Storage } from '../../../../kibana_utils/public/storage'; -import { StubBrowserStorage } from '@kbn/test/jest'; +import { StubBrowserStorage } from '@kbn/test-jest-helpers'; import { coreMock } from '../../../../../core/public/mocks'; import { Query } from '../../../common/query'; diff --git a/src/plugins/data/public/query/state_sync/connect_to_query_state.test.ts b/src/plugins/data/public/query/state_sync/connect_to_query_state.test.ts index 857a932d9157b..32e9ec7fb374a 100644 --- a/src/plugins/data/public/query/state_sync/connect_to_query_state.test.ts +++ b/src/plugins/data/public/query/state_sync/connect_to_query_state.test.ts @@ -13,7 +13,7 @@ import { Filter, FilterStateStore, UI_SETTINGS } from '../../../common'; import { coreMock } from '../../../../../core/public/mocks'; import { BaseStateContainer, createStateContainer, Storage } from '../../../../kibana_utils/public'; import { QueryService, QueryStart } from '../query_service'; -import { StubBrowserStorage } from '@kbn/test/jest'; +import { StubBrowserStorage } from '@kbn/test-jest-helpers'; import { connectToQueryState } from './connect_to_query_state'; import { TimefilterContract } from '../timefilter'; import { QueryState } from './types'; diff --git a/src/plugins/data/public/query/state_sync/sync_state_with_url.test.ts b/src/plugins/data/public/query/state_sync/sync_state_with_url.test.ts index 2e48a11efd69c..2442ca68f997d 100644 --- a/src/plugins/data/public/query/state_sync/sync_state_with_url.test.ts +++ b/src/plugins/data/public/query/state_sync/sync_state_with_url.test.ts @@ -18,7 +18,7 @@ import { Storage, } from '../../../../kibana_utils/public'; import { QueryService, QueryStart } from '../query_service'; -import { StubBrowserStorage } from '@kbn/test/jest'; +import { StubBrowserStorage } from '@kbn/test-jest-helpers'; import { TimefilterContract } from '../timefilter'; import { syncQueryStateWithUrl } from './sync_state_with_url'; import { QueryState } from './types'; diff --git a/src/plugins/data/public/ui/filter_bar/filter_editor/filter_editor.test.tsx b/src/plugins/data/public/ui/filter_bar/filter_editor/filter_editor.test.tsx index 3a0c0db96c5de..8f48bef8e0e54 100644 --- a/src/plugins/data/public/ui/filter_bar/filter_editor/filter_editor.test.tsx +++ b/src/plugins/data/public/ui/filter_bar/filter_editor/filter_editor.test.tsx @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { registerTestBed, TestBed } from '@kbn/test/jest'; +import { registerTestBed, TestBed } from '@kbn/test-jest-helpers'; import { FilterEditor, Props } from '.'; import React from 'react'; diff --git a/src/plugins/data/public/ui/query_string_input/language_switcher.test.tsx b/src/plugins/data/public/ui/query_string_input/language_switcher.test.tsx index acbd48718d92e..67d36f465568d 100644 --- a/src/plugins/data/public/ui/query_string_input/language_switcher.test.tsx +++ b/src/plugins/data/public/ui/query_string_input/language_switcher.test.tsx @@ -10,7 +10,7 @@ import React from 'react'; import { QueryLanguageSwitcher, QueryLanguageSwitcherProps } from './language_switcher'; import { KibanaContextProvider } from 'src/plugins/kibana_react/public'; import { coreMock } from '../../../../../core/public/mocks'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { EuiButtonEmpty, EuiIcon, EuiPopover } from '@elastic/eui'; const startMock = coreMock.createStart(); diff --git a/src/plugins/data/public/ui/query_string_input/no_data_popover.test.tsx b/src/plugins/data/public/ui/query_string_input/no_data_popover.test.tsx index 53edaa8d9bf4f..f80fc68494091 100644 --- a/src/plugins/data/public/ui/query_string_input/no_data_popover.test.tsx +++ b/src/plugins/data/public/ui/query_string_input/no_data_popover.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { mountWithIntl as mount } from '@kbn/test/jest'; +import { mountWithIntl as mount } from '@kbn/test-jest-helpers'; import { NoDataPopover } from './no_data_popover'; import { EuiTourStep } from '@elastic/eui'; import { act } from 'react-dom/test-utils'; diff --git a/src/plugins/data/public/ui/shard_failure_modal/shard_failure_description.test.tsx b/src/plugins/data/public/ui/shard_failure_modal/shard_failure_description.test.tsx index 94efcefb719a8..535b7ea66237b 100644 --- a/src/plugins/data/public/ui/shard_failure_modal/shard_failure_description.test.tsx +++ b/src/plugins/data/public/ui/shard_failure_modal/shard_failure_description.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { ShardFailureDescription } from './shard_failure_description'; import { shardFailureResponse } from './__mocks__/shard_failure_response'; import { ShardFailure } from './shard_failure_types'; diff --git a/src/plugins/data/public/ui/shard_failure_modal/shard_failure_modal.test.tsx b/src/plugins/data/public/ui/shard_failure_modal/shard_failure_modal.test.tsx index 35933250276c7..d4b30d5a1923b 100644 --- a/src/plugins/data/public/ui/shard_failure_modal/shard_failure_modal.test.tsx +++ b/src/plugins/data/public/ui/shard_failure_modal/shard_failure_modal.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { ShardFailureModal } from './shard_failure_modal'; import { shardFailureRequest } from './__mocks__/shard_failure_request'; import { shardFailureResponse } from './__mocks__/shard_failure_response'; diff --git a/src/plugins/data/public/ui/shard_failure_modal/shard_failure_open_modal_button.test.tsx b/src/plugins/data/public/ui/shard_failure_modal/shard_failure_open_modal_button.test.tsx index b8289bc23cf01..0cb71f9097f9e 100644 --- a/src/plugins/data/public/ui/shard_failure_modal/shard_failure_open_modal_button.test.tsx +++ b/src/plugins/data/public/ui/shard_failure_modal/shard_failure_open_modal_button.test.tsx @@ -9,7 +9,7 @@ import { openModal } from './shard_failure_open_modal_button.test.mocks'; import React from 'react'; import { themeServiceMock } from 'src/core/public/mocks'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import ShardFailureOpenModalButton from './shard_failure_open_modal_button'; import { shardFailureRequest } from './__mocks__/shard_failure_request'; import { shardFailureResponse } from './__mocks__/shard_failure_response'; diff --git a/src/plugins/data/public/ui/shard_failure_modal/shard_failure_table.test.tsx b/src/plugins/data/public/ui/shard_failure_modal/shard_failure_table.test.tsx index 32f245de53e7b..c4a53f850ab6a 100644 --- a/src/plugins/data/public/ui/shard_failure_modal/shard_failure_table.test.tsx +++ b/src/plugins/data/public/ui/shard_failure_modal/shard_failure_table.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { ShardFailureTable } from './shard_failure_table'; import { shardFailureResponse } from './__mocks__/shard_failure_response'; import { ShardFailure } from './shard_failure_types'; diff --git a/src/plugins/data/public/utils/table_inspector_view/components/data_view.test.tsx b/src/plugins/data/public/utils/table_inspector_view/components/data_view.test.tsx index e6b40bcb5936c..eb7f51aad8223 100644 --- a/src/plugins/data/public/utils/table_inspector_view/components/data_view.test.tsx +++ b/src/plugins/data/public/utils/table_inspector_view/components/data_view.test.tsx @@ -8,7 +8,7 @@ import React, { Suspense } from 'react'; import { getTableViewDescription } from '../index'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { TablesAdapter } from '../../../../../expressions/common'; jest.mock('../../../../../share/public', () => ({ diff --git a/src/plugins/data_view_editor/public/components/empty_prompts/empty_index_list_prompt/empty_index_list_prompt.test.tsx b/src/plugins/data_view_editor/public/components/empty_prompts/empty_index_list_prompt/empty_index_list_prompt.test.tsx index f5a996a441515..3de6995267bb3 100644 --- a/src/plugins/data_view_editor/public/components/empty_prompts/empty_index_list_prompt/empty_index_list_prompt.test.tsx +++ b/src/plugins/data_view_editor/public/components/empty_prompts/empty_index_list_prompt/empty_index_list_prompt.test.tsx @@ -11,7 +11,7 @@ import { EmptyIndexListPrompt } from './empty_index_list_prompt'; import { shallow } from 'enzyme'; import sinon from 'sinon'; import { findTestSubject } from '@elastic/eui/lib/test'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; jest.mock('react-router-dom', () => ({ useHistory: () => ({ diff --git a/src/plugins/data_view_editor/public/components/empty_prompts/empty_index_pattern_prompt/empty_index_pattern_prompt.test.tsx b/src/plugins/data_view_editor/public/components/empty_prompts/empty_index_pattern_prompt/empty_index_pattern_prompt.test.tsx index 4cf3c4b55acde..242f124b326b8 100644 --- a/src/plugins/data_view_editor/public/components/empty_prompts/empty_index_pattern_prompt/empty_index_pattern_prompt.test.tsx +++ b/src/plugins/data_view_editor/public/components/empty_prompts/empty_index_pattern_prompt/empty_index_pattern_prompt.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { EmptyIndexPatternPrompt } from '../empty_index_pattern_prompt'; -import { shallowWithI18nProvider } from '@kbn/test/jest'; +import { shallowWithI18nProvider } from '@kbn/test-jest-helpers'; describe('EmptyIndexPatternPrompt', () => { it('should render normally', () => { diff --git a/src/plugins/data_view_editor/public/test_utils/test_utils.ts b/src/plugins/data_view_editor/public/test_utils/test_utils.ts index 311d93d31b593..1a553b74c19c8 100644 --- a/src/plugins/data_view_editor/public/test_utils/test_utils.ts +++ b/src/plugins/data_view_editor/public/test_utils/test_utils.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -export { getRandomString } from '@kbn/test/jest'; +export { getRandomString } from '@kbn/test-jest-helpers'; -export type { TestBed } from '@kbn/test/jest'; -export { registerTestBed } from '@kbn/test/jest'; +export type { TestBed } from '@kbn/test-jest-helpers'; +export { registerTestBed } from '@kbn/test-jest-helpers'; diff --git a/src/plugins/data_view_field_editor/__jest__/client_integration/field_editor.helpers.ts b/src/plugins/data_view_field_editor/__jest__/client_integration/field_editor.helpers.ts index 1fd280a937a03..f1cf9b862ebaa 100644 --- a/src/plugins/data_view_field_editor/__jest__/client_integration/field_editor.helpers.ts +++ b/src/plugins/data_view_field_editor/__jest__/client_integration/field_editor.helpers.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ import { act } from 'react-dom/test-utils'; -import { registerTestBed, TestBed } from '@kbn/test/jest'; +import { registerTestBed, TestBed } from '@kbn/test-jest-helpers'; import { Context } from '../../public/components/field_editor_context'; import { FieldEditor, Props } from '../../public/components/field_editor/field_editor'; diff --git a/src/plugins/data_view_field_editor/__jest__/client_integration/field_editor_flyout_content.helpers.ts b/src/plugins/data_view_field_editor/__jest__/client_integration/field_editor_flyout_content.helpers.ts index 0e87756819bf2..c3816b0bfb8c3 100644 --- a/src/plugins/data_view_field_editor/__jest__/client_integration/field_editor_flyout_content.helpers.ts +++ b/src/plugins/data_view_field_editor/__jest__/client_integration/field_editor_flyout_content.helpers.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ import { act } from 'react-dom/test-utils'; -import { registerTestBed, TestBed } from '@kbn/test/jest'; +import { registerTestBed, TestBed } from '@kbn/test-jest-helpers'; import { Context } from '../../public/components/field_editor_context'; import { diff --git a/src/plugins/data_view_field_editor/__jest__/client_integration/field_editor_flyout_preview.helpers.ts b/src/plugins/data_view_field_editor/__jest__/client_integration/field_editor_flyout_preview.helpers.ts index 305cf84d59622..9df7de5f65d62 100644 --- a/src/plugins/data_view_field_editor/__jest__/client_integration/field_editor_flyout_preview.helpers.ts +++ b/src/plugins/data_view_field_editor/__jest__/client_integration/field_editor_flyout_preview.helpers.ts @@ -7,7 +7,7 @@ */ import { act } from 'react-dom/test-utils'; import { ReactWrapper } from 'enzyme'; -import { registerTestBed, TestBed } from '@kbn/test/jest'; +import { registerTestBed, TestBed } from '@kbn/test-jest-helpers'; import { API_BASE_PATH } from '../../common/constants'; import { Context } from '../../public/components/field_editor_context'; diff --git a/src/plugins/data_view_field_editor/__jest__/client_integration/helpers/common_actions.ts b/src/plugins/data_view_field_editor/__jest__/client_integration/helpers/common_actions.ts index 9f8b52af5878e..77e8e8834a0f4 100644 --- a/src/plugins/data_view_field_editor/__jest__/client_integration/helpers/common_actions.ts +++ b/src/plugins/data_view_field_editor/__jest__/client_integration/helpers/common_actions.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ import { act } from 'react-dom/test-utils'; -import { TestBed } from '@kbn/test/jest'; +import { TestBed } from '@kbn/test-jest-helpers'; /** * We often need to wait for both the documents & the preview to be fetched. diff --git a/src/plugins/data_view_field_editor/__jest__/client_integration/helpers/index.ts b/src/plugins/data_view_field_editor/__jest__/client_integration/helpers/index.ts index 2fc870bd42d66..b29b76a9daf23 100644 --- a/src/plugins/data_view_field_editor/__jest__/client_integration/helpers/index.ts +++ b/src/plugins/data_view_field_editor/__jest__/client_integration/helpers/index.ts @@ -6,8 +6,8 @@ * Side Public License, v 1. */ -export type { TestBed } from '@kbn/test/jest'; -export { findTestSubject } from '@kbn/test/jest'; +export type { TestBed } from '@kbn/test-jest-helpers'; +export { findTestSubject } from '@kbn/test-jest-helpers'; export { setupEnvironment, diff --git a/src/plugins/data_view_field_editor/public/components/field_format_editor/editors/color/color.test.tsx b/src/plugins/data_view_field_editor/public/components/field_format_editor/editors/color/color.test.tsx index 362fa0887b780..750cf8378f334 100644 --- a/src/plugins/data_view_field_editor/public/components/field_format_editor/editors/color/color.test.tsx +++ b/src/plugins/data_view_field_editor/public/components/field_format_editor/editors/color/color.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { shallowWithI18nProvider } from '@kbn/test/jest'; +import { shallowWithI18nProvider } from '@kbn/test-jest-helpers'; import { ColorFormatEditor } from './color'; import { FieldFormat, DEFAULT_CONVERTER_COLOR } from '../../../../../../field_formats/common'; diff --git a/src/plugins/data_view_field_editor/public/components/field_format_editor/editors/static_lookup/static_lookup.test.tsx b/src/plugins/data_view_field_editor/public/components/field_format_editor/editors/static_lookup/static_lookup.test.tsx index 5142f11ae87e5..9f2bd59d7ceb4 100644 --- a/src/plugins/data_view_field_editor/public/components/field_format_editor/editors/static_lookup/static_lookup.test.tsx +++ b/src/plugins/data_view_field_editor/public/components/field_format_editor/editors/static_lookup/static_lookup.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { shallowWithI18nProvider } from '@kbn/test/jest'; +import { shallowWithI18nProvider } from '@kbn/test-jest-helpers'; import { StaticLookupFormatEditorFormatParams } from './static_lookup'; import { FieldFormat } from 'src/plugins/field_formats/common'; diff --git a/src/plugins/data_view_field_editor/public/components/field_format_editor/samples/samples.test.tsx b/src/plugins/data_view_field_editor/public/components/field_format_editor/samples/samples.test.tsx index 433e08ad5bcd0..9b400dd4931e0 100644 --- a/src/plugins/data_view_field_editor/public/components/field_format_editor/samples/samples.test.tsx +++ b/src/plugins/data_view_field_editor/public/components/field_format_editor/samples/samples.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { shallowWithI18nProvider } from '@kbn/test/jest'; +import { shallowWithI18nProvider } from '@kbn/test-jest-helpers'; import { FormatEditorSamples } from './samples'; diff --git a/src/plugins/data_view_field_editor/public/plugin.test.tsx b/src/plugins/data_view_field_editor/public/plugin.test.tsx index 4f609965171b5..fe7e8c57cd4ec 100644 --- a/src/plugins/data_view_field_editor/public/plugin.test.tsx +++ b/src/plugins/data_view_field_editor/public/plugin.test.tsx @@ -6,7 +6,7 @@ * Side Public License, v 1. */ import React from 'react'; -import { registerTestBed } from '@kbn/test/jest'; +import { registerTestBed } from '@kbn/test-jest-helpers'; jest.mock('../../kibana_react/public', () => { const original = jest.requireActual('../../kibana_react/public'); diff --git a/src/plugins/discover/public/application/context/components/action_bar/action_bar.test.tsx b/src/plugins/discover/public/application/context/components/action_bar/action_bar.test.tsx index cce6c7fbe6053..5a4e959ccb576 100644 --- a/src/plugins/discover/public/application/context/components/action_bar/action_bar.test.tsx +++ b/src/plugins/discover/public/application/context/components/action_bar/action_bar.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { ActionBar, ActionBarProps } from './action_bar'; import { findTestSubject } from '@elastic/eui/lib/test'; import { MAX_CONTEXT_SIZE, MIN_CONTEXT_SIZE } from '../../services/constants'; diff --git a/src/plugins/discover/public/application/context/components/context_error_message/context_error_message.test.tsx b/src/plugins/discover/public/application/context/components/context_error_message/context_error_message.test.tsx index 47937058451fa..049a3977b5b96 100644 --- a/src/plugins/discover/public/application/context/components/context_error_message/context_error_message.test.tsx +++ b/src/plugins/discover/public/application/context/components/context_error_message/context_error_message.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { ReactWrapper } from 'enzyme'; import { ContextErrorMessage } from './context_error_message'; import { FailureReason, LoadingStatus } from '../../services/context_query_state'; diff --git a/src/plugins/discover/public/application/context/context_app.test.tsx b/src/plugins/discover/public/application/context/context_app.test.tsx index aa3428e52fa96..c9089a6c1111c 100644 --- a/src/plugins/discover/public/application/context/context_app.test.tsx +++ b/src/plugins/discover/public/application/context/context_app.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { waitFor } from '@testing-library/react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { createFilterManagerMock } from '../../../../data/public/query/filter_manager/filter_manager.mock'; import { mockTopNavMenu } from './__mocks__/top_nav_menu'; import { ContextAppContent } from './context_app_content'; diff --git a/src/plugins/discover/public/application/context/context_app_content.test.tsx b/src/plugins/discover/public/application/context/context_app_content.test.tsx index a066dbe0deddb..e57206bcba2c1 100644 --- a/src/plugins/discover/public/application/context/context_app_content.test.tsx +++ b/src/plugins/discover/public/application/context/context_app_content.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { findTestSubject } from '@elastic/eui/lib/test'; import { ActionBar } from './components/action_bar/action_bar'; import { GetStateReturn } from './services/context_state'; diff --git a/src/plugins/discover/public/application/doc/components/doc.test.tsx b/src/plugins/discover/public/application/doc/components/doc.test.tsx index f9b024b9c6835..29453e7f83f19 100644 --- a/src/plugins/discover/public/application/doc/components/doc.test.tsx +++ b/src/plugins/discover/public/application/doc/components/doc.test.tsx @@ -9,7 +9,7 @@ import { throwError, of } from 'rxjs'; import React from 'react'; import { act } from 'react-dom/test-utils'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { ReactWrapper } from 'enzyme'; import { findTestSubject } from '@elastic/eui/lib/test'; import { Doc, DocProps } from './doc'; diff --git a/src/plugins/discover/public/application/main/components/chart/discover_chart.test.tsx b/src/plugins/discover/public/application/main/components/chart/discover_chart.test.tsx index 3feb8f2cea6b5..1be37081a01b5 100644 --- a/src/plugins/discover/public/application/main/components/chart/discover_chart.test.tsx +++ b/src/plugins/discover/public/application/main/components/chart/discover_chart.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { Subject, BehaviorSubject } from 'rxjs'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { setHeaderActionMenuMounter } from '../../../../kibana_services'; import { esHits } from '../../../../__mocks__/es_hits'; import { savedSearchMock } from '../../../../__mocks__/saved_search'; diff --git a/src/plugins/discover/public/application/main/components/chart/histogram.test.tsx b/src/plugins/discover/public/application/main/components/chart/histogram.test.tsx index 547c6ffe42f48..d336cd2c092b6 100644 --- a/src/plugins/discover/public/application/main/components/chart/histogram.test.tsx +++ b/src/plugins/discover/public/application/main/components/chart/histogram.test.tsx @@ -5,7 +5,7 @@ * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { BehaviorSubject } from 'rxjs'; import { FetchStatus } from '../../../types'; import { DataCharts$ } from '../../utils/use_saved_search'; diff --git a/src/plugins/discover/public/application/main/components/document_explorer_callout/document_explorere_callout.test.tsx b/src/plugins/discover/public/application/main/components/document_explorer_callout/document_explorere_callout.test.tsx index 37c9f2284aa20..3e6b8e3973001 100644 --- a/src/plugins/discover/public/application/main/components/document_explorer_callout/document_explorere_callout.test.tsx +++ b/src/plugins/discover/public/application/main/components/document_explorer_callout/document_explorere_callout.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { KibanaContextProvider } from '../../../../../../kibana_react/public'; import { CALLOUT_STATE_KEY, DocumentExplorerCallout } from './document_explorer_callout'; import { LocalStorageMock } from '../../../../__mocks__/local_storage_mock'; diff --git a/src/plugins/discover/public/application/main/components/hits_counter/hits_counter.test.tsx b/src/plugins/discover/public/application/main/components/hits_counter/hits_counter.test.tsx index d46600fca01f4..4ba4eda45d279 100644 --- a/src/plugins/discover/public/application/main/components/hits_counter/hits_counter.test.tsx +++ b/src/plugins/discover/public/application/main/components/hits_counter/hits_counter.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { ReactWrapper } from 'enzyme'; import { HitsCounter, HitsCounterProps } from './hits_counter'; import { findTestSubject } from '@elastic/eui/lib/test'; diff --git a/src/plugins/discover/public/application/main/components/layout/discover_documents.test.tsx b/src/plugins/discover/public/application/main/components/layout/discover_documents.test.tsx index cf547b42c7277..78f18e0218872 100644 --- a/src/plugins/discover/public/application/main/components/layout/discover_documents.test.tsx +++ b/src/plugins/discover/public/application/main/components/layout/discover_documents.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { BehaviorSubject } from 'rxjs'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { setHeaderActionMenuMounter } from '../../../../kibana_services'; import { esHits } from '../../../../__mocks__/es_hits'; import { savedSearchMock } from '../../../../__mocks__/saved_search'; diff --git a/src/plugins/discover/public/application/main/components/layout/discover_layout.test.tsx b/src/plugins/discover/public/application/main/components/layout/discover_layout.test.tsx index aa2149abdde62..7b0845cd199c0 100644 --- a/src/plugins/discover/public/application/main/components/layout/discover_layout.test.tsx +++ b/src/plugins/discover/public/application/main/components/layout/discover_layout.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { Subject, BehaviorSubject } from 'rxjs'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { setHeaderActionMenuMounter } from '../../../../kibana_services'; import { DiscoverLayout, SIDEBAR_CLOSED_KEY } from './discover_layout'; import { esHits } from '../../../../__mocks__/es_hits'; diff --git a/src/plugins/discover/public/application/main/components/loading_spinner/loading_spinner.test.tsx b/src/plugins/discover/public/application/main/components/loading_spinner/loading_spinner.test.tsx index 020c6d38398ba..36978a1f72684 100644 --- a/src/plugins/discover/public/application/main/components/loading_spinner/loading_spinner.test.tsx +++ b/src/plugins/discover/public/application/main/components/loading_spinner/loading_spinner.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { ReactWrapper } from 'enzyme'; import { LoadingSpinner } from './loading_spinner'; import { findTestSubject } from '@elastic/eui/lib/test'; diff --git a/src/plugins/discover/public/application/main/components/no_results/no_results.test.tsx b/src/plugins/discover/public/application/main/components/no_results/no_results.test.tsx index 2418416e5c277..4dc1a5feda5dc 100644 --- a/src/plugins/discover/public/application/main/components/no_results/no_results.test.tsx +++ b/src/plugins/discover/public/application/main/components/no_results/no_results.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { findTestSubject } from '@elastic/eui/lib/test'; import { DiscoverNoResults, DiscoverNoResultsProps } from './no_results'; diff --git a/src/plugins/discover/public/application/main/components/sidebar/change_indexpattern.test.tsx b/src/plugins/discover/public/application/main/components/sidebar/change_indexpattern.test.tsx index b61683c8de14a..a5e93c1d895bc 100644 --- a/src/plugins/discover/public/application/main/components/sidebar/change_indexpattern.test.tsx +++ b/src/plugins/discover/public/application/main/components/sidebar/change_indexpattern.test.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { EuiSelectable } from '@elastic/eui'; import { ShallowWrapper } from 'enzyme'; import { act } from 'react-dom/test-utils'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { ChangeIndexPattern } from './change_indexpattern'; import { indexPatternMock } from '../../../../__mocks__/index_pattern'; import { indexPatternWithTimefieldMock } from '../../../../__mocks__/index_pattern_with_timefield'; diff --git a/src/plugins/discover/public/application/main/components/sidebar/discover_field.test.tsx b/src/plugins/discover/public/application/main/components/sidebar/discover_field.test.tsx index 758738a6cbc56..c2ba365ef5fda 100644 --- a/src/plugins/discover/public/application/main/components/sidebar/discover_field.test.tsx +++ b/src/plugins/discover/public/application/main/components/sidebar/discover_field.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { findTestSubject } from '@elastic/eui/lib/test'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { DiscoverField } from './discover_field'; import { DataViewField } from '../../../../../../data/common'; diff --git a/src/plugins/discover/public/application/main/components/sidebar/discover_field_details.test.tsx b/src/plugins/discover/public/application/main/components/sidebar/discover_field_details.test.tsx index c63a50c17fa8f..77f2d0fd89d25 100644 --- a/src/plugins/discover/public/application/main/components/sidebar/discover_field_details.test.tsx +++ b/src/plugins/discover/public/application/main/components/sidebar/discover_field_details.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { findTestSubject } from '@elastic/eui/lib/test'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { DiscoverFieldDetails } from './discover_field_details'; import { DataViewField } from '../../../../../../data/common'; diff --git a/src/plugins/discover/public/application/main/components/sidebar/discover_field_search.test.tsx b/src/plugins/discover/public/application/main/components/sidebar/discover_field_search.test.tsx index e654d87ea2ba6..40474f3e4fc1d 100644 --- a/src/plugins/discover/public/application/main/components/sidebar/discover_field_search.test.tsx +++ b/src/plugins/discover/public/application/main/components/sidebar/discover_field_search.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { act } from 'react-dom/test-utils'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { findTestSubject } from '@elastic/eui/lib/test'; import { DiscoverFieldSearch, Props } from './discover_field_search'; import { EuiButtonGroupProps, EuiPopover } from '@elastic/eui'; diff --git a/src/plugins/discover/public/application/main/components/sidebar/discover_index_pattern.test.tsx b/src/plugins/discover/public/application/main/components/sidebar/discover_index_pattern.test.tsx index 153f1cb4c7b3d..73f460cccf784 100644 --- a/src/plugins/discover/public/application/main/components/sidebar/discover_index_pattern.test.tsx +++ b/src/plugins/discover/public/application/main/components/sidebar/discover_index_pattern.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { act } from 'react-dom/test-utils'; -import { shallowWithIntl as shallow } from '@kbn/test/jest'; +import { shallowWithIntl as shallow } from '@kbn/test-jest-helpers'; import { ShallowWrapper } from 'enzyme'; import { ChangeIndexPattern } from './change_indexpattern'; import { SavedObject } from 'kibana/server'; diff --git a/src/plugins/discover/public/application/main/components/sidebar/discover_index_pattern_management.test.tsx b/src/plugins/discover/public/application/main/components/sidebar/discover_index_pattern_management.test.tsx index 272e8178aefc2..b511dc08f1e91 100644 --- a/src/plugins/discover/public/application/main/components/sidebar/discover_index_pattern_management.test.tsx +++ b/src/plugins/discover/public/application/main/components/sidebar/discover_index_pattern_management.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { mountWithIntl, findTestSubject } from '@kbn/test/jest'; +import { mountWithIntl, findTestSubject } from '@kbn/test-jest-helpers'; import { EuiContextMenuPanel, EuiPopover, EuiContextMenuItem } from '@elastic/eui'; import { DiscoverServices } from '../../../../build_services'; import { DiscoverIndexPatternManagement } from './discover_index_pattern_management'; diff --git a/src/plugins/discover/public/application/main/components/sidebar/discover_sidebar.test.tsx b/src/plugins/discover/public/application/main/components/sidebar/discover_sidebar.test.tsx index b6dbf40cc7b3d..8a9e9a0ee6872 100644 --- a/src/plugins/discover/public/application/main/components/sidebar/discover_sidebar.test.tsx +++ b/src/plugins/discover/public/application/main/components/sidebar/discover_sidebar.test.tsx @@ -12,7 +12,7 @@ import { findTestSubject } from '@elastic/eui/lib/test'; // @ts-expect-error import realHits from '../../../../__fixtures__/real_hits.js'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { DiscoverSidebarProps } from './discover_sidebar'; import { flattenHit, IndexPatternAttributes } from '../../../../../../data/common'; diff --git a/src/plugins/discover/public/application/main/components/sidebar/discover_sidebar_responsive.test.tsx b/src/plugins/discover/public/application/main/components/sidebar/discover_sidebar_responsive.test.tsx index eee09f4ef481e..7f1f6b94eab16 100644 --- a/src/plugins/discover/public/application/main/components/sidebar/discover_sidebar_responsive.test.tsx +++ b/src/plugins/discover/public/application/main/components/sidebar/discover_sidebar_responsive.test.tsx @@ -13,7 +13,7 @@ import { findTestSubject } from '@elastic/eui/lib/test'; // @ts-expect-error import realHits from '../../../../__fixtures__/real_hits.js'; import { act } from 'react-dom/test-utils'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { flattenHit, IndexPatternAttributes } from '../../../../../../data/common'; import { SavedObject } from '../../../../../../../core/types'; diff --git a/src/plugins/discover/public/application/main/components/skip_bottom_button/skip_bottom_button.test.tsx b/src/plugins/discover/public/application/main/components/skip_bottom_button/skip_bottom_button.test.tsx index 0cdbbb7602e8c..21456ca59dab1 100644 --- a/src/plugins/discover/public/application/main/components/skip_bottom_button/skip_bottom_button.test.tsx +++ b/src/plugins/discover/public/application/main/components/skip_bottom_button/skip_bottom_button.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { ReactWrapper } from 'enzyme'; import { SkipBottomButton, SkipBottomButtonProps } from './skip_bottom_button'; diff --git a/src/plugins/discover/public/application/main/components/top_nav/discover_topnav.test.tsx b/src/plugins/discover/public/application/main/components/top_nav/discover_topnav.test.tsx index ca5eacd4fdb8a..2c5c5ffb37d69 100644 --- a/src/plugins/discover/public/application/main/components/top_nav/discover_topnav.test.tsx +++ b/src/plugins/discover/public/application/main/components/top_nav/discover_topnav.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { indexPatternMock } from '../../../../__mocks__/index_pattern'; import { savedSearchMock } from '../../../../__mocks__/saved_search'; import { DiscoverTopNav, DiscoverTopNavProps } from './discover_topnav'; diff --git a/src/plugins/discover/public/application/main/components/top_nav/open_options_popover.test.tsx b/src/plugins/discover/public/application/main/components/top_nav/open_options_popover.test.tsx index c2059915b2af8..ef64e602280b4 100644 --- a/src/plugins/discover/public/application/main/components/top_nav/open_options_popover.test.tsx +++ b/src/plugins/discover/public/application/main/components/top_nav/open_options_popover.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { findTestSubject } from '@elastic/eui/lib/test'; import { OptionsPopover } from './open_options_popover'; diff --git a/src/plugins/discover/public/application/main/discover_main_app.test.tsx b/src/plugins/discover/public/application/main/discover_main_app.test.tsx index d1699900b1498..5d3b28bb35c5f 100644 --- a/src/plugins/discover/public/application/main/discover_main_app.test.tsx +++ b/src/plugins/discover/public/application/main/discover_main_app.test.tsx @@ -6,7 +6,7 @@ * Side Public License, v 1. */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { indexPatternMock } from '../../__mocks__/index_pattern'; import { DiscoverMainApp } from './discover_main_app'; import { savedSearchMock } from '../../__mocks__/saved_search'; diff --git a/src/plugins/discover/public/components/discover_grid/discover_grid.test.tsx b/src/plugins/discover/public/components/discover_grid/discover_grid.test.tsx index c4ef4ffef3234..f2b3b130e395c 100644 --- a/src/plugins/discover/public/components/discover_grid/discover_grid.test.tsx +++ b/src/plugins/discover/public/components/discover_grid/discover_grid.test.tsx @@ -12,7 +12,7 @@ import { act } from 'react-dom/test-utils'; import { findTestSubject } from '@elastic/eui/lib/test'; import { esHits } from '../../__mocks__/es_hits'; import { indexPatternMock } from '../../__mocks__/index_pattern'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { DiscoverGrid, DiscoverGridProps } from './discover_grid'; import { getDocId } from './discover_grid_document_selection'; import { ElasticSearchHit } from '../../types'; diff --git a/src/plugins/discover/public/components/discover_grid/discover_grid_cell_actions.test.tsx b/src/plugins/discover/public/components/discover_grid/discover_grid_cell_actions.test.tsx index 7568cb427e7b5..651004638a85e 100644 --- a/src/plugins/discover/public/components/discover_grid/discover_grid_cell_actions.test.tsx +++ b/src/plugins/discover/public/components/discover_grid/discover_grid_cell_actions.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { findTestSubject } from '@elastic/eui/lib/test'; import { FilterInBtn, FilterOutBtn, buildCellActions } from './discover_grid_cell_actions'; import { DiscoverGridContext } from './discover_grid_context'; diff --git a/src/plugins/discover/public/components/discover_grid/discover_grid_document_selection.test.tsx b/src/plugins/discover/public/components/discover_grid/discover_grid_document_selection.test.tsx index d57fba241a1e7..2afee7a6a48a3 100644 --- a/src/plugins/discover/public/components/discover_grid/discover_grid_document_selection.test.tsx +++ b/src/plugins/discover/public/components/discover_grid/discover_grid_document_selection.test.tsx @@ -6,7 +6,7 @@ * Side Public License, v 1. */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { findTestSubject } from '@elastic/eui/lib/test'; import { DiscoverGridDocumentToolbarBtn, diff --git a/src/plugins/discover/public/components/discover_grid/discover_grid_expand_button.test.tsx b/src/plugins/discover/public/components/discover_grid/discover_grid_expand_button.test.tsx index de2117afe7bdb..bb8341f746e85 100644 --- a/src/plugins/discover/public/components/discover_grid/discover_grid_expand_button.test.tsx +++ b/src/plugins/discover/public/components/discover_grid/discover_grid_expand_button.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { findTestSubject } from '@elastic/eui/lib/test'; import { ExpandButton } from './discover_grid_expand_button'; import { DiscoverGridContext } from './discover_grid_context'; diff --git a/src/plugins/discover/public/components/discover_grid/discover_grid_flyout.test.tsx b/src/plugins/discover/public/components/discover_grid/discover_grid_flyout.test.tsx index a6c5ecdcdf35c..cc10da2dfc464 100644 --- a/src/plugins/discover/public/components/discover_grid/discover_grid_flyout.test.tsx +++ b/src/plugins/discover/public/components/discover_grid/discover_grid_flyout.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { findTestSubject } from '@elastic/eui/lib/test'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { DiscoverGridFlyout, DiscoverGridFlyoutProps } from './discover_grid_flyout'; import { esHits } from '../../__mocks__/es_hits'; import { createFilterManagerMock } from '../../../../data/public/query/filter_manager/filter_manager.mock'; diff --git a/src/plugins/discover/public/components/doc_table/components/table_header/table_header.test.tsx b/src/plugins/discover/public/components/doc_table/components/table_header/table_header.test.tsx index 60e9c25cb4532..d29bd02e92d35 100644 --- a/src/plugins/discover/public/components/doc_table/components/table_header/table_header.test.tsx +++ b/src/plugins/discover/public/components/doc_table/components/table_header/table_header.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import type { DataView, DataViewField } from 'src/plugins/data/common'; import { TableHeader } from './table_header'; import { findTestSubject } from '@elastic/eui/lib/test'; diff --git a/src/plugins/discover/public/components/doc_table/components/table_row.test.tsx b/src/plugins/discover/public/components/doc_table/components/table_row.test.tsx index 084fddc991f74..61e536129ffdb 100644 --- a/src/plugins/discover/public/components/doc_table/components/table_row.test.tsx +++ b/src/plugins/discover/public/components/doc_table/components/table_row.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { mountWithIntl, findTestSubject } from '@kbn/test/jest'; +import { mountWithIntl, findTestSubject } from '@kbn/test-jest-helpers'; import { TableRow, TableRowProps } from './table_row'; import { setDocViewsRegistry } from '../../../kibana_services'; import { createFilterManagerMock } from '../../../../../data/public/query/filter_manager/filter_manager.mock'; diff --git a/src/plugins/discover/public/components/doc_table/doc_table_wrapper.test.tsx b/src/plugins/discover/public/components/doc_table/doc_table_wrapper.test.tsx index 3634a47e3bcf1..9de67c340f8bd 100644 --- a/src/plugins/discover/public/components/doc_table/doc_table_wrapper.test.tsx +++ b/src/plugins/discover/public/components/doc_table/doc_table_wrapper.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { findTestSubject, mountWithIntl } from '@kbn/test/jest'; +import { findTestSubject, mountWithIntl } from '@kbn/test-jest-helpers'; import { indexPatternMock } from '../../__mocks__/index_pattern'; import { DocTableWrapper } from './doc_table_wrapper'; import { DocTableRow } from './components/table_row'; diff --git a/src/plugins/discover/public/services/doc_views/components/doc_viewer_source/source.test.tsx b/src/plugins/discover/public/services/doc_views/components/doc_viewer_source/source.test.tsx index 70648b46d7804..986ad37384c92 100644 --- a/src/plugins/discover/public/services/doc_views/components/doc_viewer_source/source.test.tsx +++ b/src/plugins/discover/public/services/doc_views/components/doc_viewer_source/source.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import type { DataView } from 'src/plugins/data/common'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { DocViewerSource } from './source'; import * as hooks from '../../../../utils/use_es_doc_search'; import * as useUiSettingHook from '../../../../../../kibana_react/public/ui_settings/use_ui_setting'; diff --git a/src/plugins/discover/public/services/doc_views/components/doc_viewer_table/legacy/table.test.tsx b/src/plugins/discover/public/services/doc_views/components/doc_viewer_table/legacy/table.test.tsx index cb85315e7dd42..26dbd76a1dc1a 100644 --- a/src/plugins/discover/public/services/doc_views/components/doc_viewer_table/legacy/table.test.tsx +++ b/src/plugins/discover/public/services/doc_views/components/doc_viewer_table/legacy/table.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { findTestSubject } from '@elastic/eui/lib/test'; import { DocViewerLegacyTable } from './table'; import { DataView } from '../../../../../../../data/common'; diff --git a/src/plugins/discover/public/services/saved_searches/saved_search_url_conflict_callout.test.tsx b/src/plugins/discover/public/services/saved_searches/saved_search_url_conflict_callout.test.tsx index 0aac9aea62192..6bdea087fcf46 100644 --- a/src/plugins/discover/public/services/saved_searches/saved_search_url_conflict_callout.test.tsx +++ b/src/plugins/discover/public/services/saved_searches/saved_search_url_conflict_callout.test.tsx @@ -9,7 +9,7 @@ import React from 'react'; import type { History } from 'history'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { SavedSearchURLConflictCallout } from './saved_search_url_conflict_callout'; import type { SavedSearch } from './types'; diff --git a/src/plugins/discover/public/utils/with_query_params.test.tsx b/src/plugins/discover/public/utils/with_query_params.test.tsx index 3d416d6a3e8b5..e23688c0031c7 100644 --- a/src/plugins/discover/public/utils/with_query_params.test.tsx +++ b/src/plugins/discover/public/utils/with_query_params.test.tsx @@ -9,7 +9,7 @@ import React, { ReactElement } from 'react'; import { Router } from 'react-router-dom'; import { createMemoryHistory } from 'history'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { withQueryParams } from './with_query_params'; const mountComponent = (children: ReactElement, query = '') => { diff --git a/src/plugins/embeddable/public/lib/containers/embeddable_child_panel.test.tsx b/src/plugins/embeddable/public/lib/containers/embeddable_child_panel.test.tsx index d5452870ed0de..07867476508a5 100644 --- a/src/plugins/embeddable/public/lib/containers/embeddable_child_panel.test.tsx +++ b/src/plugins/embeddable/public/lib/containers/embeddable_child_panel.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { EmbeddableChildPanel } from './embeddable_child_panel'; import { CONTACT_CARD_EMBEDDABLE } from '../test_samples/embeddables/contact_card/contact_card_embeddable_factory'; import { SlowContactCardEmbeddableFactory } from '../test_samples/embeddables/contact_card/slow_contact_card_embeddable_factory'; diff --git a/src/plugins/embeddable/public/lib/panel/embeddable_panel.test.tsx b/src/plugins/embeddable/public/lib/panel/embeddable_panel.test.tsx index 8d313030556c6..81ea83fe06d10 100644 --- a/src/plugins/embeddable/public/lib/panel/embeddable_panel.test.tsx +++ b/src/plugins/embeddable/public/lib/panel/embeddable_panel.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { mount } from 'enzyme'; -import { mountWithIntl, nextTick } from '@kbn/test/jest'; +import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; import { findTestSubject } from '@elastic/eui/lib/test'; import { I18nProvider } from '@kbn/i18n-react'; diff --git a/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_flyout.test.tsx b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_flyout.test.tsx index 1c96945f014c8..c860fc7e770b9 100644 --- a/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_flyout.test.tsx +++ b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_flyout.test.tsx @@ -16,7 +16,7 @@ import { import { HelloWorldContainer } from '../../../../test_samples/embeddables/hello_world_container'; import { ContactCardEmbeddable } from '../../../../test_samples/embeddables/contact_card/contact_card_embeddable'; import { ContainerInput } from '../../../../containers'; -import { mountWithIntl as mount } from '@kbn/test/jest'; +import { mountWithIntl as mount } from '@kbn/test-jest-helpers'; import { ReactWrapper } from 'enzyme'; import { coreMock } from '../../../../../../../../core/public/mocks'; import { findTestSubject } from '@elastic/eui/lib/test'; diff --git a/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/tests/saved_object_finder_create_new.test.tsx b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/tests/saved_object_finder_create_new.test.tsx index be8416da38700..79e68aabe577a 100644 --- a/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/tests/saved_object_finder_create_new.test.tsx +++ b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/tests/saved_object_finder_create_new.test.tsx @@ -10,7 +10,7 @@ import React from 'react'; import { SavedObjectFinderCreateNew } from '../saved_object_finder_create_new'; import { shallow } from 'enzyme'; import { EuiButton, EuiContextMenuItem, EuiContextMenuPanel, EuiPopover } from '@elastic/eui'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; describe('SavedObjectFinderCreateNew', () => { test('renders correctly with no items', () => { diff --git a/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/customize_title/customize_panel_action.test.ts b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/customize_title/customize_panel_action.test.ts index 4d04778398938..983f9ceedf369 100644 --- a/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/customize_title/customize_panel_action.test.ts +++ b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/customize_title/customize_panel_action.test.ts @@ -7,7 +7,7 @@ */ import { Container, isErrorEmbeddable } from '../../../..'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { CustomizePanelTitleAction } from './customize_panel_action'; import { ContactCardEmbeddable, diff --git a/src/plugins/embeddable/public/tests/customize_panel_modal.test.tsx b/src/plugins/embeddable/public/tests/customize_panel_modal.test.tsx index 44cd93069bfb3..baae08b23cfa1 100644 --- a/src/plugins/embeddable/public/tests/customize_panel_modal.test.tsx +++ b/src/plugins/embeddable/public/tests/customize_panel_modal.test.tsx @@ -24,7 +24,7 @@ import { testPlugin } from './test_plugin'; import { CustomizePanelModal } from '../lib/panel/panel_header/panel_actions/customize_title/customize_panel_modal'; import { EmbeddableStart } from '../plugin'; import { createEmbeddablePanelMock } from '../mocks'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { OverlayStart } from 'kibana/public'; let api: EmbeddableStart; diff --git a/src/plugins/es_ui_shared/public/components/cron_editor/cron_editor.test.tsx b/src/plugins/es_ui_shared/public/components/cron_editor/cron_editor.test.tsx index 0ae82872124a4..cb8994b153bdd 100644 --- a/src/plugins/es_ui_shared/public/components/cron_editor/cron_editor.test.tsx +++ b/src/plugins/es_ui_shared/public/components/cron_editor/cron_editor.test.tsx @@ -9,7 +9,7 @@ import React from 'react'; import sinon from 'sinon'; import { findTestSubject } from '@elastic/eui/lib/test'; -import { mountWithI18nProvider } from '@kbn/test/jest'; +import { mountWithI18nProvider } from '@kbn/test-jest-helpers'; import { Frequency } from './types'; import { CronEditor } from './cron_editor'; diff --git a/src/plugins/es_ui_shared/static/forms/hook_form_lib/shared_imports.ts b/src/plugins/es_ui_shared/static/forms/hook_form_lib/shared_imports.ts index cd9bb97cab8d9..113d33dba7100 100644 --- a/src/plugins/es_ui_shared/static/forms/hook_form_lib/shared_imports.ts +++ b/src/plugins/es_ui_shared/static/forms/hook_form_lib/shared_imports.ts @@ -7,9 +7,6 @@ */ // eslint-disable-next-line import/no-extraneous-dependencies -export type { TestBed } from '@kbn/test/jest'; +export type { TestBed } from '@kbn/test-jest-helpers'; // eslint-disable-next-line import/no-extraneous-dependencies -export { registerTestBed } from '@kbn/test/jest'; - -// eslint-disable-next-line import/no-extraneous-dependencies -export { getRandomString } from '@kbn/test/jest'; +export { registerTestBed, getRandomString } from '@kbn/test-jest-helpers'; diff --git a/src/plugins/home/public/application/components/add_data/add_data.test.tsx b/src/plugins/home/public/application/components/add_data/add_data.test.tsx index 3aa51f89c7d67..009b72791263b 100644 --- a/src/plugins/home/public/application/components/add_data/add_data.test.tsx +++ b/src/plugins/home/public/application/components/add_data/add_data.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { AddData } from './add_data'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { ApplicationStart } from 'kibana/public'; jest.mock('../app_navigation_handler', () => { diff --git a/src/plugins/home/public/application/components/manage_data/manage_data.test.tsx b/src/plugins/home/public/application/components/manage_data/manage_data.test.tsx index fb222be657786..f602ee5aa4439 100644 --- a/src/plugins/home/public/application/components/manage_data/manage_data.test.tsx +++ b/src/plugins/home/public/application/components/manage_data/manage_data.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { ManageData } from './manage_data'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { ApplicationStart } from 'kibana/public'; import { FeatureCatalogueEntry, FeatureCatalogueCategory } from '../../../services'; diff --git a/src/plugins/home/public/application/components/recently_accessed.test.js b/src/plugins/home/public/application/components/recently_accessed.test.js index 14611d26aa8e5..95f151923f425 100644 --- a/src/plugins/home/public/application/components/recently_accessed.test.js +++ b/src/plugins/home/public/application/components/recently_accessed.test.js @@ -10,7 +10,7 @@ import React from 'react'; import { shallow } from 'enzyme'; import { RecentlyAccessed, NUM_LONG_LINKS } from './recently_accessed'; import { findTestSubject } from '@elastic/eui/lib/test'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; const createRecentlyAccessed = (length) => { const recentlyAccessed = []; diff --git a/src/plugins/home/public/application/components/tutorial/instruction_set.test.js b/src/plugins/home/public/application/components/tutorial/instruction_set.test.js index 6faadf275bea3..8c0ce306d9c05 100644 --- a/src/plugins/home/public/application/components/tutorial/instruction_set.test.js +++ b/src/plugins/home/public/application/components/tutorial/instruction_set.test.js @@ -7,7 +7,7 @@ */ import React from 'react'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { InstructionSet } from './instruction_set'; import * as StatusCheckStates from './status_check_states'; diff --git a/src/plugins/home/public/application/components/tutorial/introduction.test.js b/src/plugins/home/public/application/components/tutorial/introduction.test.js index 70b4856a8b2fd..c599c8748e925 100644 --- a/src/plugins/home/public/application/components/tutorial/introduction.test.js +++ b/src/plugins/home/public/application/components/tutorial/introduction.test.js @@ -7,7 +7,7 @@ */ import React from 'react'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { Introduction } from './introduction'; import { httpServiceMock } from '../../../../../../core/public/mocks'; diff --git a/src/plugins/home/public/application/components/tutorial/saved_objects_installer.test.js b/src/plugins/home/public/application/components/tutorial/saved_objects_installer.test.js index 0efcd9bf9df9c..67ae2d1dd2eed 100644 --- a/src/plugins/home/public/application/components/tutorial/saved_objects_installer.test.js +++ b/src/plugins/home/public/application/components/tutorial/saved_objects_installer.test.js @@ -8,7 +8,7 @@ import React from 'react'; import { findTestSubject } from '@elastic/eui/lib/test'; -import { shallowWithIntl, mountWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl, mountWithIntl } from '@kbn/test-jest-helpers'; import { SavedObjectsInstaller } from './saved_objects_installer'; diff --git a/src/plugins/home/public/application/components/tutorial/tutorial.test.js b/src/plugins/home/public/application/components/tutorial/tutorial.test.js index 73499c0dcb75f..9bfe100c4ce60 100644 --- a/src/plugins/home/public/application/components/tutorial/tutorial.test.js +++ b/src/plugins/home/public/application/components/tutorial/tutorial.test.js @@ -7,7 +7,7 @@ */ import React from 'react'; -import { shallowWithIntl, mountWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl, mountWithIntl } from '@kbn/test-jest-helpers'; import { Tutorial } from './tutorial'; diff --git a/src/plugins/input_control_vis/public/components/editor/controls_tab.test.tsx b/src/plugins/input_control_vis/public/components/editor/controls_tab.test.tsx index 3257b7dab0825..2182843d30975 100644 --- a/src/plugins/input_control_vis/public/components/editor/controls_tab.test.tsx +++ b/src/plugins/input_control_vis/public/components/editor/controls_tab.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { shallowWithIntl, mountWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl, mountWithIntl } from '@kbn/test-jest-helpers'; import { findTestSubject } from '@elastic/eui/lib/test'; import { getDepsMock, getIndexPatternMock } from '../../test_utils'; import ControlsTab, { ControlsTabProps } from './controls_tab'; diff --git a/src/plugins/input_control_vis/public/components/editor/list_control_editor.test.tsx b/src/plugins/input_control_vis/public/components/editor/list_control_editor.test.tsx index 27597bb3a1e52..3192cd3db54ad 100644 --- a/src/plugins/input_control_vis/public/components/editor/list_control_editor.test.tsx +++ b/src/plugins/input_control_vis/public/components/editor/list_control_editor.test.tsx @@ -12,7 +12,7 @@ import { shallow } from 'enzyme'; import { findTestSubject } from '@elastic/eui/lib/test'; -import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; +import { mountWithIntl, shallowWithIntl } from '@kbn/test-jest-helpers'; import { getIndexPatternMock } from '../../test_utils/get_index_pattern_mock'; import { ListControlEditor } from './list_control_editor'; import { ControlParams } from '../../editor_utils'; diff --git a/src/plugins/input_control_vis/public/components/editor/options_tab.test.tsx b/src/plugins/input_control_vis/public/components/editor/options_tab.test.tsx index 8b886134c1173..45907fc08e1c2 100644 --- a/src/plugins/input_control_vis/public/components/editor/options_tab.test.tsx +++ b/src/plugins/input_control_vis/public/components/editor/options_tab.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { shallow } from 'enzyme'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { Vis } from '../../../../visualizations/public'; import OptionsTab, { OptionsTabProps } from './options_tab'; diff --git a/src/plugins/input_control_vis/public/components/editor/range_control_editor.test.tsx b/src/plugins/input_control_vis/public/components/editor/range_control_editor.test.tsx index 2494a0b57dbc5..67ee222b3bae9 100644 --- a/src/plugins/input_control_vis/public/components/editor/range_control_editor.test.tsx +++ b/src/plugins/input_control_vis/public/components/editor/range_control_editor.test.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { shallow } from 'enzyme'; import { SinonSpy, spy, assert } from 'sinon'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { findTestSubject } from '@elastic/eui/lib/test'; diff --git a/src/plugins/input_control_vis/public/components/vis/input_control_vis.test.tsx b/src/plugins/input_control_vis/public/components/vis/input_control_vis.test.tsx index 3eb78cfe81544..6d9f2f9b05ade 100644 --- a/src/plugins/input_control_vis/public/components/vis/input_control_vis.test.tsx +++ b/src/plugins/input_control_vis/public/components/vis/input_control_vis.test.tsx @@ -9,7 +9,7 @@ import React from 'react'; import sinon from 'sinon'; import { shallow } from 'enzyme'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { findTestSubject } from '@elastic/eui/lib/test'; import { InputControlVis } from './input_control_vis'; diff --git a/src/plugins/input_control_vis/public/components/vis/list_control.test.tsx b/src/plugins/input_control_vis/public/components/vis/list_control.test.tsx index 5f102b58a7b42..cf90ad9837bfe 100644 --- a/src/plugins/input_control_vis/public/components/vis/list_control.test.tsx +++ b/src/plugins/input_control_vis/public/components/vis/list_control.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import sinon from 'sinon'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { ListControl } from './list_control'; diff --git a/src/plugins/input_control_vis/public/components/vis/range_control.test.tsx b/src/plugins/input_control_vis/public/components/vis/range_control.test.tsx index 4396da3df827b..d51db16952f1e 100644 --- a/src/plugins/input_control_vis/public/components/vis/range_control.test.tsx +++ b/src/plugins/input_control_vis/public/components/vis/range_control.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { RangeControl, ceilWithPrecision, floorWithPrecision } from './range_control'; import { RangeControl as RangeControlClass } from '../../control/range_control_factory'; diff --git a/src/plugins/inspector/public/ui/inspector_panel.test.tsx b/src/plugins/inspector/public/ui/inspector_panel.test.tsx index 03b71219b1e9f..254afca11c1da 100644 --- a/src/plugins/inspector/public/ui/inspector_panel.test.tsx +++ b/src/plugins/inspector/public/ui/inspector_panel.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { InspectorPanel } from './inspector_panel'; import { InspectorViewDescription } from '../types'; import { Adapters } from '../../common'; diff --git a/src/plugins/interactive_setup/public/theme/kibana_theme_provider.test.tsx b/src/plugins/interactive_setup/public/theme/kibana_theme_provider.test.tsx index 21059bd4a8236..5d1bc9798ee17 100644 --- a/src/plugins/interactive_setup/public/theme/kibana_theme_provider.test.tsx +++ b/src/plugins/interactive_setup/public/theme/kibana_theme_provider.test.tsx @@ -13,7 +13,7 @@ import React, { useEffect } from 'react'; import { act } from 'react-dom/test-utils'; import { BehaviorSubject, of } from 'rxjs'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import type { CoreTheme } from 'src/core/public'; import { KibanaThemeProvider } from './kibana_theme_provider'; diff --git a/src/plugins/interactive_setup/server/elasticsearch_service.test.ts b/src/plugins/interactive_setup/server/elasticsearch_service.test.ts index 5956bf3a2f64a..e7b326a1d019d 100644 --- a/src/plugins/interactive_setup/server/elasticsearch_service.test.ts +++ b/src/plugins/interactive_setup/server/elasticsearch_service.test.ts @@ -10,7 +10,7 @@ import { errors } from '@elastic/elasticsearch'; import { BehaviorSubject } from 'rxjs'; import tls from 'tls'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { elasticsearchServiceMock, loggingSystemMock } from 'src/core/server/mocks'; import { pollEsNodesVersion } from '../../../../src/core/server'; diff --git a/src/plugins/kibana_overview/public/components/add_data/add_data.test.tsx b/src/plugins/kibana_overview/public/components/add_data/add_data.test.tsx index 4c58b034186c4..ed091ff96c5f2 100644 --- a/src/plugins/kibana_overview/public/components/add_data/add_data.test.tsx +++ b/src/plugins/kibana_overview/public/components/add_data/add_data.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { AddData } from './add_data'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { FeatureCatalogueCategory } from 'src/plugins/home/public'; const mockFeatures = [ diff --git a/src/plugins/kibana_overview/public/components/manage_data/manage_data.test.tsx b/src/plugins/kibana_overview/public/components/manage_data/manage_data.test.tsx index 2a028a7a53a11..f5e72a3e0a867 100644 --- a/src/plugins/kibana_overview/public/components/manage_data/manage_data.test.tsx +++ b/src/plugins/kibana_overview/public/components/manage_data/manage_data.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { ManageData } from './manage_data'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { FeatureCatalogueCategory } from 'src/plugins/home/public'; const mockFeatures = [ diff --git a/src/plugins/kibana_overview/public/components/news_feed/news_feed.test.tsx b/src/plugins/kibana_overview/public/components/news_feed/news_feed.test.tsx index 0215242d0c078..420230e7caef6 100644 --- a/src/plugins/kibana_overview/public/components/news_feed/news_feed.test.tsx +++ b/src/plugins/kibana_overview/public/components/news_feed/news_feed.test.tsx @@ -9,7 +9,7 @@ import moment from 'moment'; import React from 'react'; import { NewsFeed } from './news_feed'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; const mockNewsFetchResult = { error: null, diff --git a/src/plugins/kibana_overview/public/components/overview/overview.test.tsx b/src/plugins/kibana_overview/public/components/overview/overview.test.tsx index b4804fe56f470..85aee7411d7ad 100644 --- a/src/plugins/kibana_overview/public/components/overview/overview.test.tsx +++ b/src/plugins/kibana_overview/public/components/overview/overview.test.tsx @@ -13,7 +13,7 @@ import React from 'react'; import { act } from 'react-dom/test-utils'; import { ReactWrapper } from 'enzyme'; import { Overview } from './overview'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { FeatureCatalogueCategory } from 'src/plugins/home/public'; const mockNewsFetchResult = { diff --git a/src/plugins/kibana_react/public/code_editor/code_editor.test.tsx b/src/plugins/kibana_react/public/code_editor/code_editor.test.tsx index 62488809dd59b..b66d136c50710 100644 --- a/src/plugins/kibana_react/public/code_editor/code_editor.test.tsx +++ b/src/plugins/kibana_react/public/code_editor/code_editor.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { ReactWrapper } from 'enzyme'; -import { mountWithIntl, findTestSubject } from '@kbn/test/jest'; +import { mountWithIntl, findTestSubject } from '@kbn/test-jest-helpers'; import { monaco } from '@kbn/monaco'; import { keys } from '@elastic/eui'; diff --git a/src/plugins/kibana_react/public/overview_page/overview_page_footer/overview_page_footer.test.tsx b/src/plugins/kibana_react/public/overview_page/overview_page_footer/overview_page_footer.test.tsx index 1fbde1bb8bfe9..ec48d3fda4c73 100644 --- a/src/plugins/kibana_react/public/overview_page/overview_page_footer/overview_page_footer.test.tsx +++ b/src/plugins/kibana_react/public/overview_page/overview_page_footer/overview_page_footer.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { OverviewPageFooter } from './overview_page_footer'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; jest.mock('../../app_links', () => ({ RedirectAppLinks: jest.fn((element: JSX.Element) => element), diff --git a/src/plugins/kibana_react/public/page_template/no_data_page/no_data_page.test.tsx b/src/plugins/kibana_react/public/page_template/no_data_page/no_data_page.test.tsx index 59d6e8280af98..2c9f91be339f6 100644 --- a/src/plugins/kibana_react/public/page_template/no_data_page/no_data_page.test.tsx +++ b/src/plugins/kibana_react/public/page_template/no_data_page/no_data_page.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { NoDataPage } from './no_data_page'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; describe('NoDataPage', () => { test('render', () => { diff --git a/src/plugins/kibana_react/public/table_list_view/table_list_view.test.tsx b/src/plugins/kibana_react/public/table_list_view/table_list_view.test.tsx index bdc5ca30216bc..cf8ff8ac8ec53 100644 --- a/src/plugins/kibana_react/public/table_list_view/table_list_view.test.tsx +++ b/src/plugins/kibana_react/public/table_list_view/table_list_view.test.tsx @@ -7,7 +7,7 @@ */ import { EuiEmptyPrompt } from '@elastic/eui'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { ToastsStart } from 'kibana/public'; import React from 'react'; import { themeServiceMock } from '../../../../../src/core/public/mocks'; diff --git a/src/plugins/kibana_react/public/theme/kibana_theme_provider.test.tsx b/src/plugins/kibana_react/public/theme/kibana_theme_provider.test.tsx index ef7f79cdaa64e..10c1f32e6ec26 100644 --- a/src/plugins/kibana_react/public/theme/kibana_theme_provider.test.tsx +++ b/src/plugins/kibana_react/public/theme/kibana_theme_provider.test.tsx @@ -12,7 +12,7 @@ import type { ReactWrapper } from 'enzyme'; import { of, BehaviorSubject } from 'rxjs'; import { useEuiTheme } from '@elastic/eui'; import type { UseEuiTheme } from '@elastic/eui'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import type { CoreTheme } from 'src/core/public'; import { KibanaThemeProvider } from './kibana_theme_provider'; diff --git a/src/plugins/kibana_utils/public/state_management/url/kbn_url_tracker.test.ts b/src/plugins/kibana_utils/public/state_management/url/kbn_url_tracker.test.ts index 8d22665fdf2cc..3c748fab8e0c1 100644 --- a/src/plugins/kibana_utils/public/state_management/url/kbn_url_tracker.test.ts +++ b/src/plugins/kibana_utils/public/state_management/url/kbn_url_tracker.test.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { StubBrowserStorage } from '@kbn/test/jest'; +import { StubBrowserStorage } from '@kbn/test-jest-helpers'; import { createMemoryHistory, History } from 'history'; import { createKbnUrlTracker, KbnUrlTracker } from './kbn_url_tracker'; import { BehaviorSubject, Subject } from 'rxjs'; diff --git a/src/plugins/kibana_utils/public/state_management/url/url_tracker.test.ts b/src/plugins/kibana_utils/public/state_management/url/url_tracker.test.ts index 2bc1f1e57f117..42a12c3fd0c5d 100644 --- a/src/plugins/kibana_utils/public/state_management/url/url_tracker.test.ts +++ b/src/plugins/kibana_utils/public/state_management/url/url_tracker.test.ts @@ -7,7 +7,7 @@ */ import { createUrlTracker, IUrlTracker } from './url_tracker'; -import { StubBrowserStorage } from '@kbn/test/jest'; +import { StubBrowserStorage } from '@kbn/test-jest-helpers'; import { createMemoryHistory, History } from 'history'; describe('urlTracker', () => { diff --git a/src/plugins/kibana_utils/public/state_sync/state_sync.test.ts b/src/plugins/kibana_utils/public/state_sync/state_sync.test.ts index 6fac5731d50a3..f752c6e25c8ab 100644 --- a/src/plugins/kibana_utils/public/state_sync/state_sync.test.ts +++ b/src/plugins/kibana_utils/public/state_sync/state_sync.test.ts @@ -22,7 +22,7 @@ import { IKbnUrlStateStorage, ISessionStorageStateStorage, } from './state_sync_state_storage'; -import { StubBrowserStorage } from '@kbn/test/jest'; +import { StubBrowserStorage } from '@kbn/test-jest-helpers'; import { createBrowserHistory, History } from 'history'; import { INullableBaseStateContainer } from './types'; diff --git a/src/plugins/kibana_utils/public/state_sync/state_sync_state_storage/create_session_storage_state_storage.test.ts b/src/plugins/kibana_utils/public/state_sync/state_sync_state_storage/create_session_storage_state_storage.test.ts index cad2fc2733f3c..a0ab2b3f9da3d 100644 --- a/src/plugins/kibana_utils/public/state_sync/state_sync_state_storage/create_session_storage_state_storage.test.ts +++ b/src/plugins/kibana_utils/public/state_sync/state_sync_state_storage/create_session_storage_state_storage.test.ts @@ -10,7 +10,7 @@ import { createSessionStorageStateStorage, ISessionStorageStateStorage, } from './create_session_storage_state_storage'; -import { StubBrowserStorage } from '@kbn/test/jest'; +import { StubBrowserStorage } from '@kbn/test-jest-helpers'; describe('SessionStorageStateStorage', () => { let browserStorage: StubBrowserStorage; diff --git a/src/plugins/kibana_utils/public/storage/hashed_item_store/hashed_item_store.test.ts b/src/plugins/kibana_utils/public/storage/hashed_item_store/hashed_item_store.test.ts index b7ee08044b323..20cc81bc3b75b 100644 --- a/src/plugins/kibana_utils/public/storage/hashed_item_store/hashed_item_store.test.ts +++ b/src/plugins/kibana_utils/public/storage/hashed_item_store/hashed_item_store.test.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { StubBrowserStorage } from '@kbn/test/jest'; +import { StubBrowserStorage } from '@kbn/test-jest-helpers'; import { HashedItemStore } from './hashed_item_store'; describe('hashedItemStore', () => { diff --git a/src/plugins/kibana_utils/public/storage/hashed_item_store/mock.ts b/src/plugins/kibana_utils/public/storage/hashed_item_store/mock.ts index 56408d2cbdb5b..0f2176b5d4ba9 100644 --- a/src/plugins/kibana_utils/public/storage/hashed_item_store/mock.ts +++ b/src/plugins/kibana_utils/public/storage/hashed_item_store/mock.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { StubBrowserStorage } from '@kbn/test/jest'; +import { StubBrowserStorage } from '@kbn/test-jest-helpers'; import { HashedItemStore } from './hashed_item_store'; /** diff --git a/src/plugins/kibana_utils/public/theme/kibana_theme_provider.test.tsx b/src/plugins/kibana_utils/public/theme/kibana_theme_provider.test.tsx index 21059bd4a8236..5d1bc9798ee17 100644 --- a/src/plugins/kibana_utils/public/theme/kibana_theme_provider.test.tsx +++ b/src/plugins/kibana_utils/public/theme/kibana_theme_provider.test.tsx @@ -13,7 +13,7 @@ import React, { useEffect } from 'react'; import { act } from 'react-dom/test-utils'; import { BehaviorSubject, of } from 'rxjs'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import type { CoreTheme } from 'src/core/public'; import { KibanaThemeProvider } from './kibana_theme_provider'; diff --git a/src/plugins/navigation/public/top_nav_menu/top_nav_menu.test.tsx b/src/plugins/navigation/public/top_nav_menu/top_nav_menu.test.tsx index 45b9b4c7a885b..682154dd5d5db 100644 --- a/src/plugins/navigation/public/top_nav_menu/top_nav_menu.test.tsx +++ b/src/plugins/navigation/public/top_nav_menu/top_nav_menu.test.tsx @@ -12,7 +12,7 @@ import { act } from 'react-dom/test-utils'; import { MountPoint } from 'kibana/public'; import { TopNavMenu } from './top_nav_menu'; import { TopNavMenuData } from './top_nav_menu_data'; -import { shallowWithIntl, mountWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl, mountWithIntl } from '@kbn/test-jest-helpers'; const dataShim = { ui: { diff --git a/src/plugins/navigation/public/top_nav_menu/top_nav_menu_item.test.tsx b/src/plugins/navigation/public/top_nav_menu/top_nav_menu_item.test.tsx index 8d62a3ebd9633..2211ae5db1052 100644 --- a/src/plugins/navigation/public/top_nav_menu/top_nav_menu_item.test.tsx +++ b/src/plugins/navigation/public/top_nav_menu/top_nav_menu_item.test.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { TopNavMenuItem } from './top_nav_menu_item'; import { TopNavMenuData } from './top_nav_menu_data'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; describe('TopNavMenu', () => { const ensureMenuItemDisabled = (data: TopNavMenuData) => { diff --git a/src/plugins/saved_objects/public/save_modal/saved_object_save_modal.test.tsx b/src/plugins/saved_objects/public/save_modal/saved_object_save_modal.test.tsx index 2c530df7b93ae..8e939ec58a792 100644 --- a/src/plugins/saved_objects/public/save_modal/saved_object_save_modal.test.tsx +++ b/src/plugins/saved_objects/public/save_modal/saved_object_save_modal.test.tsx @@ -10,7 +10,7 @@ import { shallow } from 'enzyme'; import React from 'react'; import { SavedObjectSaveModal } from './saved_object_save_modal'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; describe('SavedObjectSaveModal', () => { it('should render matching snapshot', () => { diff --git a/src/plugins/saved_objects_management/public/management_section/object_view/components/inspect.test.tsx b/src/plugins/saved_objects_management/public/management_section/object_view/components/inspect.test.tsx index 843468b78307c..4e852de7ee731 100644 --- a/src/plugins/saved_objects_management/public/management_section/object_view/components/inspect.test.tsx +++ b/src/plugins/saved_objects_management/public/management_section/object_view/components/inspect.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { ShallowWrapper } from 'enzyme'; -import { shallowWithI18nProvider } from '@kbn/test/jest'; +import { shallowWithI18nProvider } from '@kbn/test-jest-helpers'; import { Inspect, InspectProps } from './inspect'; import { SavedObjectWithMetadata } from '../../../../common'; diff --git a/src/plugins/saved_objects_management/public/management_section/object_view/saved_object_view.test.tsx b/src/plugins/saved_objects_management/public/management_section/object_view/saved_object_view.test.tsx index 554e34a9fc55a..ba0a584a94074 100644 --- a/src/plugins/saved_objects_management/public/management_section/object_view/saved_object_view.test.tsx +++ b/src/plugins/saved_objects_management/public/management_section/object_view/saved_object_view.test.tsx @@ -10,7 +10,7 @@ import { bulkGetObjectsMock } from './saved_object_view.test.mocks'; import React from 'react'; import { ShallowWrapper } from 'enzyme'; -import { shallowWithI18nProvider } from '@kbn/test/jest'; +import { shallowWithI18nProvider } from '@kbn/test-jest-helpers'; import { httpServiceMock, diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/delete_confirm_modal.test.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/components/delete_confirm_modal.test.tsx index 396ef209cc396..3c24d68007222 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/delete_confirm_modal.test.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/delete_confirm_modal.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { findTestSubject } from '@elastic/eui/lib/test'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import type { SavedObjectWithMetadata, SavedObjectManagementTypeInfo } from '../../../../common'; import { DeleteConfirmModal } from './delete_confirm_modal'; diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/export_modal.test.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/components/export_modal.test.tsx index eb364dbf69102..609338f7aed38 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/export_modal.test.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/export_modal.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { ExportModal } from './export_modal'; describe('ExportModal', () => { diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/flyout.test.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/components/flyout.test.tsx index a084c26b04d2d..04d4556548720 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/flyout.test.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/flyout.test.tsx @@ -9,7 +9,7 @@ import { importFileMock, resolveImportErrorsMock } from './flyout.test.mocks'; import React from 'react'; -import { shallowWithI18nProvider } from '@kbn/test/jest'; +import { shallowWithI18nProvider } from '@kbn/test-jest-helpers'; import { coreMock, httpServiceMock } from '../../../../../../core/public/mocks'; import { Flyout, FlyoutProps, FlyoutState } from './flyout'; import { ShallowWrapper } from 'enzyme'; diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/import_mode_control.test.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/components/import_mode_control.test.tsx index fbf50e0ee0c86..481e8cd91903f 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/import_mode_control.test.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/import_mode_control.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { ReactWrapper } from 'enzyme'; -import { shallowWithI18nProvider, mountWithIntl } from '@kbn/test/jest'; +import { shallowWithI18nProvider, mountWithIntl } from '@kbn/test-jest-helpers'; import { ImportModeControl, ImportModeControlProps } from './import_mode_control'; describe('ImportModeControl', () => { diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/import_summary.test.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/components/import_summary.test.tsx index 4cbfcb06b3595..03d3631398cda 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/import_summary.test.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/import_summary.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { ReactWrapper } from 'enzyme'; -import { mountWithI18nProvider } from '@kbn/test/jest'; +import { mountWithI18nProvider } from '@kbn/test-jest-helpers'; import { httpServiceMock } from '../../../../../../core/public/mocks'; import { ImportSummary, ImportSummaryProps } from './import_summary'; import { FailedImport } from '../../../lib'; diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/overwrite_modal.test.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/components/overwrite_modal.test.tsx index ef9020d231f31..c07ab70079ccf 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/overwrite_modal.test.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/overwrite_modal.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { shallowWithI18nProvider, mountWithIntl } from '@kbn/test/jest'; +import { shallowWithI18nProvider, mountWithIntl } from '@kbn/test-jest-helpers'; import { OverwriteModalProps, OverwriteModal } from './overwrite_modal'; import { findTestSubject } from '@elastic/eui/lib/test'; diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/relationships.test.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/components/relationships.test.tsx index a3db8af627d2f..751335e4670d9 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/relationships.test.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/relationships.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { shallowWithI18nProvider } from '@kbn/test/jest'; +import { shallowWithI18nProvider } from '@kbn/test-jest-helpers'; import { httpServiceMock } from '../../../../../../core/public/mocks'; import type { SavedObjectManagementTypeInfo } from '../../../../common/types'; import { Relationships, RelationshipsProps } from './relationships'; diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/table.test.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/components/table.test.tsx index 6fb153cb980ff..c0b795f9e9610 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/table.test.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/table.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { shallowWithI18nProvider, mountWithI18nProvider } from '@kbn/test/jest'; +import { shallowWithI18nProvider, mountWithI18nProvider } from '@kbn/test-jest-helpers'; import { findTestSubject } from '@elastic/eui/lib/test'; import { keys } from '@elastic/eui'; import { httpServiceMock } from '../../../../../../core/public/mocks'; diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.test.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.test.tsx index 173d8af0de04d..5382cc39989ed 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.test.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.test.tsx @@ -19,7 +19,7 @@ import { import React from 'react'; import { Query } from '@elastic/eui'; import { ShallowWrapper } from 'enzyme'; -import { shallowWithI18nProvider } from '@kbn/test/jest'; +import { shallowWithI18nProvider } from '@kbn/test-jest-helpers'; import { httpServiceMock, overlayServiceMock, diff --git a/src/plugins/telemetry/public/components/opt_in_banner.test.tsx b/src/plugins/telemetry/public/components/opt_in_banner.test.tsx index b892633b66b9a..1c4467db803c4 100644 --- a/src/plugins/telemetry/public/components/opt_in_banner.test.tsx +++ b/src/plugins/telemetry/public/components/opt_in_banner.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { EuiButton } from '@elastic/eui'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { OptInBanner } from './opt_in_banner'; describe('OptInDetailsComponent', () => { diff --git a/src/plugins/telemetry/public/components/opt_in_message.test.tsx b/src/plugins/telemetry/public/components/opt_in_message.test.tsx index c27e4326c6625..1196e36a1b424 100644 --- a/src/plugins/telemetry/public/components/opt_in_message.test.tsx +++ b/src/plugins/telemetry/public/components/opt_in_message.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { OptInMessage } from './opt_in_message'; describe('OptInMessage', () => { diff --git a/src/plugins/telemetry/public/components/opted_in_notice_banner.test.tsx b/src/plugins/telemetry/public/components/opted_in_notice_banner.test.tsx index ce5a42ed17ad8..e4ec8e32c5456 100644 --- a/src/plugins/telemetry/public/components/opted_in_notice_banner.test.tsx +++ b/src/plugins/telemetry/public/components/opted_in_notice_banner.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { EuiButton } from '@elastic/eui'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { OptedInNoticeBanner } from './opted_in_notice_banner'; // eslint-disable-next-line @kbn/eslint/no-restricted-paths import { httpServiceMock } from '../../../../core/public/http/http_service.mock'; diff --git a/src/plugins/telemetry_management_section/public/components/opt_in_example_flyout.test.tsx b/src/plugins/telemetry_management_section/public/components/opt_in_example_flyout.test.tsx index 52c6ecfefbacf..845d7d3fa0c8a 100644 --- a/src/plugins/telemetry_management_section/public/components/opt_in_example_flyout.test.tsx +++ b/src/plugins/telemetry_management_section/public/components/opt_in_example_flyout.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { OptInExampleFlyout } from './opt_in_example_flyout'; describe('OptInDetailsComponent', () => { diff --git a/src/plugins/telemetry_management_section/public/components/telemetry_management_section.test.tsx b/src/plugins/telemetry_management_section/public/components/telemetry_management_section.test.tsx index 8f27c340720a1..4b474f0cc7bdd 100644 --- a/src/plugins/telemetry_management_section/public/components/telemetry_management_section.test.tsx +++ b/src/plugins/telemetry_management_section/public/components/telemetry_management_section.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; +import { mountWithIntl, shallowWithIntl } from '@kbn/test-jest-helpers'; import TelemetryManagementSection from './telemetry_management_section'; import { TelemetryService } from '../../../telemetry/public/services'; import { coreMock } from '../../../../core/public/mocks'; @@ -257,7 +257,7 @@ describe('TelemetryManagementSectionComponent', () => { await expect( toggleOptInComponent.prop('handleChange')() ).resolves.toBe(true); - // TODO: Fix `mountWithIntl` types in @kbn/test/jest to make testing easier + // TODO: Fix `mountWithIntl` types in @kbn/test-jest-helpers to make testing easier expect((component.state() as { enabled: boolean }).enabled).toBe(true); await expect( toggleOptInComponent.prop('handleChange')() diff --git a/src/plugins/vis_default_editor/public/components/controls/components/number_list/number_list.test.tsx b/src/plugins/vis_default_editor/public/components/controls/components/number_list/number_list.test.tsx index af363dbacaff7..87c74d0c497a7 100644 --- a/src/plugins/vis_default_editor/public/components/controls/components/number_list/number_list.test.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/components/number_list/number_list.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { shallow } from 'enzyme'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { NumberList, NumberListProps } from './number_list'; import { NumberRow } from './number_row'; diff --git a/src/plugins/vis_default_editor/public/components/controls/date_ranges.test.tsx b/src/plugins/vis_default_editor/public/components/controls/date_ranges.test.tsx index 02cc0aadfff61..00da70d7687f8 100644 --- a/src/plugins/vis_default_editor/public/components/controls/date_ranges.test.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/date_ranges.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { DateRangesParamEditor } from './date_ranges'; import { KibanaContextProvider } from '../../../../kibana_react/public'; import { docLinksServiceMock } from '../../../../../core/public/mocks'; diff --git a/src/plugins/vis_default_editor/public/components/controls/palette_picker.test.tsx b/src/plugins/vis_default_editor/public/components/controls/palette_picker.test.tsx index 21fdde725cd91..a02bdc6cdb6b4 100644 --- a/src/plugins/vis_default_editor/public/components/controls/palette_picker.test.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/palette_picker.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { ReactWrapper } from 'enzyme'; import { PalettePicker, PalettePickerProps } from './palette_picker'; import { chartPluginMock } from '../../../../charts/public/mocks'; diff --git a/src/plugins/vis_default_editor/public/components/controls/percentiles.test.tsx b/src/plugins/vis_default_editor/public/components/controls/percentiles.test.tsx index c009196c20d8c..a94c68c944d12 100644 --- a/src/plugins/vis_default_editor/public/components/controls/percentiles.test.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/percentiles.test.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { AggParamEditorProps } from '../agg_param_props'; import { IAggConfig } from 'src/plugins/data/public'; -import { mountWithIntl as mount } from '@kbn/test/jest'; +import { mountWithIntl as mount } from '@kbn/test-jest-helpers'; import { PercentilesEditor } from './percentiles'; import { EditorVisState } from '../sidebar/state/reducers'; diff --git a/src/plugins/vis_default_editor/public/components/controls/size.test.tsx b/src/plugins/vis_default_editor/public/components/controls/size.test.tsx index 0d86b6074bce5..9081ed5745254 100644 --- a/src/plugins/vis_default_editor/public/components/controls/size.test.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/size.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; +import { mountWithIntl, shallowWithIntl } from '@kbn/test-jest-helpers'; import { EuiIconTip } from '@elastic/eui'; import { SizeParamEditor, SizeParamEditorProps } from './size'; import { aggParamCommonPropsMock } from './test_utils'; diff --git a/src/plugins/vis_default_editor/public/components/controls/top_aggregate.test.tsx b/src/plugins/vis_default_editor/public/components/controls/top_aggregate.test.tsx index 9c83403c60cb4..95e3a74a66d70 100644 --- a/src/plugins/vis_default_editor/public/components/controls/top_aggregate.test.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/top_aggregate.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; +import { mountWithIntl, shallowWithIntl } from '@kbn/test-jest-helpers'; import { AggregateValueProp, TopAggregateParamEditor, diff --git a/src/plugins/vis_default_editor/public/components/options/long_legend_options.test.tsx b/src/plugins/vis_default_editor/public/components/options/long_legend_options.test.tsx index a95a47bf7af88..0db6473d74d0e 100644 --- a/src/plugins/vis_default_editor/public/components/options/long_legend_options.test.tsx +++ b/src/plugins/vis_default_editor/public/components/options/long_legend_options.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { LongLegendOptions, LongLegendOptionsProps } from './long_legend_options'; import { EuiFieldNumber } from '@elastic/eui'; diff --git a/src/plugins/vis_default_editor/public/components/options/percentage_mode.test.tsx b/src/plugins/vis_default_editor/public/components/options/percentage_mode.test.tsx index 05d321a7b465c..5f45f619d2e4d 100644 --- a/src/plugins/vis_default_editor/public/components/options/percentage_mode.test.tsx +++ b/src/plugins/vis_default_editor/public/components/options/percentage_mode.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { PercentageModeOption, PercentageModeOptionProps } from './percentage_mode'; import { EuiFieldText } from '@elastic/eui'; diff --git a/src/plugins/vis_types/heatmap/public/editor/components/heatmap.test.tsx b/src/plugins/vis_types/heatmap/public/editor/components/heatmap.test.tsx index 5f57083072202..bb1467c658f76 100644 --- a/src/plugins/vis_types/heatmap/public/editor/components/heatmap.test.tsx +++ b/src/plugins/vis_types/heatmap/public/editor/components/heatmap.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { ReactWrapper } from 'enzyme'; import type { PersistedState } from '../../../../../visualizations/public'; import HeatmapOptions, { HeatmapOptionsProps } from './heatmap'; diff --git a/src/plugins/vis_types/pie/public/editor/components/pie.test.tsx b/src/plugins/vis_types/pie/public/editor/components/pie.test.tsx index d6dc4c0734e42..aac0c5aef6001 100644 --- a/src/plugins/vis_types/pie/public/editor/components/pie.test.tsx +++ b/src/plugins/vis_types/pie/public/editor/components/pie.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { ReactWrapper } from 'enzyme'; import PieOptions, { PieOptionsProps } from './pie'; import { chartPluginMock } from '../../../../../charts/public/mocks'; diff --git a/src/plugins/vis_types/pie/public/editor/components/truncate_labels.test.tsx b/src/plugins/vis_types/pie/public/editor/components/truncate_labels.test.tsx index 1d4bb238dcb50..fc5731dc6839f 100644 --- a/src/plugins/vis_types/pie/public/editor/components/truncate_labels.test.tsx +++ b/src/plugins/vis_types/pie/public/editor/components/truncate_labels.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { ReactWrapper } from 'enzyme'; import { TruncateLabelsOption, TruncateLabelsOptionProps } from './truncate_labels'; import { findTestSubject } from '@elastic/eui/lib/test'; diff --git a/src/plugins/vis_types/timeseries/public/application/components/add_delete_buttons.test.tsx b/src/plugins/vis_types/timeseries/public/application/components/add_delete_buttons.test.tsx index 43e59222e0e1e..d6bd687d60055 100644 --- a/src/plugins/vis_types/timeseries/public/application/components/add_delete_buttons.test.tsx +++ b/src/plugins/vis_types/timeseries/public/application/components/add_delete_buttons.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { AddDeleteButtons } from './add_delete_buttons'; describe('AddDeleteButtons', () => { diff --git a/src/plugins/vis_types/timeseries/public/application/components/aggs/agg_select.test.tsx b/src/plugins/vis_types/timeseries/public/application/components/aggs/agg_select.test.tsx index 3dbeb257900b7..ccdf60ea9cf98 100644 --- a/src/plugins/vis_types/timeseries/public/application/components/aggs/agg_select.test.tsx +++ b/src/plugins/vis_types/timeseries/public/application/components/aggs/agg_select.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { AggSelect } from './agg_select'; import { METRIC, SERIES } from '../../../test_utils'; import { EuiComboBox } from '@elastic/eui'; diff --git a/src/plugins/vis_types/timeseries/public/application/components/aggs/filter_ratio.test.js b/src/plugins/vis_types/timeseries/public/application/components/aggs/filter_ratio.test.js index bd9ceeeb74028..38305395bfbb6 100644 --- a/src/plugins/vis_types/timeseries/public/application/components/aggs/filter_ratio.test.js +++ b/src/plugins/vis_types/timeseries/public/application/components/aggs/filter_ratio.test.js @@ -7,7 +7,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { FilterRatioAgg } from './filter_ratio'; import { FIELDS, METRIC, SERIES, PANEL } from '../../../test_utils'; import { EuiComboBox } from '@elastic/eui'; diff --git a/src/plugins/vis_types/timeseries/public/application/components/aggs/histogram_support.test.js b/src/plugins/vis_types/timeseries/public/application/components/aggs/histogram_support.test.js index ff96e476814ff..b97968ff62241 100644 --- a/src/plugins/vis_types/timeseries/public/application/components/aggs/histogram_support.test.js +++ b/src/plugins/vis_types/timeseries/public/application/components/aggs/histogram_support.test.js @@ -7,7 +7,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { Agg } from './agg'; import { FieldSelect } from './field_select'; import { FIELDS, METRIC, SERIES, PANEL } from '../../../test_utils'; diff --git a/src/plugins/vis_types/timeseries/public/application/components/aggs/percentile_rank/multi_value_row.test.tsx b/src/plugins/vis_types/timeseries/public/application/components/aggs/percentile_rank/multi_value_row.test.tsx index 7b08715ba1a93..d0a140a15b488 100644 --- a/src/plugins/vis_types/timeseries/public/application/components/aggs/percentile_rank/multi_value_row.test.tsx +++ b/src/plugins/vis_types/timeseries/public/application/components/aggs/percentile_rank/multi_value_row.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { MultiValueRow } from './multi_value_row'; import { ColorPicker } from '../../color_picker'; diff --git a/src/plugins/vis_types/timeseries/public/application/components/aggs/percentile_ui.test.tsx b/src/plugins/vis_types/timeseries/public/application/components/aggs/percentile_ui.test.tsx index b143c0bf6ceab..edb0ae4d79884 100644 --- a/src/plugins/vis_types/timeseries/public/application/components/aggs/percentile_ui.test.tsx +++ b/src/plugins/vis_types/timeseries/public/application/components/aggs/percentile_ui.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; // @ts-ignore not-typed yet import { Percentiles } from './percentile_ui'; import { ColorPicker } from '../color_picker'; diff --git a/src/plugins/vis_types/timeseries/public/application/components/color_rules.test.tsx b/src/plugins/vis_types/timeseries/public/application/components/color_rules.test.tsx index d6009a214941f..6dafe5cd456fb 100644 --- a/src/plugins/vis_types/timeseries/public/application/components/color_rules.test.tsx +++ b/src/plugins/vis_types/timeseries/public/application/components/color_rules.test.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { keys } from '@elastic/eui'; import { findTestSubject } from '@elastic/eui/lib/test'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { collectionActions } from './lib/collection_actions'; import { diff --git a/src/plugins/vis_types/timeseries/public/application/components/palette_picker.test.tsx b/src/plugins/vis_types/timeseries/public/application/components/palette_picker.test.tsx index 81b33943f8b04..489896662033b 100644 --- a/src/plugins/vis_types/timeseries/public/application/components/palette_picker.test.tsx +++ b/src/plugins/vis_types/timeseries/public/application/components/palette_picker.test.tsx @@ -6,7 +6,7 @@ * Side Public License, v 1. */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { ReactWrapper } from 'enzyme'; import { PalettePicker, PalettePickerProps } from './palette_picker'; import { chartPluginMock } from '../../../../../charts/public/mocks'; diff --git a/src/plugins/vis_types/timeseries/public/application/components/panel_config/timeseries.test.tsx b/src/plugins/vis_types/timeseries/public/application/components/panel_config/timeseries.test.tsx index b8af2e7ef8539..9a23d8513500c 100644 --- a/src/plugins/vis_types/timeseries/public/application/components/panel_config/timeseries.test.tsx +++ b/src/plugins/vis_types/timeseries/public/application/components/panel_config/timeseries.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { shallowWithIntl as shallow } from '@kbn/test/jest'; +import { shallowWithIntl as shallow } from '@kbn/test-jest-helpers'; jest.mock('../lib/get_default_query_language', () => ({ getDefaultQueryLanguage: () => 'kuery', diff --git a/src/plugins/vis_types/timeseries/public/application/components/vis_types/gauge/series.test.js b/src/plugins/vis_types/timeseries/public/application/components/vis_types/gauge/series.test.js index 32904ba682768..b2fb7bfff0b3e 100644 --- a/src/plugins/vis_types/timeseries/public/application/components/vis_types/gauge/series.test.js +++ b/src/plugins/vis_types/timeseries/public/application/components/vis_types/gauge/series.test.js @@ -8,7 +8,7 @@ import React from 'react'; import { GaugeSeries } from './series'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; const defaultProps = { disableAdd: true, diff --git a/src/plugins/vis_types/timeseries/public/application/components/vis_types/metric/series.test.js b/src/plugins/vis_types/timeseries/public/application/components/vis_types/metric/series.test.js index c33fa2d3f442d..709ea8b23ca33 100644 --- a/src/plugins/vis_types/timeseries/public/application/components/vis_types/metric/series.test.js +++ b/src/plugins/vis_types/timeseries/public/application/components/vis_types/metric/series.test.js @@ -8,7 +8,7 @@ import React from 'react'; import { MetricSeries } from './series'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; const defaultProps = { disableAdd: false, diff --git a/src/plugins/vis_types/vislib/public/vislib/lib/chart_title.test.js b/src/plugins/vis_types/vislib/public/vislib/lib/chart_title.test.js index 54b326a292845..5c3fd271fc6ca 100644 --- a/src/plugins/vis_types/vislib/public/vislib/lib/chart_title.test.js +++ b/src/plugins/vis_types/vislib/public/vislib/lib/chart_title.test.js @@ -12,7 +12,7 @@ import { setHTMLElementClientSizes, setSVGElementGetBBox, setSVGElementGetComputedTextLength, -} from '@kbn/test/jest'; +} from '@kbn/test-jest-helpers'; import { ChartTitle } from './chart_title'; import { VisConfig } from './vis_config'; diff --git a/src/plugins/vis_types/vislib/public/vislib/lib/dispatch.test.js b/src/plugins/vis_types/vislib/public/vislib/lib/dispatch.test.js index 21a3dc069d8c6..a500aa00e6d21 100644 --- a/src/plugins/vis_types/vislib/public/vislib/lib/dispatch.test.js +++ b/src/plugins/vis_types/vislib/public/vislib/lib/dispatch.test.js @@ -13,7 +13,7 @@ import { setHTMLElementClientSizes, setSVGElementGetBBox, setSVGElementGetComputedTextLength, -} from '@kbn/test/jest'; +} from '@kbn/test-jest-helpers'; // Data import data from '../../fixtures/mock_data/date_histogram/_series'; diff --git a/src/plugins/vis_types/vislib/public/vislib/lib/handler.test.js b/src/plugins/vis_types/vislib/public/vislib/lib/handler.test.js index 60ffaf3f3d19c..d82dbb1ae77d7 100644 --- a/src/plugins/vis_types/vislib/public/vislib/lib/handler.test.js +++ b/src/plugins/vis_types/vislib/public/vislib/lib/handler.test.js @@ -11,7 +11,7 @@ import { setHTMLElementClientSizes, setSVGElementGetBBox, setSVGElementGetComputedTextLength, -} from '@kbn/test/jest'; +} from '@kbn/test-jest-helpers'; // Data import series from '../../fixtures/mock_data/date_histogram/_series'; diff --git a/src/plugins/vis_types/vislib/public/vislib/lib/layout/layout.test.js b/src/plugins/vis_types/vislib/public/vislib/lib/layout/layout.test.js index af59f011515d0..50fcdba6aa360 100644 --- a/src/plugins/vis_types/vislib/public/vislib/lib/layout/layout.test.js +++ b/src/plugins/vis_types/vislib/public/vislib/lib/layout/layout.test.js @@ -12,7 +12,7 @@ import { setHTMLElementClientSizes, setSVGElementGetBBox, setSVGElementGetComputedTextLength, -} from '@kbn/test/jest'; +} from '@kbn/test-jest-helpers'; // Data import series from '../../../fixtures/mock_data/date_histogram/_series'; diff --git a/src/plugins/vis_types/vislib/public/vislib/vis.test.js b/src/plugins/vis_types/vislib/public/vislib/vis.test.js index 46afbd1c62f69..b20bbfc700c8b 100644 --- a/src/plugins/vis_types/vislib/public/vislib/vis.test.js +++ b/src/plugins/vis_types/vislib/public/vislib/vis.test.js @@ -12,7 +12,7 @@ import { setHTMLElementClientSizes, setSVGElementGetBBox, setSVGElementGetComputedTextLength, -} from '@kbn/test/jest'; +} from '@kbn/test-jest-helpers'; import series from '../fixtures/mock_data/date_histogram/_series'; import columns from '../fixtures/mock_data/date_histogram/_columns'; import rows from '../fixtures/mock_data/date_histogram/_rows'; diff --git a/src/plugins/vis_types/vislib/public/vislib/visualizations/chart.test.js b/src/plugins/vis_types/vislib/public/vislib/visualizations/chart.test.js index 21ec67707126c..12fc0e9a5e4b8 100644 --- a/src/plugins/vis_types/vislib/public/vislib/visualizations/chart.test.js +++ b/src/plugins/vis_types/vislib/public/vislib/visualizations/chart.test.js @@ -12,7 +12,7 @@ import { setHTMLElementClientSizes, setSVGElementGetBBox, setSVGElementGetComputedTextLength, -} from '@kbn/test/jest'; +} from '@kbn/test-jest-helpers'; import { Chart } from './_chart'; import { getMockUiState } from '../../fixtures/mocks'; import { getVis } from './_vis_fixture'; diff --git a/src/plugins/vis_types/vislib/public/vislib/visualizations/gauge_chart.test.js b/src/plugins/vis_types/vislib/public/vislib/visualizations/gauge_chart.test.js index 76830c66f3aa5..47cd2833464e8 100644 --- a/src/plugins/vis_types/vislib/public/vislib/visualizations/gauge_chart.test.js +++ b/src/plugins/vis_types/vislib/public/vislib/visualizations/gauge_chart.test.js @@ -8,7 +8,7 @@ import $ from 'jquery'; import _ from 'lodash'; -import { setHTMLElementClientSizes, setSVGElementGetBBox } from '@kbn/test/jest'; +import { setHTMLElementClientSizes, setSVGElementGetBBox } from '@kbn/test-jest-helpers'; import data from '../../fixtures/mock_data/terms/_series_multiple'; import { getMockUiState } from '../../fixtures/mocks'; diff --git a/src/plugins/vis_types/vislib/public/vislib/visualizations/pie_chart.test.js b/src/plugins/vis_types/vislib/public/vislib/visualizations/pie_chart.test.js index 8ad9bf56cb020..ba11df923b8a6 100644 --- a/src/plugins/vis_types/vislib/public/vislib/visualizations/pie_chart.test.js +++ b/src/plugins/vis_types/vislib/public/vislib/visualizations/pie_chart.test.js @@ -13,7 +13,7 @@ import { setHTMLElementClientSizes, setSVGElementGetBBox, setSVGElementGetComputedTextLength, -} from '@kbn/test/jest'; +} from '@kbn/test-jest-helpers'; import { getMockUiState } from '../../fixtures/mocks'; import { getVis } from './_vis_fixture'; import { pieChartMockData } from './pie_chart_mock_data'; diff --git a/src/plugins/vis_types/vislib/public/vislib/visualizations/point_series/heatmap_chart.test.js b/src/plugins/vis_types/vislib/public/vislib/visualizations/point_series/heatmap_chart.test.js index d9bac77acf5ad..c7dbaacfdae9e 100644 --- a/src/plugins/vis_types/vislib/public/vislib/visualizations/point_series/heatmap_chart.test.js +++ b/src/plugins/vis_types/vislib/public/vislib/visualizations/point_series/heatmap_chart.test.js @@ -13,7 +13,7 @@ import { setHTMLElementClientSizes, setSVGElementGetBBox, setSVGElementGetComputedTextLength, -} from '@kbn/test/jest'; +} from '@kbn/test-jest-helpers'; // Data import series from '../../../fixtures/mock_data/date_histogram/_series'; diff --git a/src/plugins/vis_types/xy/public/editor/components/common/truncate_labels.test.tsx b/src/plugins/vis_types/xy/public/editor/components/common/truncate_labels.test.tsx index 902167cb24642..a688ddb722620 100644 --- a/src/plugins/vis_types/xy/public/editor/components/common/truncate_labels.test.tsx +++ b/src/plugins/vis_types/xy/public/editor/components/common/truncate_labels.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { ReactWrapper } from 'enzyme'; import { TruncateLabelsOption, TruncateLabelsOptionProps } from './truncate_labels'; import { findTestSubject } from '@elastic/eui/lib/test'; diff --git a/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/value_axes_panel.test.tsx b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/value_axes_panel.test.tsx index 3e1a44993235b..53acb302e9889 100644 --- a/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/value_axes_panel.test.tsx +++ b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/value_axes_panel.test.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { shallow } from 'enzyme'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { Position } from '@elastic/charts'; import { ValueAxis, SeriesParam } from '../../../../types'; diff --git a/src/plugins/vis_types/xy/public/editor/components/options/point_series/point_series.test.tsx b/src/plugins/vis_types/xy/public/editor/components/options/point_series/point_series.test.tsx index 5bf9486bbc4ee..dbd1bed390574 100644 --- a/src/plugins/vis_types/xy/public/editor/components/options/point_series/point_series.test.tsx +++ b/src/plugins/vis_types/xy/public/editor/components/options/point_series/point_series.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { ReactWrapper } from 'enzyme'; import { PointSeriesOptions } from './point_series'; import { findTestSubject } from '@elastic/eui/lib/test'; diff --git a/src/plugins/vis_types/xy/public/utils/get_color_picker.test.tsx b/src/plugins/vis_types/xy/public/utils/get_color_picker.test.tsx index 352cff0d4c4a9..89cb8d50d4b8e 100644 --- a/src/plugins/vis_types/xy/public/utils/get_color_picker.test.tsx +++ b/src/plugins/vis_types/xy/public/utils/get_color_picker.test.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { LegendColorPickerProps, XYChartSeriesIdentifier } from '@elastic/charts'; import { EuiPopover } from '@elastic/eui'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { ComponentType, ReactWrapper } from 'enzyme'; import { getColorPicker } from './get_color_picker'; import { ColorPicker } from '../../../../charts/public'; diff --git a/src/plugins/visualizations/public/visualize_app/components/visualize_editor_common.test.tsx b/src/plugins/visualizations/public/visualize_app/components/visualize_editor_common.test.tsx index d0c7b56638bc2..81f0bd8d99909 100644 --- a/src/plugins/visualizations/public/visualize_app/components/visualize_editor_common.test.tsx +++ b/src/plugins/visualizations/public/visualize_app/components/visualize_editor_common.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { shallowWithIntl, mountWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl, mountWithIntl } from '@kbn/test-jest-helpers'; import { VisualizeEditorCommon } from './visualize_editor_common'; import { VisualizeEditorVisInstance } from '../types'; import { SplitChartWarning } from './split_chart_warning'; diff --git a/src/plugins/visualizations/public/wizard/agg_based_selection/agg_based_selection.test.tsx b/src/plugins/visualizations/public/wizard/agg_based_selection/agg_based_selection.test.tsx index e3707a7aace79..b776068ab9c49 100644 --- a/src/plugins/visualizations/public/wizard/agg_based_selection/agg_based_selection.test.tsx +++ b/src/plugins/visualizations/public/wizard/agg_based_selection/agg_based_selection.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { TypesStart, BaseVisType, VisGroups } from '../../vis_types'; import { AggBasedSelection } from './agg_based_selection'; diff --git a/src/plugins/visualizations/public/wizard/group_selection/group_selection.test.tsx b/src/plugins/visualizations/public/wizard/group_selection/group_selection.test.tsx index 04824ae25704d..ae9d13b879cf7 100644 --- a/src/plugins/visualizations/public/wizard/group_selection/group_selection.test.tsx +++ b/src/plugins/visualizations/public/wizard/group_selection/group_selection.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { TypesStart, BaseVisType, VisGroups } from '../../vis_types'; import { GroupSelection } from './group_selection'; import { DocLinksStart } from '../../../../../core/public'; diff --git a/src/plugins/visualizations/public/wizard/new_vis_modal.test.tsx b/src/plugins/visualizations/public/wizard/new_vis_modal.test.tsx index 7514f467840e5..ae65251409c20 100644 --- a/src/plugins/visualizations/public/wizard/new_vis_modal.test.tsx +++ b/src/plugins/visualizations/public/wizard/new_vis_modal.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { TypesStart, VisGroups, BaseVisType } from '../vis_types'; import NewVisModal from './new_vis_modal'; import { ApplicationStart, SavedObjectsStart, DocLinksStart } from '../../../../core/public'; diff --git a/x-pack/plugins/cases/public/components/empty_value/empty_value.test.tsx b/x-pack/plugins/cases/public/components/empty_value/empty_value.test.tsx index e1dfc71867f6e..47e6ec259640c 100644 --- a/x-pack/plugins/cases/public/components/empty_value/empty_value.test.tsx +++ b/x-pack/plugins/cases/public/components/empty_value/empty_value.test.tsx @@ -8,7 +8,7 @@ import { mount, shallow } from 'enzyme'; import React from 'react'; import { ThemeProvider } from 'styled-components'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { defaultToEmptyTag, diff --git a/x-pack/plugins/cloud/public/plugin.test.ts b/x-pack/plugins/cloud/public/plugin.test.ts index 7198fb6f8a774..1eef581610f00 100644 --- a/x-pack/plugins/cloud/public/plugin.test.ts +++ b/x-pack/plugins/cloud/public/plugin.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { coreMock } from 'src/core/public/mocks'; import { homePluginMock } from 'src/plugins/home/public/mocks'; import { securityMock } from '../../security/public/mocks'; diff --git a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/fixtures/auto_follow_pattern.ts b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/fixtures/auto_follow_pattern.ts index fe43f517f7f3f..ad7d95fc64c2e 100644 --- a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/fixtures/auto_follow_pattern.ts +++ b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/fixtures/auto_follow_pattern.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { getRandomString } from '@kbn/test/jest'; +import { getRandomString } from '@kbn/test-jest-helpers'; import { AutoFollowPattern } from '../../../../common/types'; export const getAutoFollowPatternMock = ({ diff --git a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/fixtures/follower_index.ts b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/fixtures/follower_index.ts index e2f48e688610e..c3a52400dea00 100644 --- a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/fixtures/follower_index.ts +++ b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/fixtures/follower_index.ts @@ -6,7 +6,7 @@ */ import Chance from 'chance'; -import { getRandomString } from '@kbn/test/jest'; +import { getRandomString } from '@kbn/test-jest-helpers'; import { FollowerIndex } from '../../../../common/types'; const chance = new Chance(); diff --git a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/follower_indices_list.test.js b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/follower_indices_list.test.js index 9f2cb6452c6f2..b3e47b2ad7dca 100644 --- a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/follower_indices_list.test.js +++ b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/follower_indices_list.test.js @@ -11,7 +11,7 @@ Could not load worker ReferenceError: Worker is not defined at createWorker (//node_modules/brace/index.js:17992:5) */ -import { stubWebWorker } from '@kbn/test/jest'; // eslint-disable-line no-unused-vars +import { stubWebWorker } from '@kbn/test-jest-helpers'; // eslint-disable-line no-unused-vars import { act } from 'react-dom/test-utils'; import { getFollowerIndexMock } from './fixtures/follower_index'; diff --git a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/auto_follow_pattern_add.helpers.js b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/auto_follow_pattern_add.helpers.js index c1902e22265b8..138ea72bfe7ff 100644 --- a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/auto_follow_pattern_add.helpers.js +++ b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/auto_follow_pattern_add.helpers.js @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed } from '@kbn/test/jest'; +import { registerTestBed } from '@kbn/test-jest-helpers'; import { AutoFollowPatternAdd } from '../../../app/sections/auto_follow_pattern_add'; import { ccrStore } from '../../../app/store'; import { routing } from '../../../app/services/routing'; diff --git a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/auto_follow_pattern_edit.helpers.js b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/auto_follow_pattern_edit.helpers.js index 43d677596690f..0b6e6216209d8 100644 --- a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/auto_follow_pattern_edit.helpers.js +++ b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/auto_follow_pattern_edit.helpers.js @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed } from '@kbn/test/jest'; +import { registerTestBed } from '@kbn/test-jest-helpers'; import { AutoFollowPatternEdit } from '../../../app/sections/auto_follow_pattern_edit'; import { ccrStore } from '../../../app/store'; import { routing } from '../../../app/services/routing'; diff --git a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/auto_follow_pattern_list.helpers.js b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/auto_follow_pattern_list.helpers.js index 329d83d6fe3c7..0c7f483685075 100644 --- a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/auto_follow_pattern_list.helpers.js +++ b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/auto_follow_pattern_list.helpers.js @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed, findTestSubject } from '@kbn/test/jest'; +import { registerTestBed, findTestSubject } from '@kbn/test-jest-helpers'; import { AutoFollowPatternList } from '../../../app/sections/home/auto_follow_pattern_list'; import { ccrStore } from '../../../app/store'; import { routing } from '../../../app/services/routing'; diff --git a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/follower_index_add.helpers.js b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/follower_index_add.helpers.js index a873af2de8b06..ab107348bd5b7 100644 --- a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/follower_index_add.helpers.js +++ b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/follower_index_add.helpers.js @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed } from '@kbn/test/jest'; +import { registerTestBed } from '@kbn/test-jest-helpers'; import { FollowerIndexAdd } from '../../../app/sections/follower_index_add'; import { ccrStore } from '../../../app/store'; import { routing } from '../../../app/services/routing'; diff --git a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/follower_index_edit.helpers.js b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/follower_index_edit.helpers.js index f8a68e54ea52e..5f83aa841b11d 100644 --- a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/follower_index_edit.helpers.js +++ b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/follower_index_edit.helpers.js @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed } from '@kbn/test/jest'; +import { registerTestBed } from '@kbn/test-jest-helpers'; import { FollowerIndexEdit } from '../../../app/sections/follower_index_edit'; import { ccrStore } from '../../../app/store'; import { routing } from '../../../app/services/routing'; diff --git a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/follower_index_list.helpers.js b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/follower_index_list.helpers.js index 5e6a48413b18b..961ce940084e7 100644 --- a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/follower_index_list.helpers.js +++ b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/follower_index_list.helpers.js @@ -6,7 +6,7 @@ */ import { act } from 'react-dom/test-utils'; -import { registerTestBed, findTestSubject } from '@kbn/test/jest'; +import { registerTestBed, findTestSubject } from '@kbn/test-jest-helpers'; import { FollowerIndicesList } from '../../../app/sections/home/follower_indices_list'; import { ccrStore } from '../../../app/store'; import { routing } from '../../../app/services/routing'; diff --git a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/home.helpers.js b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/home.helpers.js index 1f03a56fbbcdb..8263b14e9eaab 100644 --- a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/home.helpers.js +++ b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/home.helpers.js @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed } from '@kbn/test/jest'; +import { registerTestBed } from '@kbn/test-jest-helpers'; import { CrossClusterReplicationHome } from '../../../app/sections/home/home'; import { ccrStore } from '../../../app/store'; import { routing } from '../../../app/services/routing'; diff --git a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/index.js b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/index.js index 5f910565edb3a..0fedc1ab6b903 100644 --- a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/index.js +++ b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/index.js @@ -13,7 +13,7 @@ import { setup as followerIndexAddSetup } from './follower_index_add.helpers'; import { setup as followerIndexEditSetup } from './follower_index_edit.helpers'; import { setup as homeSetup } from './home.helpers'; -export { nextTick, getRandomString, findTestSubject, delay } from '@kbn/test/jest'; +export { nextTick, getRandomString, findTestSubject, delay } from '@kbn/test-jest-helpers'; export { setupEnvironment } from './setup_environment'; diff --git a/x-pack/plugins/data_enhanced/public/search/ui/connected_search_session_indicator/connected_search_session_indicator.test.tsx b/x-pack/plugins/data_enhanced/public/search/ui/connected_search_session_indicator/connected_search_session_indicator.test.tsx index 6e9b06ad36df7..5f5753b8858e0 100644 --- a/x-pack/plugins/data_enhanced/public/search/ui/connected_search_session_indicator/connected_search_session_indicator.test.tsx +++ b/x-pack/plugins/data_enhanced/public/search/ui/connected_search_session_indicator/connected_search_session_indicator.test.tsx @@ -6,7 +6,7 @@ */ import React, { ReactNode } from 'react'; -import { StubBrowserStorage } from '@kbn/test/jest'; +import { StubBrowserStorage } from '@kbn/test-jest-helpers'; import { render, waitFor, screen, act } from '@testing-library/react'; import { Storage } from '../../../../../../../src/plugins/kibana_utils/public/'; import { dataPluginMock } from '../../../../../../../src/plugins/data/public/mocks'; diff --git a/x-pack/plugins/data_visualizer/public/application/file_data_visualizer/components/edit_flyout/overrides.test.js b/x-pack/plugins/data_visualizer/public/application/file_data_visualizer/components/edit_flyout/overrides.test.js index 8a4695f823128..a81b3b5865008 100644 --- a/x-pack/plugins/data_visualizer/public/application/file_data_visualizer/components/edit_flyout/overrides.test.js +++ b/x-pack/plugins/data_visualizer/public/application/file_data_visualizer/components/edit_flyout/overrides.test.js @@ -5,7 +5,7 @@ * 2.0. */ -import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; +import { mountWithIntl, shallowWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { FILE_FORMATS } from '../../../../../common/constants'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/analytics_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/analytics_logic.test.ts index 62ba44128663a..a87555c58014a 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/analytics_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/analytics_logic.test.ts @@ -11,7 +11,7 @@ jest.mock('../engine', () => ({ EngineLogic: { values: { engineName: 'test-engine' } }, })); -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { itShowsServerErrorAsFlashMessage } from '../../../test_helpers'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/components/analytics_tables/test_helpers/shared_columns_tests.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/components/analytics_tables/test_helpers/shared_columns_tests.tsx index ea5a28c02c989..d9ffb83a561c4 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/components/analytics_tables/test_helpers/shared_columns_tests.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/analytics/components/analytics_tables/test_helpers/shared_columns_tests.tsx @@ -14,7 +14,7 @@ import '../../../../../__mocks__/engine_logic.mock'; import { ReactWrapper } from 'enzyme'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; export const runActionColumnTests = (wrapper: ReactWrapper) => { const { http } = mockHttpValues; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/api_logs/api_logs_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/api_logs/api_logs_logic.test.ts index 51d51b5aee88c..35fa74374acb2 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/api_logs/api_logs_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/api_logs/api_logs_logic.test.ts @@ -13,7 +13,7 @@ import { import { mockApiLog } from './__mocks__/api_log.mock'; import '../../__mocks__/engine_logic.mock'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { DEFAULT_META } from '../../../shared/constants'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/add_domain/add_domain_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/add_domain/add_domain_logic.test.ts index 466ccc61838f0..08bd78b5298d4 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/add_domain/add_domain_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/add_domain/add_domain_logic.test.ts @@ -26,7 +26,7 @@ jest.mock('./utils', () => ({ getDomainWithProtocol: jest.fn().mockImplementation((domain) => domain), })); -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { CrawlerLogic } from '../../crawler_logic'; import { CrawlerDomain } from '../../types'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/manage_crawls_popover/automatic_crawl_scheduler_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/manage_crawls_popover/automatic_crawl_scheduler_logic.test.ts index 3c95243459a1c..5c9e95e097dd4 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/manage_crawls_popover/automatic_crawl_scheduler_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/manage_crawls_popover/automatic_crawl_scheduler_logic.test.ts @@ -20,7 +20,7 @@ jest.mock('./manage_crawls_popover_logic', () => ({ }, })); -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { CrawlUnits } from '../../types'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/manage_crawls_popover/manage_crawls_popover_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/manage_crawls_popover/manage_crawls_popover_logic.test.ts index f80465fa2c407..da879192efdfa 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/manage_crawls_popover/manage_crawls_popover_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/manage_crawls_popover/manage_crawls_popover_logic.test.ts @@ -12,7 +12,7 @@ import { } from '../../../../../__mocks__/kea_logic'; import '../../../../__mocks__/engine_logic.mock'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { CrawlerDomain } from '../../types'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawl_detail_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawl_detail_logic.test.ts index 152fe0f64de4d..f24fe4576e449 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawl_detail_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawl_detail_logic.test.ts @@ -8,7 +8,7 @@ import { LogicMounter, mockHttpValues } from '../../../__mocks__/kea_logic'; import '../../__mocks__/engine_logic.mock'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { itShowsServerErrorAsFlashMessage } from '../../../test_helpers'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_domains_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_domains_logic.test.ts index fda96ca5f8381..a4963d7f21b51 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_domains_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_domains_logic.test.ts @@ -12,7 +12,7 @@ import { } from '../../../__mocks__/kea_logic'; import '../../__mocks__/engine_logic.mock'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { Meta } from '../../../../../common/types'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_logic.test.ts index 0735b5262a20a..e622798e688ab 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_logic.test.ts @@ -12,7 +12,7 @@ import { } from '../../../__mocks__/kea_logic'; import '../../__mocks__/engine_logic.mock'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { itShowsServerErrorAsFlashMessage } from '../../../test_helpers'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_single_domain_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_single_domain_logic.test.ts index 547218ad6a2c1..53b63831f14b7 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_single_domain_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_single_domain_logic.test.ts @@ -21,7 +21,7 @@ jest.mock('./crawler_logic', () => ({ }, })); -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { itShowsServerErrorAsFlashMessage } from '../../../test_helpers'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_logic.test.ts index decb98d227975..4ccd91959831a 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_logic.test.ts @@ -11,7 +11,7 @@ import { mockHttpValues, } from '../../../__mocks__/kea_logic'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { DEFAULT_META } from '../../../shared/constants'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/components/suggestions_logic.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/components/suggestions_logic.test.tsx index a3ca646bd9f54..db9ee7a4bd12b 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/components/suggestions_logic.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/components/suggestions_logic.test.tsx @@ -8,7 +8,7 @@ import { LogicMounter, mockHttpValues } from '../../../../__mocks__/kea_logic'; import '../../../__mocks__/engine_logic.mock'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { DEFAULT_META } from '../../../../shared/constants'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/curation_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/curation_logic.test.ts index 644139250c07c..193d397b1fb50 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/curation_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curation/curation_logic.test.ts @@ -13,7 +13,7 @@ import { } from '../../../../__mocks__/kea_logic'; import '../../../__mocks__/engine_logic.mock'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { itShowsServerErrorAsFlashMessage } from '../../../../test_helpers'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curations_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curations_logic.test.ts index 71d8b65f1a639..d8fcc01c29a96 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curations_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/curations_logic.test.ts @@ -13,7 +13,7 @@ import { } from '../../../__mocks__/kea_logic'; import '../../__mocks__/engine_logic.mock'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { DEFAULT_META } from '../../../shared/constants'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curation_suggestion/curation_suggestion_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curation_suggestion/curation_suggestion_logic.test.ts index e7ac2b3610998..8b20c6a64e073 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curation_suggestion/curation_suggestion_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curation_suggestion/curation_suggestion_logic.test.ts @@ -14,7 +14,7 @@ import { import '../../../../__mocks__/engine_logic.mock'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { itShowsServerErrorAsFlashMessage } from '../../../../../test_helpers'; import { HydratedCurationSuggestion } from '../../types'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations_history/components/ignored_queries_panel/ignored_queries_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations_history/components/ignored_queries_panel/ignored_queries_logic.test.ts index af9f876820790..fd6589330e43f 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations_history/components/ignored_queries_panel/ignored_queries_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations_history/components/ignored_queries_panel/ignored_queries_logic.test.ts @@ -16,7 +16,7 @@ import { itShowsServerErrorAsFlashMessage } from '../../../../../../../test_help // I don't know why eslint is saying this line is out of order // eslint-disable-next-line import/order -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { IgnoredQueriesLogic } from './ignored_queries_logic'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations_settings/curations_settings.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations_settings/curations_settings.test.tsx index b95ae0bca5bf6..73559b2c4b757 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations_settings/curations_settings.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations_settings/curations_settings.test.tsx @@ -17,7 +17,7 @@ import { shallow, ShallowWrapper } from 'enzyme'; import { EuiButtonEmpty, EuiCallOut, EuiSwitch } from '@elastic/eui'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { docLinks } from '../../../../../shared/doc_links'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations_settings/curations_settings_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations_settings/curations_settings_logic.test.ts index e9643f92f2f71..e3f8a47b401b4 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations_settings/curations_settings_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations_settings/curations_settings_logic.test.ts @@ -17,7 +17,7 @@ jest.mock('../../curations_logic', () => ({ }, })); -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { CurationsLogic } from '../..'; import { itShowsServerErrorAsFlashMessage } from '../../../../../test_helpers'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/document_creation_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/document_creation_logic.test.ts index 753871765896a..edd5c5566a45d 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/document_creation_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/document_creation_logic.test.ts @@ -9,7 +9,7 @@ import { LogicMounter, mockHttpValues } from '../../../__mocks__/kea_logic'; import dedent from 'dedent'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; jest.mock('../engine', () => ({ EngineLogic: { values: { engineName: 'test-engine' } }, diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/document_detail_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/document_detail_logic.test.ts index 848a85f23c2cb..3cdad784a7d27 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/document_detail_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/document_detail_logic.test.ts @@ -13,7 +13,7 @@ import { } from '../../../__mocks__/kea_logic'; import { mockEngineValues } from '../../__mocks__'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { InternalSchemaType } from '../../../shared/schema/types'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_logic.test.ts index adcc6bc546629..2b0a4627a64b3 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_logic.test.ts @@ -11,7 +11,7 @@ import { mockFlashMessageHelpers, } from '../../../__mocks__/kea_logic'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { SchemaType } from '../../../shared/schema/types'; import { ApiTokenTypes } from '../credentials/constants'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/engine_creation_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/engine_creation_logic.test.ts index 70ff3b5adc078..3379b5d7850c8 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/engine_creation_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_creation/engine_creation_logic.test.ts @@ -12,7 +12,7 @@ import { mockFlashMessageHelpers, } from '../../../__mocks__/kea_logic'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { EngineCreationLogic } from './engine_creation_logic'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview/engine_overview_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview/engine_overview_logic.test.ts index 142aab98a643b..6f0454ca73754 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview/engine_overview_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine_overview/engine_overview_logic.test.ts @@ -11,7 +11,7 @@ jest.mock('../engine', () => ({ EngineLogic: { values: { engineName: 'some-engine' } }, })); -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { itShowsServerErrorAsFlashMessage } from '../../../test_helpers'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/engines_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/engines_logic.test.ts index d0a227c8c6fbe..9659745aeb61d 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/engines_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/engines_logic.test.ts @@ -11,7 +11,7 @@ import { mockFlashMessageHelpers, } from '../../../__mocks__/kea_logic'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { DEFAULT_META } from '../../../shared/constants'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/log_retention_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/log_retention_logic.test.ts index 20c5860160b78..c254a978f8789 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/log_retention_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/log_retention_logic.test.ts @@ -11,7 +11,7 @@ import { mockFlashMessageHelpers, } from '../../../__mocks__/kea_logic'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { LogRetentionOptions } from './types'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/meta_engine_creation/meta_engine_creation_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/meta_engine_creation/meta_engine_creation_logic.test.ts index a785f70a4edb7..9f03044476263 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/meta_engine_creation/meta_engine_creation_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/meta_engine_creation/meta_engine_creation_logic.test.ts @@ -12,7 +12,7 @@ import { mockKibanaValues, } from '../../../__mocks__/kea_logic'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { MetaEngineCreationLogic } from './meta_engine_creation_logic'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_logic.test.ts index 6ac1c27a27959..605c5ee9d7e80 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/relevance_tuning/relevance_tuning_logic.test.ts @@ -12,7 +12,7 @@ import { } from '../../../__mocks__/kea_logic'; import { mockEngineValues, mockEngineActions } from '../../__mocks__'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { itShowsServerErrorAsFlashMessage } from '../../../test_helpers'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings_logic.test.ts index 92cb2346e0a26..f498d53c509d1 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings_logic.test.ts @@ -10,7 +10,7 @@ import { mockEngineValues } from '../../__mocks__'; import { omit } from 'lodash'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { Schema, SchemaConflicts, SchemaType } from '../../../shared/schema/types'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/sample_response/sample_response_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/sample_response/sample_response_logic.test.ts index 426934b95388e..ee20fab3da66c 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/sample_response/sample_response_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/sample_response/sample_response_logic.test.ts @@ -8,7 +8,7 @@ import { LogicMounter, mockHttpValues } from '../../../../__mocks__/kea_logic'; import '../../../__mocks__/engine_logic.mock'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { flashAPIErrors } from '../../../../shared/flash_messages'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/role_mappings/role_mappings_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/role_mappings/role_mappings_logic.test.ts index a7422b34d2843..d6802c303807b 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/role_mappings/role_mappings_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/role_mappings/role_mappings_logic.test.ts @@ -13,7 +13,7 @@ import { import { engines } from '../../__mocks__/engines.mock'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { elasticsearchUsers } from '../../../shared/role_mapping/__mocks__/elasticsearch_users'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/sample_engine_creation_cta/sample_engine_creation_cta_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/sample_engine_creation_cta/sample_engine_creation_cta_logic.test.ts index 0b8e5e97cf5ed..dd469a486ca45 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/sample_engine_creation_cta/sample_engine_creation_cta_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/sample_engine_creation_cta/sample_engine_creation_cta_logic.test.ts @@ -12,7 +12,7 @@ import { mockFlashMessageHelpers, } from '../../../__mocks__/kea_logic'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { SampleEngineCreationCtaLogic } from './sample_engine_creation_cta_logic'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/reindex_job/reindex_job_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/reindex_job/reindex_job_logic.test.ts index bb8156a8b55fa..67c88d211f118 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/reindex_job/reindex_job_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/reindex_job/reindex_job_logic.test.ts @@ -12,7 +12,7 @@ import { } from '../../../../__mocks__/kea_logic'; import '../../../__mocks__/engine_logic.mock'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { ReindexJobLogic } from './reindex_job_logic'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/schema_base_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/schema_base_logic.test.ts index 5b40b362bc665..e12ad7405742a 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/schema_base_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/schema_base_logic.test.ts @@ -8,7 +8,7 @@ import { LogicMounter, mockHttpValues } from '../../../__mocks__/kea_logic'; import '../../__mocks__/engine_logic.mock'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { SchemaType } from '../../../shared/schema/types'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/schema_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/schema_logic.test.ts index 484996b710524..8f74a44f8a930 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/schema_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/schema_logic.test.ts @@ -12,7 +12,7 @@ import { } from '../../../__mocks__/kea_logic'; import { mockEngineActions } from '../../__mocks__/engine_logic.mock'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { SchemaType, Schema } from '../../../shared/schema/types'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/search/search_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/search/search_logic.test.ts index d4f5ee29f7467..a56d2f7d5c949 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/search/search_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/search/search_logic.test.ts @@ -12,7 +12,7 @@ import { mockFlashMessageHelpers, } from '../../../__mocks__/kea_logic'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { SearchLogic } from './search_logic'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/search_ui/search_ui_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/search_ui/search_ui_logic.test.ts index 49444fbd0c5c5..58f6f3d98eb28 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/search_ui/search_ui_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/search_ui/search_ui_logic.test.ts @@ -12,7 +12,7 @@ import { } from '../../../__mocks__/kea_logic'; import { mockEngineValues } from '../../__mocks__'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { itShowsServerErrorAsFlashMessage } from '../../../test_helpers'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/source_engines_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/source_engines_logic.test.ts index 75d3c46ef72ee..eaaf43259185e 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/source_engines_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/source_engines/source_engines_logic.test.ts @@ -13,7 +13,7 @@ import { import { mockRecursivelyFetchEngines } from '../../__mocks__'; import '../../__mocks__/engine_logic.mock'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { EngineLogic } from '../engine'; import { EngineDetails } from '../engine/types'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/synonyms/synonyms_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/synonyms/synonyms_logic.test.ts index 7376bc11df79e..b00619359f6c8 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/synonyms/synonyms_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/synonyms/synonyms_logic.test.ts @@ -12,7 +12,7 @@ import { } from '../../../__mocks__/kea_logic'; import '../../__mocks__/engine_logic.mock'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { itShowsServerErrorAsFlashMessage } from '../../../test_helpers'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/utils/recursively_fetch_engines/index.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/utils/recursively_fetch_engines/index.test.ts index c03ca8267993a..2eb7f5cb3cdfb 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/utils/recursively_fetch_engines/index.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/utils/recursively_fetch_engines/index.test.ts @@ -7,7 +7,7 @@ import { mockHttpValues } from '../../../__mocks__/kea_logic'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { itShowsServerErrorAsFlashMessage } from '../../../test_helpers'; diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/tables/generic_endpoint_inline_editable_table/generic_endpoint_inline_editable_table_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/shared/tables/generic_endpoint_inline_editable_table/generic_endpoint_inline_editable_table_logic.test.ts index 481013d91bf6f..a87aadcc04995 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/tables/generic_endpoint_inline_editable_table/generic_endpoint_inline_editable_table_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/tables/generic_endpoint_inline_editable_table/generic_endpoint_inline_editable_table_logic.test.ts @@ -21,7 +21,7 @@ import { mockHttpValues, } from '../../../__mocks__/kea_logic'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { GenericEndpointInlineEditableTableLogic } from './generic_endpoint_inline_editable_table_logic'; diff --git a/x-pack/plugins/enterprise_search/public/applications/test_helpers/error_handling.ts b/x-pack/plugins/enterprise_search/public/applications/test_helpers/error_handling.ts index 4f1f4a40aa503..8f17edf6628fa 100644 --- a/x-pack/plugins/enterprise_search/public/applications/test_helpers/error_handling.ts +++ b/x-pack/plugins/enterprise_search/public/applications/test_helpers/error_handling.ts @@ -7,7 +7,7 @@ import { mockFlashMessageHelpers } from '../__mocks__/kea_logic'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { HttpHandler } from 'src/core/public'; export const itShowsServerErrorAsFlashMessage = (httpMethod: HttpHandler, callback: () => void) => { diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/api_keys/api_keys_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/api_keys/api_keys_logic.test.ts index a02b1578bd38a..2013539b45b27 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/api_keys/api_keys_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/api_keys/api_keys_logic.test.ts @@ -11,7 +11,7 @@ import { mockHttpValues, } from '../../../__mocks__/kea_logic'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { DEFAULT_META } from '../../../shared/constants'; import { itShowsServerErrorAsFlashMessage } from '../../../test_helpers'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/add_source_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/add_source_logic.test.ts index da4e9cad9e276..371f01cdad212 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/add_source_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/add_source_logic.test.ts @@ -13,7 +13,7 @@ import { } from '../../../../../__mocks__/kea_logic'; import { sourceConfigData } from '../../../../__mocks__/content_sources.mock'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { itShowsServerErrorAsFlashMessage } from '../../../../../test_helpers'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/display_settings_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/display_settings_logic.test.ts index 81a97c2d19e16..336f892bad51b 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/display_settings_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/display_settings_logic.test.ts @@ -13,7 +13,7 @@ import { } from '../../../../../__mocks__/kea_logic'; import { exampleResult } from '../../../../__mocks__/content_sources.mock'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { itShowsServerErrorAsFlashMessage } from '../../../../../test_helpers'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/schema/schema_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/schema/schema_logic.test.ts index 748e5068833cf..e266fb310faa7 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/schema/schema_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/schema/schema_logic.test.ts @@ -12,7 +12,7 @@ import { } from '../../../../../__mocks__/kea_logic'; import { mostRecentIndexJob } from '../../../../__mocks__/content_sources.mock'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; const contentSource = { id: 'source123' }; jest.mock('../../source_logic', () => ({ diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/synchronization/synchronization_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/synchronization/synchronization_logic.test.ts index 0ccfd6aa63ae4..20a6ba238a2f4 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/synchronization/synchronization_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/synchronization/synchronization_logic.test.ts @@ -13,7 +13,7 @@ import { } from '../../../../../__mocks__/kea_logic'; import { fullContentSources } from '../../../../__mocks__/content_sources.mock'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { itShowsServerErrorAsFlashMessage } from '../../../../../test_helpers'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/group_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/group_logic.test.ts index df61e23fa3cdc..85b324f0a31bc 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/group_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/group_logic.test.ts @@ -14,7 +14,7 @@ import { import { groups } from '../../__mocks__/groups.mock'; import { mockGroupValues } from './__mocks__/group_logic.mock'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { itShowsServerErrorAsFlashMessage } from '../../../test_helpers'; import { GROUPS_PATH } from '../../routes'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups_logic.test.ts index 15951a9f8b9ca..14300f98ddf29 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups_logic.test.ts @@ -15,7 +15,7 @@ import { groups } from '../../__mocks__/groups.mock'; import { users } from '../../__mocks__/users.mock'; import { mockGroupsValues } from './__mocks__/groups_logic.mock'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { JSON_HEADER as headers } from '../../../../../common/constants'; import { DEFAULT_META } from '../../../shared/constants'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/oauth_authorize/oauth_authorize_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/oauth_authorize/oauth_authorize_logic.test.ts index 747feb9bc5880..6e90d5de3db8a 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/oauth_authorize/oauth_authorize_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/oauth_authorize/oauth_authorize_logic.test.ts @@ -11,7 +11,7 @@ import { mockHttpValues, } from '../../../__mocks__/kea_logic'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { OAuthAuthorizeLogic, transformServerPreAuth } from './oauth_authorize_logic'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/role_mappings/role_mappings_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/role_mappings/role_mappings_logic.test.ts index 9379c81afe199..b3246171ee5a7 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/role_mappings/role_mappings_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/role_mappings/role_mappings_logic.test.ts @@ -13,7 +13,7 @@ import { import { groups } from '../../__mocks__/groups.mock'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { elasticsearchUsers } from '../../../shared/role_mapping/__mocks__/elasticsearch_users'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/search_authorize/search_authorize_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/search_authorize/search_authorize_logic.test.ts index bc8e1942e7a1f..1aaa9ec622078 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/search_authorize/search_authorize_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/search_authorize/search_authorize_logic.test.ts @@ -11,7 +11,7 @@ import { mockHttpValues, } from '../../../__mocks__/kea_logic'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { SearchAuthorizeLogic } from './search_authorize_logic'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/security/security_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/security/security_logic.test.ts index df9035d57e56b..5469376f1ca33 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/security/security_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/security/security_logic.test.ts @@ -7,7 +7,7 @@ import { LogicMounter, mockHttpValues } from '../../../__mocks__/kea_logic'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { itShowsServerErrorAsFlashMessage } from '../../../test_helpers'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/components/branding_section.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/components/branding_section.test.tsx index 876891161b28b..b8f4c55bc7bab 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/components/branding_section.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/components/branding_section.test.tsx @@ -10,7 +10,7 @@ import React from 'react'; import { shallow, mount } from 'enzyme'; import { EuiFilePicker, EuiConfirmModal } from '@elastic/eui'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; jest.mock('../../../utils', () => ({ readUploadedFileAsBase64: jest.fn(({ img }) => img), diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/settings_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/settings_logic.test.ts index d98c9efe04d8c..f226434b8b8c0 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/settings_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/settings_logic.test.ts @@ -13,7 +13,7 @@ import { } from '../../../__mocks__/kea_logic'; import { configuredSources, oauthApplication } from '../../__mocks__/content_sources.mock'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { itShowsServerErrorAsFlashMessage } from '../../../test_helpers'; import { ORG_UPDATED_MESSAGE, OAUTH_APP_UPDATED_MESSAGE } from '../../constants'; diff --git a/x-pack/plugins/fleet/public/components/agent_enrollment_flyout/agent_enrollment_flyout.test.tsx b/x-pack/plugins/fleet/public/components/agent_enrollment_flyout/agent_enrollment_flyout.test.tsx index 0e6138aea7cb4..617bd95e18a6d 100644 --- a/x-pack/plugins/fleet/public/components/agent_enrollment_flyout/agent_enrollment_flyout.test.tsx +++ b/x-pack/plugins/fleet/public/components/agent_enrollment_flyout/agent_enrollment_flyout.test.tsx @@ -8,7 +8,7 @@ import './agent_enrollment_flyout.test.mocks'; import React from 'react'; -import { registerTestBed } from '@kbn/test/jest'; +import { registerTestBed } from '@kbn/test-jest-helpers'; import { act } from '@testing-library/react'; import { coreMock } from 'src/core/public/mocks'; diff --git a/x-pack/plugins/global_search/public/services/utils.test.ts b/x-pack/plugins/global_search/public/services/utils.test.ts index 8f22ee8082e81..99d55bf608ebf 100644 --- a/x-pack/plugins/global_search/public/services/utils.test.ts +++ b/x-pack/plugins/global_search/public/services/utils.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { StubBrowserStorage } from '@kbn/test/jest'; +import { StubBrowserStorage } from '@kbn/test-jest-helpers'; import { getDefaultPreference } from './utils'; describe('getDefaultPreference', () => { diff --git a/x-pack/plugins/graph/public/components/search_bar.test.tsx b/x-pack/plugins/graph/public/components/search_bar.test.tsx index 7d39e8027e92b..58a2996fd1e67 100644 --- a/x-pack/plugins/graph/public/components/search_bar.test.tsx +++ b/x-pack/plugins/graph/public/components/search_bar.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { SearchBar, SearchBarProps } from './search_bar'; import React, { Component, ReactElement } from 'react'; import { CoreStart } from 'src/core/public'; diff --git a/x-pack/plugins/graph/public/components/settings/settings.test.tsx b/x-pack/plugins/graph/public/components/settings/settings.test.tsx index 1c3fbb9f54f67..96d5a2a5b2bac 100644 --- a/x-pack/plugins/graph/public/components/settings/settings.test.tsx +++ b/x-pack/plugins/graph/public/components/settings/settings.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { EuiTab, EuiListGroupItem, EuiButton, EuiAccordion, EuiFieldText } from '@elastic/eui'; import * as Rx from 'rxjs'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { Settings, SettingsWorkspaceProps } from './settings'; import { act } from '@testing-library/react'; import { ReactWrapper } from 'enzyme'; diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/app/app.helpers.tsx b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/app/app.helpers.tsx index 8d55a3e093a31..153f1c09c53a9 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/app/app.helpers.tsx +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/app/app.helpers.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { act } from 'react-dom/test-utils'; -import { registerTestBed, TestBed, TestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, TestBed, TestBedConfig } from '@kbn/test-jest-helpers'; import { docLinksServiceMock } from 'src/core/public/mocks'; import { KibanaContextProvider } from '../../../../../../src/plugins/kibana_react/public'; import { createBreadcrumbsMock } from '../../../public/application/services/breadcrumbs.mock'; diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/edit_warning.test.ts b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/edit_warning.test.ts index 521d5d4da8cef..83b3a9fc53398 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/edit_warning.test.ts +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/edit_warning.test.ts @@ -6,7 +6,7 @@ */ import { act } from 'react-dom/test-utils'; -import { TestBed } from '@kbn/test/jest'; +import { TestBed } from '@kbn/test-jest-helpers'; import { setupEnvironment } from '../../helpers'; import { initTestBed } from '../init_test_bed'; import { getDefaultHotPhasePolicy, POLICY_NAME } from '../constants'; diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/frozen_phase.test.ts b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/frozen_phase.test.ts index aaa2b3dafddde..57a70237be6e1 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/frozen_phase.test.ts +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/frozen_phase.test.ts @@ -6,7 +6,7 @@ */ import { act } from 'react-dom/test-utils'; -import { TestBed } from '@kbn/test/jest'; +import { TestBed } from '@kbn/test-jest-helpers'; import { licensingMock } from '../../../../../licensing/public/mocks'; import { setupEnvironment } from '../../helpers'; diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/node_allocation/cloud_aware_behavior.helpers.ts b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/node_allocation/cloud_aware_behavior.helpers.ts index 9741ee87bda10..a0a1c80c90bbe 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/node_allocation/cloud_aware_behavior.helpers.ts +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/node_allocation/cloud_aware_behavior.helpers.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { TestBedConfig } from '@kbn/test/jest'; +import { TestBedConfig } from '@kbn/test-jest-helpers'; import { AppServicesContext } from '../../../../../public/types'; import { createTogglePhaseAction, createNodeAllocationActions } from '../../../helpers'; diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/form_validation/validation.helpers.ts b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/form_validation/validation.helpers.ts index 84ee96cd46987..5b5d3819c3463 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/form_validation/validation.helpers.ts +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/form_validation/validation.helpers.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { TestBedConfig } from '@kbn/test/jest'; +import { TestBedConfig } from '@kbn/test-jest-helpers'; import { createColdPhaseActions, createDeletePhaseActions, diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/init_test_bed.tsx b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/init_test_bed.tsx index 251ff234c230e..64d5cd65cda68 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/init_test_bed.tsx +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/init_test_bed.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { registerTestBed, TestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, TestBedConfig } from '@kbn/test-jest-helpers'; import { docLinksServiceMock } from 'src/core/public/mocks'; import '../helpers/global_mocks'; diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/errors_actions.ts b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/errors_actions.ts index 34d07d4a36ff9..4b863071e191c 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/errors_actions.ts +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/errors_actions.ts @@ -6,7 +6,7 @@ */ import { act } from 'react-dom/test-utils'; -import { TestBed } from '@kbn/test/jest'; +import { TestBed } from '@kbn/test-jest-helpers'; import { Phase } from '../../../../common/types'; const createWaitForValidationAction = (testBed: TestBed) => () => { diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/forcemerge_actions.ts b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/forcemerge_actions.ts index f2a27aba9ec56..b6ed40de36ca9 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/forcemerge_actions.ts +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/forcemerge_actions.ts @@ -6,7 +6,7 @@ */ import { act } from 'react-dom/test-utils'; -import { TestBed } from '@kbn/test/jest'; +import { TestBed } from '@kbn/test-jest-helpers'; import { Phase } from '../../../../common/types'; import { createFormToggleAction } from './form_toggle_action'; import { createFormSetValueAction } from './form_set_value_action'; diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/form_set_value_action.ts b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/form_set_value_action.ts index 95e90ac04192b..57a41831406f9 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/form_set_value_action.ts +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/form_set_value_action.ts @@ -6,7 +6,7 @@ */ import { act } from 'react-dom/test-utils'; -import { TestBed } from '@kbn/test/jest'; +import { TestBed } from '@kbn/test-jest-helpers'; export function createFormSetValueAction( testBed: TestBed, diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/form_toggle_action.ts b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/form_toggle_action.ts index 6bf47f5d513f6..b2408583cc3aa 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/form_toggle_action.ts +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/form_toggle_action.ts @@ -6,7 +6,7 @@ */ import { act } from 'react-dom/test-utils'; -import { TestBed } from '@kbn/test/jest'; +import { TestBed } from '@kbn/test-jest-helpers'; export const createFormToggleAction = (testBed: TestBed, dataTestSubject: string) => async () => { const { form, component } = testBed; diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/form_toggle_and_set_value_action.ts b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/form_toggle_and_set_value_action.ts index b3510466b4b90..a5c436b13ee0f 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/form_toggle_and_set_value_action.ts +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/form_toggle_and_set_value_action.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { TestBed } from '@kbn/test/jest'; +import { TestBed } from '@kbn/test-jest-helpers'; import { createFormToggleAction } from './form_toggle_action'; import { createFormSetValueAction } from './form_set_value_action'; diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/index_priority_actions.ts b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/index_priority_actions.ts index eeab42c408244..79fb77e53cc59 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/index_priority_actions.ts +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/index_priority_actions.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { TestBed } from '@kbn/test/jest'; +import { TestBed } from '@kbn/test-jest-helpers'; import { Phase } from '../../../../common/types'; import { createFormToggleAction } from './form_toggle_action'; import { createFormToggleAndSetValueAction } from './form_toggle_and_set_value_action'; diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/min_age_actions.ts b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/min_age_actions.ts index 551474c8b16e6..ef00fdc8d7757 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/min_age_actions.ts +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/min_age_actions.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { TestBed } from '@kbn/test/jest'; +import { TestBed } from '@kbn/test-jest-helpers'; import { Phase } from '../../../../common/types'; import { createFormSetValueAction } from './form_set_value_action'; diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/node_allocation_actions.ts b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/node_allocation_actions.ts index 7c0f8fea7299d..2a680590654a8 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/node_allocation_actions.ts +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/node_allocation_actions.ts @@ -6,7 +6,7 @@ */ import { act } from 'react-dom/test-utils'; -import { TestBed } from '@kbn/test/jest'; +import { TestBed } from '@kbn/test-jest-helpers'; import { DataTierAllocationType } from '../../../../public/application/sections/edit_policy/types'; import { Phase } from '../../../../common/types'; diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/phases.ts b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/phases.ts index 7f07480cc248d..4bc223943c6c7 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/phases.ts +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/phases.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { TestBed } from '@kbn/test/jest'; +import { TestBed } from '@kbn/test-jest-helpers'; import { createForceMergeActions, createShrinkActions, diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/readonly_actions.ts b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/readonly_actions.ts index b76143eccf1f2..1a7ec56815b00 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/readonly_actions.ts +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/readonly_actions.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { TestBed } from '@kbn/test/jest'; +import { TestBed } from '@kbn/test-jest-helpers'; import { Phase } from '../../../../common/types'; import { createFormToggleAction } from './form_toggle_action'; diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/replicas_action.ts b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/replicas_action.ts index f987ce6d0ca2f..43eca26a4e1ce 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/replicas_action.ts +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/replicas_action.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { TestBed } from '@kbn/test/jest'; +import { TestBed } from '@kbn/test-jest-helpers'; import { Phase } from '../../../../common/types'; import { createFormToggleAndSetValueAction } from './form_toggle_and_set_value_action'; diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/request_flyout_actions.ts b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/request_flyout_actions.ts index 87e66ea71e0e4..ca79d52741595 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/request_flyout_actions.ts +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/request_flyout_actions.ts @@ -6,7 +6,7 @@ */ import { act } from 'react-dom/test-utils'; -import { TestBed } from '@kbn/test/jest'; +import { TestBed } from '@kbn/test-jest-helpers'; const jsonSelector = 'policyRequestJson'; diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/rollover_actions.ts b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/rollover_actions.ts index 93a1b959ec969..683ba31843829 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/rollover_actions.ts +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/rollover_actions.ts @@ -6,7 +6,7 @@ */ import { act } from 'react-dom/test-utils'; -import { TestBed } from '@kbn/test/jest'; +import { TestBed } from '@kbn/test-jest-helpers'; import { createFormToggleAction } from './form_toggle_action'; import { createFormSetValueAction } from './form_set_value_action'; diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/save_policy_action.ts b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/save_policy_action.ts index 3fcd1205b6e1a..9c27e38d75e0d 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/save_policy_action.ts +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/save_policy_action.ts @@ -6,7 +6,7 @@ */ import { act } from 'react-dom/test-utils'; -import { TestBed } from '@kbn/test/jest'; +import { TestBed } from '@kbn/test-jest-helpers'; export const createSavePolicyAction = (testBed: TestBed) => async () => { const { find, component } = testBed; diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/searchable_snapshot_actions.ts b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/searchable_snapshot_actions.ts index f1a64c3943511..3efffcddbece6 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/searchable_snapshot_actions.ts +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/searchable_snapshot_actions.ts @@ -6,7 +6,7 @@ */ import { act } from 'react-dom/test-utils'; -import { TestBed } from '@kbn/test/jest'; +import { TestBed } from '@kbn/test-jest-helpers'; import { Phase } from '../../../../common/types'; import { createFormToggleAction } from './form_toggle_action'; diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/shrink_actions.ts b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/shrink_actions.ts index 394a64696d5eb..def20f73b82fe 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/shrink_actions.ts +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/shrink_actions.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { TestBed } from '@kbn/test/jest'; +import { TestBed } from '@kbn/test-jest-helpers'; import { act } from 'react-dom/test-utils'; import { Phase } from '../../../../common/types'; import { createFormSetValueAction } from './form_set_value_action'; diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/snapshot_policy_actions.ts b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/snapshot_policy_actions.ts index 37e0ef17d2254..8aaf968560a1d 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/snapshot_policy_actions.ts +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/snapshot_policy_actions.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { TestBed } from '@kbn/test/target_types/jest'; +import type { TestBed } from '@kbn/test-jest-helpers'; import { act } from 'react-dom/test-utils'; const createSetWaitForSnapshotAction = (testBed: TestBed) => async (snapshotPolicyName: string) => { diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/toggle_phase_action.ts b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/toggle_phase_action.ts index ce5b8b234e088..c22efae87d5ac 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/toggle_phase_action.ts +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/toggle_phase_action.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { TestBed } from '@kbn/test/jest'; +import { TestBed } from '@kbn/test-jest-helpers'; import { act } from 'react-dom/test-utils'; import { Phase } from '../../../../common/types'; diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/extend_index_management.test.tsx b/x-pack/plugins/index_lifecycle_management/__jest__/extend_index_management.test.tsx index a38c6e1af5c2a..240cc18fdc02d 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/extend_index_management.test.tsx +++ b/x-pack/plugins/index_lifecycle_management/__jest__/extend_index_management.test.tsx @@ -9,7 +9,7 @@ import moment from 'moment-timezone'; import axios from 'axios'; import axiosXhrAdapter from 'axios/lib/adapters/xhr'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { usageCollectionPluginMock } from '../../../../src/plugins/usage_collection/public/mocks'; import { Index } from '../common/types'; import { diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/policy_table.test.tsx b/x-pack/plugins/index_lifecycle_management/__jest__/policy_table.test.tsx index 1a45b2c6d93dc..3a1c2dd36812f 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/policy_table.test.tsx +++ b/x-pack/plugins/index_lifecycle_management/__jest__/policy_table.test.tsx @@ -8,7 +8,7 @@ import moment from 'moment-timezone'; import React, { ReactElement } from 'react'; import { ReactWrapper } from 'enzyme'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { findTestSubject, takeMountedSnapshot } from '@elastic/eui/lib/test'; import { diff --git a/x-pack/plugins/index_management/__jest__/client_integration/helpers/index.ts b/x-pack/plugins/index_management/__jest__/client_integration/helpers/index.ts index 79df6e8e9f20c..ba2dea966d8cb 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/helpers/index.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/helpers/index.ts @@ -7,8 +7,8 @@ import './mocks'; -export type { TestBed } from '@kbn/test/jest'; -export { nextTick, getRandomString, findTestSubject } from '@kbn/test/jest'; +export type { TestBed } from '@kbn/test-jest-helpers'; +export { nextTick, getRandomString, findTestSubject } from '@kbn/test-jest-helpers'; export { setupEnvironment, diff --git a/x-pack/plugins/index_management/__jest__/client_integration/home/data_streams_tab.helpers.ts b/x-pack/plugins/index_management/__jest__/client_integration/home/data_streams_tab.helpers.ts index e3184cadbdc49..e3295a8f4fb18 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/home/data_streams_tab.helpers.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/home/data_streams_tab.helpers.ts @@ -9,7 +9,12 @@ import { act } from 'react-dom/test-utils'; import { ReactWrapper } from 'enzyme'; import { EuiDescriptionListDescription } from '@elastic/eui'; -import { registerTestBed, TestBed, AsyncTestBedConfig, findTestSubject } from '@kbn/test/jest'; +import { + registerTestBed, + TestBed, + AsyncTestBedConfig, + findTestSubject, +} from '@kbn/test-jest-helpers'; import { DataStream } from '../../../common'; import { IndexManagementHome } from '../../../public/application/sections/home'; import { indexManagementStore } from '../../../public/application/store'; diff --git a/x-pack/plugins/index_management/__jest__/client_integration/home/home.helpers.ts b/x-pack/plugins/index_management/__jest__/client_integration/home/home.helpers.ts index ad8aceb7d56b8..46287fcdcf074 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/home/home.helpers.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/home/home.helpers.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test-jest-helpers'; import { IndexManagementHome } from '../../../public/application/sections/home'; import { indexManagementStore } from '../../../public/application/store'; import { WithAppDependencies, services, TestSubjects } from '../helpers'; diff --git a/x-pack/plugins/index_management/__jest__/client_integration/home/home.test.ts b/x-pack/plugins/index_management/__jest__/client_integration/home/home.test.ts index 426bb11f3c733..60d4b7d3f2317 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/home/home.test.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/home/home.test.ts @@ -16,7 +16,7 @@ import { HomeTestBed, setup } from './home.helpers'; Could not load worker ReferenceError: Worker is not defined at createWorker (//node_modules/brace/index.js:17992:5) */ -import { stubWebWorker } from '@kbn/test/jest'; +import { stubWebWorker } from '@kbn/test-jest-helpers'; stubWebWorker(); describe('', () => { diff --git a/x-pack/plugins/index_management/__jest__/client_integration/home/index_templates_tab.helpers.ts b/x-pack/plugins/index_management/__jest__/client_integration/home/index_templates_tab.helpers.ts index 4ddd14562577a..69dcabc287d6b 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/home/index_templates_tab.helpers.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/home/index_templates_tab.helpers.ts @@ -7,7 +7,12 @@ import { act } from 'react-dom/test-utils'; -import { registerTestBed, TestBed, AsyncTestBedConfig, findTestSubject } from '@kbn/test/jest'; +import { + registerTestBed, + TestBed, + AsyncTestBedConfig, + findTestSubject, +} from '@kbn/test-jest-helpers'; import { TemplateList } from '../../../public/application/sections/home/template_list'; import { TemplateDeserialized } from '../../../common'; import { WithAppDependencies, TestSubjects } from '../helpers'; diff --git a/x-pack/plugins/index_management/__jest__/client_integration/home/indices_tab.helpers.ts b/x-pack/plugins/index_management/__jest__/client_integration/home/indices_tab.helpers.ts index 018025b25246b..719758e18525a 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/home/indices_tab.helpers.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/home/indices_tab.helpers.ts @@ -8,7 +8,12 @@ import { act } from 'react-dom/test-utils'; import { ReactWrapper } from 'enzyme'; -import { registerTestBed, TestBed, AsyncTestBedConfig, findTestSubject } from '@kbn/test/jest'; +import { + registerTestBed, + TestBed, + AsyncTestBedConfig, + findTestSubject, +} from '@kbn/test-jest-helpers'; import { IndexManagementHome } from '../../../public/application/sections/home'; import { indexManagementStore } from '../../../public/application/store'; import { WithAppDependencies, services, TestSubjects } from '../helpers'; diff --git a/x-pack/plugins/index_management/__jest__/client_integration/home/indices_tab.test.ts b/x-pack/plugins/index_management/__jest__/client_integration/home/indices_tab.test.ts index 9e3f323ca45ea..6387a0904a69c 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/home/indices_tab.test.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/home/indices_tab.test.ts @@ -43,7 +43,7 @@ jest.mock('../../../public/application/lib/ace.js', () => { Could not load worker ReferenceError: Worker is not defined at createWorker (//node_modules/brace/index.js:17992:5) */ -import { stubWebWorker } from '@kbn/test/jest'; +import { stubWebWorker } from '@kbn/test-jest-helpers'; import { createMemoryHistory } from 'history'; stubWebWorker(); diff --git a/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_clone.helpers.ts b/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_clone.helpers.ts index dffa6fee19d06..9aec6cae7a17e 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_clone.helpers.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_clone.helpers.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed, AsyncTestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, AsyncTestBedConfig } from '@kbn/test-jest-helpers'; import { TemplateClone } from '../../../public/application/sections/template_clone'; import { WithAppDependencies } from '../helpers'; diff --git a/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_create.helpers.ts b/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_create.helpers.ts index 450d2c524b445..b039fa83000ed 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_create.helpers.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_create.helpers.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed, AsyncTestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, AsyncTestBedConfig } from '@kbn/test-jest-helpers'; import { TemplateCreate } from '../../../public/application/sections/template_create'; import { WithAppDependencies } from '../helpers'; diff --git a/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_edit.helpers.ts b/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_edit.helpers.ts index 6c73da3b3379d..a7f87d828eb23 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_edit.helpers.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_edit.helpers.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed, AsyncTestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, AsyncTestBedConfig } from '@kbn/test-jest-helpers'; import { TemplateEdit } from '../../../public/application/sections/template_edit'; import { WithAppDependencies } from '../helpers'; diff --git a/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_form.helpers.ts b/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_form.helpers.ts index d14855354f0ad..57d0b282d351d 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_form.helpers.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_form.helpers.ts @@ -7,7 +7,7 @@ import { act } from 'react-dom/test-utils'; -import { TestBed, SetupFunc } from '@kbn/test/jest'; +import { TestBed, SetupFunc } from '@kbn/test-jest-helpers'; import { TemplateDeserialized } from '../../../common'; interface MappingField { diff --git a/x-pack/plugins/index_management/__jest__/components/index_table.test.js b/x-pack/plugins/index_management/__jest__/components/index_table.test.js index 5e5538fcca4e8..f98c891e5f4f5 100644 --- a/x-pack/plugins/index_management/__jest__/components/index_table.test.js +++ b/x-pack/plugins/index_management/__jest__/components/index_table.test.js @@ -19,7 +19,7 @@ import axiosXhrAdapter from 'axios/lib/adapters/xhr'; Could not load worker ReferenceError: Worker is not defined at createWorker (//node_modules/brace/index.js:17992:5) */ -import { mountWithIntl, stubWebWorker } from '@kbn/test/jest'; // eslint-disable-line no-unused-vars +import { mountWithIntl, stubWebWorker } from '@kbn/test-jest-helpers'; // eslint-disable-line no-unused-vars import { BASE_PATH, API_BASE_PATH } from '../../common/constants'; import { AppWithoutRouter } from '../../public/application/app'; diff --git a/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_create.helpers.ts b/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_create.helpers.ts index 06f0036cc5c77..18b5bbfd775bb 100644 --- a/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_create.helpers.ts +++ b/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_create.helpers.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test-jest-helpers'; import { BASE_PATH } from '../../../../../../../common'; import { ComponentTemplateCreate } from '../../../component_template_wizard'; diff --git a/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_details.helpers.ts b/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_details.helpers.ts index 49bef82ce3d11..cdf376028ff1d 100644 --- a/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_details.helpers.ts +++ b/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_details.helpers.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed, TestBed } from '@kbn/test/jest'; +import { registerTestBed, TestBed } from '@kbn/test-jest-helpers'; import { WithAppDependencies } from './setup_environment'; import { ComponentTemplateDetailsFlyoutContent } from '../../../component_template_details'; diff --git a/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_edit.helpers.ts b/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_edit.helpers.ts index e7b8df245aaa9..6e0f9d55ef7f0 100644 --- a/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_edit.helpers.ts +++ b/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_edit.helpers.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test-jest-helpers'; import { BASE_PATH } from '../../../../../../../common'; import { ComponentTemplateEdit } from '../../../component_template_wizard'; diff --git a/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_form.helpers.ts b/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_form.helpers.ts index 578a124125107..ce97ac9d4e222 100644 --- a/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_form.helpers.ts +++ b/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_form.helpers.ts @@ -7,7 +7,7 @@ import { act } from 'react-dom/test-utils'; -import { TestBed } from '@kbn/test/jest'; +import { TestBed } from '@kbn/test-jest-helpers'; interface MappingField { name: string; diff --git a/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_list.helpers.ts b/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_list.helpers.ts index 680550d16096b..2a01518e25466 100644 --- a/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_list.helpers.ts +++ b/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_list.helpers.ts @@ -13,7 +13,7 @@ import { AsyncTestBedConfig, findTestSubject, nextTick, -} from '@kbn/test/jest'; +} from '@kbn/test-jest-helpers'; import { BASE_PATH } from '../../../../../../../common'; import { WithAppDependencies } from './setup_environment'; import { ComponentTemplateList } from '../../../component_template_list/component_template_list'; diff --git a/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/index.ts b/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/index.ts index 5185878ee98bc..72c3b8af534a5 100644 --- a/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/index.ts +++ b/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/index.ts @@ -8,7 +8,7 @@ import { setup as componentTemplatesListSetup } from './component_template_list.helpers'; import { setup as componentTemplateDetailsSetup } from './component_template_details.helpers'; -export { nextTick, getRandomString, findTestSubject } from '@kbn/test/jest'; +export { nextTick, getRandomString, findTestSubject } from '@kbn/test-jest-helpers'; export { setupEnvironment, componentTemplatesDependencies } from './setup_environment'; diff --git a/x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/helpers/index.ts b/x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/helpers/index.ts index d436492756659..5244cdb65bb0f 100644 --- a/x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/helpers/index.ts +++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/helpers/index.ts @@ -12,8 +12,8 @@ import { getMappingsEditorDataFactory, } from './mappings_editor.helpers'; -export type { TestBed } from '@kbn/test/jest'; -export { nextTick, getRandomString, findTestSubject } from '@kbn/test/jest'; +export type { TestBed } from '@kbn/test-jest-helpers'; +export { nextTick, getRandomString, findTestSubject } from '@kbn/test-jest-helpers'; export { kibanaVersion } from './setup_environment'; export const componentHelpers = { diff --git a/x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/helpers/mappings_editor.helpers.tsx b/x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/helpers/mappings_editor.helpers.tsx index 074d96e9be4c1..1e3cfd99cedb4 100644 --- a/x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/helpers/mappings_editor.helpers.tsx +++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/helpers/mappings_editor.helpers.tsx @@ -7,7 +7,7 @@ import { act } from 'react-dom/test-utils'; import { ReactWrapper } from 'enzyme'; -import { registerTestBed, TestBed, findTestSubject } from '@kbn/test/jest'; +import { registerTestBed, TestBed, findTestSubject } from '@kbn/test-jest-helpers'; // This import needs to come first as it sets the jest.mock calls import { WithAppDependencies } from './setup_environment'; diff --git a/x-pack/plugins/index_management/public/application/components/mappings_editor/components/load_mappings/load_mappings_provider.test.tsx b/x-pack/plugins/index_management/public/application/components/mappings_editor/components/load_mappings/load_mappings_provider.test.tsx index 8259c78b8e140..c2502f14facfb 100644 --- a/x-pack/plugins/index_management/public/application/components/mappings_editor/components/load_mappings/load_mappings_provider.test.tsx +++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/components/load_mappings/load_mappings_provider.test.tsx @@ -18,7 +18,7 @@ jest.mock('lodash', () => { }; }); -import { registerTestBed, TestBed } from '@kbn/test/jest'; +import { registerTestBed, TestBed } from '@kbn/test-jest-helpers'; import { LoadMappingsProvider } from './load_mappings_provider'; const ComponentToTest = ({ onJson }: { onJson: () => void }) => ( diff --git a/x-pack/plugins/index_management/test/fixtures/template.ts b/x-pack/plugins/index_management/test/fixtures/template.ts index dd279cf4bcaec..ae9be96015735 100644 --- a/x-pack/plugins/index_management/test/fixtures/template.ts +++ b/x-pack/plugins/index_management/test/fixtures/template.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { getRandomString, getRandomNumber } from '@kbn/test/jest'; +import { getRandomString, getRandomNumber } from '@kbn/test-jest-helpers'; import { TemplateDeserialized, TemplateType, TemplateListItem } from '../../common'; const objHasProperties = (obj?: Record): boolean => { diff --git a/x-pack/plugins/infra/public/alerting/inventory/components/expression.test.tsx b/x-pack/plugins/infra/public/alerting/inventory/components/expression.test.tsx index c8cd2da45c5c3..d34f6b369b2df 100644 --- a/x-pack/plugins/infra/public/alerting/inventory/components/expression.test.tsx +++ b/x-pack/plugins/infra/public/alerting/inventory/components/expression.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { mountWithIntl, nextTick, shallowWithIntl } from '@kbn/test/jest'; +import { mountWithIntl, nextTick, shallowWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { act } from 'react-dom/test-utils'; // We are using this inside a `jest.mock` call. Jest requires dynamic dependencies to be prefixed with `mock` diff --git a/x-pack/plugins/infra/public/alerting/metric_anomaly/components/expression.test.tsx b/x-pack/plugins/infra/public/alerting/metric_anomaly/components/expression.test.tsx index 3bbc3cb2662cb..e40c72171f72b 100644 --- a/x-pack/plugins/infra/public/alerting/metric_anomaly/components/expression.test.tsx +++ b/x-pack/plugins/infra/public/alerting/metric_anomaly/components/expression.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { mountWithIntl, nextTick } from '@kbn/test/jest'; +import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; // We are using this inside a `jest.mock` call. Jest requires dynamic dependencies to be prefixed with `mock` import { coreMock as mockCoreMock } from 'src/core/public/mocks'; import React from 'react'; diff --git a/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression.test.tsx b/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression.test.tsx index 94192f9f911c5..309808bf48352 100644 --- a/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression.test.tsx +++ b/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { mountWithIntl, nextTick } from '@kbn/test/jest'; +import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; import React from 'react'; import { act } from 'react-dom/test-utils'; // We are using this inside a `jest.mock` call. Jest requires dynamic dependencies to be prefixed with `mock` diff --git a/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression_chart.test.tsx b/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression_chart.test.tsx index f7e3201bbf2c9..e5c6e1a4d8984 100644 --- a/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression_chart.test.tsx +++ b/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression_chart.test.tsx @@ -6,7 +6,7 @@ */ import { DataViewBase } from '@kbn/es-query'; -import { mountWithIntl, nextTick } from '@kbn/test/jest'; +import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; import React from 'react'; import { act } from 'react-dom/test-utils'; // We are using this inside a `jest.mock` call. Jest requires dynamic dependencies to be prefixed with `mock` diff --git a/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression_row.test.tsx b/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression_row.test.tsx index 1d8c6f6339878..6a0de2481e64a 100644 --- a/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression_row.test.tsx +++ b/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression_row.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { mountWithIntl, nextTick } from '@kbn/test/jest'; +import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; import React from 'react'; import { act } from 'react-dom/test-utils'; import { Comparator } from '../../../../common/alerting/metrics'; diff --git a/x-pack/plugins/infra/public/containers/logs/log_view_configuration.test.tsx b/x-pack/plugins/infra/public/containers/logs/log_view_configuration.test.tsx index f30878dd2ff3d..1fe14d9b2965b 100644 --- a/x-pack/plugins/infra/public/containers/logs/log_view_configuration.test.tsx +++ b/x-pack/plugins/infra/public/containers/logs/log_view_configuration.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { mountHook } from '@kbn/test/jest'; +import { mountHook } from '@kbn/test-jest-helpers'; import { useLogViewConfiguration } from './log_view_configuration'; diff --git a/x-pack/plugins/infra/public/pages/metrics/metric_detail/hooks/metrics_time.test.tsx b/x-pack/plugins/infra/public/pages/metrics/metric_detail/hooks/metrics_time.test.tsx index c16314a6c0e71..5260cd4d680f6 100644 --- a/x-pack/plugins/infra/public/pages/metrics/metric_detail/hooks/metrics_time.test.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/metric_detail/hooks/metrics_time.test.tsx @@ -8,7 +8,7 @@ import { createMemoryHistory } from 'history'; import React from 'react'; import { Router } from 'react-router-dom'; -import { mountHook } from '@kbn/test/jest'; +import { mountHook } from '@kbn/test-jest-helpers'; import { ScopedHistory } from '../../../../../../../../src/core/public'; import { useMetricsTime } from './use_metrics_time'; diff --git a/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/index.ts b/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/index.ts index ed88156b740bf..5f4dc01fa924a 100644 --- a/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/index.ts +++ b/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/index.ts @@ -11,7 +11,7 @@ import { setup as pipelinesCloneSetup } from './pipelines_clone.helpers'; import { setup as pipelinesEditSetup } from './pipelines_edit.helpers'; import { setup as pipelinesCreateFromCsvSetup } from './pipelines_create_from_csv.helpers'; -export { nextTick, getRandomString, findTestSubject } from '@kbn/test/jest'; +export { nextTick, getRandomString, findTestSubject } from '@kbn/test-jest-helpers'; export { setupEnvironment } from './setup_environment'; diff --git a/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipeline_form.helpers.ts b/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipeline_form.helpers.ts index 3f11f9538ffa9..432b9046f1071 100644 --- a/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipeline_form.helpers.ts +++ b/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipeline_form.helpers.ts @@ -7,7 +7,7 @@ import { act } from 'react-dom/test-utils'; -import { TestBed } from '@kbn/test/jest'; +import { TestBed } from '@kbn/test-jest-helpers'; export const getFormActions = (testBed: TestBed) => { const { find, form, component } = testBed; diff --git a/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_clone.helpers.ts b/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_clone.helpers.ts index 51f6d9bd96bd6..5b5d6704e9001 100644 --- a/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_clone.helpers.ts +++ b/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_clone.helpers.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed, AsyncTestBedConfig, TestBed } from '@kbn/test/jest'; +import { registerTestBed, AsyncTestBedConfig, TestBed } from '@kbn/test-jest-helpers'; import { PipelinesClone } from '../../../public/application/sections/pipelines_clone'; import { getFormActions, PipelineFormTestSubjects } from './pipeline_form.helpers'; import { WithAppDependencies } from './setup_environment'; diff --git a/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_create.helpers.ts b/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_create.helpers.ts index faf1b42042ec1..3dc97cf121b98 100644 --- a/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_create.helpers.ts +++ b/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_create.helpers.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed, AsyncTestBedConfig, TestBed } from '@kbn/test/jest'; +import { registerTestBed, AsyncTestBedConfig, TestBed } from '@kbn/test-jest-helpers'; import { PipelinesCreate } from '../../../public/application/sections/pipelines_create'; import { getFormActions, PipelineFormTestSubjects } from './pipeline_form.helpers'; import { WithAppDependencies } from './setup_environment'; diff --git a/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_create_from_csv.helpers.ts b/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_create_from_csv.helpers.ts index e7de57de0e948..ea9d623e216b2 100644 --- a/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_create_from_csv.helpers.ts +++ b/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_create_from_csv.helpers.ts @@ -7,7 +7,7 @@ import { act } from 'react-dom/test-utils'; -import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test-jest-helpers'; import { PipelinesCreateFromCsv } from '../../../public/application/sections/pipelines_create_from_csv'; import { WithAppDependencies } from './setup_environment'; import { getCreateFromCsvPath, ROUTES } from '../../../public/application/services/navigation'; diff --git a/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_edit.helpers.ts b/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_edit.helpers.ts index 9a3c41196653f..74d124de885ff 100644 --- a/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_edit.helpers.ts +++ b/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_edit.helpers.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed, AsyncTestBedConfig, TestBed } from '@kbn/test/jest'; +import { registerTestBed, AsyncTestBedConfig, TestBed } from '@kbn/test-jest-helpers'; import { PipelinesEdit } from '../../../public/application/sections/pipelines_edit'; import { getFormActions, PipelineFormTestSubjects } from './pipeline_form.helpers'; import { WithAppDependencies } from './setup_environment'; diff --git a/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_list.helpers.ts b/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_list.helpers.ts index e2d9f1f8bf5f9..6fa3a7a9473fe 100644 --- a/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_list.helpers.ts +++ b/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_list.helpers.ts @@ -7,7 +7,12 @@ import { act } from 'react-dom/test-utils'; -import { registerTestBed, TestBed, AsyncTestBedConfig, findTestSubject } from '@kbn/test/jest'; +import { + registerTestBed, + TestBed, + AsyncTestBedConfig, + findTestSubject, +} from '@kbn/test-jest-helpers'; import { PipelinesList } from '../../../public/application/sections/pipelines_list'; import { WithAppDependencies } from './setup_environment'; import { getListPath, ROUTES } from '../../../public/application/services/navigation'; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/pipeline_processors_editor.helpers.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/pipeline_processors_editor.helpers.tsx index 79ffd28c9e788..dd269e34fa694 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/pipeline_processors_editor.helpers.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/pipeline_processors_editor.helpers.tsx @@ -8,7 +8,7 @@ import { act } from 'react-dom/test-utils'; import React from 'react'; -import { registerTestBed, TestBed } from '@kbn/test/jest'; +import { registerTestBed, TestBed } from '@kbn/test-jest-helpers'; import { Props } from '../'; import { ProcessorsEditorWithDeps } from './processors_editor'; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/processor.helpers.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/processor.helpers.tsx index 65d9b8f306058..274d41651fe91 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/processor.helpers.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/processor.helpers.tsx @@ -13,8 +13,8 @@ import axiosXhrAdapter from 'axios/lib/adapters/xhr'; /* eslint-disable @kbn/eslint/no-restricted-paths */ import { usageCollectionPluginMock } from 'src/plugins/usage_collection/public/mocks'; -import { registerTestBed, TestBed } from '@kbn/test/jest'; -import { stubWebWorker } from '@kbn/test/jest'; +import { registerTestBed, TestBed } from '@kbn/test-jest-helpers'; +import { stubWebWorker } from '@kbn/test-jest-helpers'; import { uiMetricService, apiService } from '../../../../services'; import { Props } from '../../'; import { initHttpRequests } from '../http_requests.helpers'; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/test_pipeline.helpers.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/test_pipeline.helpers.tsx index 263a40a605d2d..ff8802a91cc9b 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/test_pipeline.helpers.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/test_pipeline.helpers.tsx @@ -13,8 +13,8 @@ import axiosXhrAdapter from 'axios/lib/adapters/xhr'; /* eslint-disable-next-line @kbn/eslint/no-restricted-paths */ import { usageCollectionPluginMock } from 'src/plugins/usage_collection/public/mocks'; -import { registerTestBed, TestBed } from '@kbn/test/jest'; -import { stubWebWorker } from '@kbn/test/jest'; +import { registerTestBed, TestBed } from '@kbn/test-jest-helpers'; +import { stubWebWorker } from '@kbn/test-jest-helpers'; /* eslint-disable-next-line @kbn/eslint/no-restricted-paths */ import '../../../../../../../../src/plugins/es_ui_shared/public/components/code_editor/jest_mock'; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/load_from_json/modal_provider.test.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/load_from_json/modal_provider.test.tsx index 74b759fc80375..9392fe2398e2f 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/load_from_json/modal_provider.test.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/load_from_json/modal_provider.test.tsx @@ -18,7 +18,7 @@ jest.mock('lodash', () => { }; }); -import { registerTestBed, TestBed } from '@kbn/test/jest'; +import { registerTestBed, TestBed } from '@kbn/test-jest-helpers'; const setup = ({ onDone }: { onDone: OnDoneLoadJsonHandler }) => { return registerTestBed( diff --git a/x-pack/plugins/lens/public/datatable_visualization/components/cell_value.test.tsx b/x-pack/plugins/lens/public/datatable_visualization/components/cell_value.test.tsx index 21f6cb6bc2052..7cd45dffd5def 100644 --- a/x-pack/plugins/lens/public/datatable_visualization/components/cell_value.test.tsx +++ b/x-pack/plugins/lens/public/datatable_visualization/components/cell_value.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { DataContext } from './table_basic'; import { createGridCell } from './cell_value'; diff --git a/x-pack/plugins/lens/public/datatable_visualization/components/dimension_editor.test.tsx b/x-pack/plugins/lens/public/datatable_visualization/components/dimension_editor.test.tsx index 22f5227baa556..d8dabd81441da 100644 --- a/x-pack/plugins/lens/public/datatable_visualization/components/dimension_editor.test.tsx +++ b/x-pack/plugins/lens/public/datatable_visualization/components/dimension_editor.test.tsx @@ -10,7 +10,7 @@ import { EuiButtonGroup, EuiComboBox, EuiFieldText } from '@elastic/eui'; import { FramePublicAPI, Operation, VisualizationDimensionEditorProps } from '../../types'; import { DatatableVisualizationState } from '../visualization'; import { createMockDatasource, createMockFramePublicAPI } from '../../mocks'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { TableDimensionEditor } from './dimension_editor'; import { chartPluginMock } from 'src/plugins/charts/public/mocks'; import { PaletteRegistry } from 'src/plugins/charts/public'; diff --git a/x-pack/plugins/lens/public/datatable_visualization/components/table_basic.test.tsx b/x-pack/plugins/lens/public/datatable_visualization/components/table_basic.test.tsx index c01419cc2a91e..8c75ee9efcc6b 100644 --- a/x-pack/plugins/lens/public/datatable_visualization/components/table_basic.test.tsx +++ b/x-pack/plugins/lens/public/datatable_visualization/components/table_basic.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { ReactWrapper, shallow, mount } from 'enzyme'; import { act } from 'react-dom/test-utils'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { EuiDataGrid } from '@elastic/eui'; import { IAggType } from 'src/plugins/data/public'; import { diff --git a/x-pack/plugins/lens/public/datatable_visualization/components/toolbar.test.tsx b/x-pack/plugins/lens/public/datatable_visualization/components/toolbar.test.tsx index 35e5c81cb72c4..6bc27808c7c0c 100644 --- a/x-pack/plugins/lens/public/datatable_visualization/components/toolbar.test.tsx +++ b/x-pack/plugins/lens/public/datatable_visualization/components/toolbar.test.tsx @@ -6,7 +6,7 @@ */ import React, { FormEvent } from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { DataTableToolbar } from './toolbar'; import { DatatableVisualizationState } from '../visualization'; import { FramePublicAPI, VisualizationToolbarProps } from '../../types'; diff --git a/x-pack/plugins/lens/public/debounced_component/debounced_component.test.tsx b/x-pack/plugins/lens/public/debounced_component/debounced_component.test.tsx index 6beb565be098c..d52eb3c578059 100644 --- a/x-pack/plugins/lens/public/debounced_component/debounced_component.test.tsx +++ b/x-pack/plugins/lens/public/debounced_component/debounced_component.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { mountWithIntl as mount } from '@kbn/test/jest'; +import { mountWithIntl as mount } from '@kbn/test-jest-helpers'; import { debouncedComponent } from './debounced_component'; import { act } from 'react-dom/test-utils'; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/datapanel.test.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/datapanel.test.tsx index 7fe115847b2b5..03dc83d030838 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/datapanel.test.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/datapanel.test.tsx @@ -17,7 +17,7 @@ import { NoFieldsCallout } from './no_fields_callout'; import { act } from 'react-dom/test-utils'; import { coreMock } from 'src/core/public/mocks'; import { IndexPatternPrivateState } from './types'; -import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; +import { mountWithIntl, shallowWithIntl } from '@kbn/test-jest-helpers'; import { ChangeIndexPattern } from './change_indexpattern'; import { EuiProgress, EuiLoadingSpinner } from '@elastic/eui'; import { documentField } from './document_field'; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.test.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.test.tsx index 975e08e5ca1a9..d8121e4b726be 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.test.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.test.tsx @@ -21,7 +21,7 @@ import { IndexPatternDimensionEditorComponent, IndexPatternDimensionEditorProps, } from './dimension_panel'; -import { mountWithIntl as mount, shallowWithIntl as shallow } from '@kbn/test/jest'; +import { mountWithIntl as mount, shallowWithIntl as shallow } from '@kbn/test-jest-helpers'; import { IUiSettingsClient, SavedObjectsClientContract, HttpSetup, CoreSetup } from 'kibana/public'; import { IStorageWrapper } from 'src/plugins/kibana_utils/public'; import { generateId } from '../../id_generator'; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/reference_editor.test.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/reference_editor.test.tsx index 4a16739e65972..5131a1224341e 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/reference_editor.test.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/reference_editor.test.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { ReactWrapper, ShallowWrapper } from 'enzyme'; import { act } from 'react-dom/test-utils'; import { EuiComboBox } from '@elastic/eui'; -import { mountWithIntl as mount } from '@kbn/test/jest'; +import { mountWithIntl as mount } from '@kbn/test-jest-helpers'; import type { IUiSettingsClient, SavedObjectsClientContract, HttpSetup } from 'kibana/public'; import { IStorageWrapper } from 'src/plugins/kibana_utils/public'; import type { DataPublicPluginStart } from 'src/plugins/data/public'; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/field_item.test.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/field_item.test.tsx index cb721416a1df9..c86fdcc33b15f 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/field_item.test.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/field_item.test.tsx @@ -11,7 +11,7 @@ import { act } from 'react-dom/test-utils'; import { EuiLoadingSpinner, EuiPopover } from '@elastic/eui'; import { InnerFieldItem, FieldItemProps } from './field_item'; import { coreMock } from 'src/core/public/mocks'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { fieldFormatsServiceMock } from '../../../../../src/plugins/field_formats/public/mocks'; import { IndexPattern } from './types'; import { chartPluginMock } from '../../../../../src/plugins/charts/public/mocks'; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/fields_accordion.test.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/fields_accordion.test.tsx index b3ade3ebc48b8..b886cc5539d40 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/fields_accordion.test.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/fields_accordion.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { EuiLoadingSpinner, EuiNotificationBadge } from '@elastic/eui'; import { coreMock } from 'src/core/public/mocks'; -import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; +import { mountWithIntl, shallowWithIntl } from '@kbn/test-jest-helpers'; import { fieldFormatsServiceMock } from '../../../../../src/plugins/field_formats/public/mocks'; import { IndexPattern } from './types'; import { FieldItem } from './field_item'; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/layerpanel.test.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/layerpanel.test.tsx index 335796442bd8b..91b9de58bdaa1 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/layerpanel.test.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/layerpanel.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { IndexPatternPrivateState } from './types'; import { IndexPatternLayerPanelProps, LayerPanel } from './layerpanel'; -import { shallowWithIntl as shallow } from '@kbn/test/jest'; +import { shallowWithIntl as shallow } from '@kbn/test-jest-helpers'; import { ShallowWrapper } from 'enzyme'; import { EuiSelectable } from '@elastic/eui'; import { ChangeIndexPattern } from './change_indexpattern'; diff --git a/x-pack/plugins/lens/public/metric_visualization/dimension_editor.test.tsx b/x-pack/plugins/lens/public/metric_visualization/dimension_editor.test.tsx index ef0687a2cd519..b296313086d7f 100644 --- a/x-pack/plugins/lens/public/metric_visualization/dimension_editor.test.tsx +++ b/x-pack/plugins/lens/public/metric_visualization/dimension_editor.test.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { EuiButtonGroup } from '@elastic/eui'; import { FramePublicAPI, VisualizationDimensionEditorProps } from '../types'; import { createMockDatasource, createMockFramePublicAPI } from '../mocks'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { MetricDimensionEditor } from './dimension_editor'; import { chartPluginMock } from 'src/plugins/charts/public/mocks'; import { ColorMode, PaletteOutput, PaletteRegistry } from 'src/plugins/charts/public'; diff --git a/x-pack/plugins/lens/public/mocks/store_mocks.tsx b/x-pack/plugins/lens/public/mocks/store_mocks.tsx index 1b1d83ef2892d..3365657fea34e 100644 --- a/x-pack/plugins/lens/public/mocks/store_mocks.tsx +++ b/x-pack/plugins/lens/public/mocks/store_mocks.tsx @@ -9,7 +9,7 @@ import React from 'react'; // eslint-disable-next-line import/no-extraneous-dependencies import { ReactWrapper } from 'enzyme'; // eslint-disable-next-line import/no-extraneous-dependencies -import { mountWithIntl as mount } from '@kbn/test/jest'; +import { mountWithIntl as mount } from '@kbn/test-jest-helpers'; import { Provider } from 'react-redux'; import { act } from 'react-dom/test-utils'; import { PreloadedState } from '@reduxjs/toolkit'; diff --git a/x-pack/plugins/lens/public/pie_visualization/get_legend_action.test.tsx b/x-pack/plugins/lens/public/pie_visualization/get_legend_action.test.tsx index 91886c6cf19d6..df0648aa40d74 100644 --- a/x-pack/plugins/lens/public/pie_visualization/get_legend_action.test.tsx +++ b/x-pack/plugins/lens/public/pie_visualization/get_legend_action.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { LegendActionProps, SeriesIdentifier } from '@elastic/charts'; import { EuiPopover } from '@elastic/eui'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { ComponentType, ReactWrapper } from 'enzyme'; import type { Datatable } from 'src/plugins/expressions/public'; import { getLegendAction } from './get_legend_action'; diff --git a/x-pack/plugins/lens/public/shared_components/axis_title_settings.test.tsx b/x-pack/plugins/lens/public/shared_components/axis_title_settings.test.tsx index 4cb7f6d1314b6..433a0f821f273 100644 --- a/x-pack/plugins/lens/public/shared_components/axis_title_settings.test.tsx +++ b/x-pack/plugins/lens/public/shared_components/axis_title_settings.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { shallowWithIntl as shallow } from '@kbn/test/jest'; +import { shallowWithIntl as shallow } from '@kbn/test-jest-helpers'; import { AxisTitleSettings, AxisTitleSettingsProps } from './axis_title_settings'; describe('Axes Title settings', () => { diff --git a/x-pack/plugins/lens/public/shared_components/coloring/color_ranges/color_ranges.test.tsx b/x-pack/plugins/lens/public/shared_components/coloring/color_ranges/color_ranges.test.tsx index 3010c9fcc47e9..aafcc3fce8dde 100644 --- a/x-pack/plugins/lens/public/shared_components/coloring/color_ranges/color_ranges.test.tsx +++ b/x-pack/plugins/lens/public/shared_components/coloring/color_ranges/color_ranges.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { act } from 'react-dom/test-utils'; import { ColorRanges, ColorRangesProps } from './color_ranges'; diff --git a/x-pack/plugins/lens/public/shared_components/coloring/palette_configuration.test.tsx b/x-pack/plugins/lens/public/shared_components/coloring/palette_configuration.test.tsx index a97f3d3f04112..cb7ce91b84aeb 100644 --- a/x-pack/plugins/lens/public/shared_components/coloring/palette_configuration.test.tsx +++ b/x-pack/plugins/lens/public/shared_components/coloring/palette_configuration.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { EuiButtonGroup, EuiColorPalettePickerPaletteProps } from '@elastic/eui'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { chartPluginMock } from 'src/plugins/charts/public/mocks'; import type { PaletteOutput, PaletteRegistry } from 'src/plugins/charts/public'; import { ReactWrapper } from 'enzyme'; diff --git a/x-pack/plugins/lens/public/shared_components/legend_location_settings.test.tsx b/x-pack/plugins/lens/public/shared_components/legend_location_settings.test.tsx index 0c494f4d0090d..49a53c1abf66f 100644 --- a/x-pack/plugins/lens/public/shared_components/legend_location_settings.test.tsx +++ b/x-pack/plugins/lens/public/shared_components/legend_location_settings.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { Position } from '@elastic/charts'; -import { shallowWithIntl as shallow, mountWithIntl as mount } from '@kbn/test/jest'; +import { shallowWithIntl as shallow, mountWithIntl as mount } from '@kbn/test-jest-helpers'; import { LegendLocationSettings, LegendLocationSettingsProps } from './legend_location_settings'; describe('Legend Location Settings', () => { diff --git a/x-pack/plugins/lens/public/shared_components/legend_settings_popover.test.tsx b/x-pack/plugins/lens/public/shared_components/legend_settings_popover.test.tsx index 95739c294b320..0072a6cd2dcce 100644 --- a/x-pack/plugins/lens/public/shared_components/legend_settings_popover.test.tsx +++ b/x-pack/plugins/lens/public/shared_components/legend_settings_popover.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { shallowWithIntl as shallow } from '@kbn/test/jest'; +import { shallowWithIntl as shallow } from '@kbn/test-jest-helpers'; import { LegendSettingsPopover, LegendSettingsPopoverProps, diff --git a/x-pack/plugins/lens/public/shared_components/value_labels_settings.test.tsx b/x-pack/plugins/lens/public/shared_components/value_labels_settings.test.tsx index ae68a40d8cea6..7f5ebcf7aa281 100644 --- a/x-pack/plugins/lens/public/shared_components/value_labels_settings.test.tsx +++ b/x-pack/plugins/lens/public/shared_components/value_labels_settings.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { shallowWithIntl as shallow } from '@kbn/test/jest'; +import { shallowWithIntl as shallow } from '@kbn/test-jest-helpers'; import { ValueLabelsSettings, VisualOptionsProps } from './value_labels_settings'; describe('Value labels Settings', () => { diff --git a/x-pack/plugins/lens/public/visualizations/gauge/toolbar_component/gauge_toolbar.test.tsx b/x-pack/plugins/lens/public/visualizations/gauge/toolbar_component/gauge_toolbar.test.tsx index 93d9eb04775ea..1c3a5fdea5593 100644 --- a/x-pack/plugins/lens/public/visualizations/gauge/toolbar_component/gauge_toolbar.test.tsx +++ b/x-pack/plugins/lens/public/visualizations/gauge/toolbar_component/gauge_toolbar.test.tsx @@ -6,7 +6,7 @@ */ import React, { FormEvent } from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { ToolbarButton } from 'src/plugins/kibana_react/public'; import { ReactWrapper } from 'enzyme'; import { act } from 'react-dom/test-utils'; diff --git a/x-pack/plugins/lens/public/xy_visualization/expression.test.tsx b/x-pack/plugins/lens/public/xy_visualization/expression.test.tsx index 027165a2eb5d0..bc57547bc0ee6 100644 --- a/x-pack/plugins/lens/public/xy_visualization/expression.test.tsx +++ b/x-pack/plugins/lens/public/xy_visualization/expression.test.tsx @@ -43,7 +43,7 @@ import { Datatable, DatatableRow } from '../../../../../src/plugins/expressions/ import React from 'react'; import { shallow } from 'enzyme'; import { createMockExecutionContext } from '../../../../../src/plugins/expressions/common/mocks'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { chartPluginMock } from '../../../../../src/plugins/charts/public/mocks'; import { EmptyPlaceholder } from '../../../../../src/plugins/charts/public'; import { XyEndzones } from './x_domain'; diff --git a/x-pack/plugins/lens/public/xy_visualization/get_legend_action.test.tsx b/x-pack/plugins/lens/public/xy_visualization/get_legend_action.test.tsx index 5d1b45e481499..c15c0916bee0b 100644 --- a/x-pack/plugins/lens/public/xy_visualization/get_legend_action.test.tsx +++ b/x-pack/plugins/lens/public/xy_visualization/get_legend_action.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { LegendActionProps, SeriesIdentifier } from '@elastic/charts'; import { EuiPopover } from '@elastic/eui'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { ComponentType, ReactWrapper } from 'enzyme'; import type { LensMultiTable } from '../../common'; import { layerTypes } from '../../common'; diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/axis_settings_popover.test.tsx b/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/axis_settings_popover.test.tsx index 81e82bd1fb904..a57298787b2e3 100644 --- a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/axis_settings_popover.test.tsx +++ b/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/axis_settings_popover.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { shallowWithIntl as shallow } from '@kbn/test/jest'; +import { shallowWithIntl as shallow } from '@kbn/test-jest-helpers'; import { AxisSettingsPopover, AxisSettingsPopoverProps } from './axis_settings_popover'; import { ToolbarPopover } from '../../shared_components'; import { layerTypes } from '../../../common'; diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/visual_options_popover/fill_opacity_option.test.tsx b/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/visual_options_popover/fill_opacity_option.test.tsx index 3ba29e4f72c83..f9920647478be 100644 --- a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/visual_options_popover/fill_opacity_option.test.tsx +++ b/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/visual_options_popover/fill_opacity_option.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { mountWithIntl as mount, shallowWithIntl as shallow } from '@kbn/test/jest'; +import { mountWithIntl as mount, shallowWithIntl as shallow } from '@kbn/test-jest-helpers'; import { EuiRange } from '@elastic/eui'; import { FillOpacityOption } from './fill_opacity_option'; diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/visual_options_popover/line_curve_option.test.tsx b/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/visual_options_popover/line_curve_option.test.tsx index c37a36a42fa47..272adc3b17f05 100644 --- a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/visual_options_popover/line_curve_option.test.tsx +++ b/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/visual_options_popover/line_curve_option.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { mountWithIntl as mount, shallowWithIntl as shallow } from '@kbn/test/jest'; +import { mountWithIntl as mount, shallowWithIntl as shallow } from '@kbn/test-jest-helpers'; import { EuiSwitch } from '@elastic/eui'; import { LineCurveOption } from './line_curve_option'; diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/visual_options_popover/missing_value_option.test.tsx b/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/visual_options_popover/missing_value_option.test.tsx index ce4e05223b5a3..d3960acd56377 100644 --- a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/visual_options_popover/missing_value_option.test.tsx +++ b/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/visual_options_popover/missing_value_option.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { shallowWithIntl as shallow, mountWithIntl as mount } from '@kbn/test/jest'; +import { shallowWithIntl as shallow, mountWithIntl as mount } from '@kbn/test-jest-helpers'; import { EuiSuperSelect } from '@elastic/eui'; import { MissingValuesOptions } from './missing_values_option'; diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/visual_options_popover/visual_options_popover.test.tsx b/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/visual_options_popover/visual_options_popover.test.tsx index 6b48738e22a60..fe8a71ad9f326 100644 --- a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/visual_options_popover/visual_options_popover.test.tsx +++ b/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/visual_options_popover/visual_options_popover.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { shallowWithIntl as shallow } from '@kbn/test/jest'; +import { shallowWithIntl as shallow } from '@kbn/test-jest-helpers'; import { Position } from '@elastic/charts'; import type { FramePublicAPI } from '../../../types'; import { createMockDatasource, createMockFramePublicAPI } from '../../../mocks'; diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/xy_config_panel.test.tsx b/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/xy_config_panel.test.tsx index e5b1870c73404..0ffa2d394bcaf 100644 --- a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/xy_config_panel.test.tsx +++ b/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/xy_config_panel.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { mountWithIntl as mount, shallowWithIntl as shallow } from '@kbn/test/jest'; +import { mountWithIntl as mount, shallowWithIntl as shallow } from '@kbn/test-jest-helpers'; import { EuiButtonGroupProps, EuiButtonGroup } from '@elastic/eui'; import { LayerContextMenu, XyToolbar, DimensionEditor } from '.'; import { AxisSettingsPopover } from './axis_settings_popover'; diff --git a/x-pack/plugins/license_management/__jest__/upload_license.test.tsx b/x-pack/plugins/license_management/__jest__/upload_license.test.tsx index a5f6a866bc9de..62b7dbf6c1a78 100644 --- a/x-pack/plugins/license_management/__jest__/upload_license.test.tsx +++ b/x-pack/plugins/license_management/__jest__/upload_license.test.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { Provider } from 'react-redux'; import { LocationDescriptorObject } from 'history'; import { httpServiceMock, scopedHistoryMock } from '../../../../src/core/public/mocks'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; // @ts-ignore import { uploadLicense } from '../public/application/store/actions/upload_license'; diff --git a/x-pack/plugins/license_management/__jest__/util/util.js b/x-pack/plugins/license_management/__jest__/util/util.js index eacd397d60016..25ef77612ca2c 100644 --- a/x-pack/plugins/license_management/__jest__/util/util.js +++ b/x-pack/plugins/license_management/__jest__/util/util.js @@ -10,7 +10,7 @@ import React from 'react'; import { Provider } from 'react-redux'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { httpServiceMock, scopedHistoryMock } from '../../../../../src/core/public/mocks'; import { licenseManagementStore } from '../../public/application/store/store'; import { AppContextProvider } from '../../public/application/app_context'; diff --git a/x-pack/plugins/logstash/public/application/components/pipeline_editor/pipeline_editor.test.js b/x-pack/plugins/logstash/public/application/components/pipeline_editor/pipeline_editor.test.js index b9f4c6d707a3b..32103896134ad 100644 --- a/x-pack/plugins/logstash/public/application/components/pipeline_editor/pipeline_editor.test.js +++ b/x-pack/plugins/logstash/public/application/components/pipeline_editor/pipeline_editor.test.js @@ -6,7 +6,7 @@ */ import React from 'react'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import 'brace'; import { PipelineEditor } from './pipeline_editor'; diff --git a/x-pack/plugins/logstash/public/application/components/pipeline_list/add_role_alert.test.js b/x-pack/plugins/logstash/public/application/components/pipeline_list/add_role_alert.test.js index 398310e72be02..a99f8ce5519f5 100644 --- a/x-pack/plugins/logstash/public/application/components/pipeline_list/add_role_alert.test.js +++ b/x-pack/plugins/logstash/public/application/components/pipeline_list/add_role_alert.test.js @@ -6,7 +6,7 @@ */ import React from 'react'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { AddRoleAlert } from './add_role_alert'; describe('AddRoleAlert component', () => { diff --git a/x-pack/plugins/logstash/public/application/components/pipeline_list/alert_call_out.test.js b/x-pack/plugins/logstash/public/application/components/pipeline_list/alert_call_out.test.js index a8ee367e8d36f..7889a91f925f9 100644 --- a/x-pack/plugins/logstash/public/application/components/pipeline_list/alert_call_out.test.js +++ b/x-pack/plugins/logstash/public/application/components/pipeline_list/alert_call_out.test.js @@ -6,7 +6,7 @@ */ import React from 'react'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { AlertCallOut } from './alert_call_out'; describe('AlertCallOut component', () => { diff --git a/x-pack/plugins/logstash/public/application/components/pipeline_list/confirm_delete_modal.test.js b/x-pack/plugins/logstash/public/application/components/pipeline_list/confirm_delete_modal.test.js index 3d7babb95eeb9..9186d8138c094 100644 --- a/x-pack/plugins/logstash/public/application/components/pipeline_list/confirm_delete_modal.test.js +++ b/x-pack/plugins/logstash/public/application/components/pipeline_list/confirm_delete_modal.test.js @@ -6,7 +6,7 @@ */ import React from 'react'; -import { shallowWithIntl, mountWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl, mountWithIntl } from '@kbn/test-jest-helpers'; import { ConfirmDeleteModal } from './confirm_delete_modal'; describe('ConfirmDeleteModal component', () => { diff --git a/x-pack/plugins/logstash/public/application/components/pipeline_list/enable_monitoring_alert.test.js b/x-pack/plugins/logstash/public/application/components/pipeline_list/enable_monitoring_alert.test.js index 13db9e6e73e60..2f0a707d880c2 100644 --- a/x-pack/plugins/logstash/public/application/components/pipeline_list/enable_monitoring_alert.test.js +++ b/x-pack/plugins/logstash/public/application/components/pipeline_list/enable_monitoring_alert.test.js @@ -6,7 +6,7 @@ */ import React from 'react'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { EnableMonitoringAlert } from './enable_monitoring_alert'; describe('EnableMonitoringAlert component', () => { diff --git a/x-pack/plugins/logstash/public/application/components/pipeline_list/pipeline_list.test.js b/x-pack/plugins/logstash/public/application/components/pipeline_list/pipeline_list.test.js index fb8a5e2a627c7..620e8081c6744 100644 --- a/x-pack/plugins/logstash/public/application/components/pipeline_list/pipeline_list.test.js +++ b/x-pack/plugins/logstash/public/application/components/pipeline_list/pipeline_list.test.js @@ -6,7 +6,7 @@ */ import React from 'react'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { PipelineList } from './pipeline_list'; describe('PipelineList component', () => { diff --git a/x-pack/plugins/logstash/public/application/components/pipeline_list/pipelines_table.test.js b/x-pack/plugins/logstash/public/application/components/pipeline_list/pipelines_table.test.js index 38213733d5e72..79c49319bfb45 100644 --- a/x-pack/plugins/logstash/public/application/components/pipeline_list/pipelines_table.test.js +++ b/x-pack/plugins/logstash/public/application/components/pipeline_list/pipelines_table.test.js @@ -6,7 +6,7 @@ */ import React from 'react'; -import { shallowWithIntl, mountWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl, mountWithIntl } from '@kbn/test-jest-helpers'; import { PipelinesTable } from './pipelines_table'; describe('PipelinesTable component', () => { diff --git a/x-pack/plugins/ml/public/application/components/annotations/annotation_description_list/index.test.tsx b/x-pack/plugins/ml/public/application/components/annotations/annotation_description_list/index.test.tsx index 430b56b4b52b9..bb9fa3a8ec4d6 100644 --- a/x-pack/plugins/ml/public/application/components/annotations/annotation_description_list/index.test.tsx +++ b/x-pack/plugins/ml/public/application/components/annotations/annotation_description_list/index.test.tsx @@ -9,7 +9,7 @@ import mockAnnotations from '../annotations_table/__mocks__/mock_annotations.jso import moment from 'moment-timezone'; import React from 'react'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { AnnotationDescriptionList } from './index'; diff --git a/x-pack/plugins/ml/public/application/components/annotations/annotations_table/annotations_table.test.js b/x-pack/plugins/ml/public/application/components/annotations/annotations_table/annotations_table.test.js index 0caf92baca88d..1681d151cd31f 100644 --- a/x-pack/plugins/ml/public/application/components/annotations/annotations_table/annotations_table.test.js +++ b/x-pack/plugins/ml/public/application/components/annotations/annotations_table/annotations_table.test.js @@ -8,7 +8,7 @@ import jobConfig from '../../../../../common/types/__mocks__/job_config_farequote'; import mockAnnotations from './__mocks__/mock_annotations.json'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { AnnotationsTable } from './annotations_table'; diff --git a/x-pack/plugins/ml/public/application/components/anomalies_table/anomaly_details.test.js b/x-pack/plugins/ml/public/application/components/anomalies_table/anomaly_details.test.js index 668d392bffbbe..67f6a9b12dfa1 100644 --- a/x-pack/plugins/ml/public/application/components/anomalies_table/anomaly_details.test.js +++ b/x-pack/plugins/ml/public/application/components/anomalies_table/anomaly_details.test.js @@ -6,7 +6,7 @@ */ import React from 'react'; -import { shallowWithIntl, mountWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl, mountWithIntl } from '@kbn/test-jest-helpers'; import { AnomalyDetails } from './anomaly_details'; const props = { diff --git a/x-pack/plugins/ml/public/application/components/entity_cell/entity_cell.test.tsx b/x-pack/plugins/ml/public/application/components/entity_cell/entity_cell.test.tsx index efe405044f45e..d726356624b35 100644 --- a/x-pack/plugins/ml/public/application/components/entity_cell/entity_cell.test.tsx +++ b/x-pack/plugins/ml/public/application/components/entity_cell/entity_cell.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { EntityCell } from './entity_cell'; const defaultProps = { diff --git a/x-pack/plugins/ml/public/application/components/full_time_range_selector/full_time_range_selector.test.tsx b/x-pack/plugins/ml/public/application/components/full_time_range_selector/full_time_range_selector.test.tsx index 3f64ff794d9ab..ea444193db0b1 100644 --- a/x-pack/plugins/ml/public/application/components/full_time_range_selector/full_time_range_selector.test.tsx +++ b/x-pack/plugins/ml/public/application/components/full_time_range_selector/full_time_range_selector.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { FullTimeRangeSelector } from './index'; import type { Query } from 'src/plugins/data/public'; import type { DataView } from '../../../../../../../src/plugins/data_views/public'; diff --git a/x-pack/plugins/ml/public/application/components/rule_editor/actions_section.test.js b/x-pack/plugins/ml/public/application/components/rule_editor/actions_section.test.js index 149cdf9bb9aa0..37315b61c2d02 100644 --- a/x-pack/plugins/ml/public/application/components/rule_editor/actions_section.test.js +++ b/x-pack/plugins/ml/public/application/components/rule_editor/actions_section.test.js @@ -5,7 +5,7 @@ * 2.0. */ -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { ActionsSection } from './actions_section'; diff --git a/x-pack/plugins/ml/public/application/components/rule_editor/components/detector_description_list/detector_description_list.test.js b/x-pack/plugins/ml/public/application/components/rule_editor/components/detector_description_list/detector_description_list.test.js index f4752f5407370..1c979525ca9eb 100644 --- a/x-pack/plugins/ml/public/application/components/rule_editor/components/detector_description_list/detector_description_list.test.js +++ b/x-pack/plugins/ml/public/application/components/rule_editor/components/detector_description_list/detector_description_list.test.js @@ -5,7 +5,7 @@ * 2.0. */ -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { DetectorDescriptionList } from './detector_description_list'; diff --git a/x-pack/plugins/ml/public/application/components/rule_editor/condition_expression.test.js b/x-pack/plugins/ml/public/application/components/rule_editor/condition_expression.test.js index f13b2d010a370..2fbf69c67f26a 100644 --- a/x-pack/plugins/ml/public/application/components/rule_editor/condition_expression.test.js +++ b/x-pack/plugins/ml/public/application/components/rule_editor/condition_expression.test.js @@ -8,7 +8,7 @@ // Mock the mlJobService that is imported for saving rules. jest.mock('../../services/job_service.js', () => 'mlJobService'); -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { ConditionExpression } from './condition_expression'; diff --git a/x-pack/plugins/ml/public/application/components/rule_editor/conditions_section.test.js b/x-pack/plugins/ml/public/application/components/rule_editor/conditions_section.test.js index eaa352b33253d..69a71dda38cb4 100644 --- a/x-pack/plugins/ml/public/application/components/rule_editor/conditions_section.test.js +++ b/x-pack/plugins/ml/public/application/components/rule_editor/conditions_section.test.js @@ -8,7 +8,7 @@ // Mock the mlJobService that is imported for saving rules. jest.mock('../../services/job_service.js', () => 'mlJobService'); -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { ConditionsSection } from './conditions_section'; diff --git a/x-pack/plugins/ml/public/application/components/rule_editor/rule_editor_flyout.test.js b/x-pack/plugins/ml/public/application/components/rule_editor/rule_editor_flyout.test.js index 20a66bcf5b140..2553baa11da33 100644 --- a/x-pack/plugins/ml/public/application/components/rule_editor/rule_editor_flyout.test.js +++ b/x-pack/plugins/ml/public/application/components/rule_editor/rule_editor_flyout.test.js @@ -56,7 +56,7 @@ jest.mock('../../../../../../../src/plugins/kibana_react/public', () => ({ }, })); -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { RuleEditorFlyout } from './rule_editor_flyout'; diff --git a/x-pack/plugins/ml/public/application/components/rule_editor/scope_expression.test.js b/x-pack/plugins/ml/public/application/components/rule_editor/scope_expression.test.js index 59e5000dee7fd..c030dcfa1f0a4 100644 --- a/x-pack/plugins/ml/public/application/components/rule_editor/scope_expression.test.js +++ b/x-pack/plugins/ml/public/application/components/rule_editor/scope_expression.test.js @@ -8,7 +8,7 @@ // Mock the mlJobService that is imported for saving rules. jest.mock('../../services/job_service.js', () => 'mlJobService'); -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { ScopeExpression } from './scope_expression'; diff --git a/x-pack/plugins/ml/public/application/components/rule_editor/scope_section.test.js b/x-pack/plugins/ml/public/application/components/rule_editor/scope_section.test.js index 5a9c6bb3af4cd..86a777f65a338 100644 --- a/x-pack/plugins/ml/public/application/components/rule_editor/scope_section.test.js +++ b/x-pack/plugins/ml/public/application/components/rule_editor/scope_section.test.js @@ -16,7 +16,7 @@ jest.mock('../../capabilities/check_capabilities', () => ({ checkPermission: (privilege) => mockCheckPermission(privilege), })); -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { ScopeSection } from './scope_section'; diff --git a/x-pack/plugins/ml/public/application/components/rule_editor/select_rule_action/add_to_filter_list_link.test.js b/x-pack/plugins/ml/public/application/components/rule_editor/select_rule_action/add_to_filter_list_link.test.js index 802cd51575c78..2c255728f2eb3 100644 --- a/x-pack/plugins/ml/public/application/components/rule_editor/select_rule_action/add_to_filter_list_link.test.js +++ b/x-pack/plugins/ml/public/application/components/rule_editor/select_rule_action/add_to_filter_list_link.test.js @@ -5,7 +5,7 @@ * 2.0. */ -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { AddToFilterListLink } from './add_to_filter_list_link'; diff --git a/x-pack/plugins/ml/public/application/components/rule_editor/select_rule_action/delete_rule_modal.test.js b/x-pack/plugins/ml/public/application/components/rule_editor/select_rule_action/delete_rule_modal.test.js index cf06149b728b0..457a552bad6c9 100644 --- a/x-pack/plugins/ml/public/application/components/rule_editor/select_rule_action/delete_rule_modal.test.js +++ b/x-pack/plugins/ml/public/application/components/rule_editor/select_rule_action/delete_rule_modal.test.js @@ -5,7 +5,7 @@ * 2.0. */ -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { DeleteRuleModal } from './delete_rule_modal'; diff --git a/x-pack/plugins/ml/public/application/components/rule_editor/select_rule_action/edit_condition_link.test.js b/x-pack/plugins/ml/public/application/components/rule_editor/select_rule_action/edit_condition_link.test.js index 80b77e41a6964..9ae947c404c2e 100644 --- a/x-pack/plugins/ml/public/application/components/rule_editor/select_rule_action/edit_condition_link.test.js +++ b/x-pack/plugins/ml/public/application/components/rule_editor/select_rule_action/edit_condition_link.test.js @@ -7,7 +7,7 @@ jest.mock('../../../services/job_service.js', () => 'mlJobService'); -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { EditConditionLink } from './edit_condition_link'; diff --git a/x-pack/plugins/ml/public/application/components/rule_editor/select_rule_action/rule_action_panel.test.js b/x-pack/plugins/ml/public/application/components/rule_editor/select_rule_action/rule_action_panel.test.js index d4d93506a4d9d..7df277ae0b6ab 100644 --- a/x-pack/plugins/ml/public/application/components/rule_editor/select_rule_action/rule_action_panel.test.js +++ b/x-pack/plugins/ml/public/application/components/rule_editor/select_rule_action/rule_action_panel.test.js @@ -29,7 +29,7 @@ jest.mock('../../../services/ml_api_service', () => ({ }, })); -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { RuleActionPanel } from './rule_action_panel'; diff --git a/x-pack/plugins/ml/public/application/components/validate_job/validate_job_view.test.js b/x-pack/plugins/ml/public/application/components/validate_job/validate_job_view.test.js index 8ec83d8679e87..b1755660960ad 100644 --- a/x-pack/plugins/ml/public/application/components/validate_job/validate_job_view.test.js +++ b/x-pack/plugins/ml/public/application/components/validate_job/validate_job_view.test.js @@ -5,7 +5,7 @@ * 2.0. */ -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { ValidateJob } from './validate_job_view'; diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/use_create_analytics_form.test.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/use_create_analytics_form.test.tsx index f848aaf716641..36cc01d4462b9 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/use_create_analytics_form.test.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/use_create_analytics_form.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { mountHook } from '@kbn/test/jest'; +import { mountHook } from '@kbn/test-jest-helpers'; import { MlContext } from '../../../../../contexts/ml'; import { kibanaContextValueMock } from '../../../../../contexts/ml/__mocks__/kibana_context_value'; diff --git a/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_distribution.test.js b/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_distribution.test.js index 8f089ab8c07ce..8e39120e36411 100644 --- a/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_distribution.test.js +++ b/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_distribution.test.js @@ -13,7 +13,7 @@ jest.mock('../../services/field_format_service', () => ({ }, })); -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { ExplorerChartDistribution } from './explorer_chart_distribution'; diff --git a/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_info_tooltip.test.js b/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_info_tooltip.test.js index ef0482806f423..c2149097c8733 100644 --- a/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_info_tooltip.test.js +++ b/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_info_tooltip.test.js @@ -5,7 +5,7 @@ * 2.0. */ -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { ExplorerChartInfoTooltip } from './explorer_chart_info_tooltip'; diff --git a/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_single_metric.test.js b/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_single_metric.test.js index 133ca3e8eb628..2582dcfb05c16 100644 --- a/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_single_metric.test.js +++ b/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_single_metric.test.js @@ -13,7 +13,7 @@ jest.mock('../../services/field_format_service', () => ({ }, })); -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { ExplorerChartSingleMetric } from './explorer_chart_single_metric'; diff --git a/x-pack/plugins/ml/public/application/settings/calendars/edit/calendar_form/calendar_form.test.js b/x-pack/plugins/ml/public/application/settings/calendars/edit/calendar_form/calendar_form.test.js index 302dc63da7e52..e5c66bcdd59bd 100644 --- a/x-pack/plugins/ml/public/application/settings/calendars/edit/calendar_form/calendar_form.test.js +++ b/x-pack/plugins/ml/public/application/settings/calendars/edit/calendar_form/calendar_form.test.js @@ -5,7 +5,7 @@ * 2.0. */ -import { shallowWithIntl, mountWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl, mountWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { CalendarForm } from './calendar_form'; diff --git a/x-pack/plugins/ml/public/application/settings/calendars/edit/events_table/events_table.test.js b/x-pack/plugins/ml/public/application/settings/calendars/edit/events_table/events_table.test.js index a2341edf38f58..d45d93043e16b 100644 --- a/x-pack/plugins/ml/public/application/settings/calendars/edit/events_table/events_table.test.js +++ b/x-pack/plugins/ml/public/application/settings/calendars/edit/events_table/events_table.test.js @@ -5,7 +5,7 @@ * 2.0. */ -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { EventsTable } from './events_table'; diff --git a/x-pack/plugins/ml/public/application/settings/calendars/edit/import_modal/import_modal.test.js b/x-pack/plugins/ml/public/application/settings/calendars/edit/import_modal/import_modal.test.js index 10bc1c7a96601..bcbbdec7b65c6 100644 --- a/x-pack/plugins/ml/public/application/settings/calendars/edit/import_modal/import_modal.test.js +++ b/x-pack/plugins/ml/public/application/settings/calendars/edit/import_modal/import_modal.test.js @@ -5,7 +5,7 @@ * 2.0. */ -import { shallowWithIntl, mountWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl, mountWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { ImportModal } from './import_modal'; diff --git a/x-pack/plugins/ml/public/application/settings/calendars/edit/imported_events/imported_events.test.js b/x-pack/plugins/ml/public/application/settings/calendars/edit/imported_events/imported_events.test.js index 5604ef4046240..8762cb4603807 100644 --- a/x-pack/plugins/ml/public/application/settings/calendars/edit/imported_events/imported_events.test.js +++ b/x-pack/plugins/ml/public/application/settings/calendars/edit/imported_events/imported_events.test.js @@ -5,7 +5,7 @@ * 2.0. */ -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { ImportedEvents } from './imported_events'; diff --git a/x-pack/plugins/ml/public/application/settings/calendars/edit/new_calendar.test.js b/x-pack/plugins/ml/public/application/settings/calendars/edit/new_calendar.test.js index 0107af3cf8c1e..73391f3cba87f 100644 --- a/x-pack/plugins/ml/public/application/settings/calendars/edit/new_calendar.test.js +++ b/x-pack/plugins/ml/public/application/settings/calendars/edit/new_calendar.test.js @@ -67,7 +67,7 @@ jest.mock('../../../../../../../../src/plugins/kibana_react/public', () => ({ }, })); -import { shallowWithIntl, mountWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl, mountWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { NewCalendar } from './new_calendar'; diff --git a/x-pack/plugins/ml/public/application/settings/calendars/edit/new_event_modal/new_event_modal.test.js b/x-pack/plugins/ml/public/application/settings/calendars/edit/new_event_modal/new_event_modal.test.js index f33879bfa872f..0aa91a44458e7 100644 --- a/x-pack/plugins/ml/public/application/settings/calendars/edit/new_event_modal/new_event_modal.test.js +++ b/x-pack/plugins/ml/public/application/settings/calendars/edit/new_event_modal/new_event_modal.test.js @@ -5,7 +5,7 @@ * 2.0. */ -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { NewEventModal } from './new_event_modal'; import moment from 'moment'; diff --git a/x-pack/plugins/ml/public/application/settings/calendars/list/calendars_list.test.js b/x-pack/plugins/ml/public/application/settings/calendars/list/calendars_list.test.js index 8e66dbd274273..ee1879a8a3c7a 100644 --- a/x-pack/plugins/ml/public/application/settings/calendars/list/calendars_list.test.js +++ b/x-pack/plugins/ml/public/application/settings/calendars/list/calendars_list.test.js @@ -6,7 +6,7 @@ */ import React from 'react'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { ml } from '../../../services/ml_api_service'; import { CalendarsList } from './calendars_list'; diff --git a/x-pack/plugins/ml/public/application/settings/calendars/list/header.test.js b/x-pack/plugins/ml/public/application/settings/calendars/list/header.test.js index edbee43151f21..da470441caa98 100644 --- a/x-pack/plugins/ml/public/application/settings/calendars/list/header.test.js +++ b/x-pack/plugins/ml/public/application/settings/calendars/list/header.test.js @@ -5,7 +5,7 @@ * 2.0. */ -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { CalendarsListHeader } from './header'; diff --git a/x-pack/plugins/ml/public/application/settings/calendars/list/table/table.test.js b/x-pack/plugins/ml/public/application/settings/calendars/list/table/table.test.js index 543ae2b85abfc..13e2c1e2dc37b 100644 --- a/x-pack/plugins/ml/public/application/settings/calendars/list/table/table.test.js +++ b/x-pack/plugins/ml/public/application/settings/calendars/list/table/table.test.js @@ -5,7 +5,7 @@ * 2.0. */ -import { shallowWithIntl, mountWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl, mountWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { CalendarsListTable } from './table'; diff --git a/x-pack/plugins/ml/public/application/settings/filter_lists/components/add_item_popover/add_item_popover.test.js b/x-pack/plugins/ml/public/application/settings/filter_lists/components/add_item_popover/add_item_popover.test.js index b4d32c387d183..0bbb3f443f1ae 100644 --- a/x-pack/plugins/ml/public/application/settings/filter_lists/components/add_item_popover/add_item_popover.test.js +++ b/x-pack/plugins/ml/public/application/settings/filter_lists/components/add_item_popover/add_item_popover.test.js @@ -5,7 +5,7 @@ * 2.0. */ -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { AddItemPopover } from './add_item_popover'; diff --git a/x-pack/plugins/ml/public/application/settings/filter_lists/components/delete_filter_list_modal/delete_filter_list_modal.test.js b/x-pack/plugins/ml/public/application/settings/filter_lists/components/delete_filter_list_modal/delete_filter_list_modal.test.js index 65fc96a62a9cb..d46de282c59d9 100644 --- a/x-pack/plugins/ml/public/application/settings/filter_lists/components/delete_filter_list_modal/delete_filter_list_modal.test.js +++ b/x-pack/plugins/ml/public/application/settings/filter_lists/components/delete_filter_list_modal/delete_filter_list_modal.test.js @@ -14,7 +14,7 @@ jest.mock('../../../../capabilities/check_capabilities', () => ({ })); jest.mock('../../../../services/ml_api_service', () => 'ml'); -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { DeleteFilterListModal } from './delete_filter_list_modal'; diff --git a/x-pack/plugins/ml/public/application/settings/filter_lists/components/edit_description_popover/edit_description_popover.test.js b/x-pack/plugins/ml/public/application/settings/filter_lists/components/edit_description_popover/edit_description_popover.test.js index 6082a2bbf6799..ed6ae3764fd2a 100644 --- a/x-pack/plugins/ml/public/application/settings/filter_lists/components/edit_description_popover/edit_description_popover.test.js +++ b/x-pack/plugins/ml/public/application/settings/filter_lists/components/edit_description_popover/edit_description_popover.test.js @@ -5,7 +5,7 @@ * 2.0. */ -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { EditDescriptionPopover } from './edit_description_popover'; diff --git a/x-pack/plugins/ml/public/application/settings/filter_lists/edit/edit_filter_list.test.js b/x-pack/plugins/ml/public/application/settings/filter_lists/edit/edit_filter_list.test.js index 09c37c724b7c9..c20b8485b7cd1 100644 --- a/x-pack/plugins/ml/public/application/settings/filter_lists/edit/edit_filter_list.test.js +++ b/x-pack/plugins/ml/public/application/settings/filter_lists/edit/edit_filter_list.test.js @@ -51,7 +51,7 @@ jest.mock('../../../../../../../../src/plugins/kibana_react/public', () => ({ }, })); -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { EditFilterList } from './edit_filter_list'; diff --git a/x-pack/plugins/ml/public/application/settings/filter_lists/edit/header.test.js b/x-pack/plugins/ml/public/application/settings/filter_lists/edit/header.test.js index dc756fb4686bb..039acc0bef1eb 100644 --- a/x-pack/plugins/ml/public/application/settings/filter_lists/edit/header.test.js +++ b/x-pack/plugins/ml/public/application/settings/filter_lists/edit/header.test.js @@ -5,7 +5,7 @@ * 2.0. */ -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { EditFilterListHeader } from './header'; diff --git a/x-pack/plugins/ml/public/application/settings/filter_lists/edit/toolbar.test.js b/x-pack/plugins/ml/public/application/settings/filter_lists/edit/toolbar.test.js index 83226ad236a6d..7935b7dce3185 100644 --- a/x-pack/plugins/ml/public/application/settings/filter_lists/edit/toolbar.test.js +++ b/x-pack/plugins/ml/public/application/settings/filter_lists/edit/toolbar.test.js @@ -5,7 +5,7 @@ * 2.0. */ -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { EditFilterListToolbar } from './toolbar'; diff --git a/x-pack/plugins/ml/public/application/settings/filter_lists/list/filter_lists.test.js b/x-pack/plugins/ml/public/application/settings/filter_lists/list/filter_lists.test.js index 0ae4a758278f1..e6a69e971a864 100644 --- a/x-pack/plugins/ml/public/application/settings/filter_lists/list/filter_lists.test.js +++ b/x-pack/plugins/ml/public/application/settings/filter_lists/list/filter_lists.test.js @@ -5,7 +5,7 @@ * 2.0. */ -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { FilterLists } from './filter_lists'; diff --git a/x-pack/plugins/ml/public/application/settings/filter_lists/list/header.test.js b/x-pack/plugins/ml/public/application/settings/filter_lists/list/header.test.js index 204cb6036afd3..4357dad093dad 100644 --- a/x-pack/plugins/ml/public/application/settings/filter_lists/list/header.test.js +++ b/x-pack/plugins/ml/public/application/settings/filter_lists/list/header.test.js @@ -5,7 +5,7 @@ * 2.0. */ -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { FilterListsHeader } from './header'; diff --git a/x-pack/plugins/ml/public/application/settings/filter_lists/list/table.test.js b/x-pack/plugins/ml/public/application/settings/filter_lists/list/table.test.js index 164d4d7eecbd4..add92b804ee39 100644 --- a/x-pack/plugins/ml/public/application/settings/filter_lists/list/table.test.js +++ b/x-pack/plugins/ml/public/application/settings/filter_lists/list/table.test.js @@ -12,7 +12,7 @@ jest.mock('../../../capabilities/check_capabilities', () => ({ })); jest.mock('../../../services/ml_api_service', () => 'ml'); -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { FilterListsTable } from './table'; diff --git a/x-pack/plugins/ml/public/application/settings/settings.test.tsx b/x-pack/plugins/ml/public/application/settings/settings.test.tsx index a12e733631830..ad3847e011371 100644 --- a/x-pack/plugins/ml/public/application/settings/settings.test.tsx +++ b/x-pack/plugins/ml/public/application/settings/settings.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { AnomalyDetectionSettingsContext } from './anomaly_detection_settings_context'; diff --git a/x-pack/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart.test.js b/x-pack/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart.test.js index 4faae22f98153..850a585509003 100644 --- a/x-pack/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart.test.js +++ b/x-pack/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart.test.js @@ -8,7 +8,7 @@ //import mockOverallSwimlaneData from './__mocks__/mock_overall_swimlane.json'; import moment from 'moment-timezone'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { TimeseriesChart } from './timeseries_chart'; diff --git a/x-pack/plugins/monitoring/public/alerts/alert_form.test.tsx b/x-pack/plugins/monitoring/public/alerts/alert_form.test.tsx index a95eedb2b4cb1..ff58887c88c12 100644 --- a/x-pack/plugins/monitoring/public/alerts/alert_form.test.tsx +++ b/x-pack/plugins/monitoring/public/alerts/alert_form.test.tsx @@ -10,7 +10,7 @@ */ import React, { Fragment, lazy } from 'react'; -import { mountWithIntl, nextTick } from '@kbn/test/jest'; +import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; import { ReactWrapper, mount } from 'enzyme'; import { act } from 'react-dom/test-utils'; import { coreMock } from 'src/core/public/mocks'; diff --git a/x-pack/plugins/monitoring/public/components/cluster/overview/helpers.test.js b/x-pack/plugins/monitoring/public/components/cluster/overview/helpers.test.js index 47cc1bef53caa..942065263912d 100644 --- a/x-pack/plugins/monitoring/public/components/cluster/overview/helpers.test.js +++ b/x-pack/plugins/monitoring/public/components/cluster/overview/helpers.test.js @@ -6,7 +6,7 @@ */ import React from 'react'; -import { renderWithIntl } from '@kbn/test/jest'; +import { renderWithIntl } from '@kbn/test-jest-helpers'; import { BytesUsage, BytesPercentageUsage } from './helpers'; describe('Bytes Usage', () => { diff --git a/x-pack/plugins/monitoring/public/components/elasticsearch/nodes/cells.test.js b/x-pack/plugins/monitoring/public/components/elasticsearch/nodes/cells.test.js index 250b9f6391221..f2ef0484928fc 100644 --- a/x-pack/plugins/monitoring/public/components/elasticsearch/nodes/cells.test.js +++ b/x-pack/plugins/monitoring/public/components/elasticsearch/nodes/cells.test.js @@ -6,7 +6,7 @@ */ import React from 'react'; -import { renderWithIntl } from '@kbn/test/jest'; +import { renderWithIntl } from '@kbn/test-jest-helpers'; import { MetricCell } from './cells'; describe('Node Listing Metric Cell', () => { diff --git a/x-pack/plugins/monitoring/public/components/no_data/checker_errors.test.js b/x-pack/plugins/monitoring/public/components/no_data/checker_errors.test.js index d293494fcd4c4..1c33f68458fd0 100644 --- a/x-pack/plugins/monitoring/public/components/no_data/checker_errors.test.js +++ b/x-pack/plugins/monitoring/public/components/no_data/checker_errors.test.js @@ -7,7 +7,7 @@ import React from 'react'; import { boomify, forbidden } from '@hapi/boom'; -import { renderWithIntl } from '@kbn/test/jest'; +import { renderWithIntl } from '@kbn/test-jest-helpers'; import { CheckerErrors } from './checker_errors'; describe('CheckerErrors', () => { diff --git a/x-pack/plugins/monitoring/public/components/no_data/explanations/collection_enabled/collection_enabled.test.js b/x-pack/plugins/monitoring/public/components/no_data/explanations/collection_enabled/collection_enabled.test.js index b66793d840ebb..95dc62abdf9d2 100644 --- a/x-pack/plugins/monitoring/public/components/no_data/explanations/collection_enabled/collection_enabled.test.js +++ b/x-pack/plugins/monitoring/public/components/no_data/explanations/collection_enabled/collection_enabled.test.js @@ -6,7 +6,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { ExplainCollectionEnabled } from './collection_enabled'; import { findTestSubject } from '@elastic/eui/lib/test'; diff --git a/x-pack/plugins/monitoring/public/components/no_data/explanations/collection_interval/collection_interval.test.js b/x-pack/plugins/monitoring/public/components/no_data/explanations/collection_interval/collection_interval.test.js index a5af179a050b7..95ffad81b902d 100644 --- a/x-pack/plugins/monitoring/public/components/no_data/explanations/collection_interval/collection_interval.test.js +++ b/x-pack/plugins/monitoring/public/components/no_data/explanations/collection_interval/collection_interval.test.js @@ -6,7 +6,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { ExplainCollectionInterval } from './collection_interval'; import { findTestSubject } from '@elastic/eui/lib/test'; diff --git a/x-pack/plugins/monitoring/public/components/no_data/explanations/exporters/exporters.test.js b/x-pack/plugins/monitoring/public/components/no_data/explanations/exporters/exporters.test.js index 9958c6671d30b..47dbf5f1ab586 100644 --- a/x-pack/plugins/monitoring/public/components/no_data/explanations/exporters/exporters.test.js +++ b/x-pack/plugins/monitoring/public/components/no_data/explanations/exporters/exporters.test.js @@ -6,7 +6,7 @@ */ import React from 'react'; -import { renderWithIntl } from '@kbn/test/jest'; +import { renderWithIntl } from '@kbn/test-jest-helpers'; import { ExplainExporters, ExplainExportersCloud } from './exporters'; jest.mock('../../../../legacy_shims', () => ({ diff --git a/x-pack/plugins/monitoring/public/components/no_data/explanations/plugin_enabled/plugin_enabled.test.js b/x-pack/plugins/monitoring/public/components/no_data/explanations/plugin_enabled/plugin_enabled.test.js index c28c7563e5974..dd57cd3bd1c50 100644 --- a/x-pack/plugins/monitoring/public/components/no_data/explanations/plugin_enabled/plugin_enabled.test.js +++ b/x-pack/plugins/monitoring/public/components/no_data/explanations/plugin_enabled/plugin_enabled.test.js @@ -6,7 +6,7 @@ */ import React from 'react'; -import { renderWithIntl } from '@kbn/test/jest'; +import { renderWithIntl } from '@kbn/test-jest-helpers'; import { ExplainPluginEnabled } from './plugin_enabled'; describe('ExplainPluginEnabled', () => { diff --git a/x-pack/plugins/monitoring/public/components/no_data/no_data.test.js b/x-pack/plugins/monitoring/public/components/no_data/no_data.test.js index 17ee5148e5d11..a522d01037603 100644 --- a/x-pack/plugins/monitoring/public/components/no_data/no_data.test.js +++ b/x-pack/plugins/monitoring/public/components/no_data/no_data.test.js @@ -6,7 +6,7 @@ */ import React from 'react'; -import { renderWithIntl } from '@kbn/test/jest'; +import { renderWithIntl } from '@kbn/test-jest-helpers'; import { NoData } from '.'; const enabler = {}; diff --git a/x-pack/plugins/monitoring/public/components/no_data/reasons/reason_found.test.js b/x-pack/plugins/monitoring/public/components/no_data/reasons/reason_found.test.js index 6cec326109308..96b0ceb4cb83d 100644 --- a/x-pack/plugins/monitoring/public/components/no_data/reasons/reason_found.test.js +++ b/x-pack/plugins/monitoring/public/components/no_data/reasons/reason_found.test.js @@ -6,7 +6,7 @@ */ import React from 'react'; -import { renderWithIntl } from '@kbn/test/jest'; +import { renderWithIntl } from '@kbn/test-jest-helpers'; import { ReasonFound } from '.'; jest.mock('../../../legacy_shims', () => ({ diff --git a/x-pack/plugins/monitoring/public/components/no_data/reasons/we_tried.test.js b/x-pack/plugins/monitoring/public/components/no_data/reasons/we_tried.test.js index 186676776021e..5fd3947c3bb1c 100644 --- a/x-pack/plugins/monitoring/public/components/no_data/reasons/we_tried.test.js +++ b/x-pack/plugins/monitoring/public/components/no_data/reasons/we_tried.test.js @@ -6,7 +6,7 @@ */ import React from 'react'; -import { renderWithIntl } from '@kbn/test/jest'; +import { renderWithIntl } from '@kbn/test-jest-helpers'; import { WeTried } from '.'; describe('WeTried', () => { diff --git a/x-pack/plugins/monitoring/public/components/page_loading/page_loading.test.js b/x-pack/plugins/monitoring/public/components/page_loading/page_loading.test.js index f7973231f41b0..07e3e89dce9a1 100644 --- a/x-pack/plugins/monitoring/public/components/page_loading/page_loading.test.js +++ b/x-pack/plugins/monitoring/public/components/page_loading/page_loading.test.js @@ -6,7 +6,7 @@ */ import React from 'react'; -import { renderWithIntl } from '@kbn/test/jest'; +import { renderWithIntl } from '@kbn/test-jest-helpers'; import { PageLoading } from '.'; describe('PageLoading', () => { diff --git a/x-pack/plugins/monitoring/public/components/summary_status/summary_status.test.js b/x-pack/plugins/monitoring/public/components/summary_status/summary_status.test.js index 1428418ad3705..dcb4821e1819a 100644 --- a/x-pack/plugins/monitoring/public/components/summary_status/summary_status.test.js +++ b/x-pack/plugins/monitoring/public/components/summary_status/summary_status.test.js @@ -6,7 +6,7 @@ */ import React from 'react'; -import { renderWithIntl } from '@kbn/test/jest'; +import { renderWithIntl } from '@kbn/test-jest-helpers'; import { SummaryStatus } from './summary_status'; describe('Summary Status Component', () => { diff --git a/x-pack/plugins/remote_clusters/__jest__/client_integration/add/remote_clusters_add.helpers.tsx b/x-pack/plugins/remote_clusters/__jest__/client_integration/add/remote_clusters_add.helpers.tsx index a47e6c023a161..a4debdc6ae964 100644 --- a/x-pack/plugins/remote_clusters/__jest__/client_integration/add/remote_clusters_add.helpers.tsx +++ b/x-pack/plugins/remote_clusters/__jest__/client_integration/add/remote_clusters_add.helpers.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { registerTestBed } from '@kbn/test/jest'; +import { registerTestBed } from '@kbn/test-jest-helpers'; import { RemoteClusterAdd } from '../../../public/application/sections'; import { createRemoteClustersStore } from '../../../public/application/store'; diff --git a/x-pack/plugins/remote_clusters/__jest__/client_integration/add/remote_clusters_add.test.ts b/x-pack/plugins/remote_clusters/__jest__/client_integration/add/remote_clusters_add.test.ts index 0727bc0c9ba2d..28332f71ca6ac 100644 --- a/x-pack/plugins/remote_clusters/__jest__/client_integration/add/remote_clusters_add.test.ts +++ b/x-pack/plugins/remote_clusters/__jest__/client_integration/add/remote_clusters_add.test.ts @@ -6,7 +6,7 @@ */ import { SinonFakeServer } from 'sinon'; -import { TestBed } from '@kbn/test/jest'; +import { TestBed } from '@kbn/test-jest-helpers'; import { act } from 'react-dom/test-utils'; import { setupEnvironment, RemoteClustersActions } from '../helpers'; diff --git a/x-pack/plugins/remote_clusters/__jest__/client_integration/edit/remote_clusters_edit.helpers.tsx b/x-pack/plugins/remote_clusters/__jest__/client_integration/edit/remote_clusters_edit.helpers.tsx index 2259396bf33f2..86f75c12424e7 100644 --- a/x-pack/plugins/remote_clusters/__jest__/client_integration/edit/remote_clusters_edit.helpers.tsx +++ b/x-pack/plugins/remote_clusters/__jest__/client_integration/edit/remote_clusters_edit.helpers.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed, TestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, TestBedConfig } from '@kbn/test-jest-helpers'; import React from 'react'; import { RemoteClusterEdit } from '../../../public/application/sections'; diff --git a/x-pack/plugins/remote_clusters/__jest__/client_integration/edit/remote_clusters_edit.test.tsx b/x-pack/plugins/remote_clusters/__jest__/client_integration/edit/remote_clusters_edit.test.tsx index 2913de94bc2dd..47aac3f924b96 100644 --- a/x-pack/plugins/remote_clusters/__jest__/client_integration/edit/remote_clusters_edit.test.tsx +++ b/x-pack/plugins/remote_clusters/__jest__/client_integration/edit/remote_clusters_edit.test.tsx @@ -6,7 +6,7 @@ */ import { act } from 'react-dom/test-utils'; -import { TestBed } from '@kbn/test/jest'; +import { TestBed } from '@kbn/test-jest-helpers'; import { RemoteClusterForm } from '../../../public/application/sections/components/remote_cluster_form'; import { RemoteClustersActions, setupEnvironment } from '../helpers'; diff --git a/x-pack/plugins/remote_clusters/__jest__/client_integration/helpers/index.ts b/x-pack/plugins/remote_clusters/__jest__/client_integration/helpers/index.ts index 4cfe1fb41a835..b2a7e2d90dc64 100644 --- a/x-pack/plugins/remote_clusters/__jest__/client_integration/helpers/index.ts +++ b/x-pack/plugins/remote_clusters/__jest__/client_integration/helpers/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -export { nextTick, getRandomString, findTestSubject } from '@kbn/test/jest'; +export { nextTick, getRandomString, findTestSubject } from '@kbn/test-jest-helpers'; export { setupEnvironment } from './setup_environment'; export type { RemoteClustersActions } from './remote_clusters_actions'; export { createRemoteClustersActions } from './remote_clusters_actions'; diff --git a/x-pack/plugins/remote_clusters/__jest__/client_integration/helpers/remote_clusters_actions.ts b/x-pack/plugins/remote_clusters/__jest__/client_integration/helpers/remote_clusters_actions.ts index ba0c424793838..3a2d4be3e060d 100644 --- a/x-pack/plugins/remote_clusters/__jest__/client_integration/helpers/remote_clusters_actions.ts +++ b/x-pack/plugins/remote_clusters/__jest__/client_integration/helpers/remote_clusters_actions.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { TestBed } from '@kbn/test/jest'; +import { TestBed } from '@kbn/test-jest-helpers'; import { act } from 'react-dom/test-utils'; export interface RemoteClustersActions { docsButtonExists: () => boolean; diff --git a/x-pack/plugins/remote_clusters/__jest__/client_integration/list/remote_clusters_list.helpers.js b/x-pack/plugins/remote_clusters/__jest__/client_integration/list/remote_clusters_list.helpers.js index d05ddbd1800e4..9aeef5d684f3f 100644 --- a/x-pack/plugins/remote_clusters/__jest__/client_integration/list/remote_clusters_list.helpers.js +++ b/x-pack/plugins/remote_clusters/__jest__/client_integration/list/remote_clusters_list.helpers.js @@ -7,7 +7,7 @@ import { act } from 'react-dom/test-utils'; -import { registerTestBed, findTestSubject } from '@kbn/test/jest'; +import { registerTestBed, findTestSubject } from '@kbn/test-jest-helpers'; import { RemoteClusterList } from '../../../public/application/sections/remote_cluster_list'; import { createRemoteClustersStore } from '../../../public/application/store'; diff --git a/x-pack/plugins/remote_clusters/fixtures/remote_cluster.js b/x-pack/plugins/remote_clusters/fixtures/remote_cluster.js index d6bbe99f7b5d7..d750636b76234 100644 --- a/x-pack/plugins/remote_clusters/fixtures/remote_cluster.js +++ b/x-pack/plugins/remote_clusters/fixtures/remote_cluster.js @@ -5,7 +5,7 @@ * 2.0. */ -import { getRandomString } from '@kbn/test/jest'; +import { getRandomString } from '@kbn/test-jest-helpers'; import { SNIFF_MODE } from '../common/constants'; diff --git a/x-pack/plugins/reporting/public/management/__test__/report_listing.test.helpers.tsx b/x-pack/plugins/reporting/public/management/__test__/report_listing.test.helpers.tsx index 3030994c5ed32..3200a3305ebcd 100644 --- a/x-pack/plugins/reporting/public/management/__test__/report_listing.test.helpers.tsx +++ b/x-pack/plugins/reporting/public/management/__test__/report_listing.test.helpers.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { registerTestBed } from '@kbn/test/jest'; +import { registerTestBed } from '@kbn/test-jest-helpers'; import { act } from 'react-dom/test-utils'; import { Observable } from 'rxjs'; import { SerializableRecord } from '@kbn/utility-types'; diff --git a/x-pack/plugins/reporting/public/share_context_menu/reporting_panel_content/reporting_panel_content.test.tsx b/x-pack/plugins/reporting/public/share_context_menu/reporting_panel_content/reporting_panel_content.test.tsx index ef3e9940238c1..82dfe8e167dfa 100644 --- a/x-pack/plugins/reporting/public/share_context_menu/reporting_panel_content/reporting_panel_content.test.tsx +++ b/x-pack/plugins/reporting/public/share_context_menu/reporting_panel_content/reporting_panel_content.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { httpServiceMock, notificationServiceMock, diff --git a/x-pack/plugins/rollup/fixtures/job.js b/x-pack/plugins/rollup/fixtures/job.js index 53c63e14c96cc..d0086d134c60b 100644 --- a/x-pack/plugins/rollup/fixtures/job.js +++ b/x-pack/plugins/rollup/fixtures/job.js @@ -5,7 +5,7 @@ * 2.0. */ -import { getRandomString } from '@kbn/test/jest'; +import { getRandomString } from '@kbn/test-jest-helpers'; const initialValues = { dateHistogramField: 'timestamp', diff --git a/x-pack/plugins/rollup/public/crud_app/sections/job_list/detail_panel/detail_panel.test.js b/x-pack/plugins/rollup/public/crud_app/sections/job_list/detail_panel/detail_panel.test.js index e1f9ec2b3a315..fa63639ef4d06 100644 --- a/x-pack/plugins/rollup/public/crud_app/sections/job_list/detail_panel/detail_panel.test.js +++ b/x-pack/plugins/rollup/public/crud_app/sections/job_list/detail_panel/detail_panel.test.js @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed } from '@kbn/test/jest'; +import { registerTestBed } from '@kbn/test-jest-helpers'; import { getJob } from '../../../../../fixtures'; import { rollupJobsStore } from '../../../store'; import { DetailPanel } from './detail_panel'; diff --git a/x-pack/plugins/rollup/public/crud_app/sections/job_list/job_list.test.js b/x-pack/plugins/rollup/public/crud_app/sections/job_list/job_list.test.js index b2c738a033b3c..ba82e3b9b9f5e 100644 --- a/x-pack/plugins/rollup/public/crud_app/sections/job_list/job_list.test.js +++ b/x-pack/plugins/rollup/public/crud_app/sections/job_list/job_list.test.js @@ -6,7 +6,7 @@ */ import React from 'react'; -import { registerTestBed } from '@kbn/test/jest'; +import { registerTestBed } from '@kbn/test-jest-helpers'; import { rollupJobsStore } from '../../store'; import { JobList } from './job_list'; diff --git a/x-pack/plugins/rollup/public/crud_app/sections/job_list/job_table/job_table.test.js b/x-pack/plugins/rollup/public/crud_app/sections/job_list/job_table/job_table.test.js index d52f3fa35a544..d9fbf796c64d6 100644 --- a/x-pack/plugins/rollup/public/crud_app/sections/job_list/job_table/job_table.test.js +++ b/x-pack/plugins/rollup/public/crud_app/sections/job_list/job_table/job_table.test.js @@ -7,7 +7,7 @@ import { Pager } from '@elastic/eui'; -import { registerTestBed } from '@kbn/test/jest'; +import { registerTestBed } from '@kbn/test-jest-helpers'; import { getJobs, jobCount } from '../../../../../fixtures'; import { rollupJobsStore } from '../../../store'; import { JobTable } from './job_table'; diff --git a/x-pack/plugins/rollup/public/test/client_integration/helpers/index.js b/x-pack/plugins/rollup/public/test/client_integration/helpers/index.js index ef5a191b994c6..c897eed6c477e 100644 --- a/x-pack/plugins/rollup/public/test/client_integration/helpers/index.js +++ b/x-pack/plugins/rollup/public/test/client_integration/helpers/index.js @@ -11,7 +11,7 @@ import { setup as jobCreateSetup } from './job_create.helpers'; import { setup as jobListSetup } from './job_list.helpers'; import { setup as jobCloneSetup } from './job_clone.helpers'; -export { getRandomString, findTestSubject } from '@kbn/test/jest'; +export { getRandomString, findTestSubject } from '@kbn/test-jest-helpers'; export { wrapComponent } from './setup_context'; diff --git a/x-pack/plugins/rollup/public/test/client_integration/helpers/job_clone.helpers.js b/x-pack/plugins/rollup/public/test/client_integration/helpers/job_clone.helpers.js index d81bdd3093300..613980868edbe 100644 --- a/x-pack/plugins/rollup/public/test/client_integration/helpers/job_clone.helpers.js +++ b/x-pack/plugins/rollup/public/test/client_integration/helpers/job_clone.helpers.js @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed } from '@kbn/test/jest'; +import { registerTestBed } from '@kbn/test-jest-helpers'; import { createRollupJobsStore } from '../../../crud_app/store'; import { JobCreate } from '../../../crud_app/sections'; import { JOB_TO_CLONE } from './constants'; diff --git a/x-pack/plugins/rollup/public/test/client_integration/helpers/job_create.helpers.js b/x-pack/plugins/rollup/public/test/client_integration/helpers/job_create.helpers.js index 36550d904fa39..92eb2bf62cc2f 100644 --- a/x-pack/plugins/rollup/public/test/client_integration/helpers/job_create.helpers.js +++ b/x-pack/plugins/rollup/public/test/client_integration/helpers/job_create.helpers.js @@ -7,7 +7,7 @@ import { act } from 'react-dom/test-utils'; -import { registerTestBed } from '@kbn/test/jest'; +import { registerTestBed } from '@kbn/test-jest-helpers'; import { rollupJobsStore } from '../../../crud_app/store'; import { JobCreate } from '../../../crud_app/sections'; diff --git a/x-pack/plugins/rollup/public/test/client_integration/helpers/job_list.helpers.js b/x-pack/plugins/rollup/public/test/client_integration/helpers/job_list.helpers.js index f4c59334b8875..5f64e0cfe34bf 100644 --- a/x-pack/plugins/rollup/public/test/client_integration/helpers/job_list.helpers.js +++ b/x-pack/plugins/rollup/public/test/client_integration/helpers/job_list.helpers.js @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed } from '@kbn/test/jest'; +import { registerTestBed } from '@kbn/test-jest-helpers'; import { registerRouter } from '../../../crud_app/services'; import { createRollupJobsStore } from '../../../crud_app/store'; import { JobList } from '../../../crud_app/sections/job_list'; diff --git a/x-pack/plugins/runtime_fields/public/test_utils.ts b/x-pack/plugins/runtime_fields/public/test_utils.ts index 1c052cd666e56..637ef68b1726d 100644 --- a/x-pack/plugins/runtime_fields/public/test_utils.ts +++ b/x-pack/plugins/runtime_fields/public/test_utils.ts @@ -5,5 +5,5 @@ * 2.0. */ -export type { TestBed } from '@kbn/test/jest'; -export { registerTestBed } from '@kbn/test/jest'; +export type { TestBed } from '@kbn/test-jest-helpers'; +export { registerTestBed } from '@kbn/test-jest-helpers'; diff --git a/x-pack/plugins/searchprofiler/public/application/components/empty_tree_placeholder/empty_tree_placeholder.test.tsx b/x-pack/plugins/searchprofiler/public/application/components/empty_tree_placeholder/empty_tree_placeholder.test.tsx index 91fda67046f93..007786722ca52 100644 --- a/x-pack/plugins/searchprofiler/public/application/components/empty_tree_placeholder/empty_tree_placeholder.test.tsx +++ b/x-pack/plugins/searchprofiler/public/application/components/empty_tree_placeholder/empty_tree_placeholder.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed } from '@kbn/test/jest'; +import { registerTestBed } from '@kbn/test-jest-helpers'; import { EmptyTreePlaceHolder } from '.'; describe('EmptyTreePlaceholder', () => { diff --git a/x-pack/plugins/searchprofiler/public/application/components/highlight_details_flyout/highlight_details_flyout.test.tsx b/x-pack/plugins/searchprofiler/public/application/components/highlight_details_flyout/highlight_details_flyout.test.tsx index ef93896e7fe3e..ac8df87086e57 100644 --- a/x-pack/plugins/searchprofiler/public/application/components/highlight_details_flyout/highlight_details_flyout.test.tsx +++ b/x-pack/plugins/searchprofiler/public/application/components/highlight_details_flyout/highlight_details_flyout.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed } from '@kbn/test/jest'; +import { registerTestBed } from '@kbn/test-jest-helpers'; import { HighlightDetailsFlyout, Props } from '.'; describe('Highlight Details Flyout', () => { diff --git a/x-pack/plugins/searchprofiler/public/application/components/license_warning_notice/license_warning_notice.test.ts b/x-pack/plugins/searchprofiler/public/application/components/license_warning_notice/license_warning_notice.test.ts index 27109c0527032..a4a1f8864e883 100644 --- a/x-pack/plugins/searchprofiler/public/application/components/license_warning_notice/license_warning_notice.test.ts +++ b/x-pack/plugins/searchprofiler/public/application/components/license_warning_notice/license_warning_notice.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed } from '@kbn/test/jest'; +import { registerTestBed } from '@kbn/test-jest-helpers'; import { LicenseWarningNotice } from './license_warning_notice'; diff --git a/x-pack/plugins/searchprofiler/public/application/components/profile_loading_placeholder/profile_loading_placeholder.test.tsx b/x-pack/plugins/searchprofiler/public/application/components/profile_loading_placeholder/profile_loading_placeholder.test.tsx index caa858c41d702..d6c7a0afbf38d 100644 --- a/x-pack/plugins/searchprofiler/public/application/components/profile_loading_placeholder/profile_loading_placeholder.test.tsx +++ b/x-pack/plugins/searchprofiler/public/application/components/profile_loading_placeholder/profile_loading_placeholder.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed } from '@kbn/test/jest'; +import { registerTestBed } from '@kbn/test-jest-helpers'; import { ProfileLoadingPlaceholder } from '.'; describe('Profile Loading Placeholder', () => { diff --git a/x-pack/plugins/searchprofiler/public/application/components/profile_query_editor/editor/editor.test.tsx b/x-pack/plugins/searchprofiler/public/application/components/profile_query_editor/editor/editor.test.tsx index 8e495e7d2c49e..f92e2b2a5167c 100644 --- a/x-pack/plugins/searchprofiler/public/application/components/profile_query_editor/editor/editor.test.tsx +++ b/x-pack/plugins/searchprofiler/public/application/components/profile_query_editor/editor/editor.test.tsx @@ -8,7 +8,7 @@ import 'brace'; import 'brace/mode/json'; -import { registerTestBed } from '@kbn/test/jest'; +import { registerTestBed } from '@kbn/test-jest-helpers'; import { Editor, Props } from './editor'; describe('Editor Component', () => { diff --git a/x-pack/plugins/searchprofiler/public/application/components/profile_tree/__jest__/profile_tree.test.tsx b/x-pack/plugins/searchprofiler/public/application/components/profile_tree/__jest__/profile_tree.test.tsx index fef3c2e46958f..64cd05f3fa0a5 100644 --- a/x-pack/plugins/searchprofiler/public/application/components/profile_tree/__jest__/profile_tree.test.tsx +++ b/x-pack/plugins/searchprofiler/public/application/components/profile_tree/__jest__/profile_tree.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed } from '@kbn/test/jest'; +import { registerTestBed } from '@kbn/test-jest-helpers'; import { searchResponse } from './fixtures/search_response'; import { ProfileTree, Props } from '../profile_tree'; diff --git a/x-pack/plugins/searchprofiler/public/application/components/searchprofiler_tabs/searchprofiler_tabs.test.ts b/x-pack/plugins/searchprofiler/public/application/components/searchprofiler_tabs/searchprofiler_tabs.test.ts index 4cc7b0e5db966..daba54949efe8 100644 --- a/x-pack/plugins/searchprofiler/public/application/components/searchprofiler_tabs/searchprofiler_tabs.test.ts +++ b/x-pack/plugins/searchprofiler/public/application/components/searchprofiler_tabs/searchprofiler_tabs.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed } from '@kbn/test/jest'; +import { registerTestBed } from '@kbn/test-jest-helpers'; import { SearchProfilerTabs, Props } from './searchprofiler_tabs'; diff --git a/x-pack/plugins/security/public/account_management/account_management_page.test.tsx b/x-pack/plugins/security/public/account_management/account_management_page.test.tsx index 4e9f1a6692eb9..fb73322655399 100644 --- a/x-pack/plugins/security/public/account_management/account_management_page.test.tsx +++ b/x-pack/plugins/security/public/account_management/account_management_page.test.tsx @@ -8,7 +8,7 @@ import { act } from '@testing-library/react'; import React from 'react'; -import { mountWithIntl, nextTick } from '@kbn/test/jest'; +import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; import { coreMock } from 'src/core/public/mocks'; import type { AuthenticatedUser } from '../../common/model'; diff --git a/x-pack/plugins/security/public/authentication/access_agreement/access_agreement_page.test.tsx b/x-pack/plugins/security/public/authentication/access_agreement/access_agreement_page.test.tsx index f6fcf36a12ee6..a7a43077fbc46 100644 --- a/x-pack/plugins/security/public/authentication/access_agreement/access_agreement_page.test.tsx +++ b/x-pack/plugins/security/public/authentication/access_agreement/access_agreement_page.test.tsx @@ -10,7 +10,7 @@ import { act } from '@testing-library/react'; import React from 'react'; import ReactMarkdown from 'react-markdown'; -import { findTestSubject, mountWithIntl, nextTick } from '@kbn/test/jest'; +import { findTestSubject, mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; import { coreMock } from 'src/core/public/mocks'; import { AccessAgreementPage } from './access_agreement_page'; diff --git a/x-pack/plugins/security/public/authentication/components/authentication_state_page/authentication_state_page.test.tsx b/x-pack/plugins/security/public/authentication/components/authentication_state_page/authentication_state_page.test.tsx index eba918e072110..f775d158a3ec0 100644 --- a/x-pack/plugins/security/public/authentication/components/authentication_state_page/authentication_state_page.test.tsx +++ b/x-pack/plugins/security/public/authentication/components/authentication_state_page/authentication_state_page.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { AuthenticationStatePage } from './authentication_state_page'; diff --git a/x-pack/plugins/security/public/authentication/logged_out/logged_out_page.test.tsx b/x-pack/plugins/security/public/authentication/logged_out/logged_out_page.test.tsx index 8647edd2ba06a..d21cf1bb5677c 100644 --- a/x-pack/plugins/security/public/authentication/logged_out/logged_out_page.test.tsx +++ b/x-pack/plugins/security/public/authentication/logged_out/logged_out_page.test.tsx @@ -8,7 +8,7 @@ import { EuiButton } from '@elastic/eui'; import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { coreMock } from 'src/core/public/mocks'; import { LoggedOutPage } from './logged_out_page'; diff --git a/x-pack/plugins/security/public/authentication/login/components/login_form/login_form.test.tsx b/x-pack/plugins/security/public/authentication/login/components/login_form/login_form.test.tsx index a9bbcaab74ab0..9de62907261c1 100644 --- a/x-pack/plugins/security/public/authentication/login/components/login_form/login_form.test.tsx +++ b/x-pack/plugins/security/public/authentication/login/components/login_form/login_form.test.tsx @@ -11,7 +11,7 @@ import type { ReactWrapper } from 'enzyme'; import React from 'react'; import ReactMarkdown from 'react-markdown'; -import { findTestSubject, mountWithIntl, nextTick, shallowWithIntl } from '@kbn/test/jest'; +import { findTestSubject, mountWithIntl, nextTick, shallowWithIntl } from '@kbn/test-jest-helpers'; import { coreMock } from 'src/core/public/mocks'; import { LoginForm, MessageType, PageMode } from './login_form'; diff --git a/x-pack/plugins/security/public/authentication/login/login_page.test.tsx b/x-pack/plugins/security/public/authentication/login/login_page.test.tsx index c01777a106490..6507355221259 100644 --- a/x-pack/plugins/security/public/authentication/login/login_page.test.tsx +++ b/x-pack/plugins/security/public/authentication/login/login_page.test.tsx @@ -10,7 +10,7 @@ import { act } from '@testing-library/react'; import { shallow } from 'enzyme'; import React from 'react'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { coreMock } from 'src/core/public/mocks'; import { AUTH_PROVIDER_HINT_QUERY_STRING_PARAMETER } from '../../../common/constants'; diff --git a/x-pack/plugins/security/public/authentication/overwritten_session/overwritten_session_page.test.tsx b/x-pack/plugins/security/public/authentication/overwritten_session/overwritten_session_page.test.tsx index 42915e841b3a7..66b2408338391 100644 --- a/x-pack/plugins/security/public/authentication/overwritten_session/overwritten_session_page.test.tsx +++ b/x-pack/plugins/security/public/authentication/overwritten_session/overwritten_session_page.test.tsx @@ -9,7 +9,7 @@ import { EuiButton } from '@elastic/eui'; import { act } from '@testing-library/react'; import React from 'react'; -import { mountWithIntl, nextTick } from '@kbn/test/jest'; +import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; import { coreMock } from 'src/core/public/mocks'; import { mockAuthenticatedUser } from '../../../common/model/authenticated_user.mock'; diff --git a/x-pack/plugins/security/public/management/role_combo_box/role_combo_box.test.tsx b/x-pack/plugins/security/public/management/role_combo_box/role_combo_box.test.tsx index 3abcc07042e82..bde0980613b22 100644 --- a/x-pack/plugins/security/public/management/role_combo_box/role_combo_box.test.tsx +++ b/x-pack/plugins/security/public/management/role_combo_box/role_combo_box.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { RoleComboBox } from './role_combo_box'; diff --git a/x-pack/plugins/security/public/management/role_mappings/components/delete_provider/delete_provider.test.tsx b/x-pack/plugins/security/public/management/role_mappings/components/delete_provider/delete_provider.test.tsx index 17a6fb0bb84b3..55b6cbee4783a 100644 --- a/x-pack/plugins/security/public/management/role_mappings/components/delete_provider/delete_provider.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/components/delete_provider/delete_provider.test.tsx @@ -9,7 +9,7 @@ import { EuiConfirmModal } from '@elastic/eui'; import { act } from '@testing-library/react'; import React from 'react'; -import { findTestSubject, mountWithIntl, nextTick } from '@kbn/test/jest'; +import { findTestSubject, mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; import { coreMock } from 'src/core/public/mocks'; import type { RoleMapping } from '../../../../../common/model'; diff --git a/x-pack/plugins/security/public/management/role_mappings/components/section_loading/section_loading.test.tsx b/x-pack/plugins/security/public/management/role_mappings/components/section_loading/section_loading.test.tsx index e3e5929428164..92ce48cda0cd2 100644 --- a/x-pack/plugins/security/public/management/role_mappings/components/section_loading/section_loading.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/components/section_loading/section_loading.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { SectionLoading } from './section_loading'; diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/edit_role_mapping_page.test.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/edit_role_mapping_page.test.tsx index af7a2fb8d5240..083b742a21fe7 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/edit_role_mapping_page.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/edit_role_mapping_page.test.tsx @@ -8,11 +8,11 @@ // brace/ace uses the Worker class, which is not currently provided by JSDOM. // This is not required for the tests to pass, but it rather suppresses lengthy // warnings in the console which adds unnecessary noise to the test output. -import '@kbn/test/target_node/jest/utils/stub_web_worker'; +import '@kbn/test-jest-helpers/target_node/stub_web_worker'; import React from 'react'; -import { findTestSubject, mountWithIntl, nextTick } from '@kbn/test/jest'; +import { findTestSubject, mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; import type { PublicMethodsOf } from '@kbn/utility-types'; import { coreMock, scopedHistoryMock } from 'src/core/public/mocks'; import { KibanaContextProvider } from 'src/plugins/kibana_react/public'; diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/mapping_info_panel/mapping_info_panel.test.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/mapping_info_panel/mapping_info_panel.test.tsx index 3e18437a52ece..dd3bd25a745ca 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/mapping_info_panel/mapping_info_panel.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/mapping_info_panel/mapping_info_panel.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; -import { findTestSubject, mountWithIntl } from '@kbn/test/jest'; +import { findTestSubject, mountWithIntl } from '@kbn/test-jest-helpers'; import type { PublicMethodsOf } from '@kbn/utility-types'; import { coreMock } from 'src/core/public/mocks'; diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/add_role_template_button.test.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/add_role_template_button.test.tsx index a82b089f6630e..14cc6db062987 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/add_role_template_button.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/add_role_template_button.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; -import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; +import { mountWithIntl, shallowWithIntl } from '@kbn/test-jest-helpers'; import { AddRoleTemplateButton } from './add_role_template_button'; diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/role_selector.test.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/role_selector.test.tsx index 367fdaadca96e..6d34dbffded8b 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/role_selector.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/role_selector.test.tsx @@ -8,7 +8,7 @@ import { EuiComboBox } from '@elastic/eui'; import React from 'react'; -import { findTestSubject, mountWithIntl } from '@kbn/test/jest'; +import { findTestSubject, mountWithIntl } from '@kbn/test-jest-helpers'; import type { PublicMethodsOf } from '@kbn/utility-types'; import type { Role, RoleMapping } from '../../../../../common/model'; diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/role_template_editor.test.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/role_template_editor.test.tsx index 844d7b48321c5..c8df67e4f7b98 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/role_template_editor.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/role_template_editor.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; -import { findTestSubject, mountWithIntl } from '@kbn/test/jest'; +import { findTestSubject, mountWithIntl } from '@kbn/test-jest-helpers'; import { RoleTemplateEditor } from './role_template_editor'; diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/add_rule_button.test.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/add_rule_button.test.tsx index 399d2fc2d2c91..2ada7e9730cb0 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/add_rule_button.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/add_rule_button.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; -import { findTestSubject, mountWithIntl } from '@kbn/test/jest'; +import { findTestSubject, mountWithIntl } from '@kbn/test-jest-helpers'; import { AllRule, FieldRule } from '../../model'; import { AddRuleButton } from './add_rule_button'; diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/field_rule_editor.test.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/field_rule_editor.test.tsx index c81f3cc9da595..e2e41e90be824 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/field_rule_editor.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/field_rule_editor.test.tsx @@ -8,7 +8,7 @@ import type { ReactWrapper } from 'enzyme'; import React from 'react'; -import { findTestSubject, mountWithIntl } from '@kbn/test/jest'; +import { findTestSubject, mountWithIntl } from '@kbn/test-jest-helpers'; import { FieldRule } from '../../model'; import { FieldRuleEditor } from './field_rule_editor'; diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/json_rule_editor.test.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/json_rule_editor.test.tsx index 5a1122a88ac80..06437675a8270 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/json_rule_editor.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/json_rule_editor.test.tsx @@ -10,13 +10,13 @@ import 'brace/mode/json'; // brace/ace uses the Worker class, which is not currently provided by JSDOM. // This is not required for the tests to pass, but it rather suppresses lengthy // warnings in the console which adds unnecessary noise to the test output. -import '@kbn/test/target_node/jest/utils/stub_web_worker'; +import '@kbn/test-jest-helpers/target_node//stub_web_worker'; import React from 'react'; import { act } from 'react-dom/test-utils'; import type { monaco } from '@kbn/monaco'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { CodeEditorField } from 'src/plugins/kibana_react/public'; import { AllRule, AnyRule, ExceptAllRule, ExceptAnyRule, FieldRule } from '../../model'; diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_editor_panel.test.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_editor_panel.test.tsx index c0da0ae42a726..36b1390072408 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_editor_panel.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_editor_panel.test.tsx @@ -8,12 +8,12 @@ // brace/ace uses the Worker class, which is not currently provided by JSDOM. // This is not required for the tests to pass, but it rather suppresses lengthy // warnings in the console which adds unnecessary noise to the test output. -import '@kbn/test/target_node/jest/utils/stub_web_worker'; +import '@kbn/test-jest-helpers/target_node/stub_web_worker'; import { EuiErrorBoundary } from '@elastic/eui'; import React from 'react'; -import { findTestSubject, mountWithIntl } from '@kbn/test/jest'; +import { findTestSubject, mountWithIntl } from '@kbn/test-jest-helpers'; import { coreMock } from 'src/core/public/mocks'; import { KibanaContextProvider } from 'src/plugins/kibana_react/public'; diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_group_editor.test.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_group_editor.test.tsx index 8915bef293bc2..07a458b6a48b9 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_group_editor.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_group_editor.test.tsx @@ -8,7 +8,7 @@ import { EuiContextMenuItem } from '@elastic/eui'; import React from 'react'; -import { findTestSubject, mountWithIntl, nextTick, shallowWithIntl } from '@kbn/test/jest'; +import { findTestSubject, mountWithIntl, nextTick, shallowWithIntl } from '@kbn/test-jest-helpers'; import { AllRule, AnyRule, ExceptAnyRule, FieldRule } from '../../model'; import { AddRuleButton } from './add_rule_button'; diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/visual_rule_editor.test.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/visual_rule_editor.test.tsx index fc48e2e1c8c9e..9428e860acc09 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/visual_rule_editor.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/visual_rule_editor.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; -import { findTestSubject, mountWithIntl } from '@kbn/test/jest'; +import { findTestSubject, mountWithIntl } from '@kbn/test-jest-helpers'; import { AllRule, AnyRule, ExceptAllRule, ExceptAnyRule, FieldRule } from '../../model'; import { FieldRuleEditor } from './field_rule_editor'; diff --git a/x-pack/plugins/security/public/management/role_mappings/role_mappings_grid/role_mappings_grid_page.test.tsx b/x-pack/plugins/security/public/management/role_mappings/role_mappings_grid/role_mappings_grid_page.test.tsx index d9009d49b592b..3ac54cb7863fd 100644 --- a/x-pack/plugins/security/public/management/role_mappings/role_mappings_grid/role_mappings_grid_page.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/role_mappings_grid/role_mappings_grid_page.test.tsx @@ -9,7 +9,7 @@ import { EuiLink } from '@elastic/eui'; import { act } from '@testing-library/react'; import React from 'react'; -import { findTestSubject, mountWithIntl, nextTick } from '@kbn/test/jest'; +import { findTestSubject, mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; import type { CoreStart } from 'src/core/public'; import { coreMock, scopedHistoryMock } from 'src/core/public/mocks'; import { KibanaContextProvider } from 'src/plugins/kibana_react/public'; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/collapsible_panel/collapsible_panel.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/collapsible_panel/collapsible_panel.test.tsx index e37b440d2c021..65c30d0a723ea 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/collapsible_panel/collapsible_panel.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/collapsible_panel/collapsible_panel.test.tsx @@ -8,7 +8,7 @@ import { EuiLink } from '@elastic/eui'; import React from 'react'; -import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; +import { mountWithIntl, shallowWithIntl } from '@kbn/test-jest-helpers'; import { CollapsiblePanel } from './collapsible_panel'; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/delete_role_button.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/delete_role_button.test.tsx index 1faf514e71925..32d1e4fa6bafb 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/delete_role_button.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/delete_role_button.test.tsx @@ -8,7 +8,7 @@ import { EuiButtonEmpty, EuiConfirmModal } from '@elastic/eui'; import React from 'react'; -import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; +import { mountWithIntl, shallowWithIntl } from '@kbn/test-jest-helpers'; import { DeleteRoleButton } from './delete_role_button'; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.test.tsx index a99e08fd5a8a6..e7c3490d2ce13 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.test.tsx @@ -9,7 +9,7 @@ import { act } from '@testing-library/react'; import type { ReactWrapper } from 'enzyme'; import React from 'react'; -import { mountWithIntl, nextTick } from '@kbn/test/jest'; +import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; import type { Capabilities } from 'src/core/public'; import { coreMock, scopedHistoryMock } from 'src/core/public/mocks'; import { dataPluginMock } from 'src/plugins/data/public/mocks'; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/cluster_privileges.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/cluster_privileges.test.tsx index baeba5829562e..816e3f43c9ddc 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/cluster_privileges.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/cluster_privileges.test.tsx @@ -8,7 +8,7 @@ import { shallow } from 'enzyme'; import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import type { Role } from '../../../../../../common/model'; import { ClusterPrivileges } from './cluster_privileges'; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/elasticsearch_privileges.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/elasticsearch_privileges.test.tsx index 0ed9362956960..9585db6efda25 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/elasticsearch_privileges.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/elasticsearch_privileges.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; -import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; +import { mountWithIntl, shallowWithIntl } from '@kbn/test-jest-helpers'; import { coreMock } from 'src/core/public/mocks'; import { licenseMock } from '../../../../../../common/licensing/index.mock'; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/index_privilege_form.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/index_privilege_form.test.tsx index af701df39d8b1..d61fd1e17e33b 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/index_privilege_form.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/index_privilege_form.test.tsx @@ -8,7 +8,7 @@ import { EuiButtonIcon, EuiComboBox, EuiTextArea } from '@elastic/eui'; import React from 'react'; -import { findTestSubject, mountWithIntl, nextTick, shallowWithIntl } from '@kbn/test/jest'; +import { findTestSubject, mountWithIntl, nextTick, shallowWithIntl } from '@kbn/test-jest-helpers'; import { coreMock } from 'src/core/public/mocks'; import { diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/index_privileges.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/index_privileges.test.tsx index 03c949d90e30a..440d5132baa33 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/index_privileges.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/index_privileges.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; -import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; +import { mountWithIntl, shallowWithIntl } from '@kbn/test-jest-helpers'; import { coreMock } from 'src/core/public/mocks'; import { KibanaContextProvider } from '../../../../../../../../../src/plugins/kibana_react/public'; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/__fixtures__/index.ts b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/__fixtures__/index.ts index 3fab9d86e4dd3..c236bf15e3bb7 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/__fixtures__/index.ts +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/__fixtures__/index.ts @@ -9,7 +9,7 @@ import type { EuiButtonGroupProps, EuiCheckboxProps } from '@elastic/eui'; import { EuiAccordion, EuiButtonGroup, EuiCheckbox } from '@elastic/eui'; import type { ReactWrapper } from 'enzyme'; -import { findTestSubject } from '@kbn/test/jest'; +import { findTestSubject } from '@kbn/test-jest-helpers'; import { SubFeatureForm } from '../sub_feature_form'; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/feature_table.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/feature_table.test.tsx index 0cc4c4281b38f..4014a2a265abd 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/feature_table.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/feature_table.test.tsx @@ -8,7 +8,7 @@ import { EuiAccordion } from '@elastic/eui'; import React from 'react'; -import { findTestSubject, mountWithIntl } from '@kbn/test/jest'; +import { findTestSubject, mountWithIntl } from '@kbn/test-jest-helpers'; import type { KibanaFeature, SubFeatureConfig } from '../../../../../../../../features/public'; import type { Role } from '../../../../../../../common/model'; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/feature_table_expanded_row.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/feature_table_expanded_row.test.tsx index cd1db2f9ce486..0503ec1bf75f9 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/feature_table_expanded_row.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/feature_table_expanded_row.test.tsx @@ -8,7 +8,7 @@ import { act } from '@testing-library/react'; import React from 'react'; -import { findTestSubject, mountWithIntl } from '@kbn/test/jest'; +import { findTestSubject, mountWithIntl } from '@kbn/test-jest-helpers'; import type { Role } from '../../../../../../../common/model'; import { kibanaFeatures } from '../../../../__fixtures__/kibana_features'; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/sub_feature_form.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/sub_feature_form.test.tsx index d39d7acc6c3a1..c73dbb2616d2d 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/sub_feature_form.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/sub_feature_form.test.tsx @@ -9,7 +9,7 @@ import { EuiButtonGroup, EuiCheckbox } from '@elastic/eui'; import { act } from '@testing-library/react'; import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { KibanaFeature } from '../../../../../../../../features/public'; import type { Role } from '../../../../../../../common/model'; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table_cell/feature_table_cell.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table_cell/feature_table_cell.test.tsx index dcd2170325006..7052f724cd1cc 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table_cell/feature_table_cell.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table_cell/feature_table_cell.test.tsx @@ -8,7 +8,7 @@ import { EuiIconTip } from '@elastic/eui'; import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { createFeature } from '../../../../__fixtures__/kibana_features'; import { SecuredFeature } from '../../../../model'; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/__fixtures__/index.ts b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/__fixtures__/index.ts index 6f5c729784bb1..3a70ff5713bd9 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/__fixtures__/index.ts +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/__fixtures__/index.ts @@ -8,7 +8,7 @@ import { EuiTableRow } from '@elastic/eui'; import type { ReactWrapper } from 'enzyme'; -import { findTestSubject } from '@kbn/test/jest'; +import { findTestSubject } from '@kbn/test-jest-helpers'; import type { Role, RoleKibanaPrivilege } from '../../../../../../../../common/model'; import { FeatureTableCell } from '../../feature_table_cell'; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary.test.tsx index b23566019b31a..928a9f5d28fea 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary.test.tsx @@ -8,7 +8,7 @@ import { act } from '@testing-library/react'; import React from 'react'; -import { findTestSubject, mountWithIntl } from '@kbn/test/jest'; +import { findTestSubject, mountWithIntl } from '@kbn/test-jest-helpers'; import { coreMock } from 'src/core/public/mocks'; import { spacesManagerMock } from '../../../../../../../../spaces/public/spaces_manager/mocks'; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary_table.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary_table.test.tsx index 93ed2d000bb0e..0a3620aaa4114 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary_table.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary_table.test.tsx @@ -8,7 +8,7 @@ import { act } from '@testing-library/react'; import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { coreMock } from 'src/core/public/mocks'; import { spacesManagerMock } from '../../../../../../../../spaces/public/spaces_manager/mocks'; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/space_column_header.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/space_column_header.test.tsx index 77c8cdd69ec44..e3746e7fb1051 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/space_column_header.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/space_column_header.test.tsx @@ -8,7 +8,7 @@ import { act } from '@testing-library/react'; import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { coreMock } from 'src/core/public/mocks'; import { SpaceAvatarInternal } from '../../../../../../../../spaces/public/space_avatar/space_avatar_internal'; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_display.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_display.test.tsx index 8aa2b77f8fc12..c4400abba2da2 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_display.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_display.test.tsx @@ -8,7 +8,7 @@ import { EuiText } from '@elastic/eui'; import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { PrivilegeDisplay } from './privilege_display'; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_form.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_form.test.tsx index 7976d76ff8d86..8eaae663e7e80 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_form.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_form.test.tsx @@ -8,7 +8,7 @@ import { EuiButtonGroup } from '@elastic/eui'; import React from 'react'; -import { findTestSubject, mountWithIntl } from '@kbn/test/jest'; +import { findTestSubject, mountWithIntl } from '@kbn/test-jest-helpers'; import type { Space } from '../../../../../../../../spaces/public'; import type { Role } from '../../../../../../../common/model'; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_table.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_table.test.tsx index 6f00df3a4ee7b..9b86ad54c4d35 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_table.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_table.test.tsx @@ -9,7 +9,7 @@ import { EuiBadge, EuiInMemoryTable } from '@elastic/eui'; import type { ReactWrapper } from 'enzyme'; import React from 'react'; -import { findTestSubject, mountWithIntl } from '@kbn/test/jest'; +import { findTestSubject, mountWithIntl } from '@kbn/test-jest-helpers'; import { KibanaFeature } from '../../../../../../../../features/public'; import type { Role, RoleKibanaPrivilege } from '../../../../../../../common/model'; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/space_aware_privilege_section.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/space_aware_privilege_section.test.tsx index ebc82f28f5426..beaaf783f2f4d 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/space_aware_privilege_section.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/space_aware_privilege_section.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; -import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; +import { mountWithIntl, shallowWithIntl } from '@kbn/test-jest-helpers'; import { kibanaFeatures } from '../../../../__fixtures__/kibana_features'; import { createKibanaPrivileges } from '../../../../__fixtures__/kibana_privileges'; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/spaces_popover_list/spaces_popover_list.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/spaces_popover_list/spaces_popover_list.test.tsx index 031df26eb38f7..572822db3ca2a 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/spaces_popover_list/spaces_popover_list.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/spaces_popover_list/spaces_popover_list.test.tsx @@ -15,7 +15,7 @@ import { import { act } from '@testing-library/react'; import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { coreMock } from 'src/core/public/mocks'; import type { Space } from '../../../../../../spaces/public'; diff --git a/x-pack/plugins/security/public/management/roles/roles_grid/roles_grid_page.test.tsx b/x-pack/plugins/security/public/management/roles/roles_grid/roles_grid_page.test.tsx index aa507cf823eff..7041a61a850d0 100644 --- a/x-pack/plugins/security/public/management/roles/roles_grid/roles_grid_page.test.tsx +++ b/x-pack/plugins/security/public/management/roles/roles_grid/roles_grid_page.test.tsx @@ -9,7 +9,7 @@ import { EuiBasicTable, EuiIcon } from '@elastic/eui'; import type { ReactWrapper } from 'enzyme'; import React from 'react'; -import { findTestSubject, mountWithIntl } from '@kbn/test/jest'; +import { findTestSubject, mountWithIntl } from '@kbn/test-jest-helpers'; import type { PublicMethodsOf } from '@kbn/utility-types'; import { coreMock, scopedHistoryMock } from 'src/core/public/mocks'; diff --git a/x-pack/plugins/security/public/management/users/components/change_password_form/change_password_form.test.tsx b/x-pack/plugins/security/public/management/users/components/change_password_form/change_password_form.test.tsx index 3d8c95d52f505..cf1959f8a389f 100644 --- a/x-pack/plugins/security/public/management/users/components/change_password_form/change_password_form.test.tsx +++ b/x-pack/plugins/security/public/management/users/components/change_password_form/change_password_form.test.tsx @@ -9,7 +9,7 @@ import { EuiFieldPassword } from '@elastic/eui'; import type { ReactWrapper } from 'enzyme'; import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { coreMock } from 'src/core/public/mocks'; import type { User } from '../../../../../common/model'; diff --git a/x-pack/plugins/security/public/management/users/components/confirm_delete_users/confirm_delete_users.test.tsx b/x-pack/plugins/security/public/management/users/components/confirm_delete_users/confirm_delete_users.test.tsx index 5ce22b42e624f..2668050645f33 100644 --- a/x-pack/plugins/security/public/management/users/components/confirm_delete_users/confirm_delete_users.test.tsx +++ b/x-pack/plugins/security/public/management/users/components/confirm_delete_users/confirm_delete_users.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { coreMock } from 'src/core/public/mocks'; import { userAPIClientMock } from '../../index.mock'; diff --git a/x-pack/plugins/security/public/management/users/users_grid/users_grid_page.test.tsx b/x-pack/plugins/security/public/management/users/users_grid/users_grid_page.test.tsx index b340a915bc054..898fec5709c56 100644 --- a/x-pack/plugins/security/public/management/users/users_grid/users_grid_page.test.tsx +++ b/x-pack/plugins/security/public/management/users/users_grid/users_grid_page.test.tsx @@ -10,7 +10,7 @@ import type { ReactWrapper } from 'enzyme'; import type { LocationDescriptorObject } from 'history'; import React from 'react'; -import { findTestSubject, mountWithIntl, nextTick } from '@kbn/test/jest'; +import { findTestSubject, mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; import type { CoreStart, ScopedHistory } from 'src/core/public'; import { coreMock, scopedHistoryMock } from 'src/core/public/mocks'; diff --git a/x-pack/plugins/security/public/nav_control/nav_control_component.test.tsx b/x-pack/plugins/security/public/nav_control/nav_control_component.test.tsx index adaca23be5dae..be74cca3d2671 100644 --- a/x-pack/plugins/security/public/nav_control/nav_control_component.test.tsx +++ b/x-pack/plugins/security/public/nav_control/nav_control_component.test.tsx @@ -9,7 +9,7 @@ import { EuiContextMenuItem, EuiHeaderSectionItemButton, EuiPopover } from '@ela import React from 'react'; import { BehaviorSubject } from 'rxjs'; -import { findTestSubject, mountWithIntl, nextTick, shallowWithIntl } from '@kbn/test/jest'; +import { findTestSubject, mountWithIntl, nextTick, shallowWithIntl } from '@kbn/test-jest-helpers'; import type { AuthenticatedUser } from '../../common/model'; import { mockAuthenticatedUser } from '../../common/model/authenticated_user.mock'; diff --git a/x-pack/plugins/security/public/nav_control/nav_control_service.test.ts b/x-pack/plugins/security/public/nav_control/nav_control_service.test.ts index f19b88dd91c34..21352f16d2354 100644 --- a/x-pack/plugins/security/public/nav_control/nav_control_service.test.ts +++ b/x-pack/plugins/security/public/nav_control/nav_control_service.test.ts @@ -7,7 +7,7 @@ import { BehaviorSubject } from 'rxjs'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { coreMock } from 'src/core/public/mocks'; import type { ILicense } from '../../../licensing/public'; diff --git a/x-pack/plugins/security/public/security_checkup/security_checkup_service.test.ts b/x-pack/plugins/security/public/security_checkup/security_checkup_service.test.ts index 1c4a15a8cfb93..b71d42fb08adc 100644 --- a/x-pack/plugins/security/public/security_checkup/security_checkup_service.test.ts +++ b/x-pack/plugins/security/public/security_checkup/security_checkup_service.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import type { DocLinksStart } from 'src/core/public'; import { coreMock } from 'src/core/public/mocks'; diff --git a/x-pack/plugins/security/server/authorization/authorization_service.test.ts b/x-pack/plugins/security/server/authorization/authorization_service.test.ts index ff6f510f64b28..61ca8423fc626 100644 --- a/x-pack/plugins/security/server/authorization/authorization_service.test.ts +++ b/x-pack/plugins/security/server/authorization/authorization_service.test.ts @@ -7,7 +7,7 @@ import { Subject } from 'rxjs'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { coreMock, elasticsearchServiceMock, loggingSystemMock } from 'src/core/server/mocks'; // Note: this import must be before other relative imports for the mocks to work as intended. diff --git a/x-pack/plugins/security/server/elasticsearch/elasticsearch_service.test.ts b/x-pack/plugins/security/server/elasticsearch/elasticsearch_service.test.ts index 65fe1de0c962c..0cbf04aac4f58 100644 --- a/x-pack/plugins/security/server/elasticsearch/elasticsearch_service.test.ts +++ b/x-pack/plugins/security/server/elasticsearch/elasticsearch_service.test.ts @@ -7,7 +7,7 @@ import { BehaviorSubject } from 'rxjs'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import type { CoreStatus } from 'src/core/server'; import { ServiceStatusLevels } from 'src/core/server'; import { coreMock, loggingSystemMock } from 'src/core/server/mocks'; diff --git a/x-pack/plugins/security/server/session_management/session_management_service.test.ts b/x-pack/plugins/security/server/session_management/session_management_service.test.ts index 100d0b30082c6..6570dca0801da 100644 --- a/x-pack/plugins/security/server/session_management/session_management_service.test.ts +++ b/x-pack/plugins/security/server/session_management/session_management_service.test.ts @@ -7,7 +7,7 @@ import { Subject } from 'rxjs'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { coreMock, elasticsearchServiceMock, loggingSystemMock } from 'src/core/server/mocks'; import type { diff --git a/x-pack/plugins/security_solution/public/common/components/empty_value/empty_value.test.tsx b/x-pack/plugins/security_solution/public/common/components/empty_value/empty_value.test.tsx index 8bf2bba491051..c455ed1953c28 100644 --- a/x-pack/plugins/security_solution/public/common/components/empty_value/empty_value.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/empty_value/empty_value.test.tsx @@ -8,7 +8,7 @@ import { mount, shallow } from 'enzyme'; import React from 'react'; import { ThemeProvider } from 'styled-components'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { defaultToEmptyTag, diff --git a/x-pack/plugins/security_solution/public/common/components/exceptions/error_callout.test.tsx b/x-pack/plugins/security_solution/public/common/components/exceptions/error_callout.test.tsx index 531ad1318e0e1..6c3dba5f2e22b 100644 --- a/x-pack/plugins/security_solution/public/common/components/exceptions/error_callout.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/exceptions/error_callout.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { coreMock } from '../../../../../../../src/core/public/mocks'; import { getListMock } from '../../../../common/detection_engine/schemas/types/lists.mock'; diff --git a/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/exceptions_utility.test.tsx b/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/exceptions_utility.test.tsx index 9bbd490f1ed16..562c6a7250a5d 100644 --- a/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/exceptions_utility.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/exceptions_utility.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { ThemeProvider } from 'styled-components'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { ExceptionsViewerUtility } from './exceptions_utility'; import { getMockTheme } from '../../../lib/kibana/kibana_react.mock'; diff --git a/x-pack/plugins/security_solution/public/common/components/links/index.test.tsx b/x-pack/plugins/security_solution/public/common/components/links/index.test.tsx index 0c077aaea81a8..97f93b9732c02 100644 --- a/x-pack/plugins/security_solution/public/common/components/links/index.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/links/index.test.tsx @@ -8,7 +8,7 @@ import { mount, shallow, ReactWrapper, ShallowWrapper } from 'enzyme'; import React from 'react'; import { removeExternalLinkText } from '@kbn/securitysolution-io-ts-utils'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { encodeIpv6 } from '../../lib/helpers'; import { useUiSetting$ } from '../../lib/kibana'; diff --git a/x-pack/plugins/security_solution/public/common/components/ml_popover/ml_popover.test.tsx b/x-pack/plugins/security_solution/public/common/components/ml_popover/ml_popover.test.tsx index a3d6cb50bef57..ebd1c0c4df109 100644 --- a/x-pack/plugins/security_solution/public/common/components/ml_popover/ml_popover.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/ml_popover/ml_popover.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { MlPopover } from './ml_popover'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/delete_timeline_modal/delete_timeline_modal.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/delete_timeline_modal/delete_timeline_modal.test.tsx index c130ea4c96814..1e6a4b15bf124 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/delete_timeline_modal/delete_timeline_modal.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/delete_timeline_modal/delete_timeline_modal.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { useParams } from 'react-router-dom'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/delete_timeline_modal/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/delete_timeline_modal/index.test.tsx index 54b405feeb176..6a9d4a6bbdbe8 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/delete_timeline_modal/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/delete_timeline_modal/index.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { useParams } from 'react-router-dom'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/note_previews/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/note_previews/index.test.tsx index 607bccdbc039d..e00a23261e747 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/note_previews/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/note_previews/index.test.tsx @@ -7,7 +7,7 @@ import { cloneDeep } from 'lodash/fp'; import moment from 'moment'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import '../../../../common/mock/formatted_relative'; import { useDeepEqualSelector } from '../../../../common/hooks/use_selector'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/open_timeline.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/open_timeline.test.tsx index a215f02863123..24683cfdab548 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/open_timeline.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/open_timeline.test.tsx @@ -6,7 +6,7 @@ */ import { cloneDeep } from 'lodash/fp'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { ThemeProvider } from 'styled-components'; import { waitFor } from '@testing-library/react'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/open_timeline_modal/open_timeline_modal_body.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/open_timeline_modal/open_timeline_modal_body.test.tsx index 794cd275528e4..e2184aaaec773 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/open_timeline_modal/open_timeline_modal_body.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/open_timeline_modal/open_timeline_modal_body.test.tsx @@ -6,7 +6,7 @@ */ import { cloneDeep } from 'lodash/fp'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { ThemeProvider } from 'styled-components'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/search_row/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/search_row/index.test.tsx index 1c650b0ae0a11..55d230d118e25 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/search_row/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/search_row/index.test.tsx @@ -6,7 +6,7 @@ */ import { EuiFilterButtonProps } from '@elastic/eui'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { ThemeProvider } from 'styled-components'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/timelines_table/actions_columns.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/timelines_table/actions_columns.test.tsx index 2a77f872117f6..925ea396b7fa0 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/timelines_table/actions_columns.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/timelines_table/actions_columns.test.tsx @@ -7,7 +7,7 @@ import { EuiButtonIconProps } from '@elastic/eui'; import { cloneDeep, omit } from 'lodash/fp'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { ThemeProvider } from 'styled-components'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/timelines_table/common_columns.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/timelines_table/common_columns.test.tsx index bdb55aaf20969..5b17994a64530 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/timelines_table/common_columns.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/timelines_table/common_columns.test.tsx @@ -9,7 +9,7 @@ import { EuiButtonIconProps } from '@elastic/eui'; import { cloneDeep, omit } from 'lodash/fp'; import React from 'react'; import { ThemeProvider } from 'styled-components'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import '../../../../common/mock/match_media'; import '../../../../common/mock/formatted_relative'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/timelines_table/extended_columns.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/timelines_table/extended_columns.test.tsx index e8960d2e0ad93..89331ca8e33bf 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/timelines_table/extended_columns.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/timelines_table/extended_columns.test.tsx @@ -6,7 +6,7 @@ */ import { cloneDeep, omit } from 'lodash/fp'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { ThemeProvider } from 'styled-components'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/timelines_table/icon_header_columns.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/timelines_table/icon_header_columns.test.tsx index a92d3a4eac4b0..01e9c588f0ef5 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/timelines_table/icon_header_columns.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/timelines_table/icon_header_columns.test.tsx @@ -6,7 +6,7 @@ */ import { cloneDeep, omit } from 'lodash/fp'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { ThemeProvider } from 'styled-components'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/timelines_table/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/timelines_table/index.test.tsx index c1aecd4a33825..55de25ff283e3 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/timelines_table/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/timelines_table/index.test.tsx @@ -6,7 +6,7 @@ */ import { cloneDeep } from 'lodash/fp'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { ThemeProvider } from 'styled-components'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/title_row/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/title_row/index.test.tsx index a94777d0e573b..d46cad3c43a98 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/title_row/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/title_row/index.test.tsx @@ -6,7 +6,7 @@ */ import { EuiButtonProps } from '@elastic/eui'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { ThemeProvider } from 'styled-components'; diff --git a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/home.helpers.ts b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/home.helpers.ts index 1e16fa2a40129..45b31a19693b7 100644 --- a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/home.helpers.ts +++ b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/home.helpers.ts @@ -13,7 +13,7 @@ import { TestBed, AsyncTestBedConfig, delay, -} from '@kbn/test/jest'; +} from '@kbn/test-jest-helpers'; import { SnapshotRestoreHome } from '../../../public/application/sections/home/home'; import { BASE_PATH } from '../../../public/application/constants'; import { WithAppDependencies } from './setup_environment'; diff --git a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/index.ts b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/index.ts index fdf8ea8d83868..51c41bc49bc3d 100644 --- a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/index.ts +++ b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/index.ts @@ -14,8 +14,8 @@ import { setup as policyEditSetup } from './policy_edit.helpers'; import { setup as restoreSnapshotSetup } from './restore_snapshot.helpers'; import { setup as snapshotListSetup } from './snapshot_list.helpers'; -export type { TestBed } from '@kbn/test/jest'; -export { nextTick, getRandomString, findTestSubject, delay } from '@kbn/test/jest'; +export type { TestBed } from '@kbn/test-jest-helpers'; +export { nextTick, getRandomString, findTestSubject, delay } from '@kbn/test-jest-helpers'; export { setupEnvironment } from './setup_environment'; diff --git a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_add.helpers.ts b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_add.helpers.ts index a6e7c4a4c1056..d921b96781d0c 100644 --- a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_add.helpers.ts +++ b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_add.helpers.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed, AsyncTestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, AsyncTestBedConfig } from '@kbn/test-jest-helpers'; import { PolicyAdd } from '../../../public/application/sections/policy_add'; import { formSetup, PolicyFormTestSubjects } from './policy_form.helpers'; import { WithAppDependencies } from './setup_environment'; diff --git a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_edit.helpers.ts b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_edit.helpers.ts index 2014d22ffbfbc..461351e744125 100644 --- a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_edit.helpers.ts +++ b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_edit.helpers.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed, AsyncTestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, AsyncTestBedConfig } from '@kbn/test-jest-helpers'; import { PolicyEdit } from '../../../public/application/sections/policy_edit'; import { WithAppDependencies } from './setup_environment'; import { POLICY_NAME } from './constant'; diff --git a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_form.helpers.ts b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_form.helpers.ts index f097f6185fc7c..c776a22ef9868 100644 --- a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_form.helpers.ts +++ b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_form.helpers.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { TestBed, SetupFunc } from '@kbn/test/jest'; +import { TestBed, SetupFunc } from '@kbn/test-jest-helpers'; export interface PolicyFormTestBed extends TestBed { actions: { diff --git a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/repository_add.helpers.ts b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/repository_add.helpers.ts index b369b20c122eb..c6460078482bf 100644 --- a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/repository_add.helpers.ts +++ b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/repository_add.helpers.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed, TestBed } from '@kbn/test/jest'; +import { registerTestBed, TestBed } from '@kbn/test-jest-helpers'; import { RepositoryType } from '../../../common/types'; import { RepositoryAdd } from '../../../public/application/sections/repository_add'; import { WithAppDependencies } from './setup_environment'; diff --git a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/repository_edit.helpers.ts b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/repository_edit.helpers.ts index f0563f2831a98..275c216d70664 100644 --- a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/repository_edit.helpers.ts +++ b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/repository_edit.helpers.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed, AsyncTestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, AsyncTestBedConfig } from '@kbn/test-jest-helpers'; import { RepositoryEdit } from '../../../public/application/sections/repository_edit'; import { WithAppDependencies } from './setup_environment'; import { REPOSITORY_NAME } from './constant'; diff --git a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/restore_snapshot.helpers.ts b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/restore_snapshot.helpers.ts index 123ae0cbb1c2e..86c93a6811bd4 100644 --- a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/restore_snapshot.helpers.ts +++ b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/restore_snapshot.helpers.ts @@ -6,7 +6,7 @@ */ import { act } from 'react-dom/test-utils'; -import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test-jest-helpers'; import { RestoreSnapshot } from '../../../public/application/sections/restore_snapshot'; import { WithAppDependencies } from './setup_environment'; diff --git a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/snapshot_list.helpers.ts b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/snapshot_list.helpers.ts index 176e5714f1308..261976623144b 100644 --- a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/snapshot_list.helpers.ts +++ b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/snapshot_list.helpers.ts @@ -6,7 +6,7 @@ */ import { act } from 'react-dom/test-utils'; -import { TestBedConfig, registerTestBed, TestBed } from '@kbn/test/jest'; +import { TestBedConfig, registerTestBed, TestBed } from '@kbn/test-jest-helpers'; import { BASE_PATH } from '../../../public/application/constants'; import { SnapshotList } from '../../../public/application/sections/home/snapshot_list'; diff --git a/x-pack/plugins/snapshot_restore/test/fixtures/policy.ts b/x-pack/plugins/snapshot_restore/test/fixtures/policy.ts index 873d36fcc656e..66d5b9557fae2 100644 --- a/x-pack/plugins/snapshot_restore/test/fixtures/policy.ts +++ b/x-pack/plugins/snapshot_restore/test/fixtures/policy.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { getRandomString, getRandomNumber } from '@kbn/test/jest'; +import { getRandomString, getRandomNumber } from '@kbn/test-jest-helpers'; import { SlmPolicy } from '../../common/types'; import { DEFAULT_POLICY_SCHEDULE } from '../../public/application/constants'; diff --git a/x-pack/plugins/snapshot_restore/test/fixtures/repository.ts b/x-pack/plugins/snapshot_restore/test/fixtures/repository.ts index b906a657f1ad7..16f2bea61bc28 100644 --- a/x-pack/plugins/snapshot_restore/test/fixtures/repository.ts +++ b/x-pack/plugins/snapshot_restore/test/fixtures/repository.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { getRandomString } from '@kbn/test/jest'; +import { getRandomString } from '@kbn/test-jest-helpers'; import { RepositoryType } from '../../common/types'; const defaultSettings: any = { chunkSize: '10mb', location: '/tmp/es-backups' }; diff --git a/x-pack/plugins/snapshot_restore/test/fixtures/snapshot.ts b/x-pack/plugins/snapshot_restore/test/fixtures/snapshot.ts index 8b385b5e83006..e7fad7f4a291f 100644 --- a/x-pack/plugins/snapshot_restore/test/fixtures/snapshot.ts +++ b/x-pack/plugins/snapshot_restore/test/fixtures/snapshot.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { getRandomString, getRandomNumber } from '@kbn/test/jest'; +import { getRandomString, getRandomNumber } from '@kbn/test-jest-helpers'; export const getSnapshot = ({ repository = 'my-repo', diff --git a/x-pack/plugins/spaces/public/advanced_settings/components/advanced_settings_subtitle/advanced_settings_subtitle.test.tsx b/x-pack/plugins/spaces/public/advanced_settings/components/advanced_settings_subtitle/advanced_settings_subtitle.test.tsx index 6e215b20e4f2a..7352e769f7e55 100644 --- a/x-pack/plugins/spaces/public/advanced_settings/components/advanced_settings_subtitle/advanced_settings_subtitle.test.tsx +++ b/x-pack/plugins/spaces/public/advanced_settings/components/advanced_settings_subtitle/advanced_settings_subtitle.test.tsx @@ -9,7 +9,7 @@ import { EuiCallOut } from '@elastic/eui'; import { act } from '@testing-library/react'; import React from 'react'; -import { mountWithIntl, nextTick } from '@kbn/test/jest'; +import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; import { AdvancedSettingsSubtitle } from './advanced_settings_subtitle'; diff --git a/x-pack/plugins/spaces/public/advanced_settings/components/advanced_settings_title/advanced_settings_title.test.tsx b/x-pack/plugins/spaces/public/advanced_settings/components/advanced_settings_title/advanced_settings_title.test.tsx index 95dd62a6680a6..e8b6766411d0c 100644 --- a/x-pack/plugins/spaces/public/advanced_settings/components/advanced_settings_title/advanced_settings_title.test.tsx +++ b/x-pack/plugins/spaces/public/advanced_settings/components/advanced_settings_title/advanced_settings_title.test.tsx @@ -8,7 +8,7 @@ import { act } from '@testing-library/react'; import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { SpaceAvatarInternal } from '../../../space_avatar/space_avatar_internal'; import { AdvancedSettingsTitle } from './advanced_settings_title'; diff --git a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_mode_control.test.tsx b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_mode_control.test.tsx index 9c69b172751cf..a9da59c37739d 100644 --- a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_mode_control.test.tsx +++ b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_mode_control.test.tsx @@ -8,7 +8,7 @@ import type { ReactWrapper } from 'enzyme'; import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import type { CopyModeControlProps } from './copy_mode_control'; import { CopyModeControl } from './copy_mode_control'; diff --git a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout_internal.test.tsx b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout_internal.test.tsx index a9768bea9d1ed..858fddaf4698b 100644 --- a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout_internal.test.tsx +++ b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout_internal.test.tsx @@ -10,7 +10,7 @@ import Boom from '@hapi/boom'; import { act } from '@testing-library/react'; import React from 'react'; -import { findTestSubject, mountWithIntl, nextTick } from '@kbn/test/jest'; +import { findTestSubject, mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; import { coreMock } from 'src/core/public/mocks'; import type { Space } from '../../../common'; diff --git a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/resolve_all_conflicts.test.tsx b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/resolve_all_conflicts.test.tsx index 96fe78e237a80..ad183196039c6 100644 --- a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/resolve_all_conflicts.test.tsx +++ b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/resolve_all_conflicts.test.tsx @@ -9,7 +9,7 @@ import { act } from '@testing-library/react'; import type { ReactWrapper } from 'enzyme'; import React from 'react'; -import { findTestSubject, mountWithIntl, nextTick, shallowWithIntl } from '@kbn/test/jest'; +import { findTestSubject, mountWithIntl, nextTick, shallowWithIntl } from '@kbn/test-jest-helpers'; import type { SummarizedCopyToSpaceResult } from '../lib'; import type { ImportRetry } from '../types'; diff --git a/x-pack/plugins/spaces/public/legacy_urls/components/legacy_url_conflict_internal.test.tsx b/x-pack/plugins/spaces/public/legacy_urls/components/legacy_url_conflict_internal.test.tsx index b999ae961d0f1..5f4f1f845717a 100644 --- a/x-pack/plugins/spaces/public/legacy_urls/components/legacy_url_conflict_internal.test.tsx +++ b/x-pack/plugins/spaces/public/legacy_urls/components/legacy_url_conflict_internal.test.tsx @@ -10,7 +10,7 @@ import { act } from '@testing-library/react'; import React from 'react'; import { BehaviorSubject } from 'rxjs'; -import { findTestSubject, mountWithIntl } from '@kbn/test/jest'; +import { findTestSubject, mountWithIntl } from '@kbn/test-jest-helpers'; import { coreMock } from 'src/core/public/mocks'; import { LegacyUrlConflictInternal } from './legacy_url_conflict_internal'; diff --git a/x-pack/plugins/spaces/public/management/components/confirm_delete_modal/confirm_delete_modal.test.tsx b/x-pack/plugins/spaces/public/management/components/confirm_delete_modal/confirm_delete_modal.test.tsx index 59c7dde71aedb..4b1ad8a6fe01f 100644 --- a/x-pack/plugins/spaces/public/management/components/confirm_delete_modal/confirm_delete_modal.test.tsx +++ b/x-pack/plugins/spaces/public/management/components/confirm_delete_modal/confirm_delete_modal.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { act } from 'react-dom/test-utils'; -import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; +import { mountWithIntl, shallowWithIntl } from '@kbn/test-jest-helpers'; import { spacesManagerMock } from '../../../spaces_manager/mocks'; import { ConfirmDeleteModal } from './confirm_delete_modal'; diff --git a/x-pack/plugins/spaces/public/management/components/unauthorized_prompt/unauthorized_prompt.test.tsx b/x-pack/plugins/spaces/public/management/components/unauthorized_prompt/unauthorized_prompt.test.tsx index 0f26c69cac2be..6a491e5303149 100644 --- a/x-pack/plugins/spaces/public/management/components/unauthorized_prompt/unauthorized_prompt.test.tsx +++ b/x-pack/plugins/spaces/public/management/components/unauthorized_prompt/unauthorized_prompt.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { UnauthorizedPrompt } from './unauthorized_prompt'; diff --git a/x-pack/plugins/spaces/public/management/edit_space/confirm_alter_active_space_modal/confirm_alter_active_space_modal.test.tsx b/x-pack/plugins/spaces/public/management/edit_space/confirm_alter_active_space_modal/confirm_alter_active_space_modal.test.tsx index f4ba960b2f3a4..5c9ed1b6a3283 100644 --- a/x-pack/plugins/spaces/public/management/edit_space/confirm_alter_active_space_modal/confirm_alter_active_space_modal.test.tsx +++ b/x-pack/plugins/spaces/public/management/edit_space/confirm_alter_active_space_modal/confirm_alter_active_space_modal.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { ConfirmAlterActiveSpaceModal } from './confirm_alter_active_space_modal'; diff --git a/x-pack/plugins/spaces/public/management/edit_space/customize_space/customize_space.test.tsx b/x-pack/plugins/spaces/public/management/edit_space/customize_space/customize_space.test.tsx index 42195317e6731..cea22e31a8289 100644 --- a/x-pack/plugins/spaces/public/management/edit_space/customize_space/customize_space.test.tsx +++ b/x-pack/plugins/spaces/public/management/edit_space/customize_space/customize_space.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; -import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; +import { mountWithIntl, shallowWithIntl } from '@kbn/test-jest-helpers'; import { SpaceValidator } from '../../lib'; import { CustomizeSpace } from './customize_space'; diff --git a/x-pack/plugins/spaces/public/management/edit_space/customize_space/customize_space_avatar.test.tsx b/x-pack/plugins/spaces/public/management/edit_space/customize_space/customize_space_avatar.test.tsx index 578da9b96611c..ddc767163f0b5 100644 --- a/x-pack/plugins/spaces/public/management/edit_space/customize_space/customize_space_avatar.test.tsx +++ b/x-pack/plugins/spaces/public/management/edit_space/customize_space/customize_space_avatar.test.tsx @@ -8,7 +8,7 @@ import { EuiColorPicker, EuiFieldText, EuiLink } from '@elastic/eui'; import React from 'react'; -import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; +import { mountWithIntl, shallowWithIntl } from '@kbn/test-jest-helpers'; import { SpaceValidator } from '../../lib'; import { CustomizeSpaceAvatar } from './customize_space_avatar'; diff --git a/x-pack/plugins/spaces/public/management/edit_space/delete_spaces_button.test.tsx b/x-pack/plugins/spaces/public/management/edit_space/delete_spaces_button.test.tsx index 900c032c8fbfa..d3f95cadc051f 100644 --- a/x-pack/plugins/spaces/public/management/edit_space/delete_spaces_button.test.tsx +++ b/x-pack/plugins/spaces/public/management/edit_space/delete_spaces_button.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { notificationServiceMock } from 'src/core/public/mocks'; import type { SpacesManager } from '../../spaces_manager'; diff --git a/x-pack/plugins/spaces/public/management/edit_space/enabled_features/enabled_features.test.tsx b/x-pack/plugins/spaces/public/management/edit_space/enabled_features/enabled_features.test.tsx index af6c546fcf56a..5283cfe8ad1a3 100644 --- a/x-pack/plugins/spaces/public/management/edit_space/enabled_features/enabled_features.test.tsx +++ b/x-pack/plugins/spaces/public/management/edit_space/enabled_features/enabled_features.test.tsx @@ -8,7 +8,7 @@ import type { EuiCheckboxProps } from '@elastic/eui'; import React from 'react'; -import { findTestSubject, mountWithIntl, nextTick, shallowWithIntl } from '@kbn/test/jest'; +import { findTestSubject, mountWithIntl, nextTick, shallowWithIntl } from '@kbn/test-jest-helpers'; import { DEFAULT_APP_CATEGORIES } from 'src/core/public'; import type { KibanaFeatureConfig } from '../../../../../features/public'; diff --git a/x-pack/plugins/spaces/public/management/edit_space/manage_space_page.test.tsx b/x-pack/plugins/spaces/public/management/edit_space/manage_space_page.test.tsx index 465cb76c9e5bd..55672e9896ea3 100644 --- a/x-pack/plugins/spaces/public/management/edit_space/manage_space_page.test.tsx +++ b/x-pack/plugins/spaces/public/management/edit_space/manage_space_page.test.tsx @@ -11,7 +11,7 @@ import { waitFor } from '@testing-library/react'; import type { ReactWrapper } from 'enzyme'; import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { DEFAULT_APP_CATEGORIES } from 'src/core/public'; import { notificationServiceMock, scopedHistoryMock } from 'src/core/public/mocks'; diff --git a/x-pack/plugins/spaces/public/management/edit_space/reserved_space_badge.test.tsx b/x-pack/plugins/spaces/public/management/edit_space/reserved_space_badge.test.tsx index d8fb026058dd0..de3977ac792d0 100644 --- a/x-pack/plugins/spaces/public/management/edit_space/reserved_space_badge.test.tsx +++ b/x-pack/plugins/spaces/public/management/edit_space/reserved_space_badge.test.tsx @@ -8,7 +8,7 @@ import { EuiBadge } from '@elastic/eui'; import React from 'react'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { ReservedSpaceBadge } from './reserved_space_badge'; diff --git a/x-pack/plugins/spaces/public/management/edit_space/section_panel/section_panel.test.tsx b/x-pack/plugins/spaces/public/management/edit_space/section_panel/section_panel.test.tsx index 733044e638f5f..125697c6f4e19 100644 --- a/x-pack/plugins/spaces/public/management/edit_space/section_panel/section_panel.test.tsx +++ b/x-pack/plugins/spaces/public/management/edit_space/section_panel/section_panel.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; -import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; +import { mountWithIntl, shallowWithIntl } from '@kbn/test-jest-helpers'; import { SectionPanel } from './section_panel'; diff --git a/x-pack/plugins/spaces/public/management/spaces_grid/spaces_grid_page.test.tsx b/x-pack/plugins/spaces/public/management/spaces_grid/spaces_grid_page.test.tsx index bb1ea2914fc43..8cff17b4dfe57 100644 --- a/x-pack/plugins/spaces/public/management/spaces_grid/spaces_grid_page.test.tsx +++ b/x-pack/plugins/spaces/public/management/spaces_grid/spaces_grid_page.test.tsx @@ -8,7 +8,7 @@ import { act } from '@testing-library/react'; import React from 'react'; -import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; +import { mountWithIntl, shallowWithIntl } from '@kbn/test-jest-helpers'; import { httpServiceMock, notificationServiceMock, scopedHistoryMock } from 'src/core/public/mocks'; import { KibanaFeature } from '../../../../features/public'; diff --git a/x-pack/plugins/spaces/public/nav_control/components/manage_spaces_button.test.tsx b/x-pack/plugins/spaces/public/nav_control/components/manage_spaces_button.test.tsx index 3e1d77d0a45f1..563b3693bcd7b 100644 --- a/x-pack/plugins/spaces/public/nav_control/components/manage_spaces_button.test.tsx +++ b/x-pack/plugins/spaces/public/nav_control/components/manage_spaces_button.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { ManageSpacesButton } from './manage_spaces_button'; diff --git a/x-pack/plugins/spaces/public/nav_control/nav_control_popover.test.tsx b/x-pack/plugins/spaces/public/nav_control/nav_control_popover.test.tsx index d1282331027c2..8e5aa0c6769fe 100644 --- a/x-pack/plugins/spaces/public/nav_control/nav_control_popover.test.tsx +++ b/x-pack/plugins/spaces/public/nav_control/nav_control_popover.test.tsx @@ -11,7 +11,7 @@ import { shallow } from 'enzyme'; import React from 'react'; import * as Rx from 'rxjs'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { SpaceAvatarInternal } from '../space_avatar/space_avatar_internal'; import type { SpacesManager } from '../spaces_manager'; diff --git a/x-pack/plugins/spaces/public/share_saved_objects_to_space/components/share_to_space_flyout_internal.test.tsx b/x-pack/plugins/spaces/public/share_saved_objects_to_space/components/share_to_space_flyout_internal.test.tsx index 6daea2413599a..3c84b5da2796b 100644 --- a/x-pack/plugins/spaces/public/share_saved_objects_to_space/components/share_to_space_flyout_internal.test.tsx +++ b/x-pack/plugins/spaces/public/share_saved_objects_to_space/components/share_to_space_flyout_internal.test.tsx @@ -11,7 +11,7 @@ import { act } from '@testing-library/react'; import type { ReactWrapper } from 'enzyme'; import React from 'react'; -import { findTestSubject, mountWithIntl, nextTick } from '@kbn/test/jest'; +import { findTestSubject, mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; import type { SavedObjectReferenceWithContext } from 'src/core/public'; import { coreMock } from 'src/core/public/mocks'; diff --git a/x-pack/plugins/spaces/public/space_list/space_list_internal.test.tsx b/x-pack/plugins/spaces/public/space_list/space_list_internal.test.tsx index 39ae339fb7e18..cc365e943a510 100644 --- a/x-pack/plugins/spaces/public/space_list/space_list_internal.test.tsx +++ b/x-pack/plugins/spaces/public/space_list/space_list_internal.test.tsx @@ -9,7 +9,7 @@ import { act } from '@testing-library/react'; import type { ReactWrapper } from 'enzyme'; import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { coreMock } from 'src/core/public/mocks'; import type { Space } from '../../common'; diff --git a/x-pack/plugins/spaces/public/space_selector/space_selector.test.tsx b/x-pack/plugins/spaces/public/space_selector/space_selector.test.tsx index e17c3e0078d42..7764bcc2c3b9c 100644 --- a/x-pack/plugins/spaces/public/space_selector/space_selector.test.tsx +++ b/x-pack/plugins/spaces/public/space_selector/space_selector.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import type { Space } from '../../common'; import { spacesManagerMock } from '../spaces_manager/mocks'; diff --git a/x-pack/plugins/spaces/public/spaces_manager/spaces_manager.test.ts b/x-pack/plugins/spaces/public/spaces_manager/spaces_manager.test.ts index d09177a915d99..f1e4b767b934c 100644 --- a/x-pack/plugins/spaces/public/spaces_manager/spaces_manager.test.ts +++ b/x-pack/plugins/spaces/public/spaces_manager/spaces_manager.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { coreMock } from 'src/core/public/mocks'; import { SpacesManager } from './spaces_manager'; diff --git a/x-pack/plugins/spaces/server/default_space/default_space_service.test.ts b/x-pack/plugins/spaces/server/default_space/default_space_service.test.ts index c082a75cc894b..d8a1689ae3bd6 100644 --- a/x-pack/plugins/spaces/server/default_space/default_space_service.test.ts +++ b/x-pack/plugins/spaces/server/default_space/default_space_service.test.ts @@ -8,7 +8,7 @@ import * as Rx from 'rxjs'; import { first } from 'rxjs/operators'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import type { Writable } from '@kbn/utility-types'; import type { CoreStatus, SavedObjectsRepository, ServiceStatusLevel } from 'src/core/server'; import { SavedObjectsErrorHelpers, ServiceStatusLevels } from 'src/core/server'; diff --git a/x-pack/plugins/stack_alerts/public/alert_types/components/index_select_popover.test.tsx b/x-pack/plugins/stack_alerts/public/alert_types/components/index_select_popover.test.tsx index 3b7baac9b80e6..e5c8343fddf6d 100644 --- a/x-pack/plugins/stack_alerts/public/alert_types/components/index_select_popover.test.tsx +++ b/x-pack/plugins/stack_alerts/public/alert_types/components/index_select_popover.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { act } from 'react-dom/test-utils'; -import { mountWithIntl, nextTick } from '@kbn/test/jest'; +import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; import { IndexSelectPopover } from './index_select_popover'; import { EuiComboBox } from '@elastic/eui'; diff --git a/x-pack/plugins/stack_alerts/public/alert_types/es_query/expression.test.tsx b/x-pack/plugins/stack_alerts/public/alert_types/es_query/expression.test.tsx index 994eeadd50d3b..7ecdcd6dbce38 100644 --- a/x-pack/plugins/stack_alerts/public/alert_types/es_query/expression.test.tsx +++ b/x-pack/plugins/stack_alerts/public/alert_types/es_query/expression.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import 'brace'; import { of } from 'rxjs'; -import { mountWithIntl, nextTick } from '@kbn/test/jest'; +import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; import { act } from 'react-dom/test-utils'; import EsQueryAlertTypeExpression from './expression'; import { dataPluginMock } from 'src/plugins/data/public/mocks'; diff --git a/x-pack/plugins/stack_alerts/public/alert_types/threshold/expression.test.tsx b/x-pack/plugins/stack_alerts/public/alert_types/threshold/expression.test.tsx index bf46df5eabfa7..d0aaa9b8fda52 100644 --- a/x-pack/plugins/stack_alerts/public/alert_types/threshold/expression.test.tsx +++ b/x-pack/plugins/stack_alerts/public/alert_types/threshold/expression.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { mountWithIntl, nextTick } from '@kbn/test/jest'; +import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; import { act } from 'react-dom/test-utils'; import IndexThresholdAlertTypeExpression, { DEFAULT_VALUES } from './expression'; import { dataPluginMock } from 'src/plugins/data/public/mocks'; diff --git a/x-pack/plugins/stack_alerts/public/alert_types/threshold/visualization.test.tsx b/x-pack/plugins/stack_alerts/public/alert_types/threshold/visualization.test.tsx index a27646c1643fa..ed667b4940f29 100644 --- a/x-pack/plugins/stack_alerts/public/alert_types/threshold/visualization.test.tsx +++ b/x-pack/plugins/stack_alerts/public/alert_types/threshold/visualization.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { act } from 'react-dom/test-utils'; -import { mountWithIntl, nextTick } from '@kbn/test/jest'; +import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; import { ThresholdVisualization } from './visualization'; import { DataPublicPluginStart } from 'src/plugins/data/public/types'; import { chartPluginMock } from 'src/plugins/charts/public/mocks'; diff --git a/x-pack/plugins/timelines/public/components/empty_value/empty_value.test.tsx b/x-pack/plugins/timelines/public/components/empty_value/empty_value.test.tsx index be9a086d8dc5b..0e5ee638d29e8 100644 --- a/x-pack/plugins/timelines/public/components/empty_value/empty_value.test.tsx +++ b/x-pack/plugins/timelines/public/components/empty_value/empty_value.test.tsx @@ -8,7 +8,7 @@ import { mount, shallow } from 'enzyme'; import React from 'react'; import { ThemeProvider } from 'styled-components'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { defaultToEmptyTag, diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/add_message_variables.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/add_message_variables.test.tsx index 4e03a2a09bed4..1c21170005265 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/add_message_variables.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/add_message_variables.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { AddMessageVariables } from './add_message_variables'; describe('AddMessageVariables', () => { diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/email/email_connector.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/email/email_connector.test.tsx index a96e1fc3dcb5d..742e8981a1a1a 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/email/email_connector.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/email/email_connector.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { EmailActionConnector } from '../types'; import EmailActionConnectorFields from './email_connector'; import * as hooks from './use_email_config'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/email/email_params.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/email/email_params.test.tsx index 6a173cfd80926..1762fc0b39f8e 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/email/email_params.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/email/email_params.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import EmailParamsFields from './email_params'; describe('EmailParamsFields renders', () => { diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/email/exchange_form.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/email/exchange_form.test.tsx index 2a08c9b19e602..d87efe5134794 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/email/exchange_form.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/email/exchange_form.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { EmailActionConnector } from '../types'; import ExchangeFormFields from './exchange_form'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/es_index/es_index_connector.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/es_index/es_index_connector.test.tsx index 9ef498334ad3d..6aa7fde6d23e1 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/es_index/es_index_connector.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/es_index/es_index_connector.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { mountWithIntl, nextTick } from '@kbn/test/jest'; +import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; import { act } from 'react-dom/test-utils'; import { EsIndexActionConnector } from '../types'; import IndexActionConnectorFields from './es_index_connector'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/es_index/es_index_params.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/es_index/es_index_params.test.tsx index 75c4fe2d5a055..6125255b3a52a 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/es_index/es_index_params.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/es_index/es_index_params.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { mountWithIntl, nextTick } from '@kbn/test/jest'; +import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; import { act } from '@testing-library/react'; import ParamsFields from './es_index_params'; import { AlertHistoryEsIndexConnectorId } from '../../../../types'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/jira/jira_connectors.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/jira/jira_connectors.test.tsx index 4859c25adcc06..1c8c58c7c4a16 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/jira/jira_connectors.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/jira/jira_connectors.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import JiraConnectorFields from './jira_connectors'; import { JiraActionConnector } from './types'; jest.mock('../../../../common/lib/kibana'); diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/pagerduty/pagerduty_connectors.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/pagerduty/pagerduty_connectors.test.tsx index 8be15ddaa6bca..0d10223af66cf 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/pagerduty/pagerduty_connectors.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/pagerduty/pagerduty_connectors.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { mountWithIntl, nextTick } from '@kbn/test/jest'; +import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; import { act } from 'react-dom/test-utils'; import { PagerDutyActionConnector } from '.././types'; import PagerDutyActionConnectorFields from './pagerduty_connectors'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/pagerduty/pagerduty_params.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/pagerduty/pagerduty_params.test.tsx index f67267a75ed33..6eb349b8f511c 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/pagerduty/pagerduty_params.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/pagerduty/pagerduty_params.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { EventActionOptions, SeverityActionOptions } from '.././types'; import PagerDutyParamsFields from './pagerduty_params'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/resilient/resilient_connectors.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/resilient/resilient_connectors.test.tsx index 35891f513be6b..13459888ac365 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/resilient/resilient_connectors.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/resilient/resilient_connectors.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import ResilientConnectorFields from './resilient_connectors'; import { ResilientActionConnector } from './types'; jest.mock('../../../../common/lib/kibana'); diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/server_log/server_log_params.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/server_log/server_log_params.test.tsx index eba971dd66db4..baaffb6721fc4 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/server_log/server_log_params.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/server_log/server_log_params.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { ServerLogLevelOptions } from '.././types'; import ServerLogParamsFields from './server_log_params'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/servicenow_connectors.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/servicenow_connectors.test.tsx index 03acb673bf5a4..786c84942e08f 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/servicenow_connectors.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/servicenow_connectors.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { act } from '@testing-library/react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { useKibana } from '../../../../common/lib/kibana'; import { ActionConnectorFieldsSetCallbacks } from '../../../../types'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/servicenow_itsm_params.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/servicenow_itsm_params.test.tsx index bdb38d85a8923..a5804dc484cbb 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/servicenow_itsm_params.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/servicenow_itsm_params.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { act } from '@testing-library/react'; import { ActionConnector } from '../../../../types'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/servicenow_sir_params.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/servicenow_sir_params.test.tsx index de331893ad0cf..5fa15de036844 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/servicenow_sir_params.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/servicenow_sir_params.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { act } from '@testing-library/react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { ActionConnector } from '../../../../types'; import { useGetChoices } from './use_get_choices'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/update_connector.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/update_connector.test.tsx index ecb90051e78c2..00cce14906e82 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/update_connector.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/update_connector.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { UpdateConnector, Props } from './update_connector'; import { ServiceNowActionConnector } from './types'; jest.mock('../../../../common/lib/kibana'); diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/slack/slack_connectors.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/slack/slack_connectors.test.tsx index 0a37165bd7f5f..c0f6a17cae4fe 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/slack/slack_connectors.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/slack/slack_connectors.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { mountWithIntl, nextTick } from '@kbn/test/jest'; +import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; import { act } from '@testing-library/react'; import { SlackActionConnector } from '../types'; import SlackActionFields from './slack_connectors'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/slack/slack_params.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/slack/slack_params.test.tsx index 74ee201340cc0..6611b33e094b2 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/slack/slack_params.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/slack/slack_params.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import SlackParamsFields from './slack_params'; describe('SlackParamsFields renders', () => { diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/swimlane/swimlane_connectors.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/swimlane/swimlane_connectors.test.tsx index 4829156380e94..47e5c09c13864 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/swimlane/swimlane_connectors.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/swimlane/swimlane_connectors.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { mountWithIntl, nextTick } from '@kbn/test/jest'; +import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; import { act } from 'react-dom/test-utils'; import { SwimlaneActionConnector } from './types'; import SwimlaneActionConnectorFields from './swimlane_connectors'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/swimlane/swimlane_params.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/swimlane/swimlane_params.test.tsx index f1d7efca39551..03f20546b1003 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/swimlane/swimlane_params.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/swimlane/swimlane_params.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import SwimlaneParamsFields from './swimlane_params'; import { SwimlaneConnectorType } from './types'; import { mappings } from './mocks'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/teams/teams_connectors.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/teams/teams_connectors.test.tsx index 5031b32281258..2d2b6d5052bb8 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/teams/teams_connectors.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/teams/teams_connectors.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { mountWithIntl, nextTick } from '@kbn/test/jest'; +import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; import { act } from '@testing-library/react'; import { TeamsActionConnector } from '../types'; import TeamsActionFields from './teams_connectors'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/teams/teams_params.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/teams/teams_params.test.tsx index 9d5e86d413d93..cf0bfe9db0e97 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/teams/teams_params.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/teams/teams_params.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import TeamsParamsFields from './teams_params'; jest.mock('../../../../common/lib/kibana'); diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/webhook/webhook_connectors.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/webhook/webhook_connectors.test.tsx index ea40c1ddfb139..2579d8dd1a93b 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/webhook/webhook_connectors.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/webhook/webhook_connectors.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { WebhookActionConnector } from '../types'; import WebhookActionConnectorFields from './webhook_connectors'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/webhook/webhook_params.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/webhook/webhook_params.test.tsx index 7c9ffaa23659b..064d21b50e463 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/webhook/webhook_params.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/webhook/webhook_params.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import WebhookParamsFields from './webhook_params'; import { MockCodeEditor } from '../../../code_editor.mock'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/json_editor_with_message_variables.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/json_editor_with_message_variables.test.tsx index 6a705798a9b7f..068e4755be165 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/json_editor_with_message_variables.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/json_editor_with_message_variables.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { JsonEditorWithMessageVariables } from './json_editor_with_message_variables'; import { MockCodeEditor } from '../code_editor.mock'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/text_area_with_message_variables.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/text_area_with_message_variables.test.tsx index 72ea099f87d26..0f3981391a49c 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/text_area_with_message_variables.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/text_area_with_message_variables.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { TextAreaWithMessageVariables } from './text_area_with_message_variables'; describe('TextAreaWithMessageVariables', () => { diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/text_field_with_message_variables.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/text_field_with_message_variables.test.tsx index e0d74c5568c70..43c7ac51591b5 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/text_field_with_message_variables.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/text_field_with_message_variables.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { TextFieldWithMessageVariables } from './text_field_with_message_variables'; describe('TextFieldWithMessageVariables', () => { diff --git a/x-pack/plugins/triggers_actions_ui/public/application/home.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/home.test.tsx index 3594374a54f16..51f80438c55cc 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/home.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/home.test.tsx @@ -8,7 +8,7 @@ import * as React from 'react'; import { RouteComponentProps, Router } from 'react-router-dom'; import { createMemoryHistory, createLocation } from 'history'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import TriggersActionsUIHome, { MatchParams } from './home'; import { useKibana } from '../common/lib/kibana'; jest.mock('../common/lib/kibana'); diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_connector_form.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_connector_form.test.tsx index 5a4d682ff573b..4addfc3833aab 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_connector_form.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_connector_form.test.tsx @@ -6,7 +6,7 @@ */ import * as React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { actionTypeRegistryMock } from '../../action_type_registry.mock'; import { UserConfiguredActionConnector, diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_form.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_form.test.tsx index f7c15dade55e3..ace563aa96b9e 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_form.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_form.test.tsx @@ -6,7 +6,7 @@ */ import React, { lazy } from 'react'; -import { mountWithIntl, nextTick } from '@kbn/test/jest'; +import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; import { EuiAccordion } from '@elastic/eui'; import { coreMock } from '../../../../../../../src/core/public/mocks'; import { act } from 'react-dom/test-utils'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_type_form.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_type_form.test.tsx index e8590595b9d61..e04b96b6839cf 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_type_form.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_type_form.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ import * as React from 'react'; -import { mountWithIntl, nextTick } from '@kbn/test/jest'; +import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; import { ActionTypeForm } from './action_type_form'; import { actionTypeRegistryMock } from '../../action_type_registry.mock'; import { diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_type_menu.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_type_menu.test.tsx index e15916138af71..e8a0287d90026 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_type_menu.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_type_menu.test.tsx @@ -6,7 +6,7 @@ */ import * as React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { coreMock } from '../../../../../../../src/core/public/mocks'; import { actionTypeRegistryMock } from '../../action_type_registry.mock'; import { ActionTypeMenu } from './action_type_menu'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/connector_add_flyout.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/connector_add_flyout.test.tsx index 8dbe5f105a0f7..9870786e5d3cc 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/connector_add_flyout.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/connector_add_flyout.test.tsx @@ -6,7 +6,7 @@ */ import * as React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { coreMock } from '../../../../../../../src/core/public/mocks'; import ConnectorAddFlyout from './connector_add_flyout'; import { actionTypeRegistryMock } from '../../action_type_registry.mock'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/connector_add_modal.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/connector_add_modal.test.tsx index 1502b4255767d..0666f8be394d8 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/connector_add_modal.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/connector_add_modal.test.tsx @@ -6,7 +6,7 @@ */ import * as React from 'react'; -import { mountWithIntl, nextTick } from '@kbn/test/jest'; +import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; import { act } from 'react-dom/test-utils'; import ConnectorAddModal from './connector_add_modal'; import { actionTypeRegistryMock } from '../../action_type_registry.mock'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/connector_edit_flyout.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/connector_edit_flyout.test.tsx index e6d3c0bde8113..e2bc9d44b147c 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/connector_edit_flyout.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/connector_edit_flyout.test.tsx @@ -6,7 +6,7 @@ */ import * as React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { coreMock } from '../../../../../../../src/core/public/mocks'; import { actionTypeRegistryMock } from '../../action_type_registry.mock'; import { ConnectorValidationResult, GenericValidationResult } from '../../../types'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/connectors_selection.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/connectors_selection.test.tsx index 6c383913a3c0f..1ecb651314ba9 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/connectors_selection.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/connectors_selection.test.tsx @@ -7,7 +7,7 @@ import * as React from 'react'; import { render, screen } from '@testing-library/react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { EuiThemeProvider } from '../../../../../../../src/plugins/kibana_react/common'; import { ConnectorsSelection } from './connectors_selection'; import { actionTypeRegistryMock } from '../../action_type_registry.mock'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/test_connector_form.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/test_connector_form.test.tsx index 7a3edcf4cb948..cc928d5c30fd9 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/test_connector_form.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/test_connector_form.test.tsx @@ -16,7 +16,7 @@ import { } from '../../../types'; import { actionTypeRegistryMock } from '../../action_type_registry.mock'; import { EuiFormRow, EuiFieldText, EuiText, EuiLink, EuiForm, EuiSelect } from '@elastic/eui'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; jest.mock('../../../common/lib/kibana'); const mockedActionParamsFields = lazy(async () => ({ diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/actions_connectors_list/components/actions_connectors_list.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/actions_connectors_list/components/actions_connectors_list.test.tsx index d477fcd0ddf74..1de8ad97af891 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/actions_connectors_list/components/actions_connectors_list.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/actions_connectors_list/components/actions_connectors_list.test.tsx @@ -8,7 +8,7 @@ import * as React from 'react'; // eslint-disable-next-line @kbn/eslint/module_migration import { ThemeProvider } from 'styled-components'; -import { mountWithIntl, nextTick } from '@kbn/test/jest'; +import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; import ActionsConnectorsList from './actions_connectors_list'; import { coreMock } from '../../../../../../../../src/core/public/mocks'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_details.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_details.test.tsx index b92b4289ea905..e12322c3b84ad 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_details.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_details.test.tsx @@ -8,7 +8,7 @@ import * as React from 'react'; import uuid from 'uuid'; import { shallow } from 'enzyme'; -import { mountWithIntl, nextTick } from '@kbn/test/jest'; +import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; import { act } from '@testing-library/react'; import { AlertDetails } from './alert_details'; import { Rule, ActionType, RuleTypeModel, RuleType } from '../../../../types'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_details_route.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_details_route.test.tsx index 770b273b02c29..9bfb8f20744de 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_details_route.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_details_route.test.tsx @@ -8,7 +8,7 @@ import * as React from 'react'; import uuid from 'uuid'; import { shallow } from 'enzyme'; -import { mountWithIntl, nextTick } from '@kbn/test/jest'; +import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; import { act } from 'react-dom/test-utils'; import { createMemoryHistory, createLocation } from 'history'; import { ToastsApi } from 'kibana/public'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alerts.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alerts.test.tsx index 075f6dedeb06a..909a562224ef7 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alerts.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alerts.test.tsx @@ -8,7 +8,7 @@ import * as React from 'react'; import uuid from 'uuid'; import { shallow } from 'enzyme'; -import { mountWithIntl, nextTick } from '@kbn/test/jest'; +import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; import { act } from 'react-dom/test-utils'; import { Alerts, AlertListItem, alertToListItem } from './alerts'; import { Rule, AlertSummary, AlertStatus, RuleType } from '../../../../types'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_add.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_add.test.tsx index 3187021518c9c..7e45dd8ac636a 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_add.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_add.test.tsx @@ -7,7 +7,7 @@ import uuid from 'uuid'; import React, { FunctionComponent } from 'react'; -import { mountWithIntl, nextTick } from '@kbn/test/jest'; +import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; import { act } from 'react-dom/test-utils'; import { FormattedMessage } from '@kbn/i18n-react'; import { EuiFormLabel } from '@elastic/eui'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_conditions.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_conditions.test.tsx index f4ed8d0b05a85..07f7b1475b92f 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_conditions.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_conditions.test.tsx @@ -6,7 +6,7 @@ */ import * as React from 'react'; -import { mountWithIntl, nextTick } from '@kbn/test/jest'; +import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; import { act } from 'react-dom/test-utils'; import { ReactWrapper } from 'enzyme'; import { AlertConditions, ActionGroupWithCondition } from './alert_conditions'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_conditions_group.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_conditions_group.test.tsx index f730f73a417ba..49a2ec087a2b8 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_conditions_group.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_conditions_group.test.tsx @@ -6,7 +6,7 @@ */ import * as React from 'react'; -import { mountWithIntl, nextTick } from '@kbn/test/jest'; +import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; import { act } from 'react-dom/test-utils'; import { ReactWrapper } from 'enzyme'; import { AlertConditionsGroup } from './alert_conditions_group'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_edit.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_edit.test.tsx index 226734ca46a67..ec33756cfec4a 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_edit.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_edit.test.tsx @@ -6,7 +6,7 @@ */ import * as React from 'react'; -import { mountWithIntl, nextTick } from '@kbn/test/jest'; +import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; import { act } from 'react-dom/test-utils'; import { coreMock } from '../../../../../../../src/core/public/mocks'; import { actionTypeRegistryMock } from '../../action_type_registry.mock'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_form.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_form.test.tsx index 37741dcaab6e5..49803c0cc419d 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_form.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_form.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { mountWithIntl, nextTick } from '@kbn/test/jest'; +import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; import { ReactWrapper } from 'enzyme'; import { act } from 'react-dom/test-utils'; import { actionTypeRegistryMock } from '../../action_type_registry.mock'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_notify_when.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_notify_when.test.tsx index 1534e0ed4f6b8..c15f249fd7688 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_notify_when.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_notify_when.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { mountWithIntl, nextTick } from '@kbn/test/jest'; +import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; import { ReactWrapper } from 'enzyme'; import { act } from 'react-dom/test-utils'; import { Rule } from '../../../types'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_list/components/alerts_list.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_list/components/alerts_list.test.tsx index ce94ef75ac156..2ca32ec04cd70 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_list/components/alerts_list.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_list/components/alerts_list.test.tsx @@ -6,7 +6,7 @@ */ import * as React from 'react'; -import { mountWithIntl, nextTick } from '@kbn/test/jest'; +import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; import { ReactWrapper } from 'enzyme'; import { act } from 'react-dom/test-utils'; import { actionTypeRegistryMock } from '../../../action_type_registry.mock'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_list/components/collapsed_item_actions.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_list/components/collapsed_item_actions.test.tsx index a54bc67244b35..a036feea0fbcb 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_list/components/collapsed_item_actions.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_list/components/collapsed_item_actions.test.tsx @@ -6,7 +6,7 @@ */ import * as React from 'react'; -import { mountWithIntl, nextTick } from '@kbn/test/jest'; +import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; import { CollapsedItemActions } from './collapsed_item_actions'; import { act } from 'react-dom/test-utils'; import { ruleTypeRegistryMock } from '../../../rule_type_registry.mock'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_list/components/rule_enabled_switch.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_list/components/rule_enabled_switch.test.tsx index da75faeda95e9..0773d6c9c5ed0 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_list/components/rule_enabled_switch.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_list/components/rule_enabled_switch.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { RuleEnabledSwitch, ComponentOpts } from './rule_enabled_switch'; describe('RuleEnabledSwitch', () => { diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/execution_duration_chart.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/execution_duration_chart.test.tsx index f524ff4426b6a..f98f82e412f86 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/execution_duration_chart.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/execution_duration_chart.test.tsx @@ -6,7 +6,7 @@ */ import * as React from 'react'; -import { mountWithIntl, nextTick } from '@kbn/test/jest'; +import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; import { act } from 'react-dom/test-utils'; import { ExecutionDurationChart, padOrTruncateDurations } from './execution_duration_chart'; diff --git a/x-pack/plugins/triggers_actions_ui/public/common/expression_items/threshold.test.tsx b/x-pack/plugins/triggers_actions_ui/public/common/expression_items/threshold.test.tsx index 653c0ebadcfae..bb94e1d38757a 100644 --- a/x-pack/plugins/triggers_actions_ui/public/common/expression_items/threshold.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/common/expression_items/threshold.test.tsx @@ -7,7 +7,7 @@ import * as React from 'react'; import { shallow } from 'enzyme'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { ThresholdExpression } from './threshold'; describe('threshold expression', () => { diff --git a/x-pack/plugins/triggers_actions_ui/public/common/expression_items/value.test.tsx b/x-pack/plugins/triggers_actions_ui/public/common/expression_items/value.test.tsx index e9a3dce84e149..6ff6206db456a 100644 --- a/x-pack/plugins/triggers_actions_ui/public/common/expression_items/value.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/common/expression_items/value.test.tsx @@ -9,7 +9,7 @@ import * as React from 'react'; import { shallow } from 'enzyme'; import { act } from 'react-dom/test-utils'; import { ValueExpression } from './value'; -import { mountWithIntl, nextTick } from '@kbn/test/jest'; +import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; describe('value expression', () => { it('renders description and value', () => { diff --git a/x-pack/plugins/ui_actions_enhanced/public/custom_time_range_action.test.ts b/x-pack/plugins/ui_actions_enhanced/public/custom_time_range_action.test.ts index 889b6377b16b5..663161f5ebd2d 100644 --- a/x-pack/plugins/ui_actions_enhanced/public/custom_time_range_action.test.ts +++ b/x-pack/plugins/ui_actions_enhanced/public/custom_time_range_action.test.ts @@ -19,7 +19,7 @@ import { HELLO_WORLD_EMBEDDABLE, } from '../../../../src/plugins/embeddable/public/tests/fixtures'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; import { ReactElement } from 'react'; const createOpenModalMock = () => { diff --git a/x-pack/plugins/ui_actions_enhanced/public/custom_time_range_badge.test.ts b/x-pack/plugins/ui_actions_enhanced/public/custom_time_range_badge.test.ts index b4134ddd17395..f31e2552fa717 100644 --- a/x-pack/plugins/ui_actions_enhanced/public/custom_time_range_badge.test.ts +++ b/x-pack/plugins/ui_actions_enhanced/public/custom_time_range_badge.test.ts @@ -12,7 +12,7 @@ import { mount } from 'enzyme'; import { TimeRangeEmbeddable, TimeRangeContainer, TIME_RANGE_EMBEDDABLE } from './test_helpers'; import { CustomTimeRangeBadge } from './custom_time_range_badge'; import { ReactElement } from 'react'; -import { nextTick } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; test('Removing custom time range from badge resets embeddable back to container time', async () => { const container = new TimeRangeContainer( diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/app/app.helpers.tsx b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/app/app.helpers.tsx index 55c8c7f721a49..25e38b4111e50 100644 --- a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/app/app.helpers.tsx +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/app/app.helpers.tsx @@ -6,7 +6,7 @@ */ import { act } from 'react-dom/test-utils'; -import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test-jest-helpers'; import { App } from '../../../public/application/app'; import { WithAppDependencies } from '../helpers'; diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/es_deprecation_logs/es_deprecation_logs.helpers.ts b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/es_deprecation_logs/es_deprecation_logs.helpers.ts index 11784d0269505..31bbcd01a7320 100644 --- a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/es_deprecation_logs/es_deprecation_logs.helpers.ts +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/es_deprecation_logs/es_deprecation_logs.helpers.ts @@ -6,7 +6,7 @@ */ import { act } from 'react-dom/test-utils'; -import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test-jest-helpers'; import { EsDeprecationLogs } from '../../../public/application/components/es_deprecation_logs'; import { WithAppDependencies } from '../helpers'; diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/es_deprecations/es_deprecations.helpers.ts b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/es_deprecations/es_deprecations.helpers.ts index 28ec1983cbeda..08d53d1eaca7e 100644 --- a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/es_deprecations/es_deprecations.helpers.ts +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/es_deprecations/es_deprecations.helpers.ts @@ -6,7 +6,7 @@ */ import { act } from 'react-dom/test-utils'; -import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test-jest-helpers'; import { EsDeprecations } from '../../../public/application/components/es_deprecations'; import { WithAppDependencies } from '../helpers'; diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/kibana_deprecations/kibana_deprecations.helpers.ts b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/kibana_deprecations/kibana_deprecations.helpers.ts index 8d14a211786c4..9f98496ac2edf 100644 --- a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/kibana_deprecations/kibana_deprecations.helpers.ts +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/kibana_deprecations/kibana_deprecations.helpers.ts @@ -5,7 +5,12 @@ * 2.0. */ import { act } from 'react-dom/test-utils'; -import { registerTestBed, TestBed, AsyncTestBedConfig, findTestSubject } from '@kbn/test/jest'; +import { + registerTestBed, + TestBed, + AsyncTestBedConfig, + findTestSubject, +} from '@kbn/test-jest-helpers'; import { KibanaDeprecations } from '../../../public/application/components'; import { WithAppDependencies } from '../helpers'; diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/overview.helpers.ts b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/overview.helpers.ts index 34abaed727bd3..30a531091f166 100644 --- a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/overview.helpers.ts +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/overview.helpers.ts @@ -6,7 +6,7 @@ */ import { act } from 'react-dom/test-utils'; -import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test-jest-helpers'; import { Overview } from '../../../public/application/components/overview'; import { WithAppDependencies } from '../helpers'; diff --git a/x-pack/plugins/uptime/public/components/common/charts/chart_empty_state.test.tsx b/x-pack/plugins/uptime/public/components/common/charts/chart_empty_state.test.tsx index 9d8aa3d4d091f..1f185b964b668 100644 --- a/x-pack/plugins/uptime/public/components/common/charts/chart_empty_state.test.tsx +++ b/x-pack/plugins/uptime/public/components/common/charts/chart_empty_state.test.tsx @@ -6,7 +6,7 @@ */ import { ChartEmptyState } from './chart_empty_state'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { FormattedMessage } from '@kbn/i18n-react'; diff --git a/x-pack/plugins/uptime/public/components/common/charts/chart_wrapper.test.tsx b/x-pack/plugins/uptime/public/components/common/charts/chart_wrapper.test.tsx index 25b316344b32a..37354104cf871 100644 --- a/x-pack/plugins/uptime/public/components/common/charts/chart_wrapper.test.tsx +++ b/x-pack/plugins/uptime/public/components/common/charts/chart_wrapper.test.tsx @@ -8,8 +8,8 @@ import React from 'react'; import { EuiSpacer } from '@elastic/eui'; import { mount } from 'enzyme'; -import { nextTick } from '@kbn/test/jest'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { nextTick } from '@kbn/test-jest-helpers'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { ChartWrapper } from './chart_wrapper'; import { SnapshotHeading } from '../../overview/snapshot/snapshot_heading'; import { DonutChart } from './donut_chart'; diff --git a/x-pack/plugins/uptime/public/components/common/charts/donut_chart.test.tsx b/x-pack/plugins/uptime/public/components/common/charts/donut_chart.test.tsx index ee01235a75fd7..ff83c51900cdf 100644 --- a/x-pack/plugins/uptime/public/components/common/charts/donut_chart.test.tsx +++ b/x-pack/plugins/uptime/public/components/common/charts/donut_chart.test.tsx @@ -6,7 +6,7 @@ */ import { DonutChart } from './donut_chart'; -import { renderWithIntl, shallowWithIntl } from '@kbn/test/jest'; +import { renderWithIntl, shallowWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; describe('DonutChart component', () => { diff --git a/x-pack/plugins/uptime/public/components/common/charts/donut_chart_legend.test.tsx b/x-pack/plugins/uptime/public/components/common/charts/donut_chart_legend.test.tsx index f2f9757afce07..3e5a5c2539680 100644 --- a/x-pack/plugins/uptime/public/components/common/charts/donut_chart_legend.test.tsx +++ b/x-pack/plugins/uptime/public/components/common/charts/donut_chart_legend.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { renderWithIntl } from '@kbn/test/jest'; +import { renderWithIntl } from '@kbn/test-jest-helpers'; import { DonutChartLegend } from './donut_chart_legend'; diff --git a/x-pack/plugins/uptime/public/components/common/charts/donut_chart_legend_row.test.tsx b/x-pack/plugins/uptime/public/components/common/charts/donut_chart_legend_row.test.tsx index 1b73b80bacd57..cae142b2a4f79 100644 --- a/x-pack/plugins/uptime/public/components/common/charts/donut_chart_legend_row.test.tsx +++ b/x-pack/plugins/uptime/public/components/common/charts/donut_chart_legend_row.test.tsx @@ -6,7 +6,7 @@ */ import { DonutChartLegendRow } from './donut_chart_legend_row'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; describe('DonutChartLegendRow', () => { diff --git a/x-pack/plugins/uptime/public/components/common/location_link.test.tsx b/x-pack/plugins/uptime/public/components/common/location_link.test.tsx index 177015b93d3f3..285ee6cb47725 100644 --- a/x-pack/plugins/uptime/public/components/common/location_link.test.tsx +++ b/x-pack/plugins/uptime/public/components/common/location_link.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { LocationLink } from './location_link'; diff --git a/x-pack/plugins/uptime/public/components/common/monitor_page_link.test.tsx b/x-pack/plugins/uptime/public/components/common/monitor_page_link.test.tsx index 317af4c083ca2..9bd7db2de7f6b 100644 --- a/x-pack/plugins/uptime/public/components/common/monitor_page_link.test.tsx +++ b/x-pack/plugins/uptime/public/components/common/monitor_page_link.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { MonitorPageLink } from './monitor_page_link'; describe('MonitorPageLink component', () => { diff --git a/x-pack/plugins/uptime/public/components/monitor/ml/confirm_delete.test.tsx b/x-pack/plugins/uptime/public/components/monitor/ml/confirm_delete.test.tsx index c88349282b7b4..5f46169901e57 100644 --- a/x-pack/plugins/uptime/public/components/monitor/ml/confirm_delete.test.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/ml/confirm_delete.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { ConfirmJobDeletion } from './confirm_delete'; describe('ML Confirm Job Delete', () => { diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/expanded_row.test.tsx b/x-pack/plugins/uptime/public/components/monitor/ping_list/expanded_row.test.tsx index dd42a14890793..f87501a79e964 100644 --- a/x-pack/plugins/uptime/public/components/monitor/ping_list/expanded_row.test.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/ping_list/expanded_row.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { mountWithIntl, renderWithIntl, shallowWithIntl } from '@kbn/test/jest'; +import { mountWithIntl, renderWithIntl, shallowWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { PingListExpandedRowComponent } from './expanded_row'; import { Ping } from '../../../../common/runtime_types'; diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/ping_headers.test.tsx b/x-pack/plugins/uptime/public/components/monitor/ping_list/ping_headers.test.tsx index aa1f85556bc5f..8bc9f2b7fed51 100644 --- a/x-pack/plugins/uptime/public/components/monitor/ping_list/ping_headers.test.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/ping_list/ping_headers.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { PingHeaders } from './headers'; diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/availability_reporting/tag_label.test.tsx b/x-pack/plugins/uptime/public/components/monitor/status_details/availability_reporting/tag_label.test.tsx index 76ec33ccc5fe2..d4dd2f6f0678b 100644 --- a/x-pack/plugins/uptime/public/components/monitor/status_details/availability_reporting/tag_label.test.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/status_details/availability_reporting/tag_label.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { renderWithIntl, shallowWithIntl } from '@kbn/test/jest'; +import { renderWithIntl, shallowWithIntl } from '@kbn/test-jest-helpers'; import { TagLabel } from './tag_label'; describe('TagLabel component', () => { diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/status_by_location.test.tsx b/x-pack/plugins/uptime/public/components/monitor/status_details/status_by_location.test.tsx index d86b7f13604dd..d7e8f70475f54 100644 --- a/x-pack/plugins/uptime/public/components/monitor/status_details/status_by_location.test.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/status_details/status_by_location.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { renderWithIntl, shallowWithIntl } from '@kbn/test/jest'; +import { renderWithIntl, shallowWithIntl } from '@kbn/test-jest-helpers'; import { MonitorLocation } from '../../../../common/runtime_types'; import { StatusByLocations } from './index'; diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/alert_field_number.test.tsx b/x-pack/plugins/uptime/public/components/overview/alerts/alert_field_number.test.tsx index 32e16f1ae88eb..62823b4ca87d6 100644 --- a/x-pack/plugins/uptime/public/components/overview/alerts/alert_field_number.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/alerts/alert_field_number.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; import { AlertFieldNumber, handleAlertFieldNumberChange } from './alert_field_number'; describe('AlertFieldNumber', () => { diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/down_number_select.test.tsx b/x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/down_number_select.test.tsx index 0598b675cab35..1290d4cb4ceba 100644 --- a/x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/down_number_select.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/down_number_select.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { renderWithIntl, shallowWithIntl } from '@kbn/test/jest'; +import { renderWithIntl, shallowWithIntl } from '@kbn/test-jest-helpers'; import { DownNoExpressionSelect } from './down_number_select'; describe('DownNoExpressionSelect component', () => { diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/time_expression_select.test.tsx b/x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/time_expression_select.test.tsx index 4ce9720cfc4ce..87caf3f7cb3b6 100644 --- a/x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/time_expression_select.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/time_expression_select.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { renderWithIntl, shallowWithIntl } from '@kbn/test/jest'; +import { renderWithIntl, shallowWithIntl } from '@kbn/test-jest-helpers'; import { TimeExpressionSelect } from './time_expression_select'; describe('TimeExpressionSelect component', () => { diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/monitor_status_alert/add_filter_btn.test.tsx b/x-pack/plugins/uptime/public/components/overview/alerts/monitor_status_alert/add_filter_btn.test.tsx index 5b32d9bc01992..f8f9e5a84bc5c 100644 --- a/x-pack/plugins/uptime/public/components/overview/alerts/monitor_status_alert/add_filter_btn.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/alerts/monitor_status_alert/add_filter_btn.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { shallowWithIntl, mountWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl, mountWithIntl } from '@kbn/test-jest-helpers'; import { AddFilterButton } from './add_filter_btn'; import { EuiButtonEmpty, EuiContextMenuItem } from '@elastic/eui'; diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/monitor_status_alert/old_alert_callout.test.tsx b/x-pack/plugins/uptime/public/components/overview/alerts/monitor_status_alert/old_alert_callout.test.tsx index 5300b218b4d00..f0c41480f5172 100644 --- a/x-pack/plugins/uptime/public/components/overview/alerts/monitor_status_alert/old_alert_callout.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/alerts/monitor_status_alert/old_alert_callout.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { OldAlertCallOut } from './old_alert_call_out'; describe('OldAlertCallOut', () => { diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/integration_group.test.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/integration_group.test.tsx index c4de51f68a17a..5f50285063541 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/integration_group.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/integration_group.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { MonitorSummary, makePing } from '../../../../../common/runtime_types'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { IntegrationGroup, extractSummaryValues } from './actions_popover/integration_group'; describe('IntegrationGroup', () => { diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/integration_link.test.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/integration_link.test.tsx index dacdf38b1207f..7f4926f994b1f 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/integration_link.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/integration_link.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { IntegrationLink } from './actions_popover/integration_link'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; describe('IntegrationLink component', () => { it('renders without errors', () => { diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/most_recent_error.test.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/most_recent_error.test.tsx index f0f330807ffbf..111a8a18ccad5 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/most_recent_error.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/most_recent_error.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { shallowWithIntl, renderWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl, renderWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import moment from 'moment'; import { BrowserRouter as Router } from 'react-router-dom'; diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_page_size_select.test.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_page_size_select.test.tsx index c8da376a7a8cd..9b7e2a1917835 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_page_size_select.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_page_size_select.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { MonitorListPageSizeSelectComponent } from './monitor_list_page_size_select'; -import { mountWithIntl } from '@kbn/test/jest'; +import { mountWithIntl } from '@kbn/test-jest-helpers'; describe('MonitorListPageSizeSelect', () => { it('updates the state when selection changes', () => { diff --git a/x-pack/plugins/uptime/public/components/overview/snapshot/snapshot.test.tsx b/x-pack/plugins/uptime/public/components/overview/snapshot/snapshot.test.tsx index 184f6b73cc7ab..3cea8199544d4 100644 --- a/x-pack/plugins/uptime/public/components/overview/snapshot/snapshot.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/snapshot/snapshot.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { SnapshotComponent } from './snapshot'; import { Snapshot } from '../../../../common/runtime_types/snapshot'; import * as hook from './use_snap_shot'; diff --git a/x-pack/plugins/uptime/public/components/overview/snapshot_heading.test.tsx b/x-pack/plugins/uptime/public/components/overview/snapshot_heading.test.tsx index 04874a4177e07..f3616345a6f9b 100644 --- a/x-pack/plugins/uptime/public/components/overview/snapshot_heading.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/snapshot_heading.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { SnapshotHeading } from './snapshot/snapshot_heading'; diff --git a/x-pack/plugins/uptime/public/components/overview/synthetics_callout.test.tsx b/x-pack/plugins/uptime/public/components/overview/synthetics_callout.test.tsx index ec9e5f958ec3a..0d2dc15f55725 100644 --- a/x-pack/plugins/uptime/public/components/overview/synthetics_callout.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/synthetics_callout.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { SyntheticsCallout } from './synthetics_callout'; diff --git a/x-pack/plugins/uptime/public/components/synthetics/console_event.test.tsx b/x-pack/plugins/uptime/public/components/synthetics/console_event.test.tsx index b80613dbfece5..6a3c6d02151ed 100644 --- a/x-pack/plugins/uptime/public/components/synthetics/console_event.test.tsx +++ b/x-pack/plugins/uptime/public/components/synthetics/console_event.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { ConsoleEvent } from './console_event'; diff --git a/x-pack/plugins/uptime/public/components/synthetics/empty_journey.test.tsx b/x-pack/plugins/uptime/public/components/synthetics/empty_journey.test.tsx index 854006ba39356..cdbf69af0f874 100644 --- a/x-pack/plugins/uptime/public/components/synthetics/empty_journey.test.tsx +++ b/x-pack/plugins/uptime/public/components/synthetics/empty_journey.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { EmptyJourney } from './empty_journey'; diff --git a/x-pack/plugins/uptime/public/lib/helper/enzyme_helpers.tsx b/x-pack/plugins/uptime/public/lib/helper/enzyme_helpers.tsx index 04ecc6bc9c72d..b8e1c055dce49 100644 --- a/x-pack/plugins/uptime/public/lib/helper/enzyme_helpers.tsx +++ b/x-pack/plugins/uptime/public/lib/helper/enzyme_helpers.tsx @@ -10,7 +10,7 @@ import { Router } from 'react-router-dom'; import { MemoryHistory } from 'history/createMemoryHistory'; import { createMemoryHistory, History } from 'history'; // eslint-disable-next-line import/no-extraneous-dependencies -import { mountWithIntl, renderWithIntl, shallowWithIntl } from '@kbn/test/jest'; +import { mountWithIntl, renderWithIntl, shallowWithIntl } from '@kbn/test-jest-helpers'; import { MountWithReduxProvider } from './helper_with_redux'; import { AppState } from '../../state'; import { mockState } from '../__mocks__/uptime_store.mock'; diff --git a/x-pack/plugins/watcher/__fixtures__/watch.ts b/x-pack/plugins/watcher/__fixtures__/watch.ts index 36991187b6bd4..a05f100c89f19 100644 --- a/x-pack/plugins/watcher/__fixtures__/watch.ts +++ b/x-pack/plugins/watcher/__fixtures__/watch.ts @@ -6,7 +6,7 @@ */ import { Moment } from 'moment'; -import { getRandomString } from '@kbn/test/jest'; +import { getRandomString } from '@kbn/test-jest-helpers'; interface Watch { id: string; diff --git a/x-pack/plugins/watcher/__fixtures__/watch_history.ts b/x-pack/plugins/watcher/__fixtures__/watch_history.ts index 9ebc343fcddd6..d7fab9fc80d29 100644 --- a/x-pack/plugins/watcher/__fixtures__/watch_history.ts +++ b/x-pack/plugins/watcher/__fixtures__/watch_history.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { getRandomString } from '@kbn/test/jest'; +import { getRandomString } from '@kbn/test-jest-helpers'; interface WatchHistory { startTime: string; diff --git a/x-pack/plugins/watcher/__jest__/client_integration/helpers/index.ts b/x-pack/plugins/watcher/__jest__/client_integration/helpers/index.ts index 37fe71d143988..07ced2096e696 100644 --- a/x-pack/plugins/watcher/__jest__/client_integration/helpers/index.ts +++ b/x-pack/plugins/watcher/__jest__/client_integration/helpers/index.ts @@ -11,8 +11,8 @@ import { setup as watchCreateJsonSetup } from './watch_create_json.helpers'; import { setup as watchCreateThresholdSetup } from './watch_create_threshold.helpers'; import { setup as watchEditSetup } from './watch_edit.helpers'; -export type { TestBed } from '@kbn/test/jest'; -export { getRandomString, findTestSubject } from '@kbn/test/jest'; +export type { TestBed } from '@kbn/test-jest-helpers'; +export { getRandomString, findTestSubject } from '@kbn/test-jest-helpers'; export { wrapBodyResponse, unwrapBodyResponse } from './body_response'; export { setupEnvironment } from './setup_environment'; diff --git a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_json.helpers.ts b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_json.helpers.ts index a276b717bc544..16e4930510efa 100644 --- a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_json.helpers.ts +++ b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_json.helpers.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test-jest-helpers'; import { WatchEdit } from '../../../public/application/sections/watch_edit/components/watch_edit'; import { registerRouter } from '../../../public/application/lib/navigation'; import { ROUTES, WATCH_TYPES } from '../../../common/constants'; diff --git a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_threshold.helpers.ts b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_threshold.helpers.ts index 320f88eef2651..cbfdac67597e1 100644 --- a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_threshold.helpers.ts +++ b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_threshold.helpers.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test-jest-helpers'; import { WatchEdit } from '../../../public/application/sections/watch_edit/components/watch_edit'; import { registerRouter } from '../../../public/application/lib/navigation'; import { ROUTES, WATCH_TYPES } from '../../../common/constants'; diff --git a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_edit.helpers.ts b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_edit.helpers.ts index 15489fa0a864d..9f01750d43593 100644 --- a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_edit.helpers.ts +++ b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_edit.helpers.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test-jest-helpers'; import { WatchEdit } from '../../../public/application/sections/watch_edit/components/watch_edit'; import { registerRouter } from '../../../public/application/lib/navigation'; import { ROUTES } from '../../../common/constants'; diff --git a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_list.helpers.ts b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_list.helpers.ts index d048a55422f6e..914eaca62465d 100644 --- a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_list.helpers.ts +++ b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_list.helpers.ts @@ -7,7 +7,12 @@ import { act } from 'react-dom/test-utils'; -import { registerTestBed, findTestSubject, TestBed, AsyncTestBedConfig } from '@kbn/test/jest'; +import { + registerTestBed, + findTestSubject, + TestBed, + AsyncTestBedConfig, +} from '@kbn/test-jest-helpers'; import { WatchList } from '../../../public/application/sections/watch_list/components/watch_list'; import { ROUTES, REFRESH_INTERVALS } from '../../../common/constants'; import { withAppContext } from './app_context.mock'; diff --git a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_status.helpers.ts b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_status.helpers.ts index 0578f9f1092a1..63892961d8b57 100644 --- a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_status.helpers.ts +++ b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_status.helpers.ts @@ -7,7 +7,12 @@ import { act } from 'react-dom/test-utils'; -import { registerTestBed, findTestSubject, TestBed, AsyncTestBedConfig } from '@kbn/test/jest'; +import { + registerTestBed, + findTestSubject, + TestBed, + AsyncTestBedConfig, +} from '@kbn/test-jest-helpers'; import { WatchStatus } from '../../../public/application/sections/watch_status/components/watch_status'; import { ROUTES } from '../../../common/constants'; import { WATCH_ID } from './jest_constants'; diff --git a/x-pack/plugins/watcher/__jest__/client_integration/watch_edit.test.ts b/x-pack/plugins/watcher/__jest__/client_integration/watch_edit.test.ts index b5fb2aa9d915a..37f9838f176af 100644 --- a/x-pack/plugins/watcher/__jest__/client_integration/watch_edit.test.ts +++ b/x-pack/plugins/watcher/__jest__/client_integration/watch_edit.test.ts @@ -8,7 +8,7 @@ import { act } from 'react-dom/test-utils'; import axiosXhrAdapter from 'axios/lib/adapters/xhr'; import axios from 'axios'; -import { getRandomString } from '@kbn/test/jest'; +import { getRandomString } from '@kbn/test-jest-helpers'; import { getWatch } from '../../__fixtures__'; import { defaultWatch } from '../../public/application/models/watch'; diff --git a/yarn.lock b/yarn.lock index 6e0e20d55a1b1..6595fa5871aa7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3942,6 +3942,10 @@ version "0.0.0" uid "" +"@kbn/test-jest-helpers@link:bazel-bin/packages/kbn-test-jest-helpers": + version "0.0.0" + uid "" + "@kbn/test-subj-selector@link:bazel-bin/packages/kbn-test-subj-selector": version "0.0.0" uid "" @@ -6898,6 +6902,14 @@ version "0.0.0" uid "" +"@types/kbn__test-jest-helpers@link:bazel-bin/packages/kbn-test-jest-helpers/npm_module_types": + version "0.0.0" + uid "" + +"@types/kbn__test@link:bazel-bin/packages/kbn-test/npm_module_types": + version "0.0.0" + uid "" + "@types/kbn__ui-shared-deps-npm@link:bazel-bin/packages/kbn-ui-shared-deps-npm/npm_module_types": version "0.0.0" uid "" From ffeff57f0027894787bae5c0d687880bc8fe2721 Mon Sep 17 00:00:00 2001 From: Alexey Antonov Date: Fri, 4 Feb 2022 12:37:11 +0300 Subject: [PATCH 29/68] [Visualize] Coloring tooltip in Heatmap is not working for ">= n" values (#124521) --- .../public/components/heatmap_component.tsx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/plugins/chart_expressions/expression_heatmap/public/components/heatmap_component.tsx b/src/plugins/chart_expressions/expression_heatmap/public/components/heatmap_component.tsx index bac476045eb95..80ea3b344d29a 100644 --- a/src/plugins/chart_expressions/expression_heatmap/public/components/heatmap_component.tsx +++ b/src/plugins/chart_expressions/expression_heatmap/public/components/heatmap_component.tsx @@ -286,15 +286,21 @@ export const HeatmapComponent: FC = memo( const bands = ranges.map((start, index, array) => { // by default the last range is right-open - let end = index === array.length - 1 ? Infinity : array[index + 1]; + let end = index === array.length - 1 ? Number.POSITIVE_INFINITY : array[index + 1]; // if the lastRangeIsRightOpen is set to false, we need to set the last range to the max value if (args.lastRangeIsRightOpen === false) { - const lastBand = max === start ? Infinity : endValue; + const lastBand = max === start ? Number.POSITIVE_INFINITY : endValue; end = index === array.length - 1 ? lastBand : array[index + 1]; } - const overwriteArrayIdx = `${metricFormatter.convert(start)} - ${metricFormatter.convert( - end - )}`; + + let overwriteArrayIdx; + + if (end === Number.POSITIVE_INFINITY) { + overwriteArrayIdx = `≥ ${start}`; + } else { + overwriteArrayIdx = `${metricFormatter.convert(start)} - ${metricFormatter.convert(end)}`; + } + const overwriteColor = overwriteColors?.[overwriteArrayIdx]; return { // with the default continuity:above the every range is left-closed From 8989ead2d61dffd83a6e0678b8cb3e5db01ca95d Mon Sep 17 00:00:00 2001 From: Robert Oskamp Date: Fri, 4 Feb 2022 11:23:47 +0100 Subject: [PATCH 30/68] Functional test runner creates system_indices_superuser (#124008) This PR fixes the functional test runner for execution against cloud (and other existing deployments) by making sure the system_indices_superuser exists. --- .../kbn-test/src/es/es_client_for_testing.ts | 61 +++++++++++++++++++ packages/kbn-test/src/es/index.ts | 2 + .../functional_test_runner.ts | 49 +++++++++------ packages/kbn-test/src/index.ts | 15 ++++- test/common/services/elasticsearch.ts | 29 ++------- test/common/services/security/security.ts | 2 + .../services/security/system_indices_user.ts | 59 ++++++++++++++++++ .../apm/ftr_e2e/cypress/plugins/index.ts | 17 ++---- x-pack/test/functional/apps/security/users.ts | 4 +- .../common/services/cluster_client.ts | 27 ++------ 10 files changed, 183 insertions(+), 82 deletions(-) create mode 100644 packages/kbn-test/src/es/es_client_for_testing.ts create mode 100644 test/common/services/security/system_indices_user.ts diff --git a/packages/kbn-test/src/es/es_client_for_testing.ts b/packages/kbn-test/src/es/es_client_for_testing.ts new file mode 100644 index 0000000000000..084cb8d77eac5 --- /dev/null +++ b/packages/kbn-test/src/es/es_client_for_testing.ts @@ -0,0 +1,61 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import * as Url from 'url'; +import * as Fs from 'fs'; + +import { CA_CERT_PATH } from '@kbn/dev-utils'; +import { Client as EsClient, ClientOptions, HttpConnection } from '@elastic/elasticsearch'; +import type { Config } from '../functional_test_runner'; + +/** options for creating es instances used in functional testing scenarios */ +export interface EsClientForTestingOptions extends Omit { + /** url of es instance */ + esUrl: string; + /** overwrite the auth embedded in the url to use a different user in this client instance */ + authOverride?: { username: string; password: string }; + /** + * are we running tests against cloud? this is automatically determined + * by checking for the TEST_CLOUD environment variable but can be overriden + * for special cases + */ + isCloud?: boolean; +} + +export function createEsClientForFtrConfig( + config: Config, + overrides?: Omit +) { + const esUrl = Url.format(config.get('servers.elasticsearch')); + return createEsClientForTesting({ + esUrl, + requestTimeout: config.get('timeouts.esRequestTimeout'), + ...overrides, + }); +} + +export function createEsClientForTesting(options: EsClientForTestingOptions) { + const { esUrl, authOverride, isCloud = !!process.env.TEST_CLOUD, ...otherOptions } = options; + + const url = options.authOverride + ? Url.format({ + ...Url.parse(options.esUrl), + auth: `${options.authOverride.username}:${options.authOverride.password}`, + }) + : options.esUrl; + + return new EsClient({ + Connection: HttpConnection, + tls: isCloud ? undefined : { ca: Fs.readFileSync(CA_CERT_PATH) }, + + ...otherOptions, + + // force nodes config + nodes: [url], + }); +} diff --git a/packages/kbn-test/src/es/index.ts b/packages/kbn-test/src/es/index.ts index 0c19a6b903742..c823adaab101f 100644 --- a/packages/kbn-test/src/es/index.ts +++ b/packages/kbn-test/src/es/index.ts @@ -10,3 +10,5 @@ export { createTestEsCluster } from './test_es_cluster'; export type { CreateTestEsClusterOptions, EsTestCluster, ICluster } from './test_es_cluster'; export { esTestConfig } from './es_test_config'; export { convertToKibanaClient } from './client_to_kibana_client'; +export { createEsClientForTesting, createEsClientForFtrConfig } from './es_client_for_testing'; +export type { EsClientForTestingOptions } from './es_client_for_testing'; diff --git a/packages/kbn-test/src/functional_test_runner/functional_test_runner.ts b/packages/kbn-test/src/functional_test_runner/functional_test_runner.ts index 85c474c2f1bec..1701a0a2e576c 100644 --- a/packages/kbn-test/src/functional_test_runner/functional_test_runner.ts +++ b/packages/kbn-test/src/functional_test_runner/functional_test_runner.ts @@ -6,7 +6,6 @@ * Side Public License, v 1. */ -import type { Client as EsClient } from '@elastic/elasticsearch'; import { ToolingLog } from '@kbn/dev-utils'; import { Suite, Test } from './fake_mocha_types'; @@ -24,6 +23,7 @@ import { SuiteTracker, EsVersion, } from './lib'; +import { createEsClientForFtrConfig } from '../es'; export class FunctionalTestRunner { public readonly lifecycle = new Lifecycle(); @@ -61,27 +61,9 @@ export class FunctionalTestRunner { ...readProviderSpec('PageObject', config.get('pageObjects')), ]); - // validate es version if (providers.hasService('es')) { - const es = (await providers.getService('es')) as unknown as EsClient; - let esInfo; - try { - esInfo = await es.info(); - } catch (error) { - throw new Error( - `attempted to use the "es" service to fetch Elasticsearch version info but the request failed: ${error.stack}` - ); - } - - if (!this.esVersion.eql(esInfo.version.number)) { - throw new Error( - `ES reports a version number "${ - esInfo.version.number - }" which doesn't match supplied es version "${this.esVersion.toString()}"` - ); - } + await this.validateEsVersion(config); } - await providers.loadAll(); const customTestRunner = config.get('testRunner'); @@ -100,6 +82,33 @@ export class FunctionalTestRunner { }); } + private async validateEsVersion(config: Config) { + const es = createEsClientForFtrConfig(config); + + let esInfo; + try { + esInfo = await es.info(); + } catch (error) { + throw new Error( + `attempted to use the "es" service to fetch Elasticsearch version info but the request failed: ${error.stack}` + ); + } finally { + try { + await es.close(); + } catch { + // noop + } + } + + if (!this.esVersion.eql(esInfo.version.number)) { + throw new Error( + `ES reports a version number "${ + esInfo.version.number + }" which doesn't match supplied es version "${this.esVersion.toString()}"` + ); + } + } + async getTestStats() { return await this._run(async (config, coreProviders) => { if (config.get('testRunner')) { diff --git a/packages/kbn-test/src/index.ts b/packages/kbn-test/src/index.ts index b619a9eb9208a..5efd1c1f26852 100644 --- a/packages/kbn-test/src/index.ts +++ b/packages/kbn-test/src/index.ts @@ -25,8 +25,19 @@ export { runTests, startServers } from './functional_tests/tasks'; // @internal export { KIBANA_ROOT } from './functional_tests/lib/paths'; -export type { CreateTestEsClusterOptions, EsTestCluster, ICluster } from './es'; -export { esTestConfig, createTestEsCluster, convertToKibanaClient } from './es'; +export type { + CreateTestEsClusterOptions, + EsTestCluster, + ICluster, + EsClientForTestingOptions, +} from './es'; +export { + esTestConfig, + createTestEsCluster, + convertToKibanaClient, + createEsClientForTesting, + createEsClientForFtrConfig, +} from './es'; export { kbnTestConfig, diff --git a/test/common/services/elasticsearch.ts b/test/common/services/elasticsearch.ts index baa4050ee10f7..2f19bfe9105d0 100644 --- a/test/common/services/elasticsearch.ts +++ b/test/common/services/elasticsearch.ts @@ -6,12 +6,9 @@ * Side Public License, v 1. */ -import { format as formatUrl } from 'url'; -import fs from 'fs'; -import { Client, HttpConnection } from '@elastic/elasticsearch'; -import { CA_CERT_PATH } from '@kbn/dev-utils'; +import { Client } from '@elastic/elasticsearch'; -import { systemIndicesSuperuser } from '@kbn/test'; +import { systemIndicesSuperuser, createEsClientForFtrConfig } from '@kbn/test'; import { FtrProviderContext } from '../ftr_provider_context'; /* @@ -20,26 +17,8 @@ import { FtrProviderContext } from '../ftr_provider_context'; export function ElasticsearchProvider({ getService }: FtrProviderContext): Client { const config = getService('config'); - const esUrl = formatUrl({ - ...config.get('servers.elasticsearch'), + return createEsClientForFtrConfig(config, { // Use system indices user so tests can write to system indices - auth: `${systemIndicesSuperuser.username}:${systemIndicesSuperuser.password}`, + authOverride: systemIndicesSuperuser, }); - - if (process.env.TEST_CLOUD) { - return new Client({ - nodes: [esUrl], - requestTimeout: config.get('timeouts.esRequestTimeout'), - Connection: HttpConnection, - }); - } else { - return new Client({ - tls: { - ca: fs.readFileSync(CA_CERT_PATH, 'utf-8'), - }, - nodes: [esUrl], - requestTimeout: config.get('timeouts.esRequestTimeout'), - Connection: HttpConnection, - }); - } } diff --git a/test/common/services/security/security.ts b/test/common/services/security/security.ts index b8fea0a0c59b2..a182f225f2388 100644 --- a/test/common/services/security/security.ts +++ b/test/common/services/security/security.ts @@ -11,6 +11,7 @@ import { User } from './user'; import { RoleMappings } from './role_mappings'; import { FtrProviderContext } from '../../ftr_provider_context'; import { createTestUserService, TestUserSupertestProvider, TestUser } from './test_user'; +import { createSystemIndicesUser } from './system_indices_user'; export class SecurityService { constructor( @@ -28,6 +29,7 @@ export async function SecurityServiceProvider(ctx: FtrProviderContext) { const role = new Role(log, kibanaServer); const user = new User(log, kibanaServer); + await createSystemIndicesUser(ctx); const testUser = await createTestUserService(ctx, role, user); const testUserSupertest = TestUserSupertestProvider(ctx); const roleMappings = new RoleMappings(log, kibanaServer); diff --git a/test/common/services/security/system_indices_user.ts b/test/common/services/security/system_indices_user.ts new file mode 100644 index 0000000000000..c1ab6b1e0abfa --- /dev/null +++ b/test/common/services/security/system_indices_user.ts @@ -0,0 +1,59 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { systemIndicesSuperuser, createEsClientForFtrConfig } from '@kbn/test'; +import { FtrProviderContext } from '../../ftr_provider_context'; + +const SYSTEM_INDICES_SUPERUSER_ROLE = 'system_indices_superuser'; + +export async function createSystemIndicesUser(ctx: FtrProviderContext) { + const log = ctx.getService('log'); + const config = ctx.getService('config'); + + const enabled = !config + .get('esTestCluster.serverArgs') + .some((arg: string) => arg === 'xpack.security.enabled=false'); + + if (!enabled) { + return; + } + + const es = createEsClientForFtrConfig(config); + + log.debug('===============creating system indices role and user==============='); + + await es.security.putRole({ + name: SYSTEM_INDICES_SUPERUSER_ROLE, + refresh: 'wait_for', + cluster: ['all'], + indices: [ + { + names: ['*'], + privileges: ['all'], + allow_restricted_indices: true, + }, + ], + applications: [ + { + application: '*', + privileges: ['*'], + resources: ['*'], + }, + ], + run_as: ['*'], + }); + + await es.security.putUser({ + username: systemIndicesSuperuser.username, + refresh: 'wait_for', + password: systemIndicesSuperuser.password, + roles: [SYSTEM_INDICES_SUPERUSER_ROLE], + }); + + await es.close(); +} diff --git a/x-pack/plugins/apm/ftr_e2e/cypress/plugins/index.ts b/x-pack/plugins/apm/ftr_e2e/cypress/plugins/index.ts index 90cf964691274..0c924e70a1fdf 100644 --- a/x-pack/plugins/apm/ftr_e2e/cypress/plugins/index.ts +++ b/x-pack/plugins/apm/ftr_e2e/cypress/plugins/index.ts @@ -4,10 +4,8 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import Fs from 'fs'; -import { Client, HttpConnection } from '@elastic/elasticsearch'; import { apm, createLogger, LogLevel } from '@elastic/apm-synthtrace'; -import { CA_CERT_PATH } from '@kbn/dev-utils'; +import { createEsClientForTesting } from '@kbn/test'; // *********************************************************** // This example plugins/index.ts can be used to load plugins @@ -29,15 +27,10 @@ const plugin: Cypress.PluginConfig = (on, config) => { // `on` is used to hook into various events Cypress emits // `config` is the resolved Cypress config - const node = config.env.ES_NODE; - const requestTimeout = config.env.ES_REQUEST_TIMEOUT; - const isCloud = config.env.TEST_CLOUD; - - const client = new Client({ - node, - requestTimeout, - Connection: HttpConnection, - ...(isCloud ? { tls: { ca: Fs.readFileSync(CA_CERT_PATH, 'utf-8') } } : {}), + const client = createEsClientForTesting({ + esUrl: config.env.ES_NODE, + requestTimeout: config.env.ES_REQUEST_TIMEOUT, + isCloud: !!config.env.TEST_CLOUD, }); const synthtraceEsClient = new apm.ApmSynthtraceEsClient( diff --git a/x-pack/test/functional/apps/security/users.ts b/x-pack/test/functional/apps/security/users.ts index 634c7ace52735..d7201eae98bdb 100644 --- a/x-pack/test/functional/apps/security/users.ts +++ b/x-pack/test/functional/apps/security/users.ts @@ -44,7 +44,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { // In Cloud default users are defined in file realm, such users aren't exposed through the Users API. if (isCloudEnvironment()) { - expect(Object.keys(users)).to.eql(['test_user']); + expect(users).to.not.have.property('elastic'); + expect(users).to.not.have.property('kibana_system'); + expect(users).to.not.have.property('kibana'); } else { expect(users.elastic.roles).to.eql(['superuser']); expect(users.elastic.reserved).to.be(true); diff --git a/x-pack/test/rule_registry/common/services/cluster_client.ts b/x-pack/test/rule_registry/common/services/cluster_client.ts index 198919e2317fa..25c6228a7b529 100644 --- a/x-pack/test/rule_registry/common/services/cluster_client.ts +++ b/x-pack/test/rule_registry/common/services/cluster_client.ts @@ -5,10 +5,8 @@ * 2.0. */ -import { format as formatUrl } from 'url'; -import fs from 'fs'; -import { Client, HttpConnection, Transport } from '@elastic/elasticsearch'; -import { CA_CERT_PATH } from '@kbn/dev-utils'; +import { Client, Transport } from '@elastic/elasticsearch'; +import { createEsClientForFtrConfig } from '@kbn/test'; import type { TransportRequestParams, TransportRequestOptions, @@ -35,22 +33,7 @@ export function clusterClientProvider({ getService }: FtrProviderContext): Clien } } - if (process.env.TEST_CLOUD) { - return new Client({ - nodes: [formatUrl(config.get('servers.elasticsearch'))], - requestTimeout: config.get('timeouts.esRequestTimeout'), - Transport: KibanaTransport, - Connection: HttpConnection, - }); - } else { - return new Client({ - tls: { - ca: fs.readFileSync(CA_CERT_PATH, 'utf-8'), - }, - nodes: [formatUrl(config.get('servers.elasticsearch'))], - requestTimeout: config.get('timeouts.esRequestTimeout'), - Transport: KibanaTransport, - Connection: HttpConnection, - }); - } + return createEsClientForFtrConfig(config, { + Transport: KibanaTransport, + }); } From e445280fe6288ede6684efb55b86ab7aab0a6df8 Mon Sep 17 00:00:00 2001 From: Shahzad Date: Fri, 4 Feb 2022 11:47:52 +0100 Subject: [PATCH 31/68] [User Experience App] Move UX public code out of apm (#88645) --- .eslintrc.js | 3 +- .github/CODEOWNERS | 3 + docs/developer/plugin-list.asciidoc | 4 + .../styled_components_files.js | 2 +- packages/kbn-optimizer/limits.yml | 1 + x-pack/.i18nrc.json | 1 + x-pack/plugins/apm/common/ux_ui_filter.ts | 6 + x-pack/plugins/apm/kibana.json | 2 - .../public/application/application.test.tsx | 26 --- .../app/rum_dashboard/hooks/use_call_api.ts | 19 -- .../local_ui_filters/use_data_view.test.js | 44 ---- .../app/rum_dashboard/translations.ts | 188 ---------------- .../shared/environment_filter/index.tsx | 22 -- .../components/shared/links/url_helpers.ts | 5 +- .../mock_url_params_context_provider.tsx | 1 - .../url_params_context/resolve_url_params.ts | 6 - .../context/url_params_context/types.ts | 5 +- .../url_params_context/url_params_context.tsx | 28 +-- x-pack/plugins/apm/public/plugin.ts | 87 -------- .../plugins/apm/public/utils/test_helpers.tsx | 2 - .../routes/rum_client/get_page_view_trends.ts | 8 +- .../apm/server/routes/rum_client/route.ts | 2 +- .../rum_client/ui_filters/get_es_filter.ts | 8 +- x-pack/plugins/apm/server/routes/typings.ts | 2 +- .../plugins/apm/server/utils/test_helpers.tsx | 2 +- x-pack/plugins/observability/kibana.json | 3 +- .../shared/date_picker/date_picker.test.tsx} | 162 ++++++-------- .../components/shared/date_picker/index.tsx | 59 +++-- .../components/shared/date_picker/typings.ts | 22 ++ .../public/components/shared/index.tsx | 11 + .../public/hooks/use_query_params.ts | 6 +- .../public/hooks/use_time_range.ts | 4 +- x-pack/plugins/observability/public/index.ts | 2 + .../translations/translations/ja-JP.json | 158 +++++++------- .../translations/translations/zh-CN.json | 158 +++++++------- x-pack/plugins/ux/.prettierrc | 4 + x-pack/plugins/ux/.storybook/main.js | 8 + x-pack/plugins/ux/CONTRIBUTING.md | 1 + x-pack/plugins/ux/common/agent_name.ts | 20 ++ .../ux/common/elasticsearch_fieldnames.ts | 42 ++++ .../ux/common/environment_filter_values.ts | 75 +++++++ x-pack/plugins/ux/common/environment_rt.ts | 22 ++ x-pack/plugins/ux/common/fetch_options.ts | 15 ++ .../ux/common/index_pattern_constants.ts | 8 + x-pack/plugins/ux/common/transaction_types.ts | 10 + x-pack/plugins/ux/common/utils/pick_keys.ts | 12 ++ x-pack/plugins/ux/common/ux_ui_filter.ts | 120 +++++++++++ x-pack/plugins/ux/jest.config.js | 14 ++ x-pack/plugins/ux/kibana.json | 33 +++ .../public/application/application.test.tsx | 126 +++++++++++ .../{apm => ux}/public/application/ux_app.tsx | 132 ++++++------ .../app/rum_dashboard/action_menu/index.tsx | 24 +-- .../action_menu/inpector_link.tsx | 18 +- .../breakdowns/breakdown_filter.tsx | 11 +- .../app/rum_dashboard/chart_wrapper/index.tsx | 0 .../charts/page_load_dist_chart.tsx | 2 +- .../rum_dashboard/charts/page_views_chart.tsx | 2 +- .../charts/visitor_breakdown_chart.tsx | 0 .../rum_dashboard/client_metrics/index.tsx | 0 .../rum_dashboard/client_metrics/metrics.tsx | 0 .../csm_shared_context/index.tsx | 0 .../app/rum_dashboard/empty_state_loading.tsx | 2 +- .../environment_filter/index.tsx | 119 +++++++++++ .../rum_dashboard/hooks/use_has_rum_data.ts | 2 +- .../hooks/use_local_uifilters.ts} | 12 +- .../app/rum_dashboard/hooks/use_ux_query.ts | 0 .../rum_dashboard/impactful_metrics/index.tsx | 0 .../impactful_metrics/js_errors.tsx | 16 +- .../components/app/rum_dashboard/index.tsx | 2 +- .../rum_dashboard/local_uifilters}/index.tsx | 24 ++- .../rum_dashboard/local_uifilters}/queries.ts | 1 + .../local_uifilters}/selected_filters.tsx | 6 +- .../local_uifilters}/selected_wildcards.tsx | 7 +- .../local_uifilters}/use_data_view.ts | 2 +- .../breakdown_series.tsx | 0 .../page_load_distribution/index.tsx | 12 +- .../percentile_annotations.tsx | 0 .../reset_percentile_zoom.tsx | 0 .../page_load_distribution/use_breakdowns.ts | 0 .../rum_dashboard/page_views_trend/index.tsx | 12 +- .../panels/page_load_and_views.tsx | 0 .../panels/visitor_breakdowns.tsx | 0 .../panels/web_application_select.tsx | 2 +- .../app/rum_dashboard/rum_dashboard.tsx | 0 .../rum_dashboard/rum_datepicker/index.tsx | 4 +- .../components/app/rum_dashboard/rum_home.tsx | 25 +-- .../app/rum_dashboard/translations.ts | 179 ++++++++++++++++ .../app/rum_dashboard/url_filter/index.tsx | 2 +- .../url_filter/service_name_filter/index.tsx | 19 +- .../url_filter/url_search/index.tsx | 2 +- .../url_filter/url_search/render_option.tsx | 0 .../url_filter/url_search/use_url_search.tsx | 0 .../rum_dashboard/user_percentile/index.tsx | 2 +- .../app/rum_dashboard/utils/test_helper.tsx | 0 .../ux_metrics/format_to_sec.test.ts | 0 .../app/rum_dashboard/ux_metrics/index.tsx | 0 .../ux_metrics/key_ux_metrics.test.tsx | 11 +- .../ux_metrics/key_ux_metrics.tsx | 0 .../rum_dashboard/ux_metrics/translations.ts | 42 ++-- .../app/rum_dashboard/ux_overview_fetchers.ts | 0 .../rum_dashboard/visitor_breakdown/index.tsx | 0 .../__mocks__/regions_layer.mock.ts | 0 .../__snapshots__/embedded_map.test.tsx.snap | 2 +- .../__snapshots__/map_tooltip.test.tsx.snap | 0 .../__stories__/map_tooltip.stories.tsx | 0 .../embedded_map.test.tsx | 0 .../visitor_breakdown_map/embedded_map.tsx | 22 +- .../visitor_breakdown_map/index.tsx | 0 .../map_tooltip.test.tsx | 0 .../visitor_breakdown_map/map_tooltip.tsx | 0 .../use_layer_list.test.ts | 0 .../visitor_breakdown_map/use_layer_list.ts | 2 +- .../visitor_breakdown_map/use_map_filters.ts | 3 +- .../context/url_params_context/constants.ts | 9 + .../url_params_context/helpers.test.ts | 197 +++++++++++++++++ .../context/url_params_context/helpers.ts | 104 +++++++++ .../mock_url_params_context_provider.tsx | 43 ++++ .../url_params_context/resolve_url_params.ts | 65 ++++++ .../context/url_params_context/types.ts | 29 +++ .../url_params_context.test.tsx | 202 ++++++++++++++++++ .../url_params_context/url_params_context.tsx | 105 +++++++++ .../url_params_context/use_url_params.ts | 25 +++ .../url_params_context/use_ux_url_params.ts | 4 +- .../ux/public/hooks/use_breakpoints.ts | 46 ++++ .../public/hooks/use_date_range_redirect.ts | 49 +++++ .../public/hooks/use_deep_object_identity.ts | 21 ++ .../ux/public/hooks/use_dynamic_data_view.ts | 21 ++ .../public/hooks/use_environments_fetcher.tsx | 60 ++++++ .../plugins/ux/public/hooks/use_fetcher.tsx | 186 ++++++++++++++++ .../ux/public/hooks/use_kibana_services.tsx | 21 ++ x-pack/plugins/ux/public/index.ts | 14 ++ x-pack/plugins/ux/public/plugin.ts | 160 ++++++++++++++ .../ux/public/services/rest/call_api.ts | 102 +++++++++ .../services/rest/create_call_apm_api.ts | 89 ++++++++ .../ux/public/services/rest/data_view.ts | 14 ++ x-pack/plugins/ux/readme.md | 3 + x-pack/plugins/ux/tsconfig.json | 31 +++ .../plugins/{apm => ux}/typings/ui_filters.ts | 0 138 files changed, 2925 insertions(+), 970 deletions(-) delete mode 100644 x-pack/plugins/apm/public/components/app/rum_dashboard/hooks/use_call_api.ts delete mode 100644 x-pack/plugins/apm/public/components/app/rum_dashboard/local_ui_filters/use_data_view.test.js delete mode 100644 x-pack/plugins/apm/public/components/app/rum_dashboard/translations.ts rename x-pack/plugins/{apm/public/components/app/rum_dashboard/rum_datepicker/index.test.tsx => observability/public/components/shared/date_picker/date_picker.test.tsx} (51%) create mode 100644 x-pack/plugins/observability/public/components/shared/date_picker/typings.ts create mode 100644 x-pack/plugins/ux/.prettierrc create mode 100644 x-pack/plugins/ux/.storybook/main.js create mode 100644 x-pack/plugins/ux/CONTRIBUTING.md create mode 100644 x-pack/plugins/ux/common/agent_name.ts create mode 100644 x-pack/plugins/ux/common/elasticsearch_fieldnames.ts create mode 100644 x-pack/plugins/ux/common/environment_filter_values.ts create mode 100644 x-pack/plugins/ux/common/environment_rt.ts create mode 100644 x-pack/plugins/ux/common/fetch_options.ts create mode 100644 x-pack/plugins/ux/common/index_pattern_constants.ts create mode 100644 x-pack/plugins/ux/common/transaction_types.ts create mode 100644 x-pack/plugins/ux/common/utils/pick_keys.ts create mode 100644 x-pack/plugins/ux/common/ux_ui_filter.ts create mode 100644 x-pack/plugins/ux/jest.config.js create mode 100644 x-pack/plugins/ux/kibana.json create mode 100644 x-pack/plugins/ux/public/application/application.test.tsx rename x-pack/plugins/{apm => ux}/public/application/ux_app.tsx (54%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/action_menu/index.tsx (79%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/action_menu/inpector_link.tsx (54%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/breakdowns/breakdown_filter.tsx (86%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/chart_wrapper/index.tsx (100%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/charts/page_load_dist_chart.tsx (100%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/charts/page_views_chart.tsx (97%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/charts/visitor_breakdown_chart.tsx (100%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/client_metrics/index.tsx (100%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/client_metrics/metrics.tsx (100%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/csm_shared_context/index.tsx (100%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/empty_state_loading.tsx (91%) create mode 100644 x-pack/plugins/ux/public/components/app/rum_dashboard/environment_filter/index.tsx rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/hooks/use_has_rum_data.ts (96%) rename x-pack/plugins/{apm/public/components/app/rum_dashboard/hooks/use_local_ui_filters.ts => ux/public/components/app/rum_dashboard/hooks/use_local_uifilters.ts} (94%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/hooks/use_ux_query.ts (100%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/impactful_metrics/index.tsx (100%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/impactful_metrics/js_errors.tsx (90%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/index.tsx (92%) rename x-pack/plugins/{apm/public/components/app/rum_dashboard/local_ui_filters => ux/public/components/app/rum_dashboard/local_uifilters}/index.tsx (97%) rename x-pack/plugins/{apm/public/components/app/rum_dashboard/local_ui_filters => ux/public/components/app/rum_dashboard/local_uifilters}/queries.ts (99%) rename x-pack/plugins/{apm/public/components/app/rum_dashboard/local_ui_filters => ux/public/components/app/rum_dashboard/local_uifilters}/selected_filters.tsx (96%) rename x-pack/plugins/{apm/public/components/app/rum_dashboard/local_ui_filters => ux/public/components/app/rum_dashboard/local_uifilters}/selected_wildcards.tsx (91%) rename x-pack/plugins/{apm/public/components/app/rum_dashboard/local_ui_filters => ux/public/components/app/rum_dashboard/local_uifilters}/use_data_view.ts (100%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/page_load_distribution/breakdown_series.tsx (100%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/page_load_distribution/index.tsx (95%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/page_load_distribution/percentile_annotations.tsx (100%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/page_load_distribution/reset_percentile_zoom.tsx (100%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/page_load_distribution/use_breakdowns.ts (100%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/page_views_trend/index.tsx (93%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/panels/page_load_and_views.tsx (100%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/panels/visitor_breakdowns.tsx (100%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/panels/web_application_select.tsx (100%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/rum_dashboard.tsx (100%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/rum_datepicker/index.tsx (86%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/rum_home.tsx (78%) create mode 100644 x-pack/plugins/ux/public/components/app/rum_dashboard/translations.ts rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/url_filter/index.tsx (95%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/url_filter/service_name_filter/index.tsx (82%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/url_filter/url_search/index.tsx (98%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/url_filter/url_search/render_option.tsx (100%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/url_filter/url_search/use_url_search.tsx (100%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/user_percentile/index.tsx (96%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/utils/test_helper.tsx (100%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/ux_metrics/format_to_sec.test.ts (100%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/ux_metrics/index.tsx (100%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/ux_metrics/key_ux_metrics.test.tsx (82%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/ux_metrics/key_ux_metrics.tsx (100%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/ux_metrics/translations.ts (64%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/ux_overview_fetchers.ts (100%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/visitor_breakdown/index.tsx (100%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/visitor_breakdown_map/__mocks__/regions_layer.mock.ts (100%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/visitor_breakdown_map/__snapshots__/embedded_map.test.tsx.snap (93%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/visitor_breakdown_map/__snapshots__/map_tooltip.test.tsx.snap (100%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/visitor_breakdown_map/__stories__/map_tooltip.stories.tsx (100%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/visitor_breakdown_map/embedded_map.test.tsx (100%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/visitor_breakdown_map/embedded_map.tsx (85%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/visitor_breakdown_map/index.tsx (100%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/visitor_breakdown_map/map_tooltip.test.tsx (100%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/visitor_breakdown_map/map_tooltip.tsx (100%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/visitor_breakdown_map/use_layer_list.test.ts (100%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/visitor_breakdown_map/use_layer_list.ts (100%) rename x-pack/plugins/{apm => ux}/public/components/app/rum_dashboard/visitor_breakdown_map/use_map_filters.ts (99%) create mode 100644 x-pack/plugins/ux/public/context/url_params_context/constants.ts create mode 100644 x-pack/plugins/ux/public/context/url_params_context/helpers.test.ts create mode 100644 x-pack/plugins/ux/public/context/url_params_context/helpers.ts create mode 100644 x-pack/plugins/ux/public/context/url_params_context/mock_url_params_context_provider.tsx create mode 100644 x-pack/plugins/ux/public/context/url_params_context/resolve_url_params.ts create mode 100644 x-pack/plugins/ux/public/context/url_params_context/types.ts create mode 100644 x-pack/plugins/ux/public/context/url_params_context/url_params_context.test.tsx create mode 100644 x-pack/plugins/ux/public/context/url_params_context/url_params_context.tsx create mode 100644 x-pack/plugins/ux/public/context/url_params_context/use_url_params.ts rename x-pack/plugins/{apm => ux}/public/context/url_params_context/use_ux_url_params.ts (87%) create mode 100644 x-pack/plugins/ux/public/hooks/use_breakpoints.ts create mode 100644 x-pack/plugins/ux/public/hooks/use_date_range_redirect.ts create mode 100644 x-pack/plugins/ux/public/hooks/use_deep_object_identity.ts create mode 100644 x-pack/plugins/ux/public/hooks/use_dynamic_data_view.ts create mode 100644 x-pack/plugins/ux/public/hooks/use_environments_fetcher.tsx create mode 100644 x-pack/plugins/ux/public/hooks/use_fetcher.tsx create mode 100644 x-pack/plugins/ux/public/hooks/use_kibana_services.tsx create mode 100644 x-pack/plugins/ux/public/index.ts create mode 100644 x-pack/plugins/ux/public/plugin.ts create mode 100644 x-pack/plugins/ux/public/services/rest/call_api.ts create mode 100644 x-pack/plugins/ux/public/services/rest/create_call_apm_api.ts create mode 100644 x-pack/plugins/ux/public/services/rest/data_view.ts create mode 100644 x-pack/plugins/ux/readme.md create mode 100644 x-pack/plugins/ux/tsconfig.json rename x-pack/plugins/{apm => ux}/typings/ui_filters.ts (100%) diff --git a/.eslintrc.js b/.eslintrc.js index b21ad1f520a08..ce7e2dea0a14f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -853,12 +853,13 @@ module.exports = { }, /** - * APM and Observability overrides + * APM, UX and Observability overrides */ { files: [ 'x-pack/plugins/apm/**/*.{js,mjs,ts,tsx}', 'x-pack/plugins/observability/**/*.{js,mjs,ts,tsx}', + 'x-pack/plugins/ux/**/*.{js,mjs,ts,tsx}', ], rules: { 'no-console': ['warn', { allow: ['error'] }], diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index f7709dbcfa8a9..7035660b1b46a 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -96,6 +96,7 @@ # Observability Shared /x-pack/plugins/observability/ @elastic/observability-ui +/x-pack/plugins/observability/public/components/shared/date_picker/ @elastic/uptime # Unified Observability /x-pack/plugins/observability/public/components/shared/exploratory_view @elastic/unified-observability @@ -136,6 +137,8 @@ # Uptime /x-pack/plugins/uptime @elastic/uptime +/x-pack/plugins/ux @elastic/uptime +/x-pack/plugins/observability/public/components/shared/exploratory_view @elastic/uptime /x-pack/test/functional_with_es_ssl/apps/uptime @elastic/uptime /x-pack/test/functional/apps/uptime @elastic/uptime /x-pack/test/functional/es_archives/uptime @elastic/uptime diff --git a/docs/developer/plugin-list.asciidoc b/docs/developer/plugin-list.asciidoc index fa7613049f9d6..d38775fc608d5 100644 --- a/docs/developer/plugin-list.asciidoc +++ b/docs/developer/plugin-list.asciidoc @@ -635,6 +635,10 @@ in their infrastructure. |NOTE: This plugin contains implementation of URL drilldown. For drilldowns infrastructure code refer to ui_actions_enhanced plugin. +|{kib-repo}blob/{branch}/x-pack/plugins/ux/readme.md[ux] +|https://docs.elastic.dev/kibana-dev-docs/welcome + + |{kib-repo}blob/{branch}/x-pack/plugins/watcher/README.md[watcher] |This plugins adopts some conventions in addition to or in place of conventions in Kibana (at the time of the plugin's creation): diff --git a/packages/kbn-babel-preset/styled_components_files.js b/packages/kbn-babel-preset/styled_components_files.js index 2f48e39ac9456..2efe4b1474b45 100644 --- a/packages/kbn-babel-preset/styled_components_files.js +++ b/packages/kbn-babel-preset/styled_components_files.js @@ -14,7 +14,7 @@ module.exports = { USES_STYLED_COMPONENTS: [ /packages[\/\\]kbn-ui-shared-deps-(npm|src)[\/\\]/, /src[\/\\]plugins[\/\\](data|kibana_react)[\/\\]/, - /x-pack[\/\\]plugins[\/\\](apm|beats_management|cases|fleet|infra|lists|observability|osquery|security_solution|timelines|uptime)[\/\\]/, + /x-pack[\/\\]plugins[\/\\](apm|beats_management|cases|fleet|infra|lists|observability|osquery|security_solution|timelines|uptime|ux)[\/\\]/, /x-pack[\/\\]test[\/\\]plugin_functional[\/\\]plugins[\/\\]resolver_test[\/\\]/, ], }; diff --git a/packages/kbn-optimizer/limits.yml b/packages/kbn-optimizer/limits.yml index 3e5b2c77d1839..bbd7f25ca9c02 100644 --- a/packages/kbn-optimizer/limits.yml +++ b/packages/kbn-optimizer/limits.yml @@ -121,3 +121,4 @@ pageLoadAssetSize: controls: 34788 expressionPie: 26338 sharedUX: 16225 + ux: 20784 diff --git a/x-pack/.i18nrc.json b/x-pack/.i18nrc.json index aac29086fe53d..71ff1032819ff 100644 --- a/x-pack/.i18nrc.json +++ b/x-pack/.i18nrc.json @@ -60,6 +60,7 @@ "xpack.triggersActionsUI": "plugins/triggers_actions_ui", "xpack.upgradeAssistant": "plugins/upgrade_assistant", "xpack.uptime": ["plugins/uptime"], + "xpack.ux": ["plugins/ux"], "xpack.urlDrilldown": "plugins/drilldowns/url_drilldown", "xpack.watcher": "plugins/watcher", "xpack.observability": "plugins/observability", diff --git a/x-pack/plugins/apm/common/ux_ui_filter.ts b/x-pack/plugins/apm/common/ux_ui_filter.ts index 4b2ded2fd50ad..f1dd0394de62a 100644 --- a/x-pack/plugins/apm/common/ux_ui_filter.ts +++ b/x-pack/plugins/apm/common/ux_ui_filter.ts @@ -118,3 +118,9 @@ export const uxLocalUIFilters = uxLocalUIFilterNames.reduce((acc, key) => { }, }; }, {} as UxLocalUIFilterMap); + +export type UxUIFilters = { + environment?: string; +} & { + [key in UxLocalUIFilterName]?: string[]; +}; diff --git a/x-pack/plugins/apm/kibana.json b/x-pack/plugins/apm/kibana.json index 846847dcd7e05..8b5ac68f07a22 100644 --- a/x-pack/plugins/apm/kibana.json +++ b/x-pack/plugins/apm/kibana.json @@ -24,7 +24,6 @@ "cloud", "fleet", "home", - "maps", "ml", "security", "spaces", @@ -39,7 +38,6 @@ "home", "kibanaReact", "kibanaUtils", - "maps", "ml", "observability" ] diff --git a/x-pack/plugins/apm/public/application/application.test.tsx b/x-pack/plugins/apm/public/application/application.test.tsx index 5ea9b6999483e..5a7df0708caed 100644 --- a/x-pack/plugins/apm/public/application/application.test.tsx +++ b/x-pack/plugins/apm/public/application/application.test.tsx @@ -7,29 +7,21 @@ import React from 'react'; import { act } from '@testing-library/react'; -import { EuiErrorBoundary } from '@elastic/eui'; -import { mount } from 'enzyme'; import { createMemoryHistory } from 'history'; import { Observable } from 'rxjs'; import { AppMountParameters, DocLinksStart, HttpStart } from 'src/core/public'; import { mockApmPluginContextValue } from '../context/apm_plugin/mock_apm_plugin_context'; import { createCallApmApi } from '../services/rest/create_call_apm_api'; import { renderApp as renderApmApp } from './'; -import { UXAppRoot } from './ux_app'; import { disableConsoleWarning } from '../utils/test_helpers'; import { dataPluginMock } from 'src/plugins/data/public/mocks'; import { embeddablePluginMock } from 'src/plugins/embeddable/public/mocks'; import { ApmPluginSetupDeps, ApmPluginStartDeps } from '../plugin'; -import { RumHome } from '../components/app/rum_dashboard/rum_home'; jest.mock('../services/rest/data_view', () => ({ createStaticDataView: () => Promise.resolve(undefined), })); -jest.mock('../components/app/rum_dashboard/rum_home', () => ({ - RumHome: () =>

Home Mock

, -})); - describe('renderApp (APM)', () => { let mockConsole: jest.SpyInstance; beforeAll(() => { @@ -148,21 +140,3 @@ describe('renderApp (APM)', () => { }).not.toThrowError(); }); }); - -describe('renderUxApp', () => { - it('has an error boundary for the UXAppRoot', async () => { - const uxMountProps = mockApmPluginContextValue; - - const wrapper = mount(); - - wrapper - .find(RumHome) - .simulateError(new Error('Oh no, an unexpected error!')); - - expect(wrapper.find(RumHome)).toHaveLength(0); - expect(wrapper.find(EuiErrorBoundary)).toHaveLength(1); - expect(wrapper.find(EuiErrorBoundary).text()).toMatch( - /Error: Oh no, an unexpected error!/ - ); - }); -}); diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/hooks/use_call_api.ts b/x-pack/plugins/apm/public/components/app/rum_dashboard/hooks/use_call_api.ts deleted file mode 100644 index a7a5dd0d2d5ff..0000000000000 --- a/x-pack/plugins/apm/public/components/app/rum_dashboard/hooks/use_call_api.ts +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { useMemo } from 'react'; -import { callApi } from '../../../../services/rest/call_api'; -import { useApmPluginContext } from '../../../../context/apm_plugin/use_apm_plugin_context'; -import { FetchOptions } from '../../../../../common/fetch_options'; - -export function useCallApi() { - const { core } = useApmPluginContext(); - - return useMemo(() => { - return (options: FetchOptions) => callApi(core, options); - }, [core]); -} diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/local_ui_filters/use_data_view.test.js b/x-pack/plugins/apm/public/components/app/rum_dashboard/local_ui_filters/use_data_view.test.js deleted file mode 100644 index d9eef896782ca..0000000000000 --- a/x-pack/plugins/apm/public/components/app/rum_dashboard/local_ui_filters/use_data_view.test.js +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ -import React from 'react'; -import { renderHook } from '@testing-library/react-hooks'; -import * as dynamicDataView from '../../../../hooks/use_dynamic_data_view'; -import { useDataView } from './use_data_view'; -import { MockApmPluginContextWrapper } from '../../../../context/apm_plugin/mock_apm_plugin_context'; -import { KibanaContextProvider } from '../../../../../../../../src/plugins/kibana_react/public'; - -describe('useDataView', () => { - const create = jest.fn(); - const mockDataService = { - data: { - dataViews: { - create, - }, - }, - }; - - const title = 'apm-*'; - jest - .spyOn(dynamicDataView, 'useDynamicDataViewFetcher') - .mockReturnValue({ dataView: { title } }); - - it('returns result as expected', async () => { - const { waitForNextUpdate } = renderHook(() => useDataView(), { - wrapper: ({ children }) => ( - - - {children} - - - ), - }); - - await waitForNextUpdate(); - - expect(create).toBeCalledWith({ title }); - }); -}); diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/translations.ts b/x-pack/plugins/apm/public/components/app/rum_dashboard/translations.ts deleted file mode 100644 index 1720c62be3a75..0000000000000 --- a/x-pack/plugins/apm/public/components/app/rum_dashboard/translations.ts +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { i18n } from '@kbn/i18n'; - -export const I18LABELS = { - dataMissing: i18n.translate('xpack.apm.rum.dashboard.dataMissing', { - defaultMessage: 'N/A', - }), - totalPageLoad: i18n.translate('xpack.apm.rum.dashboard.totalPageLoad', { - defaultMessage: 'Total', - }), - backEnd: i18n.translate('xpack.apm.rum.dashboard.backend', { - defaultMessage: 'Backend', - }), - frontEnd: i18n.translate('xpack.apm.rum.dashboard.frontend', { - defaultMessage: 'Frontend', - }), - pageViews: i18n.translate('xpack.apm.rum.dashboard.pageViews', { - defaultMessage: 'Total page views', - }), - percPageLoaded: i18n.translate('xpack.apm.rum.dashboard.pagesLoaded.label', { - defaultMessage: 'Pages loaded', - }), - pageLoadTime: i18n.translate('xpack.apm.rum.dashboard.pageLoadTime.label', { - defaultMessage: 'Page load time (seconds)', - }), - pageLoadTimes: i18n.translate('xpack.apm.rum.dashboard.pageLoadTimes.label', { - defaultMessage: 'Page load times', - }), - pageLoadDuration: i18n.translate( - 'xpack.apm.rum.dashboard.pageLoadDuration.label', - { - defaultMessage: 'Page load duration', - } - ), - pageLoad: i18n.translate('xpack.apm.rum.dashboard.pageLoad.label', { - defaultMessage: 'Page load', - }), - pageLoadDistribution: i18n.translate( - 'xpack.apm.rum.dashboard.pageLoadDistribution.label', - { - defaultMessage: 'Page load distribution', - } - ), - jsErrors: i18n.translate( - 'xpack.apm.rum.dashboard.impactfulMetrics.jsErrors', - { - defaultMessage: 'JavaScript errors', - } - ), - highTrafficPages: i18n.translate( - 'xpack.apm.rum.dashboard.impactfulMetrics.highTrafficPages', - { - defaultMessage: 'High traffic pages', - } - ), - resetZoom: i18n.translate('xpack.apm.rum.dashboard.resetZoom.label', { - defaultMessage: 'Reset zoom', - }), - overall: i18n.translate('xpack.apm.rum.dashboard.overall.label', { - defaultMessage: 'Overall', - }), - selectBreakdown: i18n.translate('xpack.apm.rum.filterGroup.selectBreakdown', { - defaultMessage: 'Select breakdown', - }), - breakdown: i18n.translate('xpack.apm.rum.filterGroup.breakdown', { - defaultMessage: 'Breakdown', - }), - seconds: i18n.translate('xpack.apm.rum.filterGroup.seconds', { - defaultMessage: 'seconds', - }), - coreWebVitals: i18n.translate('xpack.apm.rum.filterGroup.coreWebVitals', { - defaultMessage: 'Core web vitals', - }), - browser: i18n.translate('xpack.apm.rum.visitorBreakdown.browser', { - defaultMessage: 'Browser', - }), - operatingSystem: i18n.translate( - 'xpack.apm.rum.visitorBreakdown.operatingSystem', - { - defaultMessage: 'Operating system', - } - ), - metrics: i18n.translate('xpack.apm.ux.metrics', { - defaultMessage: 'Metrics', - }), - median: i18n.translate('xpack.apm.ux.median', { - defaultMessage: 'median', - }), - avgPageLoadDuration: i18n.translate( - 'xpack.apm.rum.visitorBreakdownMap.avgPageLoadDuration', - { - defaultMessage: 'Average page load duration', - } - ), - pageLoadDurationByRegion: i18n.translate( - 'xpack.apm.rum.visitorBreakdownMap.pageLoadDurationByRegion', - { - defaultMessage: 'Page load duration by region (avg.)', - } - ), - filterByUrl: i18n.translate('xpack.apm.rum.filters.filterByUrl', { - defaultMessage: 'Filter by URL', - }), - getSearchResultsLabel: (total: number) => - i18n.translate('xpack.apm.rum.filters.searchResults', { - defaultMessage: '{total} Search results', - values: { total }, - }), - topPages: i18n.translate('xpack.apm.rum.filters.topPages', { - defaultMessage: 'Top pages', - }), - select: i18n.translate('xpack.apm.rum.filters.select', { - defaultMessage: 'Select', - }), - url: i18n.translate('xpack.apm.rum.filters.url', { - defaultMessage: 'Url', - }), - loadingResults: i18n.translate('xpack.apm.rum.filters.url.loadingResults', { - defaultMessage: 'Loading results', - }), - noResults: i18n.translate('xpack.apm.rum.filters.url.noResults', { - defaultMessage: 'No results available', - }), - totalErrors: i18n.translate('xpack.apm.rum.jsErrors.totalErrors', { - defaultMessage: 'Total errors', - }), - errorRate: i18n.translate('xpack.apm.rum.jsErrors.errorRate', { - defaultMessage: 'Error rate', - }), - errorMessage: i18n.translate('xpack.apm.rum.jsErrors.errorMessage', { - defaultMessage: 'Error message', - }), - impactedPageLoads: i18n.translate( - 'xpack.apm.rum.jsErrors.impactedPageLoads', - { - defaultMessage: 'Impacted page loads', - } - ), - percentile: i18n.translate('xpack.apm.ux.percentile.label', { - defaultMessage: 'Percentile', - }), - percentile50thMedian: i18n.translate('xpack.apm.ux.percentile.50thMedian', { - defaultMessage: '50th (Median)', - }), - percentile75th: i18n.translate('xpack.apm.ux.percentile.75th', { - defaultMessage: '75th', - }), - percentile90th: i18n.translate('xpack.apm.ux.percentile.90th', { - defaultMessage: '90th', - }), - percentile95th: i18n.translate('xpack.apm.ux.percentile.95th', { - defaultMessage: '95th', - }), - percentile99th: i18n.translate('xpack.apm.ux.percentile.99th', { - defaultMessage: '99th', - }), - noData: i18n.translate('xpack.apm.ux.visitorBreakdown.noData', { - defaultMessage: 'No data.', - }), - // Helper tooltips - totalPageLoadTooltip: i18n.translate( - 'xpack.apm.rum.dashboard.tooltips.totalPageLoad', - { - defaultMessage: 'Total represents the full page load duration', - } - ), - frontEndTooltip: i18n.translate('xpack.apm.rum.dashboard.tooltips.frontEnd', { - defaultMessage: - 'Frontend time represents the total page load duration minus the backend time', - }), - backEndTooltip: i18n.translate('xpack.apm.rum.dashboard.tooltips.backEnd', { - defaultMessage: - 'Backend time represents time to first byte (TTFB), which is when the first response packet is received after the request has been made', - }), -}; - -export const VisitorBreakdownLabel = i18n.translate( - 'xpack.apm.rum.visitorBreakdown', - { - defaultMessage: 'Visitor breakdown', - } -); diff --git a/x-pack/plugins/apm/public/components/shared/environment_filter/index.tsx b/x-pack/plugins/apm/public/components/shared/environment_filter/index.tsx index a7a8c90c31c16..64d137cae0c27 100644 --- a/x-pack/plugins/apm/public/components/shared/environment_filter/index.tsx +++ b/x-pack/plugins/apm/public/components/shared/environment_filter/index.tsx @@ -14,9 +14,7 @@ import { ENVIRONMENT_ALL, ENVIRONMENT_NOT_DEFINED, } from '../../../../common/environment_filter_values'; -import { useEnvironmentsFetcher } from '../../../hooks/use_environments_fetcher'; import { fromQuery, toQuery } from '../links/url_helpers'; -import { useUxUrlParams } from '../../../context/url_params_context/use_ux_url_params'; import { FETCH_STATUS } from '../../../hooks/use_fetcher'; import { Environment } from '../../../../common/environment_rt'; import { useEnvironmentsContext } from '../../../context/environments_context/use_environments_context'; @@ -74,26 +72,6 @@ export function ApmEnvironmentFilter() { ); } -export function UxEnvironmentFilter() { - const { - urlParams: { start, end, environment, serviceName }, - } = useUxUrlParams(); - - const { environments, status } = useEnvironmentsFetcher({ - serviceName, - start, - end, - }); - - return ( - - ); -} - export function EnvironmentFilter({ environment, environments, diff --git a/x-pack/plugins/apm/public/components/shared/links/url_helpers.ts b/x-pack/plugins/apm/public/components/shared/links/url_helpers.ts index b0cadd50b3d61..bbde45ba9cd61 100644 --- a/x-pack/plugins/apm/public/components/shared/links/url_helpers.ts +++ b/x-pack/plugins/apm/public/components/shared/links/url_helpers.ts @@ -8,7 +8,6 @@ import { History } from 'history'; import { parse, stringify } from 'query-string'; import { url } from '../../../../../../../src/plugins/kibana_utils/public'; -import { UxLocalUIFilterName } from '../../../../common/ux_ui_filter'; export function toQuery(search?: string): APMQueryParamsRaw { return search ? parse(search.slice(1), { sort: false }) : {}; @@ -64,7 +63,7 @@ export function createHref( return history.createHref(location); } -export type APMQueryParams = { +export interface APMQueryParams { sampleRangeFrom?: number; sampleRangeTo?: number; transactionId?: string; @@ -96,7 +95,7 @@ export type APMQueryParams = { podName?: string; agentName?: string; serviceVersion?: string; -} & { [key in UxLocalUIFilterName]?: string }; +} // forces every value of T[K] to be type: string type StringifyAll = { [K in keyof T]: string }; diff --git a/x-pack/plugins/apm/public/context/url_params_context/mock_url_params_context_provider.tsx b/x-pack/plugins/apm/public/context/url_params_context/mock_url_params_context_provider.tsx index 75cf050fcb089..3cd522037bb11 100644 --- a/x-pack/plugins/apm/public/context/url_params_context/mock_url_params_context_provider.tsx +++ b/x-pack/plugins/apm/public/context/url_params_context/mock_url_params_context_provider.tsx @@ -35,7 +35,6 @@ export function MockUrlParamsContextProvider({ rangeId: 0, refreshTimeRange, urlParams, - uxUiFilters: {}, }} children={children} /> diff --git a/x-pack/plugins/apm/public/context/url_params_context/resolve_url_params.ts b/x-pack/plugins/apm/public/context/url_params_context/resolve_url_params.ts index 4311a9c75de85..eb231741ad77e 100644 --- a/x-pack/plugins/apm/public/context/url_params_context/resolve_url_params.ts +++ b/x-pack/plugins/apm/public/context/url_params_context/resolve_url_params.ts @@ -7,10 +7,8 @@ import { Location } from 'history'; import { TimeRangeComparisonType } from '../../../common/runtime_types/comparison_type_rt'; -import { uxLocalUIFilterNames } from '../../../common/ux_ui_filter'; import { ENVIRONMENT_ALL } from '../../../common/environment_filter_values'; import { LatencyAggregationType } from '../../../common/latency_aggregation_types'; -import { pickKeys } from '../../../common/utils/pick_keys'; import { toQuery } from '../../components/shared/links/url_helpers'; import { getDateRange, @@ -57,8 +55,6 @@ export function resolveUrlParams(location: Location, state: TimeUrlParams) { comparisonType, } = query; - const localUIFilters = pickKeys(query, ...uxLocalUIFilterNames); - return removeUndefinedProps({ // date params ...getDateRange({ state, rangeFrom, rangeTo }), @@ -91,7 +87,5 @@ export function resolveUrlParams(location: Location, state: TimeUrlParams) { ? toBoolean(comparisonEnabled) : undefined, comparisonType: comparisonType as TimeRangeComparisonType | undefined, - // ui filters - ...localUIFilters, }); } diff --git a/x-pack/plugins/apm/public/context/url_params_context/types.ts b/x-pack/plugins/apm/public/context/url_params_context/types.ts index 8f167fc0ab734..aaad2fac2da22 100644 --- a/x-pack/plugins/apm/public/context/url_params_context/types.ts +++ b/x-pack/plugins/apm/public/context/url_params_context/types.ts @@ -7,9 +7,8 @@ import { TimeRangeComparisonType } from '../../../common/runtime_types/comparison_type_rt'; import { LatencyAggregationType } from '../../../common/latency_aggregation_types'; -import { UxLocalUIFilterName } from '../../../common/ux_ui_filter'; -export type UrlParams = { +export interface UrlParams { detailTab?: string; end?: string; flyoutDetailTab?: string; @@ -38,7 +37,7 @@ export type UrlParams = { latencyAggregationType?: LatencyAggregationType; comparisonEnabled?: boolean; comparisonType?: TimeRangeComparisonType; -} & Partial>; +} export type UxUrlParams = UrlParams; export type ApmUrlParams = Omit; diff --git a/x-pack/plugins/apm/public/context/url_params_context/url_params_context.tsx b/x-pack/plugins/apm/public/context/url_params_context/url_params_context.tsx index 4d96cb074172d..a128db6c2cd7a 100644 --- a/x-pack/plugins/apm/public/context/url_params_context/url_params_context.tsx +++ b/x-pack/plugins/apm/public/context/url_params_context/url_params_context.tsx @@ -5,7 +5,6 @@ * 2.0. */ -import { mapValues } from 'lodash'; import React, { createContext, useCallback, @@ -14,13 +13,6 @@ import React, { useState, } from 'react'; import { withRouter } from 'react-router-dom'; -import { - UxLocalUIFilterName, - uxLocalUIFilterNames, -} from '../../../common/ux_ui_filter'; -import { pickKeys } from '../../../common/utils/pick_keys'; -import { UxUIFilters } from '../../../typings/ui_filters'; -import { useDeepObjectIdentity } from '../../hooks/use_deep_object_identity'; import { getDateRange } from './helpers'; import { resolveUrlParams } from './resolve_url_params'; import { UrlParams } from './types'; @@ -30,24 +22,11 @@ export interface TimeRange { rangeTo: string; } -function useUxUiFilters(params: UrlParams): UxUIFilters { - const localUiFilters = mapValues( - pickKeys(params, ...uxLocalUIFilterNames), - (val) => (val ? val.split(',') : []) - ) as Partial>; - - return useDeepObjectIdentity({ - environment: params.environment, - ...localUiFilters, - }); -} - const defaultRefresh = (_time: TimeRange) => {}; const UrlParamsContext = createContext({ rangeId: 0, refreshTimeRange: defaultRefresh, - uxUiFilters: {} as UxUIFilters, urlParams: {} as UrlParams, }); @@ -85,16 +64,13 @@ const UrlParamsProvider: React.ComponentClass<{}> = withRouter( setRangeId((prevRangeId) => prevRangeId + 1); }, []); - const uxUiFilters = useUxUiFilters(urlParams); - const contextValue = useMemo(() => { return { rangeId, refreshTimeRange, urlParams, - uxUiFilters, }; - }, [rangeId, refreshTimeRange, uxUiFilters, urlParams]); + }, [rangeId, refreshTimeRange, urlParams]); return ( @@ -102,4 +78,4 @@ const UrlParamsProvider: React.ComponentClass<{}> = withRouter( } ); -export { UrlParamsContext, UrlParamsProvider, useUxUiFilters }; +export { UrlParamsContext, UrlParamsProvider }; diff --git a/x-pack/plugins/apm/public/plugin.ts b/x-pack/plugins/apm/public/plugin.ts index b0686f8fc28cb..952df64da840a 100644 --- a/x-pack/plugins/apm/public/plugin.ts +++ b/x-pack/plugins/apm/public/plugin.ts @@ -11,7 +11,6 @@ import { UsageCollectionStart } from 'src/plugins/usage_collection/public'; import type { ConfigSchema } from '.'; import { AppMountParameters, - AppNavLinkStatus, CoreSetup, CoreStart, DEFAULT_APP_CATEGORIES, @@ -36,7 +35,6 @@ import type { MapsStartApi } from '../../maps/public'; import type { MlPluginSetup, MlPluginStart } from '../../ml/public'; import { FetchDataParams, - HasDataParams, METRIC_TYPE, ObservabilityPublicSetup, ObservabilityPublicStart, @@ -152,23 +150,6 @@ export class ApmPlugin implements Plugin { { label: serviceMapTitle, app: 'apm', path: '/service-map' }, ], }, - - // UX navigation - { - label: 'User Experience', - sortKey: 600, - entries: [ - { - label: i18n.translate('xpack.apm.ux.overview.heading', { - defaultMessage: 'Dashboard', - }), - app: 'ux', - path: '/', - matchFullPath: true, - ignoreTrailingSlash: true, - }, - ], - }, ]; } @@ -236,33 +217,8 @@ export class ApmPlugin implements Plugin { }, }); - const getUxDataHelper = async () => { - const { fetchUxOverviewDate, hasRumData } = await import( - './components/app/rum_dashboard/ux_overview_fetchers' - ); - const { createCallApmApi } = await import( - './services/rest/create_call_apm_api' - ); - // have to do this here as well in case app isn't mounted yet - createCallApmApi(core); - - return { fetchUxOverviewDate, hasRumData }; - }; - const { observabilityRuleTypeRegistry } = plugins.observability; - plugins.observability.dashboard.register({ - appName: 'ux', - hasData: async (params?: HasDataParams) => { - const dataHelper = await getUxDataHelper(); - return await dataHelper.hasRumData(params!); - }, - fetchData: async (params: FetchDataParams) => { - const dataHelper = await getUxDataHelper(); - return await dataHelper.fetchUxOverviewDate(params); - }, - }); - core.application.register({ id: 'apm', title: 'APM', @@ -298,49 +254,6 @@ export class ApmPlugin implements Plugin { registerApmAlerts(observabilityRuleTypeRegistry); - core.application.register({ - id: 'ux', - title: 'User Experience', - order: 8500, - euiIconType: 'logoObservability', - category: DEFAULT_APP_CATEGORIES.observability, - navLinkStatus: config.ui.enabled - ? AppNavLinkStatus.default - : AppNavLinkStatus.hidden, - keywords: [ - 'RUM', - 'Real User Monitoring', - 'DEM', - 'Digital Experience Monitoring', - 'EUM', - 'End User Monitoring', - 'UX', - 'Javascript', - 'APM', - 'Mobile', - 'digital', - 'performance', - 'web performance', - 'web perf', - ], - async mount(appMountParameters: AppMountParameters) { - // Load application bundle and Get start service - const [{ renderApp }, [coreStart, corePlugins]] = await Promise.all([ - import('./application/ux_app'), - core.getStartServices(), - ]); - - return renderApp({ - core: coreStart, - deps: pluginSetupDeps, - appMountParameters, - config, - corePlugins: corePlugins as ApmPluginStartDeps, - observabilityRuleTypeRegistry, - }); - }, - }); - return {}; } public start(core: CoreStart, plugins: ApmPluginStartDeps) { diff --git a/x-pack/plugins/apm/public/utils/test_helpers.tsx b/x-pack/plugins/apm/public/utils/test_helpers.tsx index b503c8b78d63c..042d84a75bf76 100644 --- a/x-pack/plugins/apm/public/utils/test_helpers.tsx +++ b/x-pack/plugins/apm/public/utils/test_helpers.tsx @@ -25,7 +25,6 @@ import { } from '../../../../../src/core/types/elasticsearch'; // eslint-disable-next-line @kbn/eslint/no-restricted-paths import { APMConfig } from '../../server'; -import { UxUIFilters } from '../../typings/ui_filters'; import { MockApmPluginContextWrapper } from '../context/apm_plugin/mock_apm_plugin_context'; import { UrlParamsProvider } from '../context/url_params_context/url_params_context'; @@ -119,7 +118,6 @@ interface MockSetup { apmEventClient: any; internalClient: any; config: APMConfig; - uiFilters: UxUIFilters; indices: { sourcemap: string; error: string; diff --git a/x-pack/plugins/apm/server/routes/rum_client/get_page_view_trends.ts b/x-pack/plugins/apm/server/routes/rum_client/get_page_view_trends.ts index 6bcc7f66d1dfd..243349c4b4425 100644 --- a/x-pack/plugins/apm/server/routes/rum_client/get_page_view_trends.ts +++ b/x-pack/plugins/apm/server/routes/rum_client/get_page_view_trends.ts @@ -8,7 +8,13 @@ import { getRumPageLoadTransactionsProjection } from '../../projections/rum_page_load_transactions'; import { mergeProjection } from '../../projections/util/merge_projection'; import { SetupUX } from './route'; -import { BreakdownItem } from '../../../typings/ui_filters'; + +export interface BreakdownItem { + name: string; + type: string; + fieldName: string; + selected?: boolean; +} export async function getPageViewTrends({ setup, diff --git a/x-pack/plugins/apm/server/routes/rum_client/route.ts b/x-pack/plugins/apm/server/routes/rum_client/route.ts index 660f1c6afc275..e3bee6da6722c 100644 --- a/x-pack/plugins/apm/server/routes/rum_client/route.ts +++ b/x-pack/plugins/apm/server/routes/rum_client/route.ts @@ -21,8 +21,8 @@ import { getWebCoreVitals } from './get_web_core_vitals'; import { hasRumData } from './has_rum_data'; import { createApmServerRoute } from '../apm_routes/create_apm_server_route'; import { rangeRt } from '../default_api_types'; -import { UxUIFilters } from '../../../typings/ui_filters'; import { APMRouteHandlerResources } from '../typings'; +import { UxUIFilters } from '../../../common/ux_ui_filter'; export type SetupUX = Setup & { uiFilters: UxUIFilters; diff --git a/x-pack/plugins/apm/server/routes/rum_client/ui_filters/get_es_filter.ts b/x-pack/plugins/apm/server/routes/rum_client/ui_filters/get_es_filter.ts index 99a358f33cf5e..5259cd6e1ee61 100644 --- a/x-pack/plugins/apm/server/routes/rum_client/ui_filters/get_es_filter.ts +++ b/x-pack/plugins/apm/server/routes/rum_client/ui_filters/get_es_filter.ts @@ -5,14 +5,14 @@ * 2.0. */ +import { ESFilter } from '../../../../../../../src/core/types/elasticsearch'; +import { environmentQuery } from '../../../../common/utils/environment_query'; +import { ENVIRONMENT_ALL } from '../../../../common/environment_filter_values'; import { uxLocalUIFilterNames, uxLocalUIFilters, + UxUIFilters, } from '../../../../common/ux_ui_filter'; -import { ESFilter } from '../../../../../../../src/core/types/elasticsearch'; -import { UxUIFilters } from '../../../../typings/ui_filters'; -import { environmentQuery } from '../../../../common/utils/environment_query'; -import { ENVIRONMENT_ALL } from '../../../../common/environment_filter_values'; export function getEsFilter(uiFilters: UxUIFilters, exclude?: boolean) { const localFilterValues = uiFilters; diff --git a/x-pack/plugins/apm/server/routes/typings.ts b/x-pack/plugins/apm/server/routes/typings.ts index 6ec196b2a9b8c..b9c74068b3788 100644 --- a/x-pack/plugins/apm/server/routes/typings.ts +++ b/x-pack/plugins/apm/server/routes/typings.ts @@ -22,7 +22,7 @@ import { APMPluginStartDependencies, } from '../types'; import { UsageCollectionSetup } from '../../../../../src/plugins/usage_collection/server'; -import { UxUIFilters } from '../../typings/ui_filters'; +import { UxUIFilters } from '../../common/ux_ui_filter'; export interface ApmPluginRequestHandlerContext extends RequestHandlerContext { licensing: LicensingApiRequestHandlerContext; diff --git a/x-pack/plugins/apm/server/utils/test_helpers.tsx b/x-pack/plugins/apm/server/utils/test_helpers.tsx index aba519bb3db98..c0abf3a69623e 100644 --- a/x-pack/plugins/apm/server/utils/test_helpers.tsx +++ b/x-pack/plugins/apm/server/utils/test_helpers.tsx @@ -10,8 +10,8 @@ import { ESSearchRequest, ESSearchResponse, } from '../../../../../src/core/types/elasticsearch'; -import { UxUIFilters } from '../../typings/ui_filters'; import { ApmIndicesConfig } from '../routes/settings/apm_indices/get_apm_indices'; +import { UxUIFilters } from '../../common/ux_ui_filter'; interface Options { mockResponse?: ( diff --git a/x-pack/plugins/observability/kibana.json b/x-pack/plugins/observability/kibana.json index 505c8cfe79c03..1887764f6f72d 100644 --- a/x-pack/plugins/observability/kibana.json +++ b/x-pack/plugins/observability/kibana.json @@ -27,7 +27,8 @@ "inspector", "ruleRegistry", "timelines", - "triggersActionsUi" + "triggersActionsUi", + "inspector" ], "ui": true, "server": true, diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/rum_datepicker/index.test.tsx b/x-pack/plugins/observability/public/components/shared/date_picker/date_picker.test.tsx similarity index 51% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/rum_datepicker/index.test.tsx rename to x-pack/plugins/observability/public/components/shared/date_picker/date_picker.test.tsx index afb0e9ef37d51..53324e7df3af2 100644 --- a/x-pack/plugins/apm/public/components/app/rum_dashboard/rum_datepicker/index.test.tsx +++ b/x-pack/plugins/observability/public/components/shared/date_picker/date_picker.test.tsx @@ -9,86 +9,89 @@ import { EuiSuperDatePicker } from '@elastic/eui'; import { waitFor } from '@testing-library/react'; import { mount } from 'enzyme'; import { createMemoryHistory, MemoryHistory } from 'history'; -import React, { ReactNode } from 'react'; +import React from 'react'; +import { Router, useLocation } from 'react-router-dom'; import qs from 'query-string'; -import { MockApmPluginContextWrapper } from '../../../../context/apm_plugin/mock_apm_plugin_context'; -import { UrlParamsContext } from '../../../../context/url_params_context/url_params_context'; -import { RumDatePicker } from './'; -import { useLocation } from 'react-router-dom'; +import { DatePicker } from './'; +import { KibanaContextProvider } from '../../../../../../../src/plugins/kibana_react/public'; +import { of } from 'rxjs'; let history: MemoryHistory; -let mockHistoryPush: jest.SpyInstance; -let mockHistoryReplace: jest.SpyInstance; const mockRefreshTimeRange = jest.fn(); +let mockHistoryPush: jest.SpyInstance; +let mockHistoryReplace: jest.SpyInstance; -function MockUrlParamsProvider({ children }: { children: ReactNode }) { +function DatePickerWrapper() { const location = useLocation(); - const urlParams = qs.parse(location.search, { - parseBooleans: true, + const { rangeFrom, rangeTo, refreshInterval, refreshPaused } = qs.parse(location.search, { parseNumbers: true, - }); + parseBooleans: true, + }) as { + rangeFrom?: string; + rangeTo?: string; + refreshInterval?: number; + refreshPaused?: boolean; + }; return ( - ); } -function mountDatePicker( - params: { - rangeFrom?: string; - rangeTo?: string; - refreshPaused?: boolean; - refreshInterval?: number; - } = {} -) { +function mountDatePicker(initialParams: { + rangeFrom?: string; + rangeTo?: string; + refreshInterval?: number; + refreshPaused?: boolean; +}) { const setTimeSpy = jest.fn(); const getTimeSpy = jest.fn().mockReturnValue({}); history = createMemoryHistory({ - initialEntries: [`/?${qs.stringify(params)}`], + initialEntries: [`/?${qs.stringify(initialParams)}`], }); - jest.spyOn(console, 'error').mockImplementation(() => null); mockHistoryPush = jest.spyOn(history, 'push'); mockHistoryReplace = jest.spyOn(history, 'replace'); const wrapper = mount( - + - - - - + uiSettings: { + get: (key: string) => [], + get$: (key: string) => of(true), + }, + }} + > + + + ); return { wrapper, setTimeSpy, getTimeSpy }; } -describe('RumDatePicker', () => { +describe('DatePicker', () => { + beforeAll(() => { + jest.spyOn(console, 'error').mockImplementation(() => null); + }); + afterAll(() => { jest.restoreAllMocks(); }); @@ -97,40 +100,13 @@ describe('RumDatePicker', () => { jest.resetAllMocks(); }); - it('sets default query params in the URL', () => { - mountDatePicker(); - expect(mockHistoryReplace).toHaveBeenCalledTimes(1); - expect(mockHistoryReplace).toHaveBeenCalledWith( - expect.objectContaining({ - search: 'rangeFrom=now-15m&rangeTo=now', - }) - ); - }); - - it('adds missing `rangeFrom` to url', () => { - mountDatePicker({ rangeTo: 'now', refreshInterval: 5000 }); - expect(mockHistoryReplace).toHaveBeenCalledTimes(1); - expect(mockHistoryReplace).toHaveBeenCalledWith( - expect.objectContaining({ - search: 'rangeFrom=now-15m&rangeTo=now&refreshInterval=5000', - }) - ); - }); - - it('does not set default query params in the URL when values already defined', () => { - mountDatePicker({ - rangeFrom: 'now-1d', + it('updates the URL when the date range changes', () => { + const { wrapper } = mountDatePicker({ + rangeFrom: 'now-15m', rangeTo: 'now', - refreshPaused: false, - refreshInterval: 5000, }); - expect(mockHistoryReplace).toHaveBeenCalledTimes(0); - }); - - it('updates the URL when the date range changes', () => { - const { wrapper } = mountDatePicker(); - expect(mockHistoryReplace).toHaveBeenCalledTimes(1); + expect(mockHistoryReplace).toHaveBeenCalledTimes(0); wrapper.find(EuiSuperDatePicker).props().onTimeChange({ start: 'now-90m', @@ -149,11 +125,13 @@ describe('RumDatePicker', () => { it('enables auto-refresh when refreshPaused is false', async () => { jest.useFakeTimers(); const { wrapper } = mountDatePicker({ + rangeFrom: 'now-15m', + rangeTo: 'now', refreshPaused: false, refreshInterval: 1000, }); expect(mockRefreshTimeRange).not.toHaveBeenCalled(); - jest.advanceTimersByTime(2500); + jest.advanceTimersByTime(1000); await waitFor(() => {}); expect(mockRefreshTimeRange).toHaveBeenCalled(); wrapper.unmount(); @@ -161,7 +139,12 @@ describe('RumDatePicker', () => { it('disables auto-refresh when refreshPaused is true', async () => { jest.useFakeTimers(); - mountDatePicker({ refreshPaused: true, refreshInterval: 1000 }); + mountDatePicker({ + rangeFrom: 'now-15m', + rangeTo: 'now', + refreshPaused: true, + refreshInterval: 1000, + }); expect(mockRefreshTimeRange).not.toHaveBeenCalled(); jest.advanceTimersByTime(1000); await waitFor(() => {}); @@ -184,23 +167,4 @@ describe('RumDatePicker', () => { expect(mockHistoryReplace).toHaveBeenCalledTimes(0); }); }); - - describe('if `rangeFrom` is missing from the urlParams', () => { - beforeEach(() => { - mountDatePicker({ rangeTo: 'now-5m' }); - }); - - it('updates the url with the default `rangeFrom` ', async () => { - expect(mockHistoryReplace).toHaveBeenCalledTimes(1); - expect(mockHistoryReplace.mock.calls[0][0].search).toContain( - 'rangeFrom=now-15m' - ); - }); - - it('preserves `rangeTo`', () => { - expect(mockHistoryReplace.mock.calls[0][0].search).toContain( - 'rangeTo=now-5m' - ); - }); - }); }); diff --git a/x-pack/plugins/observability/public/components/shared/date_picker/index.tsx b/x-pack/plugins/observability/public/components/shared/date_picker/index.tsx index c64d4353e613b..ac32ad31d77b4 100644 --- a/x-pack/plugins/observability/public/components/shared/date_picker/index.tsx +++ b/x-pack/plugins/observability/public/components/shared/date_picker/index.tsx @@ -8,44 +8,40 @@ import { EuiSuperDatePicker } from '@elastic/eui'; import React, { useEffect } from 'react'; import { useHistory, useLocation } from 'react-router-dom'; -import { useHasData } from '../../../hooks/use_has_data'; +import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; import { UI_SETTINGS, useKibanaUISettings } from '../../../hooks/use_kibana_ui_settings'; -import { usePluginContext } from '../../../hooks/use_plugin_context'; import { fromQuery, toQuery } from '../../../utils/url'; +import { TimePickerQuickRange } from './typings'; +import { ObservabilityPublicPluginsStart } from '../../../plugin'; -export interface TimePickerTime { - from: string; - to: string; +export interface DatePickerProps { + rangeFrom?: string; + rangeTo?: string; + refreshPaused?: boolean; + refreshInterval?: number; + onTimeRangeRefresh?: (range: { start: string; end: string }) => void; } -export interface TimePickerQuickRange extends TimePickerTime { - display: string; -} - -export interface TimePickerRefreshInterval { - pause: boolean; - value: number; -} - -interface Props { - rangeFrom: string; - rangeTo: string; - refreshPaused: boolean; - refreshInterval: number; -} - -export function DatePicker({ rangeFrom, rangeTo, refreshPaused, refreshInterval }: Props) { +export function DatePicker({ + rangeFrom, + rangeTo, + refreshPaused, + refreshInterval, + onTimeRangeRefresh, +}: DatePickerProps) { const location = useLocation(); const history = useHistory(); - const { plugins } = usePluginContext(); - const { onRefreshTimeRange } = useHasData(); + const { data } = useKibana().services; useEffect(() => { - plugins.data.query.timefilter.timefilter.setTime({ - from: rangeFrom, - to: rangeTo, - }); - }, [plugins, rangeFrom, rangeTo]); + // set time if both to and from are given in the url + if (rangeFrom && rangeTo) { + data.query.timefilter.timefilter.setTime({ + from: rangeFrom, + to: rangeTo, + }); + } + }, [data, rangeFrom, rangeTo]); const timePickerQuickRanges = useKibanaUISettings( UI_SETTINGS.TIMEPICKER_QUICK_RANGES @@ -95,7 +91,10 @@ export function DatePicker({ rangeFrom, rangeTo, refreshPaused, refreshInterval refreshInterval={refreshInterval} onRefreshChange={onRefreshChange} commonlyUsedRanges={commonlyUsedRanges} - onRefresh={onRefreshTimeRange} + onRefresh={onTimeRangeRefresh} /> ); } + +// eslint-disable-next-line import/no-default-export +export default DatePicker; diff --git a/x-pack/plugins/observability/public/components/shared/date_picker/typings.ts b/x-pack/plugins/observability/public/components/shared/date_picker/typings.ts new file mode 100644 index 0000000000000..ed41716bfb78a --- /dev/null +++ b/x-pack/plugins/observability/public/components/shared/date_picker/typings.ts @@ -0,0 +1,22 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export interface TimePickerQuickRange { + from: string; + to: string; + display: string; +} + +export interface TimePickerRefreshInterval { + pause: boolean; + value: number; +} + +export interface TimePickerTimeDefaults { + from: string; + to: string; +} diff --git a/x-pack/plugins/observability/public/components/shared/index.tsx b/x-pack/plugins/observability/public/components/shared/index.tsx index 03eac23062273..cdbc6ec8a9513 100644 --- a/x-pack/plugins/observability/public/components/shared/index.tsx +++ b/x-pack/plugins/observability/public/components/shared/index.tsx @@ -9,6 +9,7 @@ import React, { lazy, Suspense } from 'react'; import { EuiLoadingSpinner } from '@elastic/eui'; import type { CoreVitalProps, HeaderMenuPortalProps } from './types'; import type { FieldValueSuggestionsProps } from './field_value_suggestions/types'; +import type { DatePickerProps } from './date_picker/index'; import type { FilterValueLabelProps } from './filter_value_label/filter_value_label'; import type { SelectableUrlListProps } from './exploratory_view/components/url_search/selectable_url_list'; import type { ExploratoryViewPageProps } from './exploratory_view/index'; @@ -76,3 +77,13 @@ export function ExploratoryView(props: ExploratoryViewPageProps) { ); } + +const DatePickerLazy = lazy(() => import('./date_picker/index')); + +export function DatePicker(props: DatePickerProps) { + return ( + }> + + + ); +} diff --git a/x-pack/plugins/observability/public/hooks/use_query_params.ts b/x-pack/plugins/observability/public/hooks/use_query_params.ts index e9d1572cfaae9..9fcbe70b5a9ef 100644 --- a/x-pack/plugins/observability/public/hooks/use_query_params.ts +++ b/x-pack/plugins/observability/public/hooks/use_query_params.ts @@ -9,15 +9,17 @@ import { useLocation } from 'react-router-dom'; import { useMemo } from 'react'; import { parse } from 'query-string'; import { UI_SETTINGS, useKibanaUISettings } from './use_kibana_ui_settings'; -import { TimePickerTime } from '../components/shared/date_picker'; import { getAbsoluteTime } from '../utils/date'; +import { TimePickerTimeDefaults } from '../components/shared/date_picker/typings'; const getParsedParams = (search: string) => { return search ? parse(search[0] === '?' ? search.slice(1) : search, { sort: false }) : {}; }; export function useQueryParams() { - const { from, to } = useKibanaUISettings(UI_SETTINGS.TIMEPICKER_TIME_DEFAULTS); + const { from, to } = useKibanaUISettings( + UI_SETTINGS.TIMEPICKER_TIME_DEFAULTS + ); const { rangeFrom, rangeTo } = getParsedParams(useLocation().search); diff --git a/x-pack/plugins/observability/public/hooks/use_time_range.ts b/x-pack/plugins/observability/public/hooks/use_time_range.ts index bfd5a00c3faa1..aa120d6968bfb 100644 --- a/x-pack/plugins/observability/public/hooks/use_time_range.ts +++ b/x-pack/plugins/observability/public/hooks/use_time_range.ts @@ -7,7 +7,7 @@ import { parse } from 'query-string'; import { useLocation } from 'react-router-dom'; -import { TimePickerTime } from '../components/shared/date_picker'; +import { TimePickerTimeDefaults } from '../components/shared/date_picker/typings'; import { getAbsoluteTime } from '../utils/date'; import { UI_SETTINGS, useKibanaUISettings } from './use_kibana_ui_settings'; import { usePluginContext } from './use_plugin_context'; @@ -19,7 +19,7 @@ const getParsedParams = (search: string) => { export function useTimeRange() { const { plugins } = usePluginContext(); - const timePickerTimeDefaults = useKibanaUISettings( + const timePickerTimeDefaults = useKibanaUISettings( UI_SETTINGS.TIMEPICKER_TIME_DEFAULTS ); diff --git a/x-pack/plugins/observability/public/index.ts b/x-pack/plugins/observability/public/index.ts index 550969191fa87..08bdace817c15 100644 --- a/x-pack/plugins/observability/public/index.ts +++ b/x-pack/plugins/observability/public/index.ts @@ -57,6 +57,7 @@ export { FilterValueLabel, SelectableUrlList, ExploratoryView, + DatePicker, } from './components/shared/'; export type { LazyObservabilityPageTemplateProps } from './components/shared'; @@ -106,3 +107,4 @@ export { RECORDS_FIELD, } from './components/shared/exploratory_view/configurations/constants'; export { ExploratoryViewContextProvider } from './components/shared/exploratory_view/contexts/exploratory_view_config'; +export { fromQuery, toQuery } from './utils/url'; diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 2d72bd20f7712..2dd515f42ff33 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -6390,8 +6390,6 @@ "xpack.apm.alertTypes.transactionErrorRate.description": "サービスのトランザクションエラー率が定義されたしきい値を超過したときにアラートを発行します。", "xpack.apm.analyzeDataButton.label": "データの探索", "xpack.apm.analyzeDataButton.tooltip": "データの探索では、任意のディメンションの結果データを選択してフィルタリングし、パフォーマンスの問題の原因または影響を調査することができます。", - "xpack.apm.analyzeDataButtonLabel": "データの探索", - "xpack.apm.analyzeDataButtonLabel.message": "データの探索では、任意のディメンションの結果データを選択してフィルタリングし、パフォーマンスの問題の原因または影響を調査することができます。", "xpack.apm.anomaly_detection.error.invalid_license": "異常検知を使用するには、Elastic Platinumライセンスのサブスクリプションが必要です。このライセンスがあれば、機械学習を活用して、サービスを監視できます。", "xpack.apm.anomaly_detection.error.missing_read_privileges": "異常検知ジョブを表示するには、機械学習およびAPMの「読み取り」権限が必要です", "xpack.apm.anomaly_detection.error.missing_write_privileges": "異常検知ジョブを作成するには、機械学習およびAPMの「書き込み」権限が必要です", @@ -6433,7 +6431,6 @@ "xpack.apm.chart.error": "データの取得時にエラーが発生しました。再試行してください", "xpack.apm.chart.memorySeries.systemAverageLabel": "平均", "xpack.apm.chart.memorySeries.systemMaxLabel": "最高", - "xpack.apm.clearFilters": "フィルターを消去", "xpack.apm.compositeSpanCallsLabel": "、{count}件の呼び出し、平均{duration}", "xpack.apm.compositeSpanDurationLabel": "平均時間", "xpack.apm.correlations.cancelButtonTitle": "キャンセル", @@ -6501,12 +6498,6 @@ "xpack.apm.correlations.progressAriaLabel": "進捗", "xpack.apm.correlations.progressTitle": "進捗状況: {progress}%", "xpack.apm.correlations.refreshButtonTitle": "更新", - "xpack.apm.csm.breakdownFilter.browser": "ブラウザー", - "xpack.apm.csm.breakdownFilter.device": "デバイス", - "xpack.apm.csm.breakdownFilter.location": "場所", - "xpack.apm.csm.breakDownFilter.noBreakdown": "内訳なし", - "xpack.apm.csm.breakdownFilter.os": "OS", - "xpack.apm.csm.pageViews.analyze": "分析", "xpack.apm.customLink.buttom.create": "カスタムリンクを作成", "xpack.apm.customLink.buttom.create.title": "作成", "xpack.apm.customLink.buttom.manage": "カスタムリンクを管理", @@ -6526,7 +6517,6 @@ "xpack.apm.deprecations.steps.switch": "[Elasticエージェントに切り替える]をクリックします。手順が案内されます。", "xpack.apm.emptyMessage.noDataFoundDescription": "別の時間範囲を試すか検索フィルターをリセットしてください。", "xpack.apm.emptyMessage.noDataFoundLabel": "データが見つかりません。", - "xpack.apm.emptyState.loadingMessage": "読み込み中…", "xpack.apm.environmentsSelectCustomOptionText": "新しい環境として\\{searchValue\\}を追加", "xpack.apm.environmentsSelectPlaceholder": "環境を選択", "xpack.apm.error.prompt.body": "詳細はブラウザの開発者コンソールをご確認ください。", @@ -6734,7 +6724,6 @@ "xpack.apm.localFilters.titles.os": "OS", "xpack.apm.localFilters.titles.serviceName": "サービス名", "xpack.apm.localFilters.titles.transactionUrl": "URL", - "xpack.apm.localFiltersTitle": "フィルター", "xpack.apm.managedTable.errorMessage": "取得できませんでした", "xpack.apm.managedTable.loadingDescription": "読み込み中…", "xpack.apm.metrics.transactionChart.machineLearningLabel": "機械学習:", @@ -6769,56 +6758,6 @@ "xpack.apm.propertiesTable.tabs.logStacktraceLabel": "スタックトレース", "xpack.apm.propertiesTable.tabs.metadataLabel": "メタデータ", "xpack.apm.propertiesTable.tabs.timelineLabel": "Timeline", - "xpack.apm.rum.coreVitals.dataUndefined": "N/A", - "xpack.apm.rum.coreVitals.fcp": "初回コンテンツの描画", - "xpack.apm.rum.coreVitals.fcpTooltip": "初回コンテンツの描画(FCP)は初期のレンダリングに集中し、ページの読み込みが開始してから、ページのコンテンツのいずれかの部分が画面に表示されるときまでの時間を測定します。", - "xpack.apm.rum.coreVitals.tbt": "合計ブロック時間", - "xpack.apm.rum.coreVitals.tbtTooltip": "合計ブロック時間(TBT)は、初回コンテンツの描画からトランザクションが完了したときまでに発生する、各長いタスクのブロック時間(50 ミリ秒超)の合計です。", - "xpack.apm.rum.dashboard.backend": "バックエンド", - "xpack.apm.rum.dashboard.dataMissing": "N/A", - "xpack.apm.rum.dashboard.frontend": "フロントエンド", - "xpack.apm.rum.dashboard.impactfulMetrics.highTrafficPages": "高トラフィックページ", - "xpack.apm.rum.dashboard.impactfulMetrics.jsErrors": "JavaScript エラー", - "xpack.apm.rum.dashboard.overall.label": "全体", - "xpack.apm.rum.dashboard.pageLoad.label": "ページの読み込み", - "xpack.apm.rum.dashboard.pageLoadDistribution.label": "ページ読み込み分布", - "xpack.apm.rum.dashboard.pageLoadDuration.label": "ページ読み込み時間", - "xpack.apm.rum.dashboard.pageLoadTime.label": "ページ読み込み時間(秒)", - "xpack.apm.rum.dashboard.pageLoadTimes.label": "ページ読み込み時間", - "xpack.apm.rum.dashboard.pagesLoaded.label": "ページが読み込まれました", - "xpack.apm.rum.dashboard.pageViews": "合計ページビュー", - "xpack.apm.rum.dashboard.resetZoom.label": "ズームをリセット", - "xpack.apm.rum.dashboard.tooltips.backEnd": "バックエンド時間は、最初の 1 バイトを受信するまでの時間(TTFB)です。これは、要求が実行された後、最初の応答パケットが受信された時点です。", - "xpack.apm.rum.dashboard.tooltips.frontEnd": "フロントエンド時間は、合計ページ読み込み時間からバックエンド時間を減算した時間です。", - "xpack.apm.rum.dashboard.tooltips.totalPageLoad": "合計はすべてのページ読み込み時間です。", - "xpack.apm.rum.dashboard.totalPageLoad": "合計", - "xpack.apm.rum.filterGroup.breakdown": "内訳", - "xpack.apm.rum.filterGroup.coreWebVitals": "コアWebバイタル", - "xpack.apm.rum.filterGroup.seconds": "秒", - "xpack.apm.rum.filterGroup.selectBreakdown": "内訳を選択", - "xpack.apm.rum.filters.filterByUrl": "IDでフィルタリング", - "xpack.apm.rum.filters.searchResults": "{total}件の検索結果", - "xpack.apm.rum.filters.select": "選択してください", - "xpack.apm.rum.filters.topPages": "上位のページ", - "xpack.apm.rum.filters.url": "Url", - "xpack.apm.rum.filters.url.loadingResults": "結果を読み込み中", - "xpack.apm.rum.filters.url.noResults": "結果がありません", - "xpack.apm.rum.jsErrors.errorMessage": "エラーメッセージ", - "xpack.apm.rum.jsErrors.errorRate": "エラー率", - "xpack.apm.rum.jsErrors.impactedPageLoads": "影響を受けるページ読み込み数", - "xpack.apm.rum.jsErrors.totalErrors": "合計エラー数", - "xpack.apm.rum.jsErrorsTable.errorMessage": "取得できませんでした", - "xpack.apm.rum.uxMetrics.longestLongTasks": "最長タスク時間", - "xpack.apm.rum.uxMetrics.longestLongTasksTooltip": "最も長いタスクの時間。長いタスクは、UI スレッドを長時間(50 ミリ秒以上)独占し、他の重要なタスク(フレームレートや入力レイテンシ)の実行を妨害するユーザーアクティビティまたはブラウザータスクとして定義されます。", - "xpack.apm.rum.uxMetrics.noOfLongTasks": "時間がかかるタスク数", - "xpack.apm.rum.uxMetrics.noOfLongTasksTooltip": "長いタスクの数。長いタスクは、UI スレッドを長時間(50 ミリ秒以上)独占し、他の重要なタスク(フレームレートや入力レイテンシ)の実行を妨害するユーザーアクティビティまたはブラウザータスクとして定義されます。", - "xpack.apm.rum.uxMetrics.sumLongTasks": "時間がかかるタスクの合計時間", - "xpack.apm.rum.uxMetrics.sumLongTasksTooltip": "長いタスクの合計時間。長いタスクは、UI スレッドを長時間(50 ミリ秒以上)独占し、他の重要なタスク(フレームレートや入力レイテンシ)の実行を妨害するユーザーアクティビティまたはブラウザータスクとして定義されます。", - "xpack.apm.rum.visitorBreakdown": "アクセスユーザー内訳", - "xpack.apm.rum.visitorBreakdown.browser": "ブラウザー", - "xpack.apm.rum.visitorBreakdown.operatingSystem": "オペレーティングシステム", - "xpack.apm.rum.visitorBreakdownMap.avgPageLoadDuration": "平均ページ読み込み時間", - "xpack.apm.rum.visitorBreakdownMap.pageLoadDurationByRegion": "地域別ページ読み込み時間(平均)", "xpack.apm.searchInput.filter": "フィルター...", "xpack.apm.selectPlaceholder": "オプションを選択:", "xpack.apm.serviceDependencies.breakdownChartTitle": "依存関係にかかった時間", @@ -7349,28 +7288,6 @@ "xpack.apm.tutorial.windowsServerInstructions.textPost": "注:システムでスクリプトの実行が無効な場合、スクリプトを実行するために現在のセッションの実行ポリシーの設定が必要となります。例:{command}。", "xpack.apm.tutorial.windowsServerInstructions.textPre": "1.[ダウンロードページ]({downloadPageLink})から APM Server Windows zip ファイルをダウンロードします。\n2.zip ファイルの内容を {zipFileExtractFolder} に抽出します。\n3.「{apmServerDirectory} ディレクトリの名前を「APM-Server」に変更します。\n4.管理者としてPowerShellプロンプトを開きます(PowerShellアイコンを右クリックして「管理者として実行」を選択します)。Windows XPをご使用の場合、PowerShellのダウンロードとインストールが必要な場合があります。\n5.PowerShell プロンプトで次のコマンドを実行し、APM Server を Windows サービスとしてインストールします。", "xpack.apm.unitLabel": "単位を選択", - "xpack.apm.urlFilter.wildcard": "ワイルドカード*{wildcard}*を使用", - "xpack.apm.ux.breadcrumbs.dashboard": "ダッシュボード", - "xpack.apm.ux.breadcrumbs.root": "ユーザーエクスペリエンス", - "xpack.apm.ux.jsErrors.percent": "{pageLoadPercent} %", - "xpack.apm.ux.localFilters.titles.webApplication": "Webアプリケーション", - "xpack.apm.ux.median": "中間", - "xpack.apm.ux.metrics": "メトリック", - "xpack.apm.ux.overview.agent.description": "APMエージェントを使用して、APMデータを収集します。多数の一般的な言語では、エージェントを使用することで処理が簡単になっています。", - "xpack.apm.ux.overview.agent.title": "APM統合を追加", - "xpack.apm.ux.overview.beatsCard.description": "APMエージェントでRUMを有効にして、ユーザーエクスペリエンスデータを収集します。", - "xpack.apm.ux.overview.beatsCard.title": "APM統合を追加", - "xpack.apm.ux.overview.heading": "ダッシュボード", - "xpack.apm.ux.overview.solutionName": "Observability", - "xpack.apm.ux.percentile.50thMedian": "50 番目(中央値)", - "xpack.apm.ux.percentile.75th": "75番目", - "xpack.apm.ux.percentile.90th": "90番目", - "xpack.apm.ux.percentile.95th": "95番目", - "xpack.apm.ux.percentile.99th": "99番目", - "xpack.apm.ux.percentile.label": "パーセンタイル", - "xpack.apm.ux.percentiles.label": "{value} パーセンタイル", - "xpack.apm.ux.title": "ダッシュボード", - "xpack.apm.ux.visitorBreakdown.noData": "データがありません。", "xpack.apm.views.dependencies.title": "依存関係", "xpack.apm.views.dependenciesInventory.title": "依存関係", "xpack.apm.views.errors.title": "エラー", @@ -7393,6 +7310,81 @@ "xpack.apm.views.transactions.title": "トランザクション", "xpack.apm.waterfall.errorCount": "{errorCount, plural, one {関連するエラーを表示} other {View # 件の関連するエラーを表示}}", "xpack.apm.waterfall.exceedsMax": "このトレースの項目数は表示されている範囲を超えています", + "xpack.ux.breakdownFilter.browser": "ブラウザー", + "xpack.ux.breakdownFilter.device": "デバイス", + "xpack.ux.breakdownFilter.location": "場所", + "xpack.ux.breakDownFilter.noBreakdown": "内訳なし", + "xpack.ux.breakdownFilter.os": "OS", + "xpack.ux.pageViews.analyze": "分析", + "xpack.ux.coreVitals.dataUndefined": "N/A", + "xpack.ux.coreVitals.fcp": "初回コンテンツの描画", + "xpack.ux.coreVitals.fcpTooltip": "初回コンテンツの描画(FCP)は初期のレンダリングに集中し、ページの読み込みが開始してから、ページのコンテンツのいずれかの部分が画面に表示されるときまでの時間を測定します。", + "xpack.ux.coreVitals.tbt": "合計ブロック時間", + "xpack.ux.coreVitals.tbtTooltip": "合計ブロック時間(TBT)は、初回コンテンツの描画からトランザクションが完了したときまでに発生する、各長いタスクのブロック時間(50 ミリ秒超)の合計です。", + "xpack.ux.dashboard.backend": "バックエンド", + "xpack.ux.dashboard.dataMissing": "N/A", + "xpack.ux.dashboard.frontend": "フロントエンド", + "xpack.ux.dashboard.impactfulMetrics.highTrafficPages": "高トラフィックページ", + "xpack.ux.dashboard.impactfulMetrics.jsErrors": "JavaScript エラー", + "xpack.ux.dashboard.overall.label": "全体", + "xpack.ux.dashboard.pageLoad.label": "ページの読み込み", + "xpack.ux.dashboard.pageLoadDistribution.label": "ページ読み込み分布", + "xpack.ux.dashboard.pageLoadDuration.label": "ページ読み込み時間", + "xpack.ux.dashboard.pageLoadTime.label": "ページ読み込み時間(秒)", + "xpack.ux.dashboard.pageLoadTimes.label": "ページ読み込み時間", + "xpack.ux.dashboard.pagesLoaded.label": "ページが読み込まれました", + "xpack.ux.dashboard.pageViews": "合計ページビュー", + "xpack.ux.dashboard.resetZoom.label": "ズームをリセット", + "xpack.ux.dashboard.tooltips.backEnd": "バックエンド時間は、最初の 1 バイトを受信するまでの時間(TTFB)です。これは、要求が実行された後、最初の応答パケットが受信された時点です。", + "xpack.ux.dashboard.tooltips.frontEnd": "フロントエンド時間は、合計ページ読み込み時間からバックエンド時間を減算した時間です。", + "xpack.ux.dashboard.tooltips.totalPageLoad": "合計はすべてのページ読み込み時間です。", + "xpack.ux.dashboard.totalPageLoad": "合計", + "xpack.ux.filterGroup.breakdown": "内訳", + "xpack.ux.filterGroup.coreWebVitals": "コアWebバイタル", + "xpack.ux.filterGroup.seconds": "秒", + "xpack.ux.filterGroup.selectBreakdown": "内訳を選択", + "xpack.ux.filters.filterByUrl": "IDでフィルタリング", + "xpack.ux.filters.searchResults": "{total}件の検索結果", + "xpack.ux.filters.select": "選択してください", + "xpack.ux.filters.topPages": "上位のページ", + "xpack.ux.filters.url": "Url", + "xpack.ux.filters.url.loadingResults": "結果を読み込み中", + "xpack.ux.filters.url.noResults": "結果がありません", + "xpack.ux.jsErrors.errorMessage": "エラーメッセージ", + "xpack.ux.jsErrors.errorRate": "エラー率", + "xpack.ux.jsErrors.impactedPageLoads": "影響を受けるページ読み込み数", + "xpack.ux.jsErrors.totalErrors": "合計エラー数", + "xpack.ux.jsErrorsTable.errorMessage": "取得できませんでした", + "xpack.ux.uxMetrics.longestLongTasks": "最長タスク時間", + "xpack.ux.uxMetrics.longestLongTasksTooltip": "最も長いタスクの時間。長いタスクは、UI スレッドを長時間(50 ミリ秒以上)独占し、他の重要なタスク(フレームレートや入力レイテンシ)の実行を妨害するユーザーアクティビティまたはブラウザータスクとして定義されます。", + "xpack.ux.uxMetrics.noOfLongTasks": "時間がかかるタスク数", + "xpack.ux.uxMetrics.noOfLongTasksTooltip": "長いタスクの数。長いタスクは、UI スレッドを長時間(50 ミリ秒以上)独占し、他の重要なタスク(フレームレートや入力レイテンシ)の実行を妨害するユーザーアクティビティまたはブラウザータスクとして定義されます。", + "xpack.ux.uxMetrics.sumLongTasks": "時間がかかるタスクの合計時間", + "xpack.ux.uxMetrics.sumLongTasksTooltip": "長いタスクの合計時間。長いタスクは、UI スレッドを長時間(50 ミリ秒以上)独占し、他の重要なタスク(フレームレートや入力レイテンシ)の実行を妨害するユーザーアクティビティまたはブラウザータスクとして定義されます。", + "xpack.ux.visitorBreakdown": "アクセスユーザー内訳", + "xpack.ux.visitorBreakdown.browser": "ブラウザー", + "xpack.ux.visitorBreakdown.operatingSystem": "オペレーティングシステム", + "xpack.ux.visitorBreakdownMap.avgPageLoadDuration": "平均ページ読み込み時間", + "xpack.ux.visitorBreakdownMap.pageLoadDurationByRegion": "地域別ページ読み込み時間(平均)", + "xpack.ux.breadcrumbs.dashboard": "ダッシュボード", + "xpack.ux.breadcrumbs.root": "ユーザーエクスペリエンス", + "xpack.ux.jsErrors.percent": "{pageLoadPercent} %", + "xpack.ux.localFilters.titles.webApplication": "Webアプリケーション", + "xpack.ux.median": "中間", + "xpack.ux.metrics": "メトリック", + "xpack.ux.overview.beatsCard.description": "APMエージェントでRUMを有効にして、ユーザーエクスペリエンスデータを収集します。", + "xpack.ux.overview.beatsCard.title": "APM統合を追加", + "xpack.ux.overview.heading": "ダッシュボード", + "xpack.ux.overview.solutionName": "オブザーバビリティ", + "xpack.ux.percentile.50thMedian": "50 番目(中央値)", + "xpack.ux.percentile.75th": "75番目", + "xpack.ux.percentile.90th": "90番目", + "xpack.ux.percentile.95th": "95番目", + "xpack.ux.percentile.99th": "99番目", + "xpack.ux.percentile.label": "パーセンタイル", + "xpack.ux.percentiles.label": "{value} パーセンタイル", + "xpack.ux.title": "ダッシュボード", + "xpack.ux.visitorBreakdown.noData": "データがありません。", "xpack.banners.settings.backgroundColor.description": "バナーの背景色。{subscriptionLink}", "xpack.banners.settings.backgroundColor.title": "バナー背景色", "xpack.banners.settings.placement.description": "Elasticヘッダーの上に、このスペースの上部のバナーを表示します。{subscriptionLink}", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 97f6c16210de8..7fa49ec247162 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -6442,8 +6442,6 @@ "xpack.apm.alertTypes.transactionErrorRate.description": "当服务中的事务错误率超过定义的阈值时告警。", "xpack.apm.analyzeDataButton.label": "浏览数据", "xpack.apm.analyzeDataButton.tooltip": "“浏览数据”允许您选择和筛选任意维度中的结果数据以及查找性能问题的原因或影响", - "xpack.apm.analyzeDataButtonLabel": "浏览数据", - "xpack.apm.analyzeDataButtonLabel.message": "“浏览数据”允许您选择和筛选任意维度中的结果数据以及查找性能问题的原因或影响。", "xpack.apm.anomaly_detection.error.invalid_license": "要使用异常检测,必须订阅 Elastic 白金级许可证。有了该许可证,您便可借助 Machine Learning 监测服务。", "xpack.apm.anomaly_detection.error.missing_read_privileges": "必须对 Machine Learning 和 APM 具有“读”权限,才能查看“异常检测”作业", "xpack.apm.anomaly_detection.error.missing_write_privileges": "必须对 Machine Learning 和 APM 具有“写”权限,才能创建“异常检测”作业", @@ -6485,7 +6483,6 @@ "xpack.apm.chart.error": "尝试提取数据时发生错误。请重试", "xpack.apm.chart.memorySeries.systemAverageLabel": "平均值", "xpack.apm.chart.memorySeries.systemMaxLabel": "最大值", - "xpack.apm.clearFilters": "清除筛选", "xpack.apm.compositeSpanCallsLabel": ",{count} 个调用,平均 {duration}", "xpack.apm.compositeSpanDurationLabel": "平均持续时间", "xpack.apm.correlations.cancelButtonTitle": "取消", @@ -6553,12 +6550,6 @@ "xpack.apm.correlations.progressAriaLabel": "进度", "xpack.apm.correlations.progressTitle": "进度:{progress}%", "xpack.apm.correlations.refreshButtonTitle": "刷新", - "xpack.apm.csm.breakdownFilter.browser": "浏览器", - "xpack.apm.csm.breakdownFilter.device": "设备", - "xpack.apm.csm.breakdownFilter.location": "位置", - "xpack.apm.csm.breakDownFilter.noBreakdown": "无细目", - "xpack.apm.csm.breakdownFilter.os": "OS", - "xpack.apm.csm.pageViews.analyze": "分析", "xpack.apm.customLink.buttom.create": "创建定制链接", "xpack.apm.customLink.buttom.create.title": "创建", "xpack.apm.customLink.buttom.manage": "管理定制链接", @@ -6578,7 +6569,6 @@ "xpack.apm.deprecations.steps.switch": "单击“切换到 Elastic 代理”。将指导您完成此过程", "xpack.apm.emptyMessage.noDataFoundDescription": "尝试其他时间范围或重置搜索筛选。", "xpack.apm.emptyMessage.noDataFoundLabel": "未找到任何数据。", - "xpack.apm.emptyState.loadingMessage": "正在加载……", "xpack.apm.environmentsSelectCustomOptionText": "将 \\{searchValue\\} 添加为新环境", "xpack.apm.environmentsSelectPlaceholder": "选择环境", "xpack.apm.error.prompt.body": "有关详情,请查看您的浏览器开发者控制台。", @@ -6789,7 +6779,6 @@ "xpack.apm.localFilters.titles.os": "OS", "xpack.apm.localFilters.titles.serviceName": "服务名称", "xpack.apm.localFilters.titles.transactionUrl": "URL", - "xpack.apm.localFiltersTitle": "筛选", "xpack.apm.managedTable.errorMessage": "无法提取", "xpack.apm.managedTable.loadingDescription": "正在加载……", "xpack.apm.metrics.transactionChart.machineLearningLabel": "Machine Learning", @@ -6825,56 +6814,6 @@ "xpack.apm.propertiesTable.tabs.logStacktraceLabel": "日志堆栈跟踪", "xpack.apm.propertiesTable.tabs.metadataLabel": "元数据", "xpack.apm.propertiesTable.tabs.timelineLabel": "时间线", - "xpack.apm.rum.coreVitals.dataUndefined": "不可用", - "xpack.apm.rum.coreVitals.fcp": "首次内容绘制", - "xpack.apm.rum.coreVitals.fcpTooltip": "首次内容绘制 (FCP) 侧重于初始渲染,并度量从页面开始加载到页面内容的任何部分显示在屏幕的时间。", - "xpack.apm.rum.coreVitals.tbt": "阻止总时间", - "xpack.apm.rum.coreVitals.tbtTooltip": "总阻塞时间 (TBT) 是指在首次内容绘制与事务完成之间发生的各个长任务的阻塞时间(持续时间超过50毫秒)之和。", - "xpack.apm.rum.dashboard.backend": "后端", - "xpack.apm.rum.dashboard.dataMissing": "不可用", - "xpack.apm.rum.dashboard.frontend": "前端", - "xpack.apm.rum.dashboard.impactfulMetrics.highTrafficPages": "高流量页面", - "xpack.apm.rum.dashboard.impactfulMetrics.jsErrors": "JavaScript 错误", - "xpack.apm.rum.dashboard.overall.label": "总体", - "xpack.apm.rum.dashboard.pageLoad.label": "页面加载", - "xpack.apm.rum.dashboard.pageLoadDistribution.label": "页面加载分布", - "xpack.apm.rum.dashboard.pageLoadDuration.label": "页面加载持续时间", - "xpack.apm.rum.dashboard.pageLoadTime.label": "页面加载时间(秒)", - "xpack.apm.rum.dashboard.pageLoadTimes.label": "页面加载时间", - "xpack.apm.rum.dashboard.pagesLoaded.label": "已加载页面", - "xpack.apm.rum.dashboard.pageViews": "页面总查看次数", - "xpack.apm.rum.dashboard.resetZoom.label": "重置缩放比例", - "xpack.apm.rum.dashboard.tooltips.backEnd": "后端时间表示接收到第一个字节所需的时间 (TTFB),即从请求发出后接收到第一个响应数据包的时间", - "xpack.apm.rum.dashboard.tooltips.frontEnd": "前端时间表示页面加载总持续时间减去后端时间", - "xpack.apm.rum.dashboard.tooltips.totalPageLoad": "合计表示整个页面加载持续时间", - "xpack.apm.rum.dashboard.totalPageLoad": "合计", - "xpack.apm.rum.filterGroup.breakdown": "细目", - "xpack.apm.rum.filterGroup.coreWebVitals": "网站体验核心指标", - "xpack.apm.rum.filterGroup.seconds": "秒", - "xpack.apm.rum.filterGroup.selectBreakdown": "选择细分", - "xpack.apm.rum.filters.filterByUrl": "按 URL 筛选", - "xpack.apm.rum.filters.searchResults": "{total} 项搜索结果", - "xpack.apm.rum.filters.select": "选择", - "xpack.apm.rum.filters.topPages": "排名靠前页面", - "xpack.apm.rum.filters.url": "URL", - "xpack.apm.rum.filters.url.loadingResults": "正在加载结果", - "xpack.apm.rum.filters.url.noResults": "没有可用结果", - "xpack.apm.rum.jsErrors.errorMessage": "错误消息", - "xpack.apm.rum.jsErrors.errorRate": "错误率", - "xpack.apm.rum.jsErrors.impactedPageLoads": "受影响的页面加载", - "xpack.apm.rum.jsErrors.totalErrors": "错误总数", - "xpack.apm.rum.jsErrorsTable.errorMessage": "无法提取", - "xpack.apm.rum.uxMetrics.longestLongTasks": "长任务最长持续时间", - "xpack.apm.rum.uxMetrics.longestLongTasksTooltip": "最长任务的持续时间。长任务是指独占用户界面线程较长时间(大于50毫秒)并阻止其他关键任务(帧速率或输入延迟)执行的任何用户活动或浏览器任务。", - "xpack.apm.rum.uxMetrics.noOfLongTasks": "长任务数目", - "xpack.apm.rum.uxMetrics.noOfLongTasksTooltip": "长任务的数量。长任务是指独占用户界面线程较长时间(大于50毫秒)并阻止其他关键任务(帧速率或输入延迟)执行的任何用户活动或浏览器任务。", - "xpack.apm.rum.uxMetrics.sumLongTasks": "长任务总持续时间", - "xpack.apm.rum.uxMetrics.sumLongTasksTooltip": "长任务的总持续时间。长任务是指独占用户界面线程较长时间(大于50毫秒)并阻止其他关键任务(帧速率或输入延迟)执行的任何用户活动或浏览器任务。", - "xpack.apm.rum.visitorBreakdown": "访问者细分", - "xpack.apm.rum.visitorBreakdown.browser": "浏览器", - "xpack.apm.rum.visitorBreakdown.operatingSystem": "操作系统", - "xpack.apm.rum.visitorBreakdownMap.avgPageLoadDuration": "页面加载平均持续时间", - "xpack.apm.rum.visitorBreakdownMap.pageLoadDurationByRegion": "按区域列出的页面加载持续时间(平均值)", "xpack.apm.searchInput.filter": "筛选...", "xpack.apm.selectPlaceholder": "选择选项:", "xpack.apm.serviceDependencies.breakdownChartTitle": "依赖项花费的时间", @@ -7410,28 +7349,6 @@ "xpack.apm.tutorial.windowsServerInstructions.textPre": "1.从[下载页面]({downloadPageLink})下载 APM Server Windows zip 文件。\n2.将 zip 文件的内容解压缩到 {zipFileExtractFolder}。\n3.将 {apmServerDirectory} 目录重命名为 `APM-Server`。\n4.以管理员身份打开 PowerShell 提示符(右键单击 PowerShell 图标,然后选择**以管理员身份运行**)。如果运行的是 Windows XP,则可能需要下载并安装 PowerShell。\n5.从 PowerShell 提示符处,运行以下命令以将 APM Server 安装为 Windows 服务:", "xpack.apm.unitLabel": "选择单位", "xpack.apm.unsavedChanges": "{unsavedChangesCount, plural, =0{0 个未保存更改} one {1 个未保存更改} other {# 个未保存更改}} ", - "xpack.apm.urlFilter.wildcard": "使用通配符 *{wildcard}*", - "xpack.apm.ux.breadcrumbs.dashboard": "仪表板", - "xpack.apm.ux.breadcrumbs.root": "用户体验", - "xpack.apm.ux.jsErrors.percent": "{pageLoadPercent}%", - "xpack.apm.ux.localFilters.titles.webApplication": "Web 应用程序", - "xpack.apm.ux.median": "中值", - "xpack.apm.ux.metrics": "指标", - "xpack.apm.ux.overview.agent.description": "使用 APM 代理来收集 APM 数据。我们的代理支持许多流行语言,可以轻松使用。", - "xpack.apm.ux.overview.agent.title": "添加 APM 集成", - "xpack.apm.ux.overview.beatsCard.description": "通过 APM 代理启用 RUM,以收集用户体验数据。", - "xpack.apm.ux.overview.beatsCard.title": "添加 APM 集成", - "xpack.apm.ux.overview.heading": "仪表板", - "xpack.apm.ux.overview.solutionName": "Observability", - "xpack.apm.ux.percentile.50thMedian": "第 50 个(中值)", - "xpack.apm.ux.percentile.75th": "第 75 个", - "xpack.apm.ux.percentile.90th": "第 90 个", - "xpack.apm.ux.percentile.95th": "第 95 个", - "xpack.apm.ux.percentile.99th": "第 99 个", - "xpack.apm.ux.percentile.label": "百分位数", - "xpack.apm.ux.percentiles.label": "第 {value} 个百分位", - "xpack.apm.ux.title": "仪表板", - "xpack.apm.ux.visitorBreakdown.noData": "无数据。", "xpack.apm.views.dependencies.title": "依赖项", "xpack.apm.views.dependenciesInventory.title": "依赖项", "xpack.apm.views.errors.title": "错误", @@ -7454,6 +7371,81 @@ "xpack.apm.views.transactions.title": "事务", "xpack.apm.waterfall.errorCount": "{errorCount, plural, one {查看相关错误} other {查看 # 个相关错误}}", "xpack.apm.waterfall.exceedsMax": "此跟踪中的项目数超过显示的项目数", + "xpack.ux.breakdownFilter.browser": "浏览器", + "xpack.ux.breakdownFilter.device": "设备", + "xpack.ux.breakdownFilter.location": "位置", + "xpack.ux.breakDownFilter.noBreakdown": "无细目", + "xpack.ux.breakdownFilter.os": "OS", + "xpack.ux.pageViews.analyze": "分析", + "xpack.ux.coreVitals.dataUndefined": "不可用", + "xpack.ux.coreVitals.fcp": "首次内容绘制", + "xpack.ux.coreVitals.fcpTooltip": "首次内容绘制 (FCP) 侧重于初始渲染,并度量从页面开始加载到页面内容的任何部分显示在屏幕的时间。", + "xpack.ux.coreVitals.tbt": "阻止总时间", + "xpack.ux.coreVitals.tbtTooltip": "总阻塞时间 (TBT) 是指在首次内容绘制与事务完成之间发生的各个长任务的阻塞时间(持续时间超过50毫秒)之和。", + "xpack.ux.dashboard.backend": "后端", + "xpack.ux.dashboard.dataMissing": "不可用", + "xpack.ux.dashboard.frontend": "前端", + "xpack.ux.dashboard.impactfulMetrics.highTrafficPages": "高流量页面", + "xpack.ux.dashboard.impactfulMetrics.jsErrors": "JavaScript 错误", + "xpack.ux.dashboard.overall.label": "总体", + "xpack.ux.dashboard.pageLoad.label": "页面加载", + "xpack.ux.dashboard.pageLoadDistribution.label": "页面加载分布", + "xpack.ux.dashboard.pageLoadDuration.label": "页面加载持续时间", + "xpack.ux.dashboard.pageLoadTime.label": "页面加载时间(秒)", + "xpack.ux.dashboard.pageLoadTimes.label": "页面加载时间", + "xpack.ux.dashboard.pagesLoaded.label": "已加载页面", + "xpack.ux.dashboard.pageViews": "页面总查看次数", + "xpack.ux.dashboard.resetZoom.label": "重置缩放比例", + "xpack.ux.dashboard.tooltips.backEnd": "后端时间表示接收到第一个字节所需的时间 (TTFB),即从请求发出后接收到第一个响应数据包的时间", + "xpack.ux.dashboard.tooltips.frontEnd": "前端时间表示页面加载总持续时间减去后端时间", + "xpack.ux.dashboard.tooltips.totalPageLoad": "合计表示整个页面加载持续时间", + "xpack.ux.dashboard.totalPageLoad": "合计", + "xpack.ux.filterGroup.breakdown": "细目", + "xpack.ux.filterGroup.coreWebVitals": "网站体验核心指标", + "xpack.ux.filterGroup.seconds": "秒", + "xpack.ux.filterGroup.selectBreakdown": "选择细分", + "xpack.ux.filters.filterByUrl": "按 URL 筛选", + "xpack.ux.filters.searchResults": "{total} 项搜索结果", + "xpack.ux.filters.select": "选择", + "xpack.ux.filters.topPages": "排名靠前页面", + "xpack.ux.filters.url": "URL", + "xpack.ux.filters.url.loadingResults": "正在加载结果", + "xpack.ux.filters.url.noResults": "没有可用结果", + "xpack.ux.jsErrors.errorMessage": "错误消息", + "xpack.ux.jsErrors.errorRate": "错误率", + "xpack.ux.jsErrors.impactedPageLoads": "受影响的页面加载", + "xpack.ux.jsErrors.totalErrors": "错误总数", + "xpack.ux.jsErrorsTable.errorMessage": "无法提取", + "xpack.ux.uxMetrics.longestLongTasks": "长任务最长持续时间", + "xpack.ux.uxMetrics.longestLongTasksTooltip": "最长任务的持续时间。长任务是指独占用户界面线程较长时间(大于50毫秒)并阻止其他关键任务(帧速率或输入延迟)执行的任何用户活动或浏览器任务。", + "xpack.ux.uxMetrics.noOfLongTasks": "长任务数目", + "xpack.ux.uxMetrics.noOfLongTasksTooltip": "长任务的数量。长任务是指独占用户界面线程较长时间(大于50毫秒)并阻止其他关键任务(帧速率或输入延迟)执行的任何用户活动或浏览器任务。", + "xpack.ux.uxMetrics.sumLongTasks": "长任务总持续时间", + "xpack.ux.uxMetrics.sumLongTasksTooltip": "长任务的总持续时间。长任务是指独占用户界面线程较长时间(大于50毫秒)并阻止其他关键任务(帧速率或输入延迟)执行的任何用户活动或浏览器任务。", + "xpack.ux.visitorBreakdown": "访问者细分", + "xpack.ux.visitorBreakdown.browser": "浏览器", + "xpack.ux.visitorBreakdown.operatingSystem": "操作系统", + "xpack.ux.visitorBreakdownMap.avgPageLoadDuration": "页面加载平均持续时间", + "xpack.ux.visitorBreakdownMap.pageLoadDurationByRegion": "按区域列出的页面加载持续时间(平均值)", + "xpack.ux.breadcrumbs.dashboard": "仪表板", + "xpack.ux.breadcrumbs.root": "用户体验", + "xpack.ux.jsErrors.percent": "{pageLoadPercent}%", + "xpack.ux.localFilters.titles.webApplication": "Web 应用程序", + "xpack.ux.median": "中值", + "xpack.ux.metrics": "指标", + "xpack.ux.overview.beatsCard.description": "通过 APM 代理启用 RUM,以收集用户体验数据。", + "xpack.ux.overview.beatsCard.title": "添加 APM 集成", + "xpack.ux.overview.heading": "仪表板", + "xpack.ux.overview.solutionName": "可观测性", + "xpack.ux.percentile.50thMedian": "第 50 个(中值)", + "xpack.ux.percentile.75th": "第 75 个", + "xpack.ux.percentile.90th": "第 90 个", + "xpack.ux.percentile.95th": "第 95 个", + "xpack.ux.percentile.99th": "第 99 个", + "xpack.ux.percentile.label": "百分位数", + "xpack.ux.percentiles.label": "第 {value} 个百分位", + "xpack.ux.title": "仪表板", + "xpack.ux.visitorBreakdown.noData": "无数据。", "xpack.banners.settings.backgroundColor.description": "设置横幅广告的背景色。{subscriptionLink}", "xpack.banners.settings.backgroundColor.title": "横幅广告背景色", "xpack.banners.settings.placement.description": "在 Elastic 页眉上显示此工作区的顶部横幅广告。{subscriptionLink}", diff --git a/x-pack/plugins/ux/.prettierrc b/x-pack/plugins/ux/.prettierrc new file mode 100644 index 0000000000000..650cb880f6f5a --- /dev/null +++ b/x-pack/plugins/ux/.prettierrc @@ -0,0 +1,4 @@ +{ + "singleQuote": true, + "semi": true +} diff --git a/x-pack/plugins/ux/.storybook/main.js b/x-pack/plugins/ux/.storybook/main.js new file mode 100644 index 0000000000000..86b48c32f103e --- /dev/null +++ b/x-pack/plugins/ux/.storybook/main.js @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +module.exports = require('@kbn/storybook').defaultConfig; diff --git a/x-pack/plugins/ux/CONTRIBUTING.md b/x-pack/plugins/ux/CONTRIBUTING.md new file mode 100644 index 0000000000000..722de5d4d29ce --- /dev/null +++ b/x-pack/plugins/ux/CONTRIBUTING.md @@ -0,0 +1 @@ +## Observability User Experience Application diff --git a/x-pack/plugins/ux/common/agent_name.ts b/x-pack/plugins/ux/common/agent_name.ts new file mode 100644 index 0000000000000..d8e079400bff4 --- /dev/null +++ b/x-pack/plugins/ux/common/agent_name.ts @@ -0,0 +1,20 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { AgentName } from '../../apm/typings/es_schemas/ui/fields/agent'; + +export const RUM_AGENT_NAMES: AgentName[] = [ + 'js-base', + 'rum-js', + 'opentelemetry/webjs', +]; + +export function isRumAgentName( + agentName?: string +): agentName is 'js-base' | 'rum-js' | 'opentelemetry/webjs' { + return RUM_AGENT_NAMES.includes(agentName! as AgentName); +} diff --git a/x-pack/plugins/ux/common/elasticsearch_fieldnames.ts b/x-pack/plugins/ux/common/elasticsearch_fieldnames.ts new file mode 100644 index 0000000000000..9bfc0f7596d09 --- /dev/null +++ b/x-pack/plugins/ux/common/elasticsearch_fieldnames.ts @@ -0,0 +1,42 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export const SERVICE = 'service'; +export const SERVICE_NAME = 'service.name'; +export const SERVICE_ENVIRONMENT = 'service.environment'; + +export const AGENT = 'agent'; +export const AGENT_NAME = 'agent.name'; +export const AGENT_VERSION = 'agent.version'; + +export const URL_FULL = 'url.full'; +export const USER_AGENT_NAME = 'user_agent.name'; + +export const TRANSACTION_DURATION = 'transaction.duration.us'; +export const TRANSACTION_TYPE = 'transaction.type'; +export const TRANSACTION_RESULT = 'transaction.result'; +export const TRANSACTION_NAME = 'transaction.name'; +export const TRANSACTION_ID = 'transaction.id'; + +export const CLIENT_GEO_COUNTRY_ISO_CODE = 'client.geo.country_iso_code'; + +// RUM Labels +export const TRANSACTION_URL = 'url.full'; +export const CLIENT_GEO = 'client.geo'; +export const USER_AGENT_DEVICE = 'user_agent.device.name'; +export const USER_AGENT_OS = 'user_agent.os.name'; + +export const TRANSACTION_TIME_TO_FIRST_BYTE = + 'transaction.marks.agent.timeToFirstByte'; +export const TRANSACTION_DOM_INTERACTIVE = + 'transaction.marks.agent.domInteractive'; + +export const FCP_FIELD = 'transaction.marks.agent.firstContentfulPaint'; +export const LCP_FIELD = 'transaction.marks.agent.largestContentfulPaint'; +export const TBT_FIELD = 'transaction.experience.tbt'; +export const FID_FIELD = 'transaction.experience.fid'; +export const CLS_FIELD = 'transaction.experience.cls'; diff --git a/x-pack/plugins/ux/common/environment_filter_values.ts b/x-pack/plugins/ux/common/environment_filter_values.ts new file mode 100644 index 0000000000000..e8b805e5326dd --- /dev/null +++ b/x-pack/plugins/ux/common/environment_filter_values.ts @@ -0,0 +1,75 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { i18n } from '@kbn/i18n'; +import { SERVICE_ENVIRONMENT } from './elasticsearch_fieldnames'; +import { Environment } from './environment_rt'; + +const ENVIRONMENT_ALL_VALUE = 'ENVIRONMENT_ALL' as const; +const ENVIRONMENT_NOT_DEFINED_VALUE = 'ENVIRONMENT_NOT_DEFINED' as const; + +export function getEnvironmentLabel(environment: string) { + if (!environment || environment === ENVIRONMENT_NOT_DEFINED_VALUE) { + return i18n.translate('xpack.ux.filter.environment.notDefinedLabel', { + defaultMessage: 'Not defined', + }); + } + + if (environment === ENVIRONMENT_ALL_VALUE) { + return i18n.translate('xpack.ux.filter.environment.allLabel', { + defaultMessage: 'All', + }); + } + + return environment; +} + +export const ENVIRONMENT_ALL = { + value: ENVIRONMENT_ALL_VALUE, + text: getEnvironmentLabel(ENVIRONMENT_ALL_VALUE), +}; + +export const ENVIRONMENT_NOT_DEFINED = { + value: ENVIRONMENT_NOT_DEFINED_VALUE, + text: getEnvironmentLabel(ENVIRONMENT_NOT_DEFINED_VALUE), +}; + +export function getEnvironmentEsField(environment: string) { + if ( + !environment || + environment === ENVIRONMENT_NOT_DEFINED_VALUE || + environment === ENVIRONMENT_ALL_VALUE + ) { + return {}; + } + + return { [SERVICE_ENVIRONMENT]: environment }; +} + +// returns the environment url param that should be used +// based on the requested environment. If the requested +// environment is different from the URL parameter, we'll +// return ENVIRONMENT_ALL. If it's not, we'll just return +// the current environment URL param +export function getNextEnvironmentUrlParam({ + requestedEnvironment, + currentEnvironmentUrlParam, +}: { + requestedEnvironment?: string; + currentEnvironmentUrlParam: Environment; +}) { + const normalizedRequestedEnvironment = + requestedEnvironment || ENVIRONMENT_NOT_DEFINED.value; + const normalizedQueryEnvironment = + currentEnvironmentUrlParam || ENVIRONMENT_ALL.value; + + if (normalizedRequestedEnvironment === normalizedQueryEnvironment) { + return currentEnvironmentUrlParam || ENVIRONMENT_ALL.value; + } + + return ENVIRONMENT_ALL.value; +} diff --git a/x-pack/plugins/ux/common/environment_rt.ts b/x-pack/plugins/ux/common/environment_rt.ts new file mode 100644 index 0000000000000..e9337da9bdcf5 --- /dev/null +++ b/x-pack/plugins/ux/common/environment_rt.ts @@ -0,0 +1,22 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import * as t from 'io-ts'; +import { nonEmptyStringRt } from '@kbn/io-ts-utils'; +import { + ENVIRONMENT_ALL, + ENVIRONMENT_NOT_DEFINED, +} from './environment_filter_values'; + +export const environmentRt = t.type({ + environment: t.union([ + t.literal(ENVIRONMENT_NOT_DEFINED.value), + t.literal(ENVIRONMENT_ALL.value), + nonEmptyStringRt, + ]), +}); + +export type Environment = t.TypeOf['environment']; diff --git a/x-pack/plugins/ux/common/fetch_options.ts b/x-pack/plugins/ux/common/fetch_options.ts new file mode 100644 index 0000000000000..2f862ec7cbc38 --- /dev/null +++ b/x-pack/plugins/ux/common/fetch_options.ts @@ -0,0 +1,15 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { HttpFetchOptions } from 'kibana/public'; + +export type FetchOptions = Omit & { + pathname: string; + isCachable?: boolean; + method?: string; + body?: any; +}; diff --git a/x-pack/plugins/ux/common/index_pattern_constants.ts b/x-pack/plugins/ux/common/index_pattern_constants.ts new file mode 100644 index 0000000000000..4b67bba1fef91 --- /dev/null +++ b/x-pack/plugins/ux/common/index_pattern_constants.ts @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export const APM_STATIC_INDEX_PATTERN_ID = 'apm_static_index_pattern_id'; diff --git a/x-pack/plugins/ux/common/transaction_types.ts b/x-pack/plugins/ux/common/transaction_types.ts new file mode 100644 index 0000000000000..87c14fbd496f7 --- /dev/null +++ b/x-pack/plugins/ux/common/transaction_types.ts @@ -0,0 +1,10 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export const TRANSACTION_PAGE_LOAD = 'page-load'; +export const TRANSACTION_REQUEST = 'request'; +export const TRANSACTION_ROUTE_CHANGE = 'route-change'; diff --git a/x-pack/plugins/ux/common/utils/pick_keys.ts b/x-pack/plugins/ux/common/utils/pick_keys.ts new file mode 100644 index 0000000000000..fe45e9a0e42c8 --- /dev/null +++ b/x-pack/plugins/ux/common/utils/pick_keys.ts @@ -0,0 +1,12 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { pick } from 'lodash'; + +export function pickKeys(obj: T, ...keys: K[]) { + return pick(obj, keys) as Pick; +} diff --git a/x-pack/plugins/ux/common/ux_ui_filter.ts b/x-pack/plugins/ux/common/ux_ui_filter.ts new file mode 100644 index 0000000000000..aeea1cddae30d --- /dev/null +++ b/x-pack/plugins/ux/common/ux_ui_filter.ts @@ -0,0 +1,120 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { i18n } from '@kbn/i18n'; +import { + CLIENT_GEO_COUNTRY_ISO_CODE, + SERVICE_NAME, + TRANSACTION_URL, + USER_AGENT_DEVICE, + USER_AGENT_NAME, + USER_AGENT_OS, +} from './elasticsearch_fieldnames'; + +export const uxFiltersByName = { + transactionUrl: { + title: i18n.translate('xpack.ux.localFilters.titles.transactionUrl', { + defaultMessage: 'URL', + }), + fieldName: TRANSACTION_URL, + }, + transactionUrlExcluded: { + title: i18n.translate('xpack.ux.localFilters.titles.transactionUrl', { + defaultMessage: 'URL', + }), + fieldName: TRANSACTION_URL, + excluded: true, + }, + browser: { + title: i18n.translate('xpack.ux.localFilters.titles.browser', { + defaultMessage: 'Browser', + }), + fieldName: USER_AGENT_NAME, + }, + browserExcluded: { + title: i18n.translate('xpack.ux.localFilters.titles.browser', { + defaultMessage: 'Browser', + }), + fieldName: USER_AGENT_NAME, + excluded: true, + }, + device: { + title: i18n.translate('xpack.ux.localFilters.titles.device', { + defaultMessage: 'Device', + }), + fieldName: USER_AGENT_DEVICE, + }, + deviceExcluded: { + title: i18n.translate('xpack.ux.localFilters.titles.device', { + defaultMessage: 'Device', + }), + fieldName: USER_AGENT_DEVICE, + excluded: true, + }, + location: { + title: i18n.translate('xpack.ux.localFilters.titles.location', { + defaultMessage: 'Location', + }), + fieldName: CLIENT_GEO_COUNTRY_ISO_CODE, + }, + locationExcluded: { + title: i18n.translate('xpack.ux.localFilters.titles.location', { + defaultMessage: 'Location', + }), + fieldName: CLIENT_GEO_COUNTRY_ISO_CODE, + excluded: true, + }, + os: { + title: i18n.translate('xpack.ux.localFilters.titles.os', { + defaultMessage: 'OS', + }), + fieldName: USER_AGENT_OS, + }, + osExcluded: { + title: i18n.translate('xpack.ux.localFilters.titles.os', { + defaultMessage: 'OS', + }), + fieldName: USER_AGENT_OS, + excluded: true, + }, + serviceName: { + title: i18n.translate('xpack.ux.localFilters.titles.serviceName', { + defaultMessage: 'Service name', + }), + fieldName: SERVICE_NAME, + }, +}; + +export type UxLocalUIFilterName = keyof typeof uxFiltersByName; + +export interface UxLocalUIFilter { + name: UxLocalUIFilterName; + title: string; + fieldName: string; + excluded?: boolean; + value: string[]; +} + +type UxLocalUIFilterMap = { + [key in UxLocalUIFilterName]: UxLocalUIFilter; +}; + +export const uxLocalUIFilterNames = Object.keys( + uxFiltersByName +) as UxLocalUIFilterName[]; + +export const uxLocalUIFilters = uxLocalUIFilterNames.reduce((acc, key) => { + const field = uxFiltersByName[key]; + + return { + ...acc, + [key]: { + ...field, + name: key, + }, + }; +}, {} as UxLocalUIFilterMap); diff --git a/x-pack/plugins/ux/jest.config.js b/x-pack/plugins/ux/jest.config.js new file mode 100644 index 0000000000000..f380a059e5547 --- /dev/null +++ b/x-pack/plugins/ux/jest.config.js @@ -0,0 +1,14 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +const path = require('path'); + +module.exports = { + preset: '@kbn/test', + rootDir: path.resolve(__dirname, '../../..'), + roots: ['/x-pack/plugins/ux'], +}; diff --git a/x-pack/plugins/ux/kibana.json b/x-pack/plugins/ux/kibana.json new file mode 100644 index 0000000000000..bc57b115b7299 --- /dev/null +++ b/x-pack/plugins/ux/kibana.json @@ -0,0 +1,33 @@ +{ + "id": "ux", + "version": "8.0.0", + "kibanaVersion": "kibana", + "requiredPlugins": [ + "features", + "data", + "licensing", + "triggersActionsUi", + "embeddable", + "infra", + "inspector", + "apm" + ], + "optionalPlugins": [ + "cloud", + "usageCollection", + "taskManager", + "actions", + "alerts", + "observability", + "security", + "maps" + ], + "server": false, + "ui": true, + "configPath": ["xpack", "ux"], + "requiredBundles": ["kibanaReact", "observability", "maps"], + "owner": { + "name": "Uptime", + "githubTeam": "uptime" + } +} diff --git a/x-pack/plugins/ux/public/application/application.test.tsx b/x-pack/plugins/ux/public/application/application.test.tsx new file mode 100644 index 0000000000000..15b351581c680 --- /dev/null +++ b/x-pack/plugins/ux/public/application/application.test.tsx @@ -0,0 +1,126 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { EuiErrorBoundary } from '@elastic/eui'; +import { mount } from 'enzyme'; + +import { UXAppRoot } from './ux_app'; +import { RumHome } from '../components/app/rum_dashboard/rum_home'; +import { coreMock } from '../../../../../src/core/public/mocks'; +import { createObservabilityRuleTypeRegistryMock } from '../../../observability/public'; +import { merge } from 'lodash'; +import { UI_SETTINGS } from '../../../../../src/plugins/data/common'; +import { embeddablePluginMock } from '../../../../../src/plugins/embeddable/public/mocks'; + +jest.mock('../services/rest/data_view', () => ({ + createStaticDataView: () => Promise.resolve(undefined), +})); + +jest.mock('../components/app/rum_dashboard/rum_home', () => ({ + RumHome: () =>

Home Mock

, +})); + +const mockPlugin = { + data: { + query: { + timefilter: { timefilter: { setTime: () => {}, getTime: () => ({}) } }, + }, + }, + observability: { + isAlertingExperienceEnabled: () => false, + }, +}; + +const mockEmbeddable = embeddablePluginMock.createStartContract(); + +mockEmbeddable.getEmbeddableFactory = jest.fn().mockImplementation(() => ({ + create: () => ({ + reload: jest.fn(), + setRenderTooltipContent: jest.fn(), + setLayerList: jest.fn(), + }), +})); + +const mockCorePlugins = { + embeddable: mockEmbeddable, + inspector: {}, + maps: {}, + observability: { + navigation: { + registerSections: () => jest.fn(), + PageTemplate: ({ children }: { children: React.ReactNode }) => ( +
hello worlds {children}
+ ), + }, + }, + data: {}, +}; +const coreStart = coreMock.createStart({ basePath: '/basepath' }); + +const mockCore = merge({}, coreStart, { + application: { + capabilities: { + apm: {}, + ml: {}, + }, + }, + uiSettings: { + get: (key: string) => { + const uiSettings: Record = { + [UI_SETTINGS.TIMEPICKER_QUICK_RANGES]: [ + { + from: 'now/d', + to: 'now/d', + display: 'Today', + }, + { + from: 'now/w', + to: 'now/w', + display: 'This week', + }, + ], + [UI_SETTINGS.TIMEPICKER_TIME_DEFAULTS]: { + from: 'now-15m', + to: 'now', + }, + [UI_SETTINGS.TIMEPICKER_REFRESH_INTERVAL_DEFAULTS]: { + pause: false, + value: 100000, + }, + }; + return uiSettings[key]; + }, + }, +}); + +export const mockApmPluginContextValue = { + appMountParameters: coreMock.createAppMountParameters('/basepath'), + core: mockCore, + plugins: mockPlugin, + observabilityRuleTypeRegistry: createObservabilityRuleTypeRegistryMock(), + corePlugins: mockCorePlugins, + deps: {}, +}; + +describe('renderUxApp', () => { + it('has an error boundary for the UXAppRoot', async () => { + const wrapper = mount( + + ); + + wrapper + .find(RumHome) + .simulateError(new Error('Oh no, an unexpected error!')); + + expect(wrapper.find(RumHome)).toHaveLength(0); + expect(wrapper.find(EuiErrorBoundary)).toHaveLength(1); + expect(wrapper.find(EuiErrorBoundary).text()).toMatch( + /Error: Oh no, an unexpected error!/ + ); + }); +}); diff --git a/x-pack/plugins/apm/public/application/ux_app.tsx b/x-pack/plugins/ux/public/application/ux_app.tsx similarity index 54% rename from x-pack/plugins/apm/public/application/ux_app.tsx rename to x-pack/plugins/ux/public/application/ux_app.tsx index 982b3b7210ee6..29ec41ab67ab5 100644 --- a/x-pack/plugins/apm/public/application/ux_app.tsx +++ b/x-pack/plugins/ux/public/application/ux_app.tsx @@ -7,46 +7,55 @@ import { euiLightVars, euiDarkVars } from '@kbn/ui-theme'; import { EuiErrorBoundary } from '@elastic/eui'; -import { AppMountParameters, CoreStart } from 'kibana/public'; import React from 'react'; import ReactDOM from 'react-dom'; -import { Route as ReactRouterRoute } from 'react-router-dom'; -import { RouterProvider, createRouter } from '@kbn/typed-react-router-config'; +import { Redirect } from 'react-router-dom'; import { DefaultTheme, ThemeProvider } from 'styled-components'; +import { RouterProvider, createRouter } from '@kbn/typed-react-router-config'; import { i18n } from '@kbn/i18n'; -import type { ObservabilityRuleTypeRegistry } from '../../../observability/public'; +import { RouteComponentProps, RouteProps } from 'react-router-dom'; +import { + AppMountParameters, + CoreStart, + APP_WRAPPER_CLASS, +} from '../../../../../src/core/public'; + import { KibanaContextProvider, RedirectAppLinks, useUiSetting$, } from '../../../../../src/plugins/kibana_react/public'; -import { APMRouteDefinition } from '../application/routes'; -import { ScrollToTopOnPathChange } from '../components/app/main/scroll_to_top_on_path_change'; + import { - RumHome, DASHBOARD_LABEL, + RumHome, } from '../components/app/rum_dashboard/rum_home'; -import { ApmPluginContext } from '../context/apm_plugin/apm_plugin_context'; -import { UrlParamsProvider } from '../context/url_params_context/url_params_context'; -import { ConfigSchema } from '../index'; import { ApmPluginSetupDeps, ApmPluginStartDeps } from '../plugin'; -import { createCallApmApi } from '../services/rest/create_call_apm_api'; -import { createStaticDataView } from '../services/rest/data_view'; import { UXActionMenu } from '../components/app/rum_dashboard/action_menu'; -import { redirectTo } from '../components/routing/redirect_to'; + import { InspectorContextProvider, useBreadcrumbs, } from '../../../observability/public'; -import { useApmPluginContext } from '../context/apm_plugin/use_apm_plugin_context'; -import { APP_WRAPPER_CLASS } from '../../../../../src/core/public'; -import { KibanaThemeProvider } from '../../../../../src/plugins/kibana_react/public'; +import { UrlParamsProvider } from '../context/url_params_context/url_params_context'; +import { createStaticDataView } from '../services/rest/data_view'; +import { createCallApmApi } from '../services/rest/create_call_apm_api'; +import { useKibanaServices } from '../hooks/use_kibana_services'; + +export type BreadcrumbTitle = + | string + | ((props: RouteComponentProps) => string) + | null; -export const uxRoutes: APMRouteDefinition[] = [ +export interface RouteDefinition extends RouteProps { + breadcrumb: BreadcrumbTitle; +} + +export const uxRoutes: RouteDefinition[] = [ { exact: true, path: '/', - render: redirectTo('/ux'), + render: () => , breadcrumb: DASHBOARD_LABEL, }, ]; @@ -54,18 +63,18 @@ export const uxRoutes: APMRouteDefinition[] = [ function UxApp() { const [darkMode] = useUiSetting$('theme:darkMode'); - const { core } = useApmPluginContext(); - const basePath = core.http.basePath.get(); + const { http } = useKibanaServices(); + const basePath = http.basePath.get(); useBreadcrumbs([ { - text: i18n.translate('xpack.apm.ux.breadcrumbs.root', { + text: i18n.translate('xpack.ux.breadcrumbs.root', { defaultMessage: 'User Experience', }), href: basePath + '/app/ux', }, { - text: i18n.translate('xpack.apm.ux.breadcrumbs.dashboard', { + text: i18n.translate('xpack.ux.breadcrumbs.dashboard', { defaultMessage: 'Dashboard', }), }, @@ -84,66 +93,57 @@ function UxApp() { data-test-subj="csmMainContainer" role="main" > - ); } -const uxRouter = createRouter({}); +export const uxRouter = createRouter({}); export function UXAppRoot({ appMountParameters, core, deps, - config, corePlugins: { embeddable, inspector, maps, observability, data }, - observabilityRuleTypeRegistry, }: { appMountParameters: AppMountParameters; core: CoreStart; deps: ApmPluginSetupDeps; - config: ConfigSchema; corePlugins: ApmPluginStartDeps; - observabilityRuleTypeRegistry: ObservabilityRuleTypeRegistry; }) { const { history } = appMountParameters; const i18nCore = core.i18n; const plugins = { ...deps, maps }; - const apmPluginContextValue = { - appMountParameters, - config, - core, - inspector, - plugins, - observability, - observabilityRuleTypeRegistry, - }; return ( - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + ); } @@ -156,18 +156,14 @@ export const renderApp = ({ core, deps, appMountParameters, - config, corePlugins, - observabilityRuleTypeRegistry, }: { core: CoreStart; deps: ApmPluginSetupDeps; appMountParameters: AppMountParameters; - config: ConfigSchema; corePlugins: ApmPluginStartDeps; - observabilityRuleTypeRegistry: ObservabilityRuleTypeRegistry; }) => { - const { element, theme$ } = appMountParameters; + const { element } = appMountParameters; createCallApmApi(core); @@ -178,16 +174,12 @@ export const renderApp = ({ }); ReactDOM.render( - - - , + , element ); return () => { diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/action_menu/index.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/action_menu/index.tsx similarity index 79% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/action_menu/index.tsx rename to x-pack/plugins/ux/public/components/app/rum_dashboard/action_menu/index.tsx index 1215048bc55a0..84c297dbdea29 100644 --- a/x-pack/plugins/apm/public/components/app/rum_dashboard/action_menu/index.tsx +++ b/x-pack/plugins/ux/public/components/app/rum_dashboard/action_menu/index.tsx @@ -14,17 +14,17 @@ import { HeaderMenuPortal, } from '../../../../../../observability/public'; import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; -import { useKibana } from '../../../../../../../../src/plugins/kibana_react/public'; import { AppMountParameters } from '../../../../../../../../src/core/public'; -import { InspectorHeaderLink } from '../../../shared/apm_header_action_menu/inspector_header_link'; import { SERVICE_NAME } from '../../../../../common/elasticsearch_fieldnames'; +import { UxInspectorHeaderLink } from './inpector_link'; +import { useKibanaServices } from '../../../../hooks/use_kibana_services'; -const ANALYZE_DATA = i18n.translate('xpack.apm.analyzeDataButtonLabel', { +const ANALYZE_DATA = i18n.translate('xpack.ux.analyzeDataButtonLabel', { defaultMessage: 'Explore data', }); const ANALYZE_MESSAGE = i18n.translate( - 'xpack.apm.analyzeDataButtonLabel.message', + 'xpack.ux.analyzeDataButtonLabel.message', { defaultMessage: 'Explore Data allows you to select and filter result data in any dimension and look for the cause or impact of performance problems.', @@ -36,9 +36,7 @@ export function UXActionMenu({ }: { appMountParameters: AppMountParameters; }) { - const { - services: { http }, - } = useKibana(); + const { http, application } = useKibanaServices(); const { urlParams } = useLegacyUrlParams(); const { rangeTo, rangeFrom, serviceName } = urlParams; @@ -57,11 +55,9 @@ export function UXActionMenu({ }, ], }, - http?.basePath.get() + http.basePath.get() ); - const kibana = useKibana(); - return ( - {i18n.translate('xpack.apm.addDataButtonLabel', { + {i18n.translate('xpack.ux.addDataButtonLabel', { defaultMessage: 'Add data', })} - + ); diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/action_menu/inpector_link.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/action_menu/inpector_link.tsx similarity index 54% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/action_menu/inpector_link.tsx rename to x-pack/plugins/ux/public/components/app/rum_dashboard/action_menu/inpector_link.tsx index fc7fad24edb56..98622184a5cec 100644 --- a/x-pack/plugins/apm/public/components/app/rum_dashboard/action_menu/inpector_link.tsx +++ b/x-pack/plugins/ux/public/components/app/rum_dashboard/action_menu/inpector_link.tsx @@ -8,19 +8,17 @@ import { EuiHeaderLink } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import React from 'react'; -import { useApmPluginContext } from '../../../../context/apm_plugin/use_apm_plugin_context'; -import { useKibana } from '../../../../../../../../src/plugins/kibana_react/public'; -import { enableInspectEsQueries } from '../../../../../../observability/common/ui_settings_keys'; -import { useInspectorContext } from '../../../../../../observability/public'; +import { + useInspectorContext, + enableInspectEsQueries, +} from '../../../../../../observability/public'; +import { useKibanaServices } from '../../../../hooks/use_kibana_services'; export function UxInspectorHeaderLink() { - const { inspector } = useApmPluginContext(); const { inspectorAdapters } = useInspectorContext(); - const { - services: { uiSettings }, - } = useKibana(); + const { uiSettings, inspector } = useKibanaServices(); - const isInspectorEnabled = uiSettings?.get(enableInspectEsQueries); + const isInspectorEnabled = uiSettings.get(enableInspectEsQueries); const inspect = () => { inspector.open(inspectorAdapters); @@ -32,7 +30,7 @@ export function UxInspectorHeaderLink() { return ( - {i18n.translate('xpack.apm.inspectButtonText', { + {i18n.translate('xpack.ux.inspectButtonText', { defaultMessage: 'Inspect', })} diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/breakdowns/breakdown_filter.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/breakdowns/breakdown_filter.tsx similarity index 86% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/breakdowns/breakdown_filter.tsx rename to x-pack/plugins/ux/public/components/app/rum_dashboard/breakdowns/breakdown_filter.tsx index 3bf8d5e58a1e4..dd2718db6cfff 100644 --- a/x-pack/plugins/apm/public/components/app/rum_dashboard/breakdowns/breakdown_filter.tsx +++ b/x-pack/plugins/ux/public/components/app/rum_dashboard/breakdowns/breakdown_filter.tsx @@ -8,6 +8,7 @@ import React from 'react'; import { EuiSuperSelect } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; + import { CLIENT_GEO_COUNTRY_ISO_CODE, USER_AGENT_DEVICE, @@ -31,35 +32,35 @@ export function BreakdownFilter({ const items: BreakdownItem[] = [ { - name: i18n.translate('xpack.apm.csm.breakDownFilter.noBreakdown', { + name: i18n.translate('xpack.ux.breakDownFilter.noBreakdown', { defaultMessage: 'No breakdown', }), fieldName: NO_BREAKDOWN, type: 'category', }, { - name: i18n.translate('xpack.apm.csm.breakdownFilter.browser', { + name: i18n.translate('xpack.ux.breakdownFilter.browser', { defaultMessage: 'Browser', }), fieldName: USER_AGENT_NAME, type: 'category', }, { - name: i18n.translate('xpack.apm.csm.breakdownFilter.os', { + name: i18n.translate('xpack.ux.breakdownFilter.os', { defaultMessage: 'OS', }), fieldName: USER_AGENT_OS, type: 'category', }, { - name: i18n.translate('xpack.apm.csm.breakdownFilter.device', { + name: i18n.translate('xpack.ux.breakdownFilter.device', { defaultMessage: 'Device', }), fieldName: USER_AGENT_DEVICE, type: 'category', }, { - name: i18n.translate('xpack.apm.csm.breakdownFilter.location', { + name: i18n.translate('xpack.ux.breakdownFilter.location', { defaultMessage: 'Location', }), fieldName: CLIENT_GEO_COUNTRY_ISO_CODE, diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/chart_wrapper/index.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/chart_wrapper/index.tsx similarity index 100% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/chart_wrapper/index.tsx rename to x-pack/plugins/ux/public/components/app/rum_dashboard/chart_wrapper/index.tsx diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/charts/page_load_dist_chart.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/charts/page_load_dist_chart.tsx similarity index 100% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/charts/page_load_dist_chart.tsx rename to x-pack/plugins/ux/public/components/app/rum_dashboard/charts/page_load_dist_chart.tsx index ff9fb97197db0..e04a23fd8ddbf 100644 --- a/x-pack/plugins/apm/public/components/app/rum_dashboard/charts/page_load_dist_chart.tsx +++ b/x-pack/plugins/ux/public/components/app/rum_dashboard/charts/page_load_dist_chart.tsx @@ -32,9 +32,9 @@ import { PercentileAnnotations } from '../page_load_distribution/percentile_anno import { I18LABELS } from '../translations'; import { ChartWrapper } from '../chart_wrapper'; import { PercentileRange } from '../page_load_distribution'; -import { BreakdownItem } from '../../../../../typings/ui_filters'; import { useUiSetting$ } from '../../../../../../../../src/plugins/kibana_react/public'; import { BreakdownSeries } from '../page_load_distribution/breakdown_series'; +import { BreakdownItem } from '../../../../../typings/ui_filters'; interface PageLoadData { pageLoadDistribution: Array<{ x: number; y: number }>; diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/charts/page_views_chart.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/charts/page_views_chart.tsx similarity index 97% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/charts/page_views_chart.tsx rename to x-pack/plugins/ux/public/components/app/rum_dashboard/charts/page_views_chart.tsx index 059feb0915fdb..79e60a2117540 100644 --- a/x-pack/plugins/apm/public/components/app/rum_dashboard/charts/page_views_chart.tsx +++ b/x-pack/plugins/ux/public/components/app/rum_dashboard/charts/page_views_chart.tsx @@ -29,9 +29,9 @@ import React from 'react'; import { useHistory } from 'react-router-dom'; import { useUiSetting$ } from '../../../../../../../../src/plugins/kibana_react/public'; import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; -import { fromQuery, toQuery } from '../../../shared/links/url_helpers'; import { ChartWrapper } from '../chart_wrapper'; import { I18LABELS } from '../translations'; +import { fromQuery, toQuery } from '../../../../../../observability/public'; interface Props { data?: { diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/charts/visitor_breakdown_chart.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/charts/visitor_breakdown_chart.tsx similarity index 100% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/charts/visitor_breakdown_chart.tsx rename to x-pack/plugins/ux/public/components/app/rum_dashboard/charts/visitor_breakdown_chart.tsx diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/client_metrics/index.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/client_metrics/index.tsx similarity index 100% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/client_metrics/index.tsx rename to x-pack/plugins/ux/public/components/app/rum_dashboard/client_metrics/index.tsx diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/client_metrics/metrics.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/client_metrics/metrics.tsx similarity index 100% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/client_metrics/metrics.tsx rename to x-pack/plugins/ux/public/components/app/rum_dashboard/client_metrics/metrics.tsx diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/csm_shared_context/index.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/csm_shared_context/index.tsx similarity index 100% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/csm_shared_context/index.tsx rename to x-pack/plugins/ux/public/components/app/rum_dashboard/csm_shared_context/index.tsx diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/empty_state_loading.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/empty_state_loading.tsx similarity index 91% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/empty_state_loading.tsx rename to x-pack/plugins/ux/public/components/app/rum_dashboard/empty_state_loading.tsx index b02672721ce8e..007cd7b97be02 100644 --- a/x-pack/plugins/apm/public/components/app/rum_dashboard/empty_state_loading.tsx +++ b/x-pack/plugins/ux/public/components/app/rum_dashboard/empty_state_loading.tsx @@ -23,7 +23,7 @@ export function EmptyStateLoading() {

- {i18n.translate('xpack.apm.emptyState.loadingMessage', { + {i18n.translate('xpack.ux.emptyState.loadingMessage', { defaultMessage: 'Loading…', })}

diff --git a/x-pack/plugins/ux/public/components/app/rum_dashboard/environment_filter/index.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/environment_filter/index.tsx new file mode 100644 index 0000000000000..d896dfd6428d7 --- /dev/null +++ b/x-pack/plugins/ux/public/components/app/rum_dashboard/environment_filter/index.tsx @@ -0,0 +1,119 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { EuiSelect } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import { History } from 'history'; +import React from 'react'; +import { useHistory, useLocation } from 'react-router-dom'; +import { fromQuery, toQuery } from '../../../../../../observability/public'; +import { useEnvironmentsFetcher } from '../../../../hooks/use_environments_fetcher'; +import { + ENVIRONMENT_ALL, + ENVIRONMENT_NOT_DEFINED, +} from '../../../../../common/environment_filter_values'; +import { useUxUrlParams } from '../../../../context/url_params_context/use_ux_url_params'; + +function updateEnvironmentUrl( + history: History, + location: ReturnType, + environment: string +) { + history.push({ + ...location, + search: fromQuery({ + ...toQuery(location.search), + environment, + }), + }); +} + +const SEPARATOR_OPTION = { + text: `- ${i18n.translate( + 'xpack.ux.filter.environment.selectEnvironmentLabel', + { defaultMessage: 'Select environment' } + )} -`, + disabled: true, +}; + +function getOptions(environments: string[]) { + const environmentOptions = environments + .filter((env) => env !== ENVIRONMENT_NOT_DEFINED.value) + .map((environment) => ({ + value: environment, + text: environment, + })); + + return [ + ENVIRONMENT_ALL, + ...(environments.includes(ENVIRONMENT_NOT_DEFINED.value) + ? [ENVIRONMENT_NOT_DEFINED] + : []), + ...(environmentOptions.length > 0 ? [SEPARATOR_OPTION] : []), + ...environmentOptions, + ]; +} + +export interface EnvironmentFilterProps { + start?: string; + end?: string; + environment?: string; + serviceName?: string; +} + +export function EnvironmentFilter({ + start, + end, + environment, + serviceName, +}: EnvironmentFilterProps) { + const history = useHistory(); + const location = useLocation(); + const { environments, status = 'loading' } = useEnvironmentsFetcher({ + serviceName, + start, + end, + }); + + // Set the min-width so we don't see as much collapsing of the select during + // the loading state. 200px is what is looks like if "production" is + // the contents. + const minWidth = 200; + + const options = getOptions(environments); + + return ( + { + updateEnvironmentUrl(history, location, event.target.value); + }} + isLoading={status === 'loading'} + style={{ minWidth }} + /> + ); +} + +export function UxEnvironmentFilter() { + const { + urlParams: { start, end, environment, serviceName }, + } = useUxUrlParams(); + + return ( + + ); +} diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/hooks/use_has_rum_data.ts b/x-pack/plugins/ux/public/components/app/rum_dashboard/hooks/use_has_rum_data.ts similarity index 96% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/hooks/use_has_rum_data.ts rename to x-pack/plugins/ux/public/components/app/rum_dashboard/hooks/use_has_rum_data.ts index 4d48135e9edb3..f76de5e82586f 100644 --- a/x-pack/plugins/apm/public/components/app/rum_dashboard/hooks/use_has_rum_data.ts +++ b/x-pack/plugins/ux/public/components/app/rum_dashboard/hooks/use_has_rum_data.ts @@ -9,6 +9,6 @@ import { useFetcher } from '../../../../hooks/use_fetcher'; export function useHasRumData() { return useFetcher((callApmApi) => { - return callApmApi('GET /api/apm/observability_overview/has_rum_data'); + return callApmApi('GET /api/apm/observability_overview/has_rum_data', {}); }, []); } diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/hooks/use_local_ui_filters.ts b/x-pack/plugins/ux/public/components/app/rum_dashboard/hooks/use_local_uifilters.ts similarity index 94% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/hooks/use_local_ui_filters.ts rename to x-pack/plugins/ux/public/components/app/rum_dashboard/hooks/use_local_uifilters.ts index 5c0bc7fdfd462..c228f9acb77c8 100644 --- a/x-pack/plugins/apm/public/components/app/rum_dashboard/hooks/use_local_ui_filters.ts +++ b/x-pack/plugins/ux/public/components/app/rum_dashboard/hooks/use_local_uifilters.ts @@ -7,18 +7,16 @@ import { omit } from 'lodash'; import { useHistory } from 'react-router-dom'; +import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; +import { getExcludedName } from '../local_uifilters'; + +import { fromQuery, toQuery } from '../../../../../../observability/public'; +import { removeUndefinedProps } from '../../../../context/url_params_context/helpers'; import { uxFiltersByName, UxLocalUIFilter, UxLocalUIFilterName, } from '../../../../../common/ux_ui_filter'; -import { - fromQuery, - toQuery, -} from '../../../../components/shared/links/url_helpers'; -import { removeUndefinedProps } from '../../../../context/url_params_context/helpers'; -import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; -import { getExcludedName } from '../local_ui_filters'; export type FiltersUIHook = ReturnType; diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/hooks/use_ux_query.ts b/x-pack/plugins/ux/public/components/app/rum_dashboard/hooks/use_ux_query.ts similarity index 100% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/hooks/use_ux_query.ts rename to x-pack/plugins/ux/public/components/app/rum_dashboard/hooks/use_ux_query.ts diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/impactful_metrics/index.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/impactful_metrics/index.tsx similarity index 100% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/impactful_metrics/index.tsx rename to x-pack/plugins/ux/public/components/app/rum_dashboard/impactful_metrics/index.tsx diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/impactful_metrics/js_errors.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/impactful_metrics/js_errors.tsx similarity index 90% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/impactful_metrics/js_errors.tsx rename to x-pack/plugins/ux/public/components/app/rum_dashboard/impactful_metrics/js_errors.tsx index 0c6e6846b2feb..c8dada5dce40b 100644 --- a/x-pack/plugins/apm/public/components/app/rum_dashboard/impactful_metrics/js_errors.tsx +++ b/x-pack/plugins/ux/public/components/app/rum_dashboard/impactful_metrics/js_errors.tsx @@ -14,15 +14,16 @@ import { EuiTitle, EuiStat, EuiToolTip, + EuiLink, } from '@elastic/eui'; import numeral from '@elastic/numeral'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; -import { FETCH_STATUS, useFetcher } from '../../../../hooks/use_fetcher'; +import { useFetcher } from '../../../../hooks/use_fetcher'; import { I18LABELS } from '../translations'; import { CsmSharedContext } from '../csm_shared_context'; -import { ErrorDetailLink } from '../../../shared/links/apm/error_detail_link'; +import { FETCH_STATUS } from '../../../../../../observability/public'; interface JSErrorItem { errorMessage: string; @@ -67,12 +68,9 @@ export function JSErrors() { field: 'errorMessage', name: I18LABELS.errorMessage, render: (errorMessage: string, item: JSErrorItem) => ( - + {errorMessage} - + ), }, { @@ -81,7 +79,7 @@ export function JSErrors() { align: 'right' as const, render: (count: number) => (

- {i18n.translate('xpack.apm.localFiltersTitle', { + {i18n.translate('xpack.ux.localFiltersTitle', { defaultMessage: 'Filters', })}

diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/local_ui_filters/queries.ts b/x-pack/plugins/ux/public/components/app/rum_dashboard/local_uifilters/queries.ts similarity index 99% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/local_ui_filters/queries.ts rename to x-pack/plugins/ux/public/components/app/rum_dashboard/local_uifilters/queries.ts index b20a122b35a7f..7c3f49ca9a869 100644 --- a/x-pack/plugins/apm/public/components/app/rum_dashboard/local_ui_filters/queries.ts +++ b/x-pack/plugins/ux/public/components/app/rum_dashboard/local_uifilters/queries.ts @@ -6,6 +6,7 @@ */ import { ESFilter } from 'src/core/types/elasticsearch'; + import { SERVICE_ENVIRONMENT } from '../../../../../common/elasticsearch_fieldnames'; import { ENVIRONMENT_ALL, diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/local_ui_filters/selected_filters.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/local_uifilters/selected_filters.tsx similarity index 96% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/local_ui_filters/selected_filters.tsx rename to x-pack/plugins/ux/public/components/app/rum_dashboard/local_uifilters/selected_filters.tsx index 787bcd88266e2..5bc2dff5924e6 100644 --- a/x-pack/plugins/apm/public/components/app/rum_dashboard/local_ui_filters/selected_filters.tsx +++ b/x-pack/plugins/ux/public/components/app/rum_dashboard/local_uifilters/selected_filters.tsx @@ -11,10 +11,10 @@ import { i18n } from '@kbn/i18n'; import styled from 'styled-components'; import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; import { FilterValueLabel } from '../../../../../../observability/public'; -import { FiltersUIHook } from '../hooks/use_local_ui_filters'; -import { UxLocalUIFilterName } from '../../../../../common/ux_ui_filter'; +import { FiltersUIHook } from '../hooks/use_local_uifilters'; import { IndexPattern } from '../../../../../../../../src/plugins/data/common'; import { SelectedWildcards } from './selected_wildcards'; +import { UxLocalUIFilterName } from '../../../../../common/ux_ui_filter'; interface Props { indexPattern?: IndexPattern; @@ -84,7 +84,7 @@ export function SelectedFilters({ onClick={clearValues} data-cy="clearFilters" > - {i18n.translate('xpack.apm.clearFilters', { + {i18n.translate('xpack.ux.clearFilters', { defaultMessage: 'Clear filters', })} diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/local_ui_filters/selected_wildcards.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/local_uifilters/selected_wildcards.tsx similarity index 91% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/local_ui_filters/selected_wildcards.tsx rename to x-pack/plugins/ux/public/components/app/rum_dashboard/local_uifilters/selected_wildcards.tsx index d18381cee77af..8a104b1ae9bd0 100644 --- a/x-pack/plugins/apm/public/components/app/rum_dashboard/local_ui_filters/selected_wildcards.tsx +++ b/x-pack/plugins/ux/public/components/app/rum_dashboard/local_uifilters/selected_wildcards.tsx @@ -8,9 +8,12 @@ import * as React from 'react'; import { useCallback } from 'react'; import { useHistory } from 'react-router-dom'; -import { FilterValueLabel } from '../../../../../../observability/public'; +import { + FilterValueLabel, + fromQuery, + toQuery, +} from '../../../../../../observability/public'; import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; -import { fromQuery, toQuery } from '../../../shared/links/url_helpers'; import { TRANSACTION_URL } from '../../../../../common/elasticsearch_fieldnames'; import { IndexPattern } from '../../../../../../../../src/plugins/data_views/common'; diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/local_ui_filters/use_data_view.ts b/x-pack/plugins/ux/public/components/app/rum_dashboard/local_uifilters/use_data_view.ts similarity index 100% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/local_ui_filters/use_data_view.ts rename to x-pack/plugins/ux/public/components/app/rum_dashboard/local_uifilters/use_data_view.ts index 40d0017d8d096..959da46da673e 100644 --- a/x-pack/plugins/apm/public/components/app/rum_dashboard/local_ui_filters/use_data_view.ts +++ b/x-pack/plugins/ux/public/components/app/rum_dashboard/local_uifilters/use_data_view.ts @@ -5,11 +5,11 @@ * 2.0. */ -import { useDynamicDataViewFetcher } from '../../../../hooks/use_dynamic_data_view'; import { DataView } from '../../../../../../../../src/plugins/data/common'; import { useKibana } from '../../../../../../../../src/plugins/kibana_react/public'; import { useFetcher } from '../../../../hooks/use_fetcher'; import { DataPublicPluginStart } from '../../../../../../../../src/plugins/data/public'; +import { useDynamicDataViewFetcher } from '../../../../hooks/use_dynamic_data_view'; export function useDataView() { const { dataView } = useDynamicDataViewFetcher(); diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/page_load_distribution/breakdown_series.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/page_load_distribution/breakdown_series.tsx similarity index 100% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/page_load_distribution/breakdown_series.tsx rename to x-pack/plugins/ux/public/components/app/rum_dashboard/page_load_distribution/breakdown_series.tsx diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/page_load_distribution/index.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/page_load_distribution/index.tsx similarity index 95% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/page_load_distribution/index.tsx rename to x-pack/plugins/ux/public/components/app/rum_dashboard/page_load_distribution/index.tsx index 2df4c9de54f52..ef32ad53b3ccf 100644 --- a/x-pack/plugins/apm/public/components/app/rum_dashboard/page_load_distribution/index.tsx +++ b/x-pack/plugins/ux/public/components/app/rum_dashboard/page_load_distribution/index.tsx @@ -19,10 +19,10 @@ import { useFetcher } from '../../../../hooks/use_fetcher'; import { I18LABELS } from '../translations'; import { BreakdownFilter } from '../breakdowns/breakdown_filter'; import { PageLoadDistChart } from '../charts/page_load_dist_chart'; -import { BreakdownItem } from '../../../../../typings/ui_filters'; import { ResetPercentileZoom } from './reset_percentile_zoom'; import { createExploratoryViewUrl } from '../../../../../../observability/public'; -import { useKibana } from '../../../../../../../../src/plugins/kibana_react/public'; +import { useKibanaServices } from '../../../../hooks/use_kibana_services'; +import { BreakdownItem } from '../../../../../typings/ui_filters'; export interface PercentileRange { min?: number | null; @@ -30,9 +30,7 @@ export interface PercentileRange { } export function PageLoadDistribution() { - const { - services: { http }, - } = useKibana(); + const { http } = useKibanaServices(); const { urlParams, uxUiFilters } = useLegacyUrlParams(); @@ -99,7 +97,7 @@ export function PageLoadDistribution() { }, ], }, - http?.basePath.get() + http.basePath.get() ); const showAnalyzeButton = false; @@ -131,7 +129,7 @@ export function PageLoadDistribution() { href={exploratoryViewLink} > diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/page_load_distribution/percentile_annotations.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/page_load_distribution/percentile_annotations.tsx similarity index 100% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/page_load_distribution/percentile_annotations.tsx rename to x-pack/plugins/ux/public/components/app/rum_dashboard/page_load_distribution/percentile_annotations.tsx diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/page_load_distribution/reset_percentile_zoom.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/page_load_distribution/reset_percentile_zoom.tsx similarity index 100% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/page_load_distribution/reset_percentile_zoom.tsx rename to x-pack/plugins/ux/public/components/app/rum_dashboard/page_load_distribution/reset_percentile_zoom.tsx diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/page_load_distribution/use_breakdowns.ts b/x-pack/plugins/ux/public/components/app/rum_dashboard/page_load_distribution/use_breakdowns.ts similarity index 100% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/page_load_distribution/use_breakdowns.ts rename to x-pack/plugins/ux/public/components/app/rum_dashboard/page_load_distribution/use_breakdowns.ts diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/page_views_trend/index.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/page_views_trend/index.tsx similarity index 93% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/page_views_trend/index.tsx rename to x-pack/plugins/ux/public/components/app/rum_dashboard/page_views_trend/index.tsx index 24d5b3a5ab0d6..48cf17089edcb 100644 --- a/x-pack/plugins/apm/public/components/app/rum_dashboard/page_views_trend/index.tsx +++ b/x-pack/plugins/ux/public/components/app/rum_dashboard/page_views_trend/index.tsx @@ -19,14 +19,12 @@ import { useFetcher } from '../../../../hooks/use_fetcher'; import { I18LABELS } from '../translations'; import { BreakdownFilter } from '../breakdowns/breakdown_filter'; import { PageViewsChart } from '../charts/page_views_chart'; -import { BreakdownItem } from '../../../../../typings/ui_filters'; import { createExploratoryViewUrl } from '../../../../../../observability/public'; -import { useKibana } from '../../../../../../../../src/plugins/kibana_react/public'; +import { useKibanaServices } from '../../../../hooks/use_kibana_services'; +import { BreakdownItem } from '../../../../../typings/ui_filters'; export function PageViewsTrend() { - const { - services: { http }, - } = useKibana(); + const { http } = useKibanaServices(); const { urlParams, uxUiFilters } = useLegacyUrlParams(); const { serviceName } = uxUiFilters; @@ -74,7 +72,7 @@ export function PageViewsTrend() { }, ], }, - http?.basePath.get() + http.basePath.get() ); const showAnalyzeButton = false; @@ -102,7 +100,7 @@ export function PageViewsTrend() { href={exploratoryViewLink} > diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/panels/page_load_and_views.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/panels/page_load_and_views.tsx similarity index 100% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/panels/page_load_and_views.tsx rename to x-pack/plugins/ux/public/components/app/rum_dashboard/panels/page_load_and_views.tsx diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/panels/visitor_breakdowns.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/panels/visitor_breakdowns.tsx similarity index 100% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/panels/visitor_breakdowns.tsx rename to x-pack/plugins/ux/public/components/app/rum_dashboard/panels/visitor_breakdowns.tsx diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/panels/web_application_select.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/panels/web_application_select.tsx similarity index 100% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/panels/web_application_select.tsx rename to x-pack/plugins/ux/public/components/app/rum_dashboard/panels/web_application_select.tsx index 64d9c3da7bdd8..e7d86db0557a5 100644 --- a/x-pack/plugins/apm/public/components/app/rum_dashboard/panels/web_application_select.tsx +++ b/x-pack/plugins/ux/public/components/app/rum_dashboard/panels/web_application_select.tsx @@ -8,8 +8,8 @@ import React from 'react'; import { ServiceNameFilter } from '../url_filter/service_name_filter'; import { useFetcher } from '../../../../hooks/use_fetcher'; -import { RUM_AGENT_NAMES } from '../../../../../common/agent_name'; import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; +import { RUM_AGENT_NAMES } from '../../../../../common/agent_name'; export function WebApplicationSelect() { const { diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/rum_dashboard.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/rum_dashboard.tsx similarity index 100% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/rum_dashboard.tsx rename to x-pack/plugins/ux/public/components/app/rum_dashboard/rum_dashboard.tsx diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/rum_datepicker/index.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/rum_datepicker/index.tsx similarity index 86% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/rum_datepicker/index.tsx rename to x-pack/plugins/ux/public/components/app/rum_dashboard/rum_datepicker/index.tsx index 4e39ad4397b41..275a154c30856 100644 --- a/x-pack/plugins/apm/public/components/app/rum_dashboard/rum_datepicker/index.tsx +++ b/x-pack/plugins/ux/public/components/app/rum_dashboard/rum_datepicker/index.tsx @@ -7,7 +7,8 @@ import React from 'react'; import { useUxUrlParams } from '../../../../context/url_params_context/use_ux_url_params'; import { useDateRangeRedirect } from '../../../../hooks/use_date_range_redirect'; -import { DatePicker } from '../../../shared/date_picker'; +import { DatePicker } from '../../../../../../observability/public'; +import { clearCache } from '../../../../services/rest/call_api'; export function RumDatePicker() { const { @@ -28,6 +29,7 @@ export function RumDatePicker() { refreshPaused={refreshPaused} refreshInterval={refreshInterval} onTimeRangeRefresh={({ start, end }) => { + clearCache(); refreshTimeRange({ rangeFrom: start, rangeTo: end }); }} /> diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/rum_home.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/rum_home.tsx similarity index 78% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/rum_home.tsx rename to x-pack/plugins/ux/public/components/app/rum_dashboard/rum_home.tsx index bb0427d462d54..d3cbeef96078d 100644 --- a/x-pack/plugins/apm/public/components/app/rum_dashboard/rum_home.tsx +++ b/x-pack/plugins/ux/public/components/app/rum_dashboard/rum_home.tsx @@ -8,24 +8,25 @@ import React, { Fragment } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiFlexGroup, EuiTitle, EuiFlexItem } from '@elastic/eui'; -import { RumOverview } from '../rum_dashboard'; +import { RumDashboard } from './rum_dashboard'; import { CsmSharedContextProvider } from './csm_shared_context'; import { WebApplicationSelect } from './panels/web_application_select'; -import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context'; -import { UxEnvironmentFilter } from '../../shared/environment_filter'; import { UserPercentile } from './user_percentile'; import { useBreakpoints } from '../../../hooks/use_breakpoints'; import { KibanaPageTemplateProps } from '../../../../../../../src/plugins/kibana_react/public'; import { useHasRumData } from './hooks/use_has_rum_data'; import { RumDatePicker } from './rum_datepicker'; import { EmptyStateLoading } from './empty_state_loading'; +import { useKibanaServices } from '../../../hooks/use_kibana_services'; +import { UxEnvironmentFilter } from './environment_filter'; -export const DASHBOARD_LABEL = i18n.translate('xpack.apm.ux.title', { +export const DASHBOARD_LABEL = i18n.translate('xpack.ux.title', { defaultMessage: 'Dashboard', }); export function RumHome() { - const { core, observability } = useApmPluginContext(); + const { docLinks, http, observability } = useKibanaServices(); + const PageTemplateComponent = observability.navigation.PageTemplate; const { data: rumHasData, status } = useHasRumData(); @@ -33,25 +34,25 @@ export function RumHome() { const noDataConfig: KibanaPageTemplateProps['noDataConfig'] = !rumHasData?.hasData ? { - solution: i18n.translate('xpack.apm.ux.overview.solutionName', { + solution: i18n.translate('xpack.ux.overview.solutionName', { defaultMessage: 'Observability', }), actions: { elasticAgent: { - title: i18n.translate('xpack.apm.ux.overview.beatsCard.title', { - defaultMessage: 'Add the APM integration', + title: i18n.translate('xpack.ux.overview.beatsCard.title', { + defaultMessage: 'Add RUM data', }), description: i18n.translate( - 'xpack.apm.ux.overview.beatsCard.description', + 'xpack.ux.overview.beatsCard.description', { defaultMessage: 'Enable RUM with the APM agent to collect user experience data.', } ), - href: core.http.basePath.prepend(`/app/home#/tutorial/apm`), + href: http.basePath.prepend(`/app/home#/tutorial/apm`), }, }, - docsLink: core.docLinks.links.observability.guide, + docsLink: docLinks.links.observability.guide, } : undefined; @@ -66,7 +67,7 @@ export function RumHome() { > {isLoading && }
- +
diff --git a/x-pack/plugins/ux/public/components/app/rum_dashboard/translations.ts b/x-pack/plugins/ux/public/components/app/rum_dashboard/translations.ts new file mode 100644 index 0000000000000..c7b585302e6ee --- /dev/null +++ b/x-pack/plugins/ux/public/components/app/rum_dashboard/translations.ts @@ -0,0 +1,179 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { i18n } from '@kbn/i18n'; + +export const I18LABELS = { + dataMissing: i18n.translate('xpack.ux.dashboard.dataMissing', { + defaultMessage: 'N/A', + }), + totalPageLoad: i18n.translate('xpack.ux.dashboard.totalPageLoad', { + defaultMessage: 'Total', + }), + backEnd: i18n.translate('xpack.ux.dashboard.backend', { + defaultMessage: 'Backend', + }), + frontEnd: i18n.translate('xpack.ux.dashboard.frontend', { + defaultMessage: 'Frontend', + }), + pageViews: i18n.translate('xpack.ux.dashboard.pageViews', { + defaultMessage: 'Total page views', + }), + percPageLoaded: i18n.translate('xpack.ux.dashboard.pagesLoaded.label', { + defaultMessage: 'Pages loaded', + }), + pageLoadTime: i18n.translate('xpack.ux.dashboard.pageLoadTime.label', { + defaultMessage: 'Page load time (seconds)', + }), + pageLoadTimes: i18n.translate('xpack.ux.dashboard.pageLoadTimes.label', { + defaultMessage: 'Page load times', + }), + pageLoadDuration: i18n.translate( + 'xpack.ux.dashboard.pageLoadDuration.label', + { + defaultMessage: 'Page load duration', + } + ), + pageLoad: i18n.translate('xpack.ux.dashboard.pageLoad.label', { + defaultMessage: 'Page load', + }), + pageLoadDistribution: i18n.translate( + 'xpack.ux.dashboard.pageLoadDistribution.label', + { + defaultMessage: 'Page load distribution', + } + ), + jsErrors: i18n.translate('xpack.ux.dashboard.impactfulMetrics.jsErrors', { + defaultMessage: 'JavaScript errors', + }), + highTrafficPages: i18n.translate( + 'xpack.ux.dashboard.impactfulMetrics.highTrafficPages', + { + defaultMessage: 'High traffic pages', + } + ), + resetZoom: i18n.translate('xpack.ux.dashboard.resetZoom.label', { + defaultMessage: 'Reset zoom', + }), + overall: i18n.translate('xpack.ux.dashboard.overall.label', { + defaultMessage: 'Overall', + }), + selectBreakdown: i18n.translate('xpack.ux.filterGroup.selectBreakdown', { + defaultMessage: 'Select breakdown', + }), + breakdown: i18n.translate('xpack.ux.filterGroup.breakdown', { + defaultMessage: 'Breakdown', + }), + seconds: i18n.translate('xpack.ux.filterGroup.seconds', { + defaultMessage: 'seconds', + }), + coreWebVitals: i18n.translate('xpack.ux.filterGroup.coreWebVitals', { + defaultMessage: 'Core web vitals', + }), + browser: i18n.translate('xpack.ux.visitorBreakdown.browser', { + defaultMessage: 'Browser', + }), + operatingSystem: i18n.translate('xpack.ux.visitorBreakdown.operatingSystem', { + defaultMessage: 'Operating system', + }), + metrics: i18n.translate('xpack.ux.metrics', { + defaultMessage: 'Metrics', + }), + median: i18n.translate('xpack.ux.median', { + defaultMessage: 'median', + }), + avgPageLoadDuration: i18n.translate( + 'xpack.ux.visitorBreakdownMap.avgPageLoadDuration', + { + defaultMessage: 'Average page load duration', + } + ), + pageLoadDurationByRegion: i18n.translate( + 'xpack.ux.visitorBreakdownMap.pageLoadDurationByRegion', + { + defaultMessage: 'Page load duration by region (avg.)', + } + ), + filterByUrl: i18n.translate('xpack.ux.filters.filterByUrl', { + defaultMessage: 'Filter by URL', + }), + getSearchResultsLabel: (total: number) => + i18n.translate('xpack.ux.filters.searchResults', { + defaultMessage: '{total} Search results', + values: { total }, + }), + topPages: i18n.translate('xpack.ux.filters.topPages', { + defaultMessage: 'Top pages', + }), + select: i18n.translate('xpack.ux.filters.select', { + defaultMessage: 'Select', + }), + url: i18n.translate('xpack.ux.filters.url', { + defaultMessage: 'Url', + }), + loadingResults: i18n.translate('xpack.ux.filters.url.loadingResults', { + defaultMessage: 'Loading results', + }), + noResults: i18n.translate('xpack.ux.filters.url.noResults', { + defaultMessage: 'No results available', + }), + totalErrors: i18n.translate('xpack.ux.jsErrors.totalErrors', { + defaultMessage: 'Total errors', + }), + errorRate: i18n.translate('xpack.ux.jsErrors.errorRate', { + defaultMessage: 'Error rate', + }), + errorMessage: i18n.translate('xpack.ux.jsErrors.errorMessage', { + defaultMessage: 'Error message', + }), + impactedPageLoads: i18n.translate('xpack.ux.jsErrors.impactedPageLoads', { + defaultMessage: 'Impacted page loads', + }), + percentile: i18n.translate('xpack.ux.percentile.label', { + defaultMessage: 'Percentile', + }), + percentile50thMedian: i18n.translate('xpack.ux.percentile.50thMedian', { + defaultMessage: '50th (Median)', + }), + percentile75th: i18n.translate('xpack.ux.percentile.75th', { + defaultMessage: '75th', + }), + percentile90th: i18n.translate('xpack.ux.percentile.90th', { + defaultMessage: '90th', + }), + percentile95th: i18n.translate('xpack.ux.percentile.95th', { + defaultMessage: '95th', + }), + percentile99th: i18n.translate('xpack.ux.percentile.99th', { + defaultMessage: '99th', + }), + noData: i18n.translate('xpack.ux.visitorBreakdown.noData', { + defaultMessage: 'No data.', + }), + // Helper tooltips + totalPageLoadTooltip: i18n.translate( + 'xpack.ux.dashboard.tooltips.totalPageLoad', + { + defaultMessage: 'Total represents the full page load duration', + } + ), + frontEndTooltip: i18n.translate('xpack.ux.dashboard.tooltips.frontEnd', { + defaultMessage: + 'Frontend time represents the total page load duration minus the backend time', + }), + backEndTooltip: i18n.translate('xpack.ux.dashboard.tooltips.backEnd', { + defaultMessage: + 'Backend time represents time to first byte (TTFB), which is when the first response packet is received after the request has been made', + }), +}; + +export const VisitorBreakdownLabel = i18n.translate( + 'xpack.ux.visitorBreakdown', + { + defaultMessage: 'Visitor breakdown', + } +); diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/url_filter/index.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/url_filter/index.tsx similarity index 95% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/url_filter/index.tsx rename to x-pack/plugins/ux/public/components/app/rum_dashboard/url_filter/index.tsx index 558092db4a458..3d5c9ddb3b3a2 100644 --- a/x-pack/plugins/apm/public/components/app/rum_dashboard/url_filter/index.tsx +++ b/x-pack/plugins/ux/public/components/app/rum_dashboard/url_filter/index.tsx @@ -9,7 +9,7 @@ import React, { useCallback } from 'react'; import { useHistory } from 'react-router-dom'; import { omit } from 'lodash'; import { URLSearch } from './url_search'; -import { fromQuery, toQuery } from '../../../shared/links/url_helpers'; +import { fromQuery, toQuery } from '../../../../../../observability/public'; import { removeUndefinedProps } from '../../../../context/url_params_context/helpers'; export function URLFilter() { diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/url_filter/service_name_filter/index.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/url_filter/service_name_filter/index.tsx similarity index 82% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/url_filter/service_name_filter/index.tsx rename to x-pack/plugins/ux/public/components/app/rum_dashboard/url_filter/service_name_filter/index.tsx index b3560f0ebc97b..45b4c8ab8b660 100644 --- a/x-pack/plugins/apm/public/components/app/rum_dashboard/url_filter/service_name_filter/index.tsx +++ b/x-pack/plugins/ux/public/components/app/rum_dashboard/url_filter/service_name_filter/index.tsx @@ -10,10 +10,10 @@ import { i18n } from '@kbn/i18n'; import React, { useEffect, useCallback } from 'react'; import { useHistory } from 'react-router-dom'; import { useLegacyUrlParams } from '../../../../../context/url_params_context/use_url_params'; -import { fromQuery, toQuery } from '../../../../shared/links/url_helpers'; +import { fromQuery, toQuery } from '../../../../../../../observability/public'; interface Props { - serviceNames: string[]; + serviceNames?: string[]; loading: boolean; } @@ -23,7 +23,7 @@ function ServiceNameFilter({ loading, serviceNames }: Props) { urlParams: { serviceName: selectedServiceName }, } = useLegacyUrlParams(); - const options = serviceNames.map((type) => ({ + const options = (serviceNames ?? []).map((type) => ({ text: type, value: type, })); @@ -47,7 +47,7 @@ function ServiceNameFilter({ loading, serviceNames }: Props) { ); useEffect(() => { - if (serviceNames?.length > 0) { + if (serviceNames && serviceNames?.length > 0) { // select first from the list if (!selectedServiceName) { updateServiceName(serviceNames[0], true); @@ -59,7 +59,7 @@ function ServiceNameFilter({ loading, serviceNames }: Props) { } } - if (selectedServiceName && serviceNames.length === 0 && !loading) { + if (selectedServiceName && serviceNames?.length === 0 && !loading) { updateServiceName(''); } }, [serviceNames, selectedServiceName, updateServiceName, loading]); @@ -67,12 +67,9 @@ function ServiceNameFilter({ loading, serviceNames }: Props) { return ( { }; const getWildcardLabel = (wildcard: string) => { - return i18n.translate('xpack.apm.urlFilter.wildcard', { + return i18n.translate('xpack.ux.urlFilter.wildcard', { defaultMessage: 'Use wildcard *{wildcard}*', values: { wildcard }, }); diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/url_filter/url_search/render_option.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/url_filter/url_search/render_option.tsx similarity index 100% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/url_filter/url_search/render_option.tsx rename to x-pack/plugins/ux/public/components/app/rum_dashboard/url_filter/url_search/render_option.tsx diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/url_filter/url_search/use_url_search.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/url_filter/url_search/use_url_search.tsx similarity index 100% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/url_filter/url_search/use_url_search.tsx rename to x-pack/plugins/ux/public/components/app/rum_dashboard/url_filter/url_search/use_url_search.tsx diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/user_percentile/index.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/user_percentile/index.tsx similarity index 96% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/user_percentile/index.tsx rename to x-pack/plugins/ux/public/components/app/rum_dashboard/user_percentile/index.tsx index a1e70f4f25d21..bac7b818fc03d 100644 --- a/x-pack/plugins/apm/public/components/app/rum_dashboard/user_percentile/index.tsx +++ b/x-pack/plugins/ux/public/components/app/rum_dashboard/user_percentile/index.tsx @@ -10,8 +10,8 @@ import React, { useCallback, useEffect } from 'react'; import { EuiSelect } from '@elastic/eui'; import { useHistory } from 'react-router-dom'; import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; -import { fromQuery, toQuery } from '../../../shared/links/url_helpers'; import { I18LABELS } from '../translations'; +import { fromQuery, toQuery } from '../../../../../../observability/public'; const DEFAULT_P = 50; diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/utils/test_helper.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/utils/test_helper.tsx similarity index 100% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/utils/test_helper.tsx rename to x-pack/plugins/ux/public/components/app/rum_dashboard/utils/test_helper.tsx diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/ux_metrics/format_to_sec.test.ts b/x-pack/plugins/ux/public/components/app/rum_dashboard/ux_metrics/format_to_sec.test.ts similarity index 100% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/ux_metrics/format_to_sec.test.ts rename to x-pack/plugins/ux/public/components/app/rum_dashboard/ux_metrics/format_to_sec.test.ts diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/ux_metrics/index.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/ux_metrics/index.tsx similarity index 100% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/ux_metrics/index.tsx rename to x-pack/plugins/ux/public/components/app/rum_dashboard/ux_metrics/index.tsx diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/ux_metrics/key_ux_metrics.test.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/ux_metrics/key_ux_metrics.test.tsx similarity index 82% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/ux_metrics/key_ux_metrics.test.tsx rename to x-pack/plugins/ux/public/components/app/rum_dashboard/ux_metrics/key_ux_metrics.test.tsx index 2f92e5efedf42..2b899aad783d7 100644 --- a/x-pack/plugins/apm/public/components/app/rum_dashboard/ux_metrics/key_ux_metrics.test.tsx +++ b/x-pack/plugins/ux/public/components/app/rum_dashboard/ux_metrics/key_ux_metrics.test.tsx @@ -6,9 +6,10 @@ */ import React from 'react'; -import { render } from '@testing-library/react'; +import { render, Matcher } from '@testing-library/react'; import * as fetcherHook from '../../../../hooks/use_fetcher'; import { KeyUXMetrics } from './key_ux_metrics'; +import { FETCH_STATUS } from '../../../../../../observability/public'; describe('KeyUXMetrics', () => { it('renders metrics with correct formats', () => { @@ -18,7 +19,7 @@ describe('KeyUXMetrics', () => { sumOfLongTasks: 520.4375, longestLongTask: 271.4375, }, - status: fetcherHook.FETCH_STATUS.SUCCESS, + status: FETCH_STATUS.SUCCESS, refetch: jest.fn(), }); const { getAllByText } = render( @@ -38,9 +39,9 @@ describe('KeyUXMetrics', () => { /> ); - const checkText = (text: string) => { - return (content: any, node: any) => { - return node?.textContent?.includes(text); + const checkText = (text: string): Matcher => { + return (content: string, element?: Element | null) => { + return Boolean(element?.textContent?.includes(text)); }; }; diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/ux_metrics/key_ux_metrics.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/ux_metrics/key_ux_metrics.tsx similarity index 100% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/ux_metrics/key_ux_metrics.tsx rename to x-pack/plugins/ux/public/components/app/rum_dashboard/ux_metrics/key_ux_metrics.tsx diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/ux_metrics/translations.ts b/x-pack/plugins/ux/public/components/app/rum_dashboard/ux_metrics/translations.ts similarity index 64% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/ux_metrics/translations.ts rename to x-pack/plugins/ux/public/components/app/rum_dashboard/ux_metrics/translations.ts index 323c02e3620bc..d323263519c36 100644 --- a/x-pack/plugins/apm/public/components/app/rum_dashboard/ux_metrics/translations.ts +++ b/x-pack/plugins/ux/public/components/app/rum_dashboard/ux_metrics/translations.ts @@ -9,45 +9,39 @@ import { i18n } from '@kbn/i18n'; import { I18LABELS } from '../translations'; export const DATA_UNDEFINED_LABEL = i18n.translate( - 'xpack.apm.rum.coreVitals.dataUndefined', + 'xpack.ux.coreVitals.dataUndefined', { defaultMessage: 'N/A', } ); -export const FCP_LABEL = i18n.translate('xpack.apm.rum.coreVitals.fcp', { +export const FCP_LABEL = i18n.translate('xpack.ux.coreVitals.fcp', { defaultMessage: 'First contentful paint', }); -export const FCP_TOOLTIP = i18n.translate( - 'xpack.apm.rum.coreVitals.fcpTooltip', - { - defaultMessage: - 'First contentful paint (FCP) focusses on the initial rendering and measures the time from when the page starts loading to when any part of the page’s content is displayed on the screen.', - } -); +export const FCP_TOOLTIP = i18n.translate('xpack.ux.coreVitals.fcpTooltip', { + defaultMessage: + 'First contentful paint (FCP) focusses on the initial rendering and measures the time from when the page starts loading to when any part of the page’s content is displayed on the screen.', +}); -export const TBT_LABEL = i18n.translate('xpack.apm.rum.coreVitals.tbt', { +export const TBT_LABEL = i18n.translate('xpack.ux.coreVitals.tbt', { defaultMessage: 'Total blocking time', }); -export const TBT_TOOLTIP = i18n.translate( - 'xpack.apm.rum.coreVitals.tbtTooltip', - { - defaultMessage: - 'Total blocking time (TBT) is the sum of the blocking time (duration above 50 ms) for each long task that occurs between the First contentful paint and the time when the transaction is completed.', - } -); +export const TBT_TOOLTIP = i18n.translate('xpack.ux.coreVitals.tbtTooltip', { + defaultMessage: + 'Total blocking time (TBT) is the sum of the blocking time (duration above 50 ms) for each long task that occurs between the First contentful paint and the time when the transaction is completed.', +}); export const NO_OF_LONG_TASK = i18n.translate( - 'xpack.apm.rum.uxMetrics.noOfLongTasks', + 'xpack.ux.uxMetrics.noOfLongTasks', { defaultMessage: 'No. of long tasks', } ); export const NO_OF_LONG_TASK_TOOLTIP = i18n.translate( - 'xpack.apm.rum.uxMetrics.noOfLongTasksTooltip', + 'xpack.ux.uxMetrics.noOfLongTasksTooltip', { defaultMessage: 'The number of long tasks, a long task is defined as any user activity or browser task that monopolizes the UI thread for extended periods (greater than 50 milliseconds) and blocks other critical tasks (frame rate or input latency) from being executed.', @@ -55,14 +49,14 @@ export const NO_OF_LONG_TASK_TOOLTIP = i18n.translate( ); export const LONGEST_LONG_TASK = i18n.translate( - 'xpack.apm.rum.uxMetrics.longestLongTasks', + 'xpack.ux.uxMetrics.longestLongTasks', { defaultMessage: 'Longest long task duration', } ); export const LONGEST_LONG_TASK_TOOLTIP = i18n.translate( - 'xpack.apm.rum.uxMetrics.longestLongTasksTooltip', + 'xpack.ux.uxMetrics.longestLongTasksTooltip', { defaultMessage: 'The duration of the longest long task, a long task is defined as any user activity or browser task that monopolizes the UI thread for extended periods (greater than 50 milliseconds) and blocks other critical tasks (frame rate or input latency) from being executed.', @@ -70,14 +64,14 @@ export const LONGEST_LONG_TASK_TOOLTIP = i18n.translate( ); export const SUM_LONG_TASKS = i18n.translate( - 'xpack.apm.rum.uxMetrics.sumLongTasks', + 'xpack.ux.uxMetrics.sumLongTasks', { defaultMessage: 'Total long tasks duration', } ); export const SUM_LONG_TASKS_TOOLTIP = i18n.translate( - 'xpack.apm.rum.uxMetrics.sumLongTasksTooltip', + 'xpack.ux.uxMetrics.sumLongTasksTooltip', { defaultMessage: 'The total duration of long tasks, a long task is defined as any user activity or browser task that monopolizes the UI thread for extended periods (greater than 50 milliseconds) and blocks other critical tasks (frame rate or input latency) from being executed.', @@ -87,7 +81,7 @@ export const SUM_LONG_TASKS_TOOLTIP = i18n.translate( export const getPercentileLabel = (value: number) => { if (value === 50) return I18LABELS.median; - return i18n.translate('xpack.apm.ux.percentiles.label', { + return i18n.translate('xpack.ux.percentiles.label', { defaultMessage: '{value}th Perc.', values: { value, diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/ux_overview_fetchers.ts b/x-pack/plugins/ux/public/components/app/rum_dashboard/ux_overview_fetchers.ts similarity index 100% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/ux_overview_fetchers.ts rename to x-pack/plugins/ux/public/components/app/rum_dashboard/ux_overview_fetchers.ts diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/visitor_breakdown/index.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/visitor_breakdown/index.tsx similarity index 100% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/visitor_breakdown/index.tsx rename to x-pack/plugins/ux/public/components/app/rum_dashboard/visitor_breakdown/index.tsx diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/visitor_breakdown_map/__mocks__/regions_layer.mock.ts b/x-pack/plugins/ux/public/components/app/rum_dashboard/visitor_breakdown_map/__mocks__/regions_layer.mock.ts similarity index 100% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/visitor_breakdown_map/__mocks__/regions_layer.mock.ts rename to x-pack/plugins/ux/public/components/app/rum_dashboard/visitor_breakdown_map/__mocks__/regions_layer.mock.ts diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/visitor_breakdown_map/__snapshots__/embedded_map.test.tsx.snap b/x-pack/plugins/ux/public/components/app/rum_dashboard/visitor_breakdown_map/__snapshots__/embedded_map.test.tsx.snap similarity index 93% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/visitor_breakdown_map/__snapshots__/embedded_map.test.tsx.snap rename to x-pack/plugins/ux/public/components/app/rum_dashboard/visitor_breakdown_map/__snapshots__/embedded_map.test.tsx.snap index 67f79c9fc747e..70929d04d0548 100644 --- a/x-pack/plugins/apm/public/components/app/rum_dashboard/visitor_breakdown_map/__snapshots__/embedded_map.test.tsx.snap +++ b/x-pack/plugins/ux/public/components/app/rum_dashboard/visitor_breakdown_map/__snapshots__/embedded_map.test.tsx.snap @@ -39,7 +39,7 @@ exports[`Embedded Map it renders 1`] = ` >
`; diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/visitor_breakdown_map/__snapshots__/map_tooltip.test.tsx.snap b/x-pack/plugins/ux/public/components/app/rum_dashboard/visitor_breakdown_map/__snapshots__/map_tooltip.test.tsx.snap similarity index 100% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/visitor_breakdown_map/__snapshots__/map_tooltip.test.tsx.snap rename to x-pack/plugins/ux/public/components/app/rum_dashboard/visitor_breakdown_map/__snapshots__/map_tooltip.test.tsx.snap diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/visitor_breakdown_map/__stories__/map_tooltip.stories.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/visitor_breakdown_map/__stories__/map_tooltip.stories.tsx similarity index 100% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/visitor_breakdown_map/__stories__/map_tooltip.stories.tsx rename to x-pack/plugins/ux/public/components/app/rum_dashboard/visitor_breakdown_map/__stories__/map_tooltip.stories.tsx diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/visitor_breakdown_map/embedded_map.test.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/visitor_breakdown_map/embedded_map.test.tsx similarity index 100% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/visitor_breakdown_map/embedded_map.test.tsx rename to x-pack/plugins/ux/public/components/app/rum_dashboard/visitor_breakdown_map/embedded_map.test.tsx diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/visitor_breakdown_map/embedded_map.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/visitor_breakdown_map/embedded_map.tsx similarity index 85% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/visitor_breakdown_map/embedded_map.tsx rename to x-pack/plugins/ux/public/components/app/rum_dashboard/visitor_breakdown_map/embedded_map.tsx index 32dcf3d5d3439..55845c44e5e27 100644 --- a/x-pack/plugins/apm/public/components/app/rum_dashboard/visitor_breakdown_map/embedded_map.tsx +++ b/x-pack/plugins/ux/public/components/app/rum_dashboard/visitor_breakdown_map/embedded_map.tsx @@ -14,7 +14,6 @@ import { MapEmbeddableInput, } from '../../../../../../maps/public'; import { MAP_SAVED_OBJECT_TYPE } from '../../../../../../maps/common'; -import { useKibana } from '../../../../../../../../src/plugins/kibana_react/public'; import { ErrorEmbeddable, ViewMode, @@ -22,11 +21,10 @@ import { } from '../../../../../../../../src/plugins/embeddable/public'; import { useLayerList } from './use_layer_list'; import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; -import { useApmPluginContext } from '../../../../context/apm_plugin/use_apm_plugin_context'; import type { RenderTooltipContentParams } from '../../../../../../maps/public'; import { MapToolTip } from './map_tooltip'; import { useMapFilters } from './use_map_filters'; -import { EmbeddableStart } from '../../../../../../../../src/plugins/embeddable/public'; +import { useKibanaServices } from '../../../../hooks/use_kibana_services'; const EmbeddedPanel = styled.div` z-index: auto; @@ -46,12 +44,8 @@ const EmbeddedPanel = styled.div` } `; -interface KibanaDeps { - embeddable: EmbeddableStart; -} export function EmbeddedMapComponent() { const { urlParams } = useLegacyUrlParams(); - const apmPluginContext = useApmPluginContext(); const { start, end, serviceName } = urlParams; @@ -66,16 +60,12 @@ export function EmbeddedMapComponent() { const embeddableRoot: React.RefObject = useRef(null); - const { - services: { embeddable: embeddablePlugin }, - } = useKibana(); + const { embeddable: embeddablePlugin, maps } = useKibanaServices(); if (!embeddablePlugin) { throw new Error('Embeddable start plugin not found'); } - const factory: any = embeddablePlugin.getEmbeddableFactory( - MAP_SAVED_OBJECT_TYPE - ); + const factory = embeddablePlugin.getEmbeddableFactory(MAP_SAVED_OBJECT_TYPE); const input: MapEmbeddableInput = { attributes: { title: '' }, @@ -148,8 +138,8 @@ export function EmbeddedMapComponent() { if (embeddableObject && !isErrorEmbeddable(embeddableObject)) { embeddableObject.setRenderTooltipContent(renderTooltipContent); - const basemapLayerDescriptor = apmPluginContext.plugins.maps - ? await apmPluginContext.plugins.maps.createLayerDescriptors.createBasemapLayerDescriptor() + const basemapLayerDescriptor = maps + ? await maps.createLayerDescriptors.createBasemapLayerDescriptor() : null; if (basemapLayerDescriptor) { layerList.unshift(basemapLayerDescriptor); @@ -176,7 +166,7 @@ export function EmbeddedMapComponent() { return (
diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/visitor_breakdown_map/index.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/visitor_breakdown_map/index.tsx similarity index 100% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/visitor_breakdown_map/index.tsx rename to x-pack/plugins/ux/public/components/app/rum_dashboard/visitor_breakdown_map/index.tsx diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/visitor_breakdown_map/map_tooltip.test.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/visitor_breakdown_map/map_tooltip.test.tsx similarity index 100% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/visitor_breakdown_map/map_tooltip.test.tsx rename to x-pack/plugins/ux/public/components/app/rum_dashboard/visitor_breakdown_map/map_tooltip.test.tsx diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/visitor_breakdown_map/map_tooltip.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/visitor_breakdown_map/map_tooltip.tsx similarity index 100% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/visitor_breakdown_map/map_tooltip.tsx rename to x-pack/plugins/ux/public/components/app/rum_dashboard/visitor_breakdown_map/map_tooltip.tsx diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/visitor_breakdown_map/use_layer_list.test.ts b/x-pack/plugins/ux/public/components/app/rum_dashboard/visitor_breakdown_map/use_layer_list.test.ts similarity index 100% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/visitor_breakdown_map/use_layer_list.test.ts rename to x-pack/plugins/ux/public/components/app/rum_dashboard/visitor_breakdown_map/use_layer_list.test.ts diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/visitor_breakdown_map/use_layer_list.ts b/x-pack/plugins/ux/public/components/app/rum_dashboard/visitor_breakdown_map/use_layer_list.ts similarity index 100% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/visitor_breakdown_map/use_layer_list.ts rename to x-pack/plugins/ux/public/components/app/rum_dashboard/visitor_breakdown_map/use_layer_list.ts index f573a2641b864..bdef5c0a35782 100644 --- a/x-pack/plugins/apm/public/components/app/rum_dashboard/visitor_breakdown_map/use_layer_list.ts +++ b/x-pack/plugins/ux/public/components/app/rum_dashboard/visitor_breakdown_map/use_layer_list.ts @@ -21,13 +21,13 @@ import { SYMBOLIZE_AS_TYPES, } from '../../../../../../maps/common'; -import { APM_STATIC_INDEX_PATTERN_ID } from '../../../../../common/index_pattern_constants'; import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; import { SERVICE_NAME, TRANSACTION_TYPE, } from '../../../../../common/elasticsearch_fieldnames'; import { TRANSACTION_PAGE_LOAD } from '../../../../../common/transaction_types'; +import { APM_STATIC_INDEX_PATTERN_ID } from '../../../../../common/index_pattern_constants'; const ES_TERM_SOURCE_COUNTRY: ESTermSourceDescriptor = { type: SOURCE_TYPES.ES_TERM_SOURCE, diff --git a/x-pack/plugins/apm/public/components/app/rum_dashboard/visitor_breakdown_map/use_map_filters.ts b/x-pack/plugins/ux/public/components/app/rum_dashboard/visitor_breakdown_map/use_map_filters.ts similarity index 99% rename from x-pack/plugins/apm/public/components/app/rum_dashboard/visitor_breakdown_map/use_map_filters.ts rename to x-pack/plugins/ux/public/components/app/rum_dashboard/visitor_breakdown_map/use_map_filters.ts index 0c1b7b6b9e7ee..6e07651f37567 100644 --- a/x-pack/plugins/apm/public/components/app/rum_dashboard/visitor_breakdown_map/use_map_filters.ts +++ b/x-pack/plugins/ux/public/components/app/rum_dashboard/visitor_breakdown_map/use_map_filters.ts @@ -8,6 +8,7 @@ import { useMemo } from 'react'; import { FieldFilter as Filter } from '@kbn/es-query'; import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; +import { APM_STATIC_INDEX_PATTERN_ID } from '../../../../../common/index_pattern_constants'; import { CLIENT_GEO_COUNTRY_ISO_CODE, SERVICE_NAME, @@ -17,8 +18,6 @@ import { USER_AGENT_OS, } from '../../../../../common/elasticsearch_fieldnames'; -import { APM_STATIC_INDEX_PATTERN_ID } from '../../../../../common/index_pattern_constants'; - const getWildcardFilter = (field: string, value: string): Filter => { return { meta: { diff --git a/x-pack/plugins/ux/public/context/url_params_context/constants.ts b/x-pack/plugins/ux/public/context/url_params_context/constants.ts new file mode 100644 index 0000000000000..d791ae5f45f1c --- /dev/null +++ b/x-pack/plugins/ux/public/context/url_params_context/constants.ts @@ -0,0 +1,9 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export const TIME_RANGE_REFRESH = 'TIME_RANGE_REFRESH'; +export const LOCATION_UPDATE = 'LOCATION_UPDATE'; diff --git a/x-pack/plugins/ux/public/context/url_params_context/helpers.test.ts b/x-pack/plugins/ux/public/context/url_params_context/helpers.test.ts new file mode 100644 index 0000000000000..784b10b3f3ee1 --- /dev/null +++ b/x-pack/plugins/ux/public/context/url_params_context/helpers.test.ts @@ -0,0 +1,197 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import datemath from '@elastic/datemath'; +import moment from 'moment-timezone'; +import * as helpers from './helpers'; + +describe('url_params_context helpers', () => { + beforeEach(() => { + jest.restoreAllMocks(); + }); + describe('getDateRange', () => { + describe('with non-rounded dates', () => { + describe('one minute', () => { + it('rounds the start value to minute', () => { + expect( + helpers.getDateRange({ + state: {}, + rangeFrom: '2021-01-28T05:47:52.134Z', + rangeTo: '2021-01-28T05:48:55.304Z', + }) + ).toEqual({ + start: '2021-01-28T05:47:00.000Z', + end: '2021-01-28T05:48:55.304Z', + exactStart: '2021-01-28T05:47:52.134Z', + exactEnd: '2021-01-28T05:48:55.304Z', + }); + }); + }); + describe('one day', () => { + it('rounds the start value to minute', () => { + expect( + helpers.getDateRange({ + state: {}, + rangeFrom: '2021-01-27T05:46:07.377Z', + rangeTo: '2021-01-28T05:46:13.367Z', + }) + ).toEqual({ + start: '2021-01-27T05:46:00.000Z', + end: '2021-01-28T05:46:13.367Z', + exactStart: '2021-01-27T05:46:07.377Z', + exactEnd: '2021-01-28T05:46:13.367Z', + }); + }); + }); + + describe('one year', () => { + it('rounds the start value to minute', () => { + expect( + helpers.getDateRange({ + state: {}, + rangeFrom: '2020-01-28T05:52:36.290Z', + rangeTo: '2021-01-28T05:52:39.741Z', + }) + ).toEqual({ + start: '2020-01-28T05:52:00.000Z', + end: '2021-01-28T05:52:39.741Z', + exactStart: '2020-01-28T05:52:36.290Z', + exactEnd: '2021-01-28T05:52:39.741Z', + }); + }); + }); + }); + + describe('when rangeFrom and rangeTo are not changed', () => { + it('returns the previous state', () => { + expect( + helpers.getDateRange({ + state: { + rangeFrom: 'now-1m', + rangeTo: 'now', + start: '1970-01-01T00:00:00.000Z', + end: '1971-01-01T00:00:00.000Z', + exactStart: '1970-01-01T00:00:00.000Z', + exactEnd: '1971-01-01T00:00:00.000Z', + }, + rangeFrom: 'now-1m', + rangeTo: 'now', + }) + ).toEqual({ + start: '1970-01-01T00:00:00.000Z', + end: '1971-01-01T00:00:00.000Z', + exactStart: '1970-01-01T00:00:00.000Z', + exactEnd: '1971-01-01T00:00:00.000Z', + }); + }); + }); + + describe('when rangeFrom or rangeTo are falsy', () => { + it('returns the previous state', () => { + // Disable console warning about not receiving a valid date for rangeFrom + jest.spyOn(console, 'warn').mockImplementationOnce(() => {}); + + expect( + helpers.getDateRange({ + state: { + start: '1972-01-01T00:00:00.000Z', + end: '1973-01-01T00:00:00.000Z', + }, + rangeFrom: '', + rangeTo: 'now', + }) + ).toEqual({ + start: '1972-01-01T00:00:00.000Z', + end: '1973-01-01T00:00:00.000Z', + exactStart: undefined, + exactEnd: undefined, + }); + }); + }); + + describe('when the start or end are invalid', () => { + it('returns the previous state', () => { + const endDate = moment('2021-06-04T18:03:24.211Z'); + jest + .spyOn(datemath, 'parse') + .mockReturnValueOnce(undefined) + .mockReturnValueOnce(endDate) + .mockReturnValueOnce(undefined) + .mockReturnValueOnce(endDate); + expect( + helpers.getDateRange({ + state: { + start: '1972-01-01T00:00:00.000Z', + end: '1973-01-01T00:00:00.000Z', + exactStart: '1972-01-01T00:00:00.000Z', + exactEnd: '1973-01-01T00:00:00.000Z', + }, + rangeFrom: 'nope', + rangeTo: 'now', + }) + ).toEqual({ + start: '1972-01-01T00:00:00.000Z', + exactStart: '1972-01-01T00:00:00.000Z', + end: '1973-01-01T00:00:00.000Z', + exactEnd: '1973-01-01T00:00:00.000Z', + }); + }); + }); + + describe('when rangeFrom or rangeTo have changed', () => { + it('returns new state', () => { + jest.spyOn(datemath, 'parse').mockReturnValue(moment(0).utc()); + + expect( + helpers.getDateRange({ + state: { + rangeFrom: 'now-1m', + rangeTo: 'now', + start: '1972-01-01T00:00:00.000Z', + end: '1973-01-01T00:00:00.000Z', + }, + rangeFrom: 'now-2m', + rangeTo: 'now', + }) + ).toEqual({ + start: '1970-01-01T00:00:00.000Z', + end: '1970-01-01T00:00:00.000Z', + exactStart: '1970-01-01T00:00:00.000Z', + exactEnd: '1970-01-01T00:00:00.000Z', + }); + }); + }); + }); + + describe('getExactDate', () => { + it('returns date when it is not not relative', () => { + expect(helpers.getExactDate('2021-01-28T05:47:52.134Z')).toEqual( + new Date('2021-01-28T05:47:52.134Z') + ); + }); + + ['s', 'm', 'h', 'd', 'w'].map((roundingOption) => + it(`removes /${roundingOption} rounding option from relative time`, () => { + const spy = jest.spyOn(datemath, 'parse'); + helpers.getExactDate(`now/${roundingOption}`); + expect(spy).toHaveBeenCalledWith('now', {}); + }) + ); + + it('removes rounding option but keeps subtracting time', () => { + const spy = jest.spyOn(datemath, 'parse'); + helpers.getExactDate('now-24h/h'); + expect(spy).toHaveBeenCalledWith('now-24h', {}); + }); + + it('removes rounding option but keeps adding time', () => { + const spy = jest.spyOn(datemath, 'parse'); + helpers.getExactDate('now+15m/h'); + expect(spy).toHaveBeenCalledWith('now+15m', {}); + }); + }); +}); diff --git a/x-pack/plugins/ux/public/context/url_params_context/helpers.ts b/x-pack/plugins/ux/public/context/url_params_context/helpers.ts new file mode 100644 index 0000000000000..ee6ac43c1aeab --- /dev/null +++ b/x-pack/plugins/ux/public/context/url_params_context/helpers.ts @@ -0,0 +1,104 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import datemath from '@elastic/datemath'; +import { compact, pickBy } from 'lodash'; +import moment from 'moment'; +import { UrlParams } from './types'; + +function getParsedDate(rawDate?: string, options = {}) { + if (rawDate) { + const parsed = datemath.parse(rawDate, options); + if (parsed && parsed.isValid()) { + return parsed.toDate(); + } + } +} + +export function getExactDate(rawDate: string) { + const isRelativeDate = rawDate.startsWith('now'); + if (isRelativeDate) { + // remove rounding from relative dates "Today" (now/d) and "This week" (now/w) + const rawDateWithouRounding = rawDate.replace(/\/([smhdw])$/, ''); + return getParsedDate(rawDateWithouRounding); + } + return getParsedDate(rawDate); +} + +export function getDateRange({ + state = {}, + rangeFrom, + rangeTo, +}: { + state?: Pick< + UrlParams, + 'rangeFrom' | 'rangeTo' | 'start' | 'end' | 'exactStart' | 'exactEnd' + >; + rangeFrom?: string; + rangeTo?: string; +}) { + // If the previous state had the same range, just return that instead of calculating a new range. + if (state.rangeFrom === rangeFrom && state.rangeTo === rangeTo) { + return { + start: state.start, + end: state.end, + exactStart: state.exactStart, + exactEnd: state.exactEnd, + }; + } + const start = getParsedDate(rangeFrom); + const end = getParsedDate(rangeTo, { roundUp: true }); + + const exactStart = rangeFrom ? getExactDate(rangeFrom) : undefined; + const exactEnd = rangeTo ? getExactDate(rangeTo) : undefined; + + // `getParsedDate` will return undefined for invalid or empty dates. We return + // the previous state if either date is undefined. + if (!start || !end) { + return { + start: state.start, + end: state.end, + exactStart: state.exactStart, + exactEnd: state.exactEnd, + }; + } + + // rounds down start to minute + const roundedStart = moment(start).startOf('minute'); + + return { + start: roundedStart.toISOString(), + end: end.toISOString(), + exactStart: exactStart?.toISOString(), + exactEnd: exactEnd?.toISOString(), + }; +} + +export function toNumber(value?: string) { + if (value !== undefined) { + return parseInt(value, 10); + } +} + +export function toString(value?: string) { + if (value === '' || value === 'null' || value === 'undefined') { + return; + } + return value; +} + +export function toBoolean(value?: string) { + return value === 'true'; +} + +export function getPathAsArray(pathname: string = '') { + return compact(pathname.split('/')); +} + +export function removeUndefinedProps(obj: T): Partial { + return pickBy(obj, (value) => value !== undefined); +} diff --git a/x-pack/plugins/ux/public/context/url_params_context/mock_url_params_context_provider.tsx b/x-pack/plugins/ux/public/context/url_params_context/mock_url_params_context_provider.tsx new file mode 100644 index 0000000000000..75cf050fcb089 --- /dev/null +++ b/x-pack/plugins/ux/public/context/url_params_context/mock_url_params_context_provider.tsx @@ -0,0 +1,43 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { UrlParams } from './types'; +import { UrlParamsContext } from './url_params_context'; + +const defaultUrlParams = { + page: 0, + serviceName: 'opbeans-python', + transactionType: 'request', + start: '2018-01-10T09:51:41.050Z', + end: '2018-01-10T10:06:41.050Z', +}; + +interface Props { + params?: UrlParams; + children: React.ReactNode; + refreshTimeRange?: (time: any) => void; +} + +export function MockUrlParamsContextProvider({ + params, + children, + refreshTimeRange = () => undefined, +}: Props) { + const urlParams = { ...defaultUrlParams, ...params }; + return ( + + ); +} diff --git a/x-pack/plugins/ux/public/context/url_params_context/resolve_url_params.ts b/x-pack/plugins/ux/public/context/url_params_context/resolve_url_params.ts new file mode 100644 index 0000000000000..94beab5c3728e --- /dev/null +++ b/x-pack/plugins/ux/public/context/url_params_context/resolve_url_params.ts @@ -0,0 +1,65 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { Location } from 'history'; +import { uxLocalUIFilterNames } from '../../../common/ux_ui_filter'; +import { pickKeys } from '../../../common/utils/pick_keys'; +import { + getDateRange, + removeUndefinedProps, + toBoolean, + toNumber, + toString, +} from './helpers'; +import { UrlParams, UxUrlParams } from './types'; +import { toQuery } from '../../../../observability/public'; +import { ENVIRONMENT_ALL } from '../../../common/environment_filter_values'; + +type TimeUrlParams = Pick< + UrlParams, + 'start' | 'end' | 'rangeFrom' | 'rangeTo' | 'exactStart' | 'exactEnd' +>; + +export function resolveUrlParams(location: Location, state: TimeUrlParams) { + const query = toQuery(location.search) as UxUrlParams; + + const { + page, + pageSize, + sortDirection, + sortField, + refreshPaused, + refreshInterval, + rangeFrom, + rangeTo, + environment, + searchTerm, + percentile, + } = query; + + const localUIFilters = pickKeys(query, ...uxLocalUIFilterNames); + + return removeUndefinedProps({ + // date params + ...getDateRange({ state, rangeFrom, rangeTo }), + rangeFrom, + rangeTo, + refreshPaused: refreshPaused ? toBoolean(refreshPaused) : undefined, + refreshInterval: refreshInterval ? toNumber(refreshInterval) : undefined, + + // query params + environment: toString(environment) || ENVIRONMENT_ALL.value, + sortDirection, + sortField, + page: toNumber(page) || 0, + pageSize: pageSize ? toNumber(pageSize) : undefined, + searchTerm: toString(searchTerm), + percentile: toNumber(percentile), + + ...localUIFilters, + }); +} diff --git a/x-pack/plugins/ux/public/context/url_params_context/types.ts b/x-pack/plugins/ux/public/context/url_params_context/types.ts new file mode 100644 index 0000000000000..8188132c1b941 --- /dev/null +++ b/x-pack/plugins/ux/public/context/url_params_context/types.ts @@ -0,0 +1,29 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { UxLocalUIFilterName } from '../../../common/ux_ui_filter'; + +export type UrlParams = { + end?: string; + environment?: string; + rangeFrom?: string; + rangeTo?: string; + refreshInterval?: number; + refreshPaused?: boolean; + sortDirection?: string; + sortField?: string; + start?: string; + page?: number; + pageSize?: number; + searchTerm?: string; + percentile?: number; + exactStart?: string; + exactEnd?: string; +} & Partial>; + +type StringifyAll = { [K in keyof T]: string }; +export type UxUrlParams = StringifyAll; diff --git a/x-pack/plugins/ux/public/context/url_params_context/url_params_context.test.tsx b/x-pack/plugins/ux/public/context/url_params_context/url_params_context.test.tsx new file mode 100644 index 0000000000000..be4b8f046ac76 --- /dev/null +++ b/x-pack/plugins/ux/public/context/url_params_context/url_params_context.test.tsx @@ -0,0 +1,202 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { waitFor } from '@testing-library/react'; +import { mount } from 'enzyme'; +import { History, Location } from 'history'; +import moment from 'moment-timezone'; +import * as React from 'react'; +import { MemoryRouter, Router } from 'react-router-dom'; +import type { UrlParams } from './types'; +import { UrlParamsContext, UrlParamsProvider } from './url_params_context'; + +function mountParams(location: Location) { + return mount( + + + + {({ urlParams }: { urlParams: UrlParams }) => ( + {JSON.stringify(urlParams, null, 2)} + )} + + + + ); +} + +function getDataFromOutput(wrapper: ReturnType) { + return JSON.parse(wrapper.find('#data').text()); +} + +describe('UrlParamsContext', () => { + beforeAll(() => { + moment.tz.setDefault('Etc/GMT'); + }); + + afterAll(() => { + moment.tz.setDefault(''); + }); + + it('should read values in from location', () => { + const location = { + pathname: '/test/pathname', + search: + '?rangeFrom=2010-03-15T12:00:00Z&rangeTo=2010-04-10T12:00:00Z&transactionId=123abc', + } as Location; + + const wrapper = mountParams(location); + const params = getDataFromOutput(wrapper); + + expect([params.start, params.end]).toEqual([ + '2010-03-15T12:00:00.000Z', + '2010-04-10T12:00:00.000Z', + ]); + }); + + it('should update param values if location has changed', () => { + const location = { + pathname: '/test/updated', + search: + '?rangeFrom=2009-03-15T12:00:00Z&rangeTo=2009-04-10T12:00:00Z&transactionId=UPDATED', + } as Location; + + const wrapper = mountParams(location); + + // force an update + wrapper.setProps({ abc: 123 }); + const params = getDataFromOutput(wrapper); + + expect([params.start, params.end]).toEqual([ + '2009-03-15T12:00:00.000Z', + '2009-04-10T12:00:00.000Z', + ]); + }); + + it('should parse relative time ranges on mount', () => { + const location = { + pathname: '/test/updated', + search: '?rangeFrom=now-1d%2Fd&rangeTo=now-1d%2Fd&transactionId=UPDATED', + } as Location; + + const nowSpy = jest.spyOn(Date, 'now').mockReturnValue(0); + + const wrapper = mountParams(location); + + // force an update + wrapper.setProps({ abc: 123 }); + const params = getDataFromOutput(wrapper); + + expect([params.start, params.end]).toEqual([ + '1969-12-31T00:00:00.000Z', + '1969-12-31T23:59:59.999Z', + ]); + + nowSpy.mockRestore(); + }); + + it('should refresh the time range with new values', async () => { + const calls = []; + const history = { + location: { + pathname: '/test', + }, + listen: jest.fn(), + } as unknown as History; + + const wrapper = mount( + + + + {({ urlParams, refreshTimeRange }) => { + calls.push({ urlParams }); + return ( + + {JSON.stringify(urlParams, null, 2)} +