workflow-output-in-loop.json 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. {
  2. "name": "verify-workflow-output-in-loop",
  3. "helpers": [
  4. {
  5. "key": "sub",
  6. "name": "verify sub: names its result from inside a loop",
  7. "active": true,
  8. "nodes": [
  9. {"id": "in", "name": "Input", "type": "workflow-input", "position": {"x": 0, "y": 0},
  10. "config": {"fields": [{"name": "n", "type": "number", "required": true}]}},
  11. {"id": "items", "name": "Items", "type": "code", "position": {"x": 0, "y": 100},
  12. "config": {"code": "return { items: ['only'] };"}},
  13. {"id": "loop", "name": "Loop", "type": "loop", "position": {"x": 0, "y": 200},
  14. "config": {"inputField": "data.result.items"}},
  15. {"id": "out", "name": "Out", "type": "workflow-output", "position": {"x": 0, "y": 300},
  16. "config": {"source": "fields",
  17. "fields": [{"name": "named", "value": "from inside the loop"},
  18. {"name": "item", "value": "{{data.loop.item}}"}]}}
  19. ],
  20. "connections": [
  21. {"sourceNodeId": "in", "sourceOutput": "main", "targetNodeId": "items", "targetInput": "data"},
  22. {"sourceNodeId": "items", "sourceOutput": "main", "targetNodeId": "loop", "targetInput": "data"},
  23. {"sourceNodeId": "loop", "sourceOutput": "loop", "targetNodeId": "out", "targetInput": "data"}
  24. ]
  25. }
  26. ],
  27. "nodes": [
  28. {"id": "n1", "name": "Trigger", "type": "click-trigger", "position": {"x": 0, "y": 0}, "config": {}},
  29. {"id": "call", "name": "Call", "type": "call-workflow", "position": {"x": 0, "y": 100},
  30. "config": {"workflowId": "{{helper:sub}}", "inputSource": "fields",
  31. "fields": [{"name": "n", "value": "1"}]}}
  32. ],
  33. "connections": [
  34. {"sourceNodeId": "n1", "sourceOutput": "main", "targetNodeId": "call", "targetInput": "data"}
  35. ],
  36. "expect": {
  37. "call": {"status": "completed",
  38. "output": {"result": {"named": "from inside the loop"}}}
  39. }
  40. }