@@ -21,6 +21,7 @@ const {
2121 mockOpenWorkflows,
2222 mockShowTextPreview,
2323 mockTrackExecutionError,
24+ mockTrackExecutionOutcome,
2425 mockTrackExecutionSuccess,
2526 mockTrackSharedWorkflowRun
2627} = await vi . hoisted ( async ( ) => {
@@ -33,6 +34,7 @@ const {
3334 mockOpenWorkflows : shallowRef < { path : string } [ ] > ( [ ] ) ,
3435 mockShowTextPreview : vi . fn ( ) ,
3536 mockTrackExecutionError : vi . fn ( ) ,
37+ mockTrackExecutionOutcome : vi . fn ( ) ,
3638 mockTrackExecutionSuccess : vi . fn ( ) ,
3739 mockTrackSharedWorkflowRun : vi . fn ( )
3840 }
@@ -92,6 +94,7 @@ vi.mock('@/platform/distribution/types', async () => ({
9294vi . mock ( '@/platform/telemetry' , ( ) => ( {
9395 useTelemetry : ( ) => ( {
9496 trackExecutionError : mockTrackExecutionError ,
97+ trackExecutionOutcome : mockTrackExecutionOutcome ,
9598 trackExecutionSuccess : mockTrackExecutionSuccess ,
9699 trackSharedWorkflowRun : mockTrackSharedWorkflowRun
97100 } )
@@ -614,6 +617,7 @@ describe('useExecutionStore - workflowStatus', () => {
614617 nodes : [ '1' ] ,
615618 id : jobId ,
616619 promptOutput : { '1' : createPromptNode ( 'Node' , 'TestNode' ) } ,
620+ startTime : 42 ,
617621 workflow
618622 } )
619623 }
@@ -631,6 +635,7 @@ describe('useExecutionStore - workflowStatus', () => {
631635 callStoreJob ( 'job-1' , workflowA )
632636 fireExecutionStart ( 'job-1' )
633637
638+ expect ( mockTrackExecutionOutcome ) . not . toHaveBeenCalled ( )
634639 expect ( store . getWorkflowStatus ( workflowA ) ) . toBe ( 'running' )
635640 } )
636641
@@ -648,6 +653,11 @@ describe('useExecutionStore - workflowStatus', () => {
648653 fireExecutionSuccess ( 'job-1' )
649654
650655 callStoreJob ( 'job-1' , workflowA )
656+ expect ( mockTrackExecutionOutcome ) . toHaveBeenCalledOnce ( )
657+ expect ( mockTrackExecutionOutcome ) . toHaveBeenCalledWith ( {
658+ startTime : 42 ,
659+ outcome : 'success'
660+ } )
651661 expect ( store . getWorkflowStatus ( workflowA ) ) . toBe ( 'completed' )
652662 } )
653663
@@ -656,6 +666,10 @@ describe('useExecutionStore - workflowStatus', () => {
656666 fireExecutionError ( 'job-1' )
657667
658668 callStoreJob ( 'job-1' , workflowA )
669+ expect ( mockTrackExecutionOutcome ) . toHaveBeenCalledWith ( {
670+ startTime : 42 ,
671+ outcome : 'failure'
672+ } )
659673 expect ( store . getWorkflowStatus ( workflowA ) ) . toBe ( 'failed' )
660674 } )
661675
@@ -672,6 +686,10 @@ describe('useExecutionStore - workflowStatus', () => {
672686 fireExecutionStart ( 'job-1' )
673687 fireExecutionSuccess ( 'job-1' )
674688
689+ expect ( mockTrackExecutionOutcome ) . toHaveBeenCalledWith ( {
690+ startTime : 42 ,
691+ outcome : 'success'
692+ } )
675693 expect ( store . getWorkflowStatus ( workflowA ) ) . toBe ( 'completed' )
676694 } )
677695
0 commit comments