diff --git a/app/src/organisms/ErrorRecoveryFlows/__fixtures__/index.ts b/app/src/organisms/ErrorRecoveryFlows/__fixtures__/index.ts index c5f36d77ea7b..e7d3a85c4842 100644 --- a/app/src/organisms/ErrorRecoveryFlows/__fixtures__/index.ts +++ b/app/src/organisms/ErrorRecoveryFlows/__fixtures__/index.ts @@ -81,4 +81,12 @@ export const mockRecoveryContentProps: RecoveryContentProps = { mockRobotSideAnalysis.commands[mockRobotSideAnalysis.commands.length - 1], ], recoveryActionMutationUtils: {} as any, + analytics: { + reportRecoveredRunResult: () => {}, + reportErrorEvent: () => {}, + reportViewErrorDetailsEvent: () => {}, + reportActionSelectedEvent: () => {}, + reportInitialActionEvent: () => {}, + reportActionSelectedResult: () => {}, + }, } diff --git a/app/src/organisms/ErrorRecoveryFlows/__tests__/ErrorRecoveryFlows.test.tsx b/app/src/organisms/ErrorRecoveryFlows/__tests__/ErrorRecoveryFlows.test.tsx index 54b4f4d814f7..d19e0d8e31f4 100644 --- a/app/src/organisms/ErrorRecoveryFlows/__tests__/ErrorRecoveryFlows.test.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/__tests__/ErrorRecoveryFlows.test.tsx @@ -16,6 +16,7 @@ import { useCurrentlyRecoveringFrom, useERUtils, useShowDoorInfo, + useRecoveryAnalytics, } from '../hooks' import { useFeatureFlag } from '../../../redux/config' import { useERWizard, ErrorRecoveryWizard } from '../ErrorRecoveryWizard' @@ -144,6 +145,9 @@ describe('ErrorRecovery', () => { vi.mocked(useRunPausedSplash).mockReturnValue(true) vi.mocked(useERUtils).mockReturnValue({ routeUpdateActions: {} } as any) vi.mocked(useShowDoorInfo).mockReturnValue(false) + vi.mocked(useRecoveryAnalytics).mockReturnValue({ + reportErrorEvent: vi.fn(), + } as any) }) it('renders the wizard when the wizard is toggled on', () => { diff --git a/app/src/organisms/ErrorRecoveryFlows/hooks/__tests__/useRecoveryCommands.test.ts b/app/src/organisms/ErrorRecoveryFlows/hooks/__tests__/useRecoveryCommands.test.ts index 1a54da00103a..c98805af16b6 100644 --- a/app/src/organisms/ErrorRecoveryFlows/hooks/__tests__/useRecoveryCommands.test.ts +++ b/app/src/organisms/ErrorRecoveryFlows/hooks/__tests__/useRecoveryCommands.test.ts @@ -60,6 +60,8 @@ describe('useRecoveryCommands', () => { failedLabwareUtils: mockFailedLabwareUtils, routeUpdateActions: mockRouteUpdateActions, recoveryToastUtils: {} as any, + analytics: { reportRecoveredRunResult: vi.fn() } as any, + selectedRecoveryOption: RECOVERY_MAP.RETRY_NEW_TIPS.ROUTE, }) ) @@ -86,6 +88,8 @@ describe('useRecoveryCommands', () => { failedLabwareUtils: mockFailedLabwareUtils, routeUpdateActions: mockRouteUpdateActions, recoveryToastUtils: {} as any, + analytics: { reportActionSelectedResult: vi.fn() } as any, + selectedRecoveryOption: RECOVERY_MAP.RETRY_NEW_TIPS.ROUTE, }) ) @@ -113,6 +117,8 @@ describe('useRecoveryCommands', () => { failedLabwareUtils: mockFailedLabwareUtils, routeUpdateActions: mockRouteUpdateActions, recoveryToastUtils: {} as any, + analytics: { reportRecoveredRunResult: vi.fn() } as any, + selectedRecoveryOption: RECOVERY_MAP.RETRY_NEW_TIPS.ROUTE, }) ) @@ -134,6 +140,8 @@ describe('useRecoveryCommands', () => { failedLabwareUtils: mockFailedLabwareUtils, routeUpdateActions: mockRouteUpdateActions, recoveryToastUtils: { makeSuccessToast: mockMakeSuccessToast } as any, + analytics: { reportActionSelectedResult: vi.fn() } as any, + selectedRecoveryOption: RECOVERY_MAP.RETRY_NEW_TIPS.ROUTE, }) ) @@ -153,6 +161,8 @@ describe('useRecoveryCommands', () => { failedLabwareUtils: mockFailedLabwareUtils, routeUpdateActions: mockRouteUpdateActions, recoveryToastUtils: {} as any, + analytics: { reportActionSelectedResult: vi.fn() } as any, + selectedRecoveryOption: RECOVERY_MAP.RETRY_NEW_TIPS.ROUTE, }) ) @@ -169,6 +179,8 @@ describe('useRecoveryCommands', () => { failedLabwareUtils: mockFailedLabwareUtils, routeUpdateActions: mockRouteUpdateActions, recoveryToastUtils: {} as any, + analytics: { reportActionSelectedResult: vi.fn() } as any, + selectedRecoveryOption: RECOVERY_MAP.RETRY_NEW_TIPS.ROUTE, }) ) @@ -208,6 +220,8 @@ describe('useRecoveryCommands', () => { }, routeUpdateActions: mockRouteUpdateActions, recoveryToastUtils: {} as any, + analytics: { reportActionSelectedResult: vi.fn() } as any, + selectedRecoveryOption: RECOVERY_MAP.RETRY_NEW_TIPS.ROUTE, }) ) @@ -229,6 +243,8 @@ describe('useRecoveryCommands', () => { failedLabwareUtils: mockFailedLabwareUtils, routeUpdateActions: mockRouteUpdateActions, recoveryToastUtils: { makeSuccessToast: mockMakeSuccessToast } as any, + analytics: { reportActionSelectedResult: vi.fn() } as any, + selectedRecoveryOption: RECOVERY_MAP.RETRY_NEW_TIPS.ROUTE, }) ) @@ -248,6 +264,8 @@ describe('useRecoveryCommands', () => { failedLabwareUtils: mockFailedLabwareUtils, routeUpdateActions: mockRouteUpdateActions, recoveryToastUtils: {} as any, + analytics: { reportActionSelectedResult: vi.fn() } as any, + selectedRecoveryOption: RECOVERY_MAP.RETRY_NEW_TIPS.ROUTE, }) ) diff --git a/app/src/organisms/ErrorRecoveryFlows/hooks/useRecoveryAnalytics.ts b/app/src/organisms/ErrorRecoveryFlows/hooks/useRecoveryAnalytics.ts index 4bde8594b396..a94c8f290ad3 100644 --- a/app/src/organisms/ErrorRecoveryFlows/hooks/useRecoveryAnalytics.ts +++ b/app/src/organisms/ErrorRecoveryFlows/hooks/useRecoveryAnalytics.ts @@ -1,5 +1,3 @@ -import * as React from 'react' - import { RUN_STATUS_FAILED, RUN_STATUS_SUCCEEDED } from '@opentrons/api-client' import {