@@ -140,6 +140,61 @@ async def test_workflow_stub_start_and_describe(helper: CadenceHelper):
140140 )
141141
142142
143+ @pytest .mark .usefixtures ("helper" )
144+ async def test_signal_workflow (helper : CadenceHelper ):
145+ """Test signal_workflow method.
146+
147+ This integration test verifies:
148+ 1. Starting a workflow execution
149+ 2. Sending a signal to the running workflow
150+ 3. Signal appears in the workflow's history
151+ """
152+ async with helper .client () as client :
153+ workflow_type = "test-workflow-signal"
154+ task_list_name = "test-task-list-signal"
155+ workflow_id = "test-workflow-signal-789"
156+ execution_timeout = timedelta (minutes = 5 )
157+ signal_name = "test-signal"
158+ signal_arg = {"action" : "update" , "value" : 42 }
159+
160+ execution = await client .start_workflow (
161+ workflow_type ,
162+ task_list = task_list_name ,
163+ execution_start_to_close_timeout = execution_timeout ,
164+ workflow_id = workflow_id ,
165+ )
166+
167+ await client .signal_workflow (
168+ execution .workflow_id ,
169+ execution .run_id ,
170+ signal_name ,
171+ signal_arg ,
172+ )
173+
174+ # Fetch workflow history to verify signal was recorded
175+ history_response = await client .workflow_stub .GetWorkflowExecutionHistory (
176+ GetWorkflowExecutionHistoryRequest (
177+ domain = DOMAIN_NAME ,
178+ workflow_execution = execution ,
179+ skip_archival = True ,
180+ )
181+ )
182+
183+ # Verify signal event appears in history
184+ signal_events = [
185+ event
186+ for event in history_response .history .events
187+ if event .HasField ("workflow_execution_signaled_event_attributes" )
188+ ]
189+
190+ assert len (signal_events ) == 1 , "Expected exactly one signal event in history"
191+ signal_event = signal_events [0 ]
192+ assert (
193+ signal_event .workflow_execution_signaled_event_attributes .signal_name
194+ == signal_name
195+ ), f"Expected signal name '{ signal_name } '"
196+
197+
143198@pytest .mark .usefixtures ("helper" )
144199async def test_signal_with_start_workflow (helper : CadenceHelper ):
145200 """Test signal_with_start_workflow method.
0 commit comments