@@ -586,8 +586,9 @@ describe("Durable Task Scheduler (DTS) E2E Tests", () => {
586586 ctx . setCustomStatus ( "Step 1: Starting" ) ;
587587 yield ctx . createTimer ( 1 ) ;
588588
589+ // Use longer timer to give CI environments more time to observe this status
589590 ctx . setCustomStatus ( { step : 2 , message : "Processing" } ) ;
590- yield ctx . createTimer ( 1 ) ;
591+ yield ctx . createTimer ( 5 ) ;
591592
592593 ctx . setCustomStatus ( "Step 3: Completed" ) ;
593594 return "done" ;
@@ -598,28 +599,38 @@ describe("Durable Task Scheduler (DTS) E2E Tests", () => {
598599
599600 const id = await taskHubClient . scheduleNewOrchestration ( orchestrator ) ;
600601
601- // Poll for custom status changes
602+ // Poll for custom status changes - collect all observed statuses
602603 let foundObjectStatus = false ;
604+ const observedStatuses : string [ ] = [ ] ;
603605 const startTime = Date . now ( ) ;
604- while ( Date . now ( ) - startTime < 15000 ) {
606+ while ( Date . now ( ) - startTime < 20000 ) {
605607 const state = await taskHubClient . getOrchestrationState ( id ) ;
606608 if ( state ?. serializedCustomStatus ) {
607609 const status = state . serializedCustomStatus ;
610+ // Track unique statuses for debugging
611+ if ( ! observedStatuses . includes ( status ) ) {
612+ observedStatuses . push ( status ) ;
613+ }
608614 if ( status . includes ( "step" ) && status . includes ( "Processing" ) ) {
609615 foundObjectStatus = true ;
610616 break ;
611617 }
612618 }
613- await new Promise ( ( resolve ) => setTimeout ( resolve , 500 ) ) ;
619+ // Poll more frequently
620+ await new Promise ( ( resolve ) => setTimeout ( resolve , 200 ) ) ;
614621 }
615622
616623 const finalState = await taskHubClient . waitForOrchestrationCompletion ( id , undefined , 30 ) ;
617624
618625 expect ( finalState ) . toBeDefined ( ) ;
619626 expect ( finalState ?. runtimeStatus ) . toEqual ( OrchestrationStatus . ORCHESTRATION_STATUS_COMPLETED ) ;
620627 expect ( finalState ?. serializedCustomStatus ) . toEqual ( JSON . stringify ( "Step 3: Completed" ) ) ;
628+ // Provide better error message on failure - log observed statuses if assertion fails
629+ if ( ! foundObjectStatus ) {
630+ console . log ( "Observed statuses during polling:" , observedStatuses ) ;
631+ }
621632 expect ( foundObjectStatus ) . toBe ( true ) ;
622- } , 31000 ) ;
633+ } , 60000 ) ;
623634
624635 it ( "should update custom status to empty string when explicitly set" , async ( ) => {
625636 const orchestrator : TOrchestrator = async function * ( ctx : OrchestrationContext ) : any {
0 commit comments