diff --git a/packages/editor-ui/src/components/ExecutionFilter.vue b/packages/editor-ui/src/components/ExecutionFilter.vue index 1f76ddf99f..bfe08d61ee 100644 --- a/packages/editor-ui/src/components/ExecutionFilter.vue +++ b/packages/editor-ui/src/components/ExecutionFilter.vue @@ -1,5 +1,5 @@ diff --git a/packages/editor-ui/src/components/__tests__/ExecutionFilter.test.ts b/packages/editor-ui/src/components/__tests__/ExecutionFilter.test.ts index 80a3cace0b..8d4ccaf000 100644 --- a/packages/editor-ui/src/components/__tests__/ExecutionFilter.test.ts +++ b/packages/editor-ui/src/components/__tests__/ExecutionFilter.test.ts @@ -10,6 +10,18 @@ import ExecutionFilter from '@/components/ExecutionFilter.vue'; import { STORES } from '@/constants'; import { i18nInstance } from '@/plugins/i18n'; import type { IWorkflowShortResponse, ExecutionFilterType } from '@/Interface'; +import { useTelemetry } from '@/composables'; + +vi.mock('@/composables', () => { + const track = vi.fn(); + return { + useTelemetry: () => ({ + track, + }), + }; +}); + +let telemetry: ReturnType; Vue.use(PiniaVuePlugin); @@ -58,6 +70,10 @@ const renderOptions: RenderOptions = { }; describe('ExecutionFilter', () => { + beforeEach(() => { + telemetry = useTelemetry(); + }); + test.each([ ['development', 'default', false, workflowsData], ['development', 'default', true, workflowsData], @@ -120,4 +136,14 @@ describe('ExecutionFilter', () => { expect(queryByTestId('executions-filter-reset-button')).not.toBeInTheDocument(); expect(queryByTestId('execution-filter-badge')).not.toBeInTheDocument(); }); + + test('telemetry sent only once after component is mounted', async () => { + const { getByTestId } = render(ExecutionFilter, renderOptions); + const customDataKeyInput = getByTestId('execution-filter-saved-data-key-input'); + + await userEvent.type(customDataKeyInput, 'test'); + await userEvent.type(customDataKeyInput, 'key'); + + expect(telemetry.track).toHaveBeenCalledTimes(1); + }); });