:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(workflows): hide go to next step when a test run stays put (#128979)
Chris Shine87aa86f3039d
diff --git a/products/workflows/frontend/Workflows/hogflows/panel/testing/hogFlowEditorNotificationTestLogic.test.ts b/products/workflows/frontend/Workflows/hogflows/panel/testing/hogFlowEditorNotificationTestLogic.test.tsindex 1cd8341f64fc..9629b2193291 100644--- a/products/workflows/frontend/Workflows/hogflows/panel/testing/hogFlowEditorNotificationTestLogic.test.ts+++ b/products/workflows/frontend/Workflows/hogflows/panel/testing/hogFlowEditorNotificationTestLogic.test.ts@@ -459,4 +459,36 @@ describe('hogFlowEditorNotificationTestLogic', () => {newLogic.unmount()})})++ describe('next step after a test run', () => {+ it.each([+ ['an unmet wait returns the selected step', 'wait_step', null],+ ['a skipped run returns no step', null, null],+ ['the response leaves out the next step', undefined, null],+ ['the run moves on', 'step_c', 'step_c'],+ ])('when %s', async (_, returnedStepId, expectedNextActionId) => {+ useMocks({+ post: {+ '/api/environments/:team_id/hog_flows/:id/invocations': async ({ request }) => {+ const { current_action_id } = (await request.json()) as { current_action_id: string }+ const nextActionId = current_action_id === 'step_a' ? 'wait_step' : returnedStepId+ return [200, { status: 'success', logs: [], nextActionId }]+ },+ },+ })+ logic.actions.setTestInvocationValue('globals', '{}')++ const runTestOn = async (stepId: string): Promise<void> => {+ logic.actions.setSelectedNodeId(stepId)+ await expectLogic(logic, () => logic.actions.submitTestInvocation()).toDispatchActions([+ 'submitTestInvocationSuccess',+ ])+ }++ await runTestOn('step_a')+ expect(logic.values.nextActionId).toBe('wait_step')+ await runTestOn('wait_step')+ expect(logic.values.nextActionId).toBe(expectedNextActionId)+ })+ })})diff --git a/products/workflows/frontend/Workflows/hogflows/panel/testing/hogFlowEditorNotificationTestLogic.ts b/products/workflows/frontend/Workflows/hogflows/panel/testing/hogFlowEditorNotificationTestLogic.tsindex 24c16cb4fc46..f0d2918021f3 100644--- a/products/workflows/frontend/Workflows/hogflows/panel/testing/hogFlowEditorNotificationTestLogic.ts+++ b/products/workflows/frontend/Workflows/hogflows/panel/testing/hogFlowEditorNotificationTestLogic.ts@@ -389,10 +389,11 @@ export const hogFlowEditorNotificationTestLogic = kea<hogFlowEditorNotificationT}actions.setTestResult(result)- const nextActionId = result.nextActionId- if (nextActionId && nextActionId !== values.selectedNodeId) {- actions.setNextActionId(nextActionId)- }+ actions.setNextActionId(+ result.nextActionId && result.nextActionId !== values.selectedNodeId+ ? result.nextActionId+ : null+ )return values.testInvocation} catch (error: any) {diff --git a/products/workflows/frontend/Workflows/hogflows/panel/testing/hogFlowEditorTestLogic.test.ts b/products/workflows/frontend/Workflows/hogflows/panel/testing/hogFlowEditorTestLogic.test.tsindex e6aced26f657..3646b7d25aed 100644--- a/products/workflows/frontend/Workflows/hogflows/panel/testing/hogFlowEditorTestLogic.test.ts+++ b/products/workflows/frontend/Workflows/hogflows/panel/testing/hogFlowEditorTestLogic.test.ts@@ -811,4 +811,39 @@ describe('hogFlowEditorTestLogic', () => {})})})++ describe('next step after a test run', () => {+ it.each([+ ['an unmet wait returns the selected step', 'wait_step', null],+ ['a skipped run returns no step', null, null],+ ['the response leaves out the next step', undefined, null],+ ['the run moves on', 'step_c', 'step_c'],+ ])('when %s', async (_, returnedStepId, expectedNextActionId) => {+ useMocks({+ post: {+ '/api/environments/:team_id/hog_flows/:id/invocations': async ({ request }) => {+ const { current_action_id } = (await request.json()) as { current_action_id: string }+ const nextActionId = current_action_id === 'step_a' ? 'wait_step' : returnedStepId+ return [200, { status: 'success', logs: [], nextActionId }]+ },+ },+ })+ logic = hogFlowEditorTestLogic({ id: 'test-workflow' })+ logic.mount()+ await expectLogic(workflowLogic({ id: 'test-workflow' })).toDispatchActions(['loadWorkflowSuccess'])+ logic.actions.setTestInvocationValue('globals', '{}')++ const runTestOn = async (stepId: string): Promise<void> => {+ logic.actions.setSelectedNodeId(stepId)+ await expectLogic(logic, () => logic.actions.submitTestInvocation()).toDispatchActions([+ 'submitTestInvocationSuccess',+ ])+ }++ await runTestOn('step_a')+ expect(logic.values.nextActionId).toBe('wait_step')+ await runTestOn('wait_step')+ expect(logic.values.nextActionId).toBe(expectedNextActionId)+ })+ })})diff --git a/products/workflows/frontend/Workflows/hogflows/panel/testing/hogFlowEditorTestLogic.ts b/products/workflows/frontend/Workflows/hogflows/panel/testing/hogFlowEditorTestLogic.tsindex 0593c8a9a16b..9aa3b6b28c5a 100644--- a/products/workflows/frontend/Workflows/hogflows/panel/testing/hogFlowEditorTestLogic.ts+++ b/products/workflows/frontend/Workflows/hogflows/panel/testing/hogFlowEditorTestLogic.ts@@ -1542,10 +1542,11 @@ export const hogFlowEditorTestLogic = kea<hogFlowEditorTestLogicType>([}actions.setTestResult(result)- const nextActionId = result.nextActionId- if (nextActionId && nextActionId !== values.selectedNodeId) {- actions.setNextActionId(nextActionId)- }+ actions.setNextActionId(+ result.nextActionId && result.nextActionId !== values.selectedNodeId+ ? result.nextActionId+ : null+ )return values.testInvocation} catch (error: any) {