@nyaruka/temba-components 0.129.7 → 0.129.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (269) hide show
  1. package/.devcontainer/Dockerfile +11 -4
  2. package/.devcontainer/devcontainer.json +3 -2
  3. package/.github/workflows/build.yml +4 -14
  4. package/CHANGELOG.md +29 -0
  5. package/demo/components/flow/example.html +1 -1
  6. package/demo/components/message-editor/example.html +125 -0
  7. package/demo/components/textinput/completion.html +1 -0
  8. package/demo/data/flows/food-order.json +12 -21
  9. package/demo/data/flows/sample-flow.json +210 -104
  10. package/dist/temba-components.js +715 -364
  11. package/dist/temba-components.js.map +1 -1
  12. package/out-tsc/src/display/Thumbnail.js +2 -1
  13. package/out-tsc/src/display/Thumbnail.js.map +1 -1
  14. package/out-tsc/src/events.js.map +1 -1
  15. package/out-tsc/src/excellent/helpers.js +2 -2
  16. package/out-tsc/src/excellent/helpers.js.map +1 -1
  17. package/out-tsc/src/flow/CanvasNode.js +25 -7
  18. package/out-tsc/src/flow/CanvasNode.js.map +1 -1
  19. package/out-tsc/src/flow/Editor.js +11 -1
  20. package/out-tsc/src/flow/Editor.js.map +1 -1
  21. package/out-tsc/src/flow/NodeEditor.js +342 -276
  22. package/out-tsc/src/flow/NodeEditor.js.map +1 -1
  23. package/out-tsc/src/flow/actions/add_input_labels.js +40 -0
  24. package/out-tsc/src/flow/actions/add_input_labels.js.map +1 -1
  25. package/out-tsc/src/flow/actions/call_llm.js +56 -3
  26. package/out-tsc/src/flow/actions/call_llm.js.map +1 -1
  27. package/out-tsc/src/flow/actions/call_webhook.js +26 -17
  28. package/out-tsc/src/flow/actions/call_webhook.js.map +1 -1
  29. package/out-tsc/src/flow/actions/open_ticket.js +65 -3
  30. package/out-tsc/src/flow/actions/open_ticket.js.map +1 -1
  31. package/out-tsc/src/flow/actions/send_msg.js +147 -6
  32. package/out-tsc/src/flow/actions/send_msg.js.map +1 -1
  33. package/out-tsc/src/flow/actions/set_run_result.js +75 -0
  34. package/out-tsc/src/flow/actions/set_run_result.js.map +1 -1
  35. package/out-tsc/src/flow/config.js +4 -0
  36. package/out-tsc/src/flow/config.js.map +1 -1
  37. package/out-tsc/src/flow/nodes/split_by_llm_categorize.js +227 -0
  38. package/out-tsc/src/flow/nodes/split_by_llm_categorize.js.map +1 -0
  39. package/out-tsc/src/flow/nodes/split_by_ticket.js +18 -0
  40. package/out-tsc/src/flow/nodes/split_by_ticket.js.map +1 -0
  41. package/out-tsc/src/flow/nodes/wait_for_response.js +27 -1
  42. package/out-tsc/src/flow/nodes/wait_for_response.js.map +1 -1
  43. package/out-tsc/src/flow/types.js +0 -65
  44. package/out-tsc/src/flow/types.js.map +1 -1
  45. package/out-tsc/src/form/ArrayEditor.js +87 -57
  46. package/out-tsc/src/form/ArrayEditor.js.map +1 -1
  47. package/out-tsc/src/form/BaseListEditor.js +19 -4
  48. package/out-tsc/src/form/BaseListEditor.js.map +1 -1
  49. package/out-tsc/src/form/FieldRenderer.js +305 -0
  50. package/out-tsc/src/form/FieldRenderer.js.map +1 -0
  51. package/out-tsc/src/form/FormField.js +4 -4
  52. package/out-tsc/src/form/FormField.js.map +1 -1
  53. package/out-tsc/src/form/KeyValueEditor.js +1 -1
  54. package/out-tsc/src/form/KeyValueEditor.js.map +1 -1
  55. package/out-tsc/src/form/MediaPicker.js +13 -1
  56. package/out-tsc/src/form/MediaPicker.js.map +1 -1
  57. package/out-tsc/src/form/MessageEditor.js +422 -0
  58. package/out-tsc/src/form/MessageEditor.js.map +1 -0
  59. package/out-tsc/src/form/TextInput.js +13 -6
  60. package/out-tsc/src/form/TextInput.js.map +1 -1
  61. package/out-tsc/src/form/select/Select.js +52 -24
  62. package/out-tsc/src/form/select/Select.js.map +1 -1
  63. package/out-tsc/src/live/ContactChat.js +66 -15
  64. package/out-tsc/src/live/ContactChat.js.map +1 -1
  65. package/out-tsc/src/markdown.js +13 -11
  66. package/out-tsc/src/markdown.js.map +1 -1
  67. package/out-tsc/temba-modules.js +2 -0
  68. package/out-tsc/temba-modules.js.map +1 -1
  69. package/out-tsc/test/ActionHelper.js +2 -0
  70. package/out-tsc/test/ActionHelper.js.map +1 -1
  71. package/out-tsc/test/NodeHelper.js +148 -0
  72. package/out-tsc/test/NodeHelper.js.map +1 -0
  73. package/out-tsc/test/actions/call_llm.test.js +103 -0
  74. package/out-tsc/test/actions/call_llm.test.js.map +1 -0
  75. package/out-tsc/test/nodes/split_by_llm_categorize.test.js +532 -0
  76. package/out-tsc/test/nodes/split_by_llm_categorize.test.js.map +1 -0
  77. package/out-tsc/test/nodes/split_by_random.test.js +150 -0
  78. package/out-tsc/test/nodes/split_by_random.test.js.map +1 -0
  79. package/out-tsc/test/nodes/wait_for_digits.test.js +150 -0
  80. package/out-tsc/test/nodes/wait_for_digits.test.js.map +1 -0
  81. package/out-tsc/test/nodes/wait_for_response.test.js +171 -0
  82. package/out-tsc/test/nodes/wait_for_response.test.js.map +1 -0
  83. package/out-tsc/test/temba-add-input-labels.test.js +70 -0
  84. package/out-tsc/test/temba-add-input-labels.test.js.map +1 -0
  85. package/out-tsc/test/temba-field-config.test.js +4 -2
  86. package/out-tsc/test/temba-field-config.test.js.map +1 -1
  87. package/out-tsc/test/temba-field-renderer.test.js +296 -0
  88. package/out-tsc/test/temba-field-renderer.test.js.map +1 -0
  89. package/out-tsc/test/temba-markdown.test.js +1 -1
  90. package/out-tsc/test/temba-markdown.test.js.map +1 -1
  91. package/out-tsc/test/temba-message-editor.test.js +194 -0
  92. package/out-tsc/test/temba-message-editor.test.js.map +1 -0
  93. package/out-tsc/test/temba-node-editor.test.js +471 -0
  94. package/out-tsc/test/temba-node-editor.test.js.map +1 -1
  95. package/out-tsc/test/temba-select.test.js +7 -4
  96. package/out-tsc/test/temba-select.test.js.map +1 -1
  97. package/out-tsc/test/temba-textinput.test.js +16 -0
  98. package/out-tsc/test/temba-textinput.test.js.map +1 -1
  99. package/out-tsc/test/temba-webchat.test.js +5 -1
  100. package/out-tsc/test/temba-webchat.test.js.map +1 -1
  101. package/out-tsc/test/utils.test.js +2 -8
  102. package/out-tsc/test/utils.test.js.map +1 -1
  103. package/package.json +7 -4
  104. package/screenshots/truth/actions/add_contact_groups/editor/descriptive-group-names.png +0 -0
  105. package/screenshots/truth/actions/add_contact_groups/editor/long-group-names.png +0 -0
  106. package/screenshots/truth/actions/add_contact_groups/editor/many-groups.png +0 -0
  107. package/screenshots/truth/actions/add_contact_groups/editor/multiple-groups.png +0 -0
  108. package/screenshots/truth/actions/add_contact_groups/editor/single-group.png +0 -0
  109. package/screenshots/truth/actions/call_llm/editor/information-extraction.png +0 -0
  110. package/screenshots/truth/actions/call_llm/editor/sentiment-analysis.png +0 -0
  111. package/screenshots/truth/actions/call_llm/editor/summarization.png +0 -0
  112. package/screenshots/truth/actions/call_llm/editor/translation-task.png +0 -0
  113. package/screenshots/truth/actions/call_llm/render/information-extraction.png +0 -0
  114. package/screenshots/truth/actions/call_llm/render/sentiment-analysis.png +0 -0
  115. package/screenshots/truth/actions/call_llm/render/summarization.png +0 -0
  116. package/screenshots/truth/actions/call_llm/render/translation-task.png +0 -0
  117. package/screenshots/truth/actions/remove_contact_groups/editor/cleanup-groups.png +0 -0
  118. package/screenshots/truth/actions/remove_contact_groups/editor/long-descriptive-group-names.png +0 -0
  119. package/screenshots/truth/actions/remove_contact_groups/editor/many-groups.png +0 -0
  120. package/screenshots/truth/actions/remove_contact_groups/editor/multiple-groups.png +0 -0
  121. package/screenshots/truth/actions/remove_contact_groups/editor/remove-from-all-groups.png +0 -0
  122. package/screenshots/truth/actions/remove_contact_groups/editor/single-group.png +0 -0
  123. package/screenshots/truth/actions/send_email/editor/complex-business-email.png +0 -0
  124. package/screenshots/truth/actions/send_email/editor/empty-body.png +0 -0
  125. package/screenshots/truth/actions/send_email/editor/empty-subject.png +0 -0
  126. package/screenshots/truth/actions/send_email/editor/long-subject.png +0 -0
  127. package/screenshots/truth/actions/send_email/editor/multiline-body.png +0 -0
  128. package/screenshots/truth/actions/send_email/editor/multiple-recipients.png +0 -0
  129. package/screenshots/truth/actions/send_email/editor/simple-email.png +0 -0
  130. package/screenshots/truth/actions/send_email/editor/with-expressions.png +0 -0
  131. package/screenshots/truth/actions/send_msg/editor/long-quick-replies.png +0 -0
  132. package/screenshots/truth/actions/send_msg/editor/multiline-text-with-replies.png +0 -0
  133. package/screenshots/truth/actions/send_msg/editor/simple-text.png +0 -0
  134. package/screenshots/truth/actions/send_msg/editor/text-with-linebreaks.png +0 -0
  135. package/screenshots/truth/actions/send_msg/editor/text-with-many-quick-replies.png +0 -0
  136. package/screenshots/truth/actions/send_msg/editor/text-with-quick-replies.png +0 -0
  137. package/screenshots/truth/actions/send_msg/editor/text-without-quick-replies.png +0 -0
  138. package/screenshots/truth/editor/router.png +0 -0
  139. package/screenshots/truth/editor/send_msg.png +0 -0
  140. package/screenshots/truth/editor/set_contact_language.png +0 -0
  141. package/screenshots/truth/editor/set_contact_name.png +0 -0
  142. package/screenshots/truth/editor/set_run_result.png +0 -0
  143. package/screenshots/truth/editor/wait.png +0 -0
  144. package/screenshots/truth/field-renderer/checkbox-checked.png +0 -0
  145. package/screenshots/truth/field-renderer/checkbox-unchecked.png +0 -0
  146. package/screenshots/truth/field-renderer/checkbox-with-errors.png +0 -0
  147. package/screenshots/truth/field-renderer/context-comparison.png +0 -0
  148. package/screenshots/truth/field-renderer/key-value-with-label.png +0 -0
  149. package/screenshots/truth/field-renderer/message-editor-with-label.png +0 -0
  150. package/screenshots/truth/field-renderer/select-multi.png +0 -0
  151. package/screenshots/truth/field-renderer/select-no-label.png +0 -0
  152. package/screenshots/truth/field-renderer/select-with-label.png +0 -0
  153. package/screenshots/truth/field-renderer/text-evaluated.png +0 -0
  154. package/screenshots/truth/field-renderer/text-no-label.png +0 -0
  155. package/screenshots/truth/field-renderer/text-with-errors.png +0 -0
  156. package/screenshots/truth/field-renderer/text-with-label.png +0 -0
  157. package/screenshots/truth/field-renderer/textarea-evaluated.png +0 -0
  158. package/screenshots/truth/field-renderer/textarea-with-label.png +0 -0
  159. package/screenshots/truth/formfield/markdown-errors.png +0 -0
  160. package/screenshots/truth/formfield/no-errors.png +0 -0
  161. package/screenshots/truth/formfield/plain-text-errors.png +0 -0
  162. package/screenshots/truth/message-editor/autogrow-initial-content.png +0 -0
  163. package/screenshots/truth/message-editor/default.png +0 -0
  164. package/screenshots/truth/message-editor/drag-highlight.png +0 -0
  165. package/screenshots/truth/message-editor/filtered-attachments.png +0 -0
  166. package/screenshots/truth/message-editor/with-completion.png +0 -0
  167. package/screenshots/truth/message-editor/with-properties.png +0 -0
  168. package/screenshots/truth/nodes/split_by_llm_categorize/editor/basic-categorization.png +0 -0
  169. package/screenshots/truth/nodes/split_by_llm_categorize/editor/custom-input-and-result-name.png +0 -0
  170. package/screenshots/truth/nodes/split_by_llm_categorize/editor/feedback-categorization.png +0 -0
  171. package/screenshots/truth/nodes/split_by_llm_categorize/editor/many-categories.png +0 -0
  172. package/screenshots/truth/nodes/split_by_llm_categorize/editor/minimal-categories.png +0 -0
  173. package/screenshots/truth/nodes/split_by_llm_categorize/render/basic-categorization.png +0 -0
  174. package/screenshots/truth/nodes/split_by_llm_categorize/render/custom-input-and-result-name.png +0 -0
  175. package/screenshots/truth/nodes/split_by_llm_categorize/render/feedback-categorization.png +0 -0
  176. package/screenshots/truth/nodes/split_by_llm_categorize/render/many-categories.png +0 -0
  177. package/screenshots/truth/nodes/split_by_llm_categorize/render/minimal-categories.png +0 -0
  178. package/screenshots/truth/nodes/split_by_random/editor/ab-test-multiple-variants.png +0 -0
  179. package/screenshots/truth/nodes/split_by_random/editor/sampling-split.png +0 -0
  180. package/screenshots/truth/nodes/split_by_random/editor/three-way-split.png +0 -0
  181. package/screenshots/truth/nodes/split_by_random/editor/two-bucket-split.png +0 -0
  182. package/screenshots/truth/nodes/split_by_random/render/ab-test-multiple-variants.png +0 -0
  183. package/screenshots/truth/nodes/split_by_random/render/sampling-split.png +0 -0
  184. package/screenshots/truth/nodes/split_by_random/render/three-way-split.png +0 -0
  185. package/screenshots/truth/nodes/split_by_random/render/two-bucket-split.png +0 -0
  186. package/screenshots/truth/nodes/wait_for_digits/editor/basic-digits-wait.png +0 -0
  187. package/screenshots/truth/nodes/wait_for_digits/editor/phone-number-collection.png +0 -0
  188. package/screenshots/truth/nodes/wait_for_digits/editor/single-digit-with-timeout.png +0 -0
  189. package/screenshots/truth/nodes/wait_for_digits/editor/verification-code.png +0 -0
  190. package/screenshots/truth/nodes/wait_for_digits/render/basic-digits-wait.png +0 -0
  191. package/screenshots/truth/nodes/wait_for_digits/render/phone-number-collection.png +0 -0
  192. package/screenshots/truth/nodes/wait_for_digits/render/single-digit-with-timeout.png +0 -0
  193. package/screenshots/truth/nodes/wait_for_digits/render/verification-code.png +0 -0
  194. package/screenshots/truth/nodes/wait_for_response/editor/basic-wait.png +0 -0
  195. package/screenshots/truth/nodes/wait_for_response/editor/custom-result-name.png +0 -0
  196. package/screenshots/truth/nodes/wait_for_response/editor/no-timeout.png +0 -0
  197. package/screenshots/truth/nodes/wait_for_response/editor/short-timeout.png +0 -0
  198. package/screenshots/truth/nodes/wait_for_response/render/basic-wait.png +0 -0
  199. package/screenshots/truth/nodes/wait_for_response/render/custom-result-name.png +0 -0
  200. package/screenshots/truth/nodes/wait_for_response/render/no-timeout.png +0 -0
  201. package/screenshots/truth/nodes/wait_for_response/render/short-timeout.png +0 -0
  202. package/screenshots/truth/omnibox/selected.png +0 -0
  203. package/screenshots/truth/select/functions.png +0 -0
  204. package/screenshots/truth/select/multi-with-endpoint.png +0 -0
  205. package/screenshots/truth/select/search-enabled.png +0 -0
  206. package/screenshots/truth/textinput/autogrow-initial.png +0 -0
  207. package/screenshots/truth/textinput/input-form.png +0 -0
  208. package/src/display/Thumbnail.ts +2 -1
  209. package/src/events.ts +13 -1
  210. package/src/excellent/helpers.ts +2 -2
  211. package/src/flow/CanvasNode.ts +22 -1
  212. package/src/flow/Editor.ts +12 -1
  213. package/src/flow/NodeEditor.ts +412 -354
  214. package/src/flow/actions/add_input_labels.ts +45 -0
  215. package/src/flow/actions/call_llm.ts +57 -3
  216. package/src/flow/actions/call_webhook.ts +28 -18
  217. package/src/flow/actions/open_ticket.ts +74 -3
  218. package/src/flow/actions/send_msg.ts +170 -6
  219. package/src/flow/actions/set_run_result.ts +83 -0
  220. package/src/flow/config.ts +4 -0
  221. package/src/flow/nodes/split_by_llm_categorize.ts +277 -0
  222. package/src/flow/nodes/split_by_ticket.ts +19 -0
  223. package/src/flow/nodes/wait_for_response.ts +28 -1
  224. package/src/flow/types.ts +46 -128
  225. package/src/form/ArrayEditor.ts +96 -66
  226. package/src/form/BaseListEditor.ts +22 -6
  227. package/src/form/FieldRenderer.ts +465 -0
  228. package/src/form/FormField.ts +4 -4
  229. package/src/form/KeyValueEditor.ts +1 -1
  230. package/src/form/MediaPicker.ts +13 -1
  231. package/src/form/MessageEditor.ts +449 -0
  232. package/src/form/TextInput.ts +16 -8
  233. package/src/form/select/Select.ts +55 -24
  234. package/src/live/ContactChat.ts +69 -19
  235. package/src/markdown.ts +19 -11
  236. package/src/store/flow-definition.d.ts +5 -2
  237. package/static/api/labels.json +31 -0
  238. package/static/api/topics.json +24 -9
  239. package/static/api/users.json +35 -16
  240. package/static/css/temba-components.css +5 -3
  241. package/static/mr/docs/en-us/editor.json +2588 -0
  242. package/stress-test.js +143 -0
  243. package/temba-modules.ts +2 -0
  244. package/test/ActionHelper.ts +2 -0
  245. package/test/NodeHelper.ts +184 -0
  246. package/test/actions/call_llm.test.ts +137 -0
  247. package/test/nodes/README.md +78 -0
  248. package/test/nodes/split_by_llm_categorize.test.ts +698 -0
  249. package/test/nodes/split_by_random.test.ts +177 -0
  250. package/test/nodes/wait_for_digits.test.ts +176 -0
  251. package/test/nodes/wait_for_response.test.ts +206 -0
  252. package/test/temba-add-input-labels.test.ts +87 -0
  253. package/test/temba-field-config.test.ts +4 -2
  254. package/test/temba-field-renderer.test.ts +482 -0
  255. package/test/temba-markdown.test.ts +1 -1
  256. package/test/temba-message-editor.test.ts +300 -0
  257. package/test/temba-node-editor.test.ts +590 -0
  258. package/test/temba-select.test.ts +7 -7
  259. package/test/temba-textinput.test.ts +26 -0
  260. package/test/temba-webchat.test.ts +6 -1
  261. package/test/utils.test.ts +2 -13
  262. package/test-assets/contacts/history.json +19 -0
  263. package/test-assets/select/llms.json +18 -0
  264. package/test-assets/style.css +2 -0
  265. package/web-dev-mock.mjs +523 -0
  266. package/web-dev-server.config.mjs +74 -6
  267. package/web-test-runner.config.mjs +9 -4
  268. package/test/temba-flow-editor.test.ts.backup +0 -563
  269. package/test/temba-utils-index.test.ts.backup +0 -1737
@@ -5,6 +5,8 @@ import '../temba-modules';
5
5
  /**
6
6
  * Generic action test framework
7
7
  * Tests the complete action lifecycle: render → edit → save → validate
8
+ *
9
+ * For node configuration testing, see NodeHelper.ts
8
10
  */
9
11
  export class ActionTest {
10
12
  constructor(actionConfig, actionName) {
@@ -1 +1 @@
1
- {"version":3,"file":"ActionHelper.js","sourceRoot":"","sources":["../../test/ActionHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAE3B,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEzD,OAAO,kBAAkB,CAAC;AAE1B;;;GAGG;AACH,MAAM,OAAO,UAAU;IACrB,YAAoB,YAAiB,EAAU,UAAkB;QAA7C,iBAAY,GAAZ,YAAY,CAAK;QAAU,eAAU,GAAV,UAAU,CAAQ;IAAG,CAAC;IAErE;;OAEG;IACK,KAAK,CAAC,YAAY,CAAC,MAAS;QAClC,MAAM,IAAI,GAAS;YACjB,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,CAAC,MAAM,CAAC;YACjB,KAAK,EAAE,EAAE;SACV,CAAC;QAEF,MAAM,cAAc,GAAG;YACrB,KAAK,EAAE,CAA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AAe,CAAC,CAAC;oBAC/D,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;gBACtC,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,mBAAmB;QACjB,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE;YACtC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;YACjD,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC;YAEzC,0FAA0F;YAC1F,IAAI,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,CAAC;gBACjC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;YAC3D,CAAC;YACD,IAAI,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,CAAC;gBACnC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;YAC7D,CAAC;YAED,IAAI,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;gBAC/B,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;YACzD,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { fixture, expect } from '@open-wc/testing';\nimport { html } from 'lit';\nimport { Action, Node } from '../src/store/flow-definition';\nimport { assertScreenshot, getClip } from './utils.test';\nimport { Editor } from '../src/flow/Editor';\nimport '../temba-modules';\n\n/**\n * Generic action test framework\n * Tests the complete action lifecycle: render → edit → save → validate\n */\nexport class ActionTest<T extends Action> {\n constructor(private actionConfig: any, private actionName: string) {}\n\n /**\n * Renders an action in the flow editor and returns the flow node\n */\n private async renderAction(action: T): Promise<HTMLElement> {\n const node: Node = {\n uuid: 'test-node',\n actions: [action],\n exits: []\n };\n\n const mockDefinition = {\n nodes: [node],\n _ui: {\n nodes: {\n [node.uuid]: {\n type: 'execute_actions',\n position: { left: 50, top: 50 }\n }\n }\n }\n };\n\n const editor = (await fixture(html`\n <temba-flow-editor>\n <div id=\"canvas\"></div>\n </temba-flow-editor>\n `)) as Editor;\n\n (editor as any).definition = mockDefinition;\n (editor as any).canvasSize = { width: 400, height: 300 };\n await editor.updateComplete;\n\n const flowNode = editor.querySelector('temba-flow-node') as HTMLElement;\n expect(flowNode).to.exist;\n\n return flowNode;\n }\n\n /**\n * Opens the node editor for an action and returns the editor element\n */\n private async openNodeEditor(action: T): Promise<HTMLElement> {\n const nodeEditor = (await fixture(html`\n <temba-node-editor .action=${action} .isOpen=${true}></temba-node-editor>\n `)) as HTMLElement;\n\n await (nodeEditor as any).updateComplete;\n expect(nodeEditor).to.exist;\n\n return nodeEditor;\n }\n\n /**\n * Takes a screenshot of the dialog container within a node editor\n */\n private async assertDialogScreenshot(\n el: HTMLElement,\n screenshotName: string\n ) {\n const dialog = el.shadowRoot\n .querySelector('temba-dialog')\n .shadowRoot.querySelector('.dialog-container') as HTMLElement;\n await assertScreenshot(screenshotName, getClip(dialog));\n }\n\n /**\n * Complete test for an action configuration\n * 1. Renders the action in a flow node (with screenshot)\n * 2. Opens the node editor (with screenshot)\n * 3. Simulates save and validates round-trip conversion\n */\n async testAction(action: T, testName: string) {\n it(`${testName}`, async () => {\n // Step 1: Render action in flow node\n const flowNode = await this.renderAction(action);\n expect(flowNode.querySelector('.body')).to.exist;\n await assertScreenshot(\n `actions/${this.actionName}/render/${testName}`,\n getClip(flowNode)\n );\n\n // Step 2: Open node editor\n const nodeEditor = await this.openNodeEditor(action);\n await this.assertDialogScreenshot(\n nodeEditor,\n `actions/${this.actionName}/editor/${testName}`\n );\n\n // Step 3: Test round-trip conversion (simulates save workflow)\n if (this.actionConfig.toFormData && this.actionConfig.fromFormData) {\n const formData = this.actionConfig.toFormData(action);\n const convertedAction = this.actionConfig.fromFormData(formData) as T;\n\n // Validate the round trip worked\n expect(convertedAction.uuid).to.equal(action.uuid);\n expect(convertedAction.type).to.equal(action.type);\n\n // Validate the converted action\n if (this.actionConfig.validate) {\n const validation = this.actionConfig.validate(convertedAction);\n expect(validation.valid).to.be.true;\n }\n }\n });\n }\n\n /**\n * Run basic property tests\n */\n testBasicProperties() {\n it('has correct basic properties', () => {\n expect(this.actionConfig.name).to.be.a('string');\n expect(this.actionConfig.color).to.exist;\n\n // toFormData and fromFormData are optional - only needed for complex data transformations\n if (this.actionConfig.toFormData) {\n expect(this.actionConfig.toFormData).to.be.a('function');\n }\n if (this.actionConfig.fromFormData) {\n expect(this.actionConfig.fromFormData).to.be.a('function');\n }\n\n if (this.actionConfig.validate) {\n expect(this.actionConfig.validate).to.be.a('function');\n }\n });\n }\n}\n"]}
1
+ {"version":3,"file":"ActionHelper.js","sourceRoot":"","sources":["../../test/ActionHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAE3B,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEzD,OAAO,kBAAkB,CAAC;AAE1B;;;;;GAKG;AACH,MAAM,OAAO,UAAU;IACrB,YAAoB,YAAiB,EAAU,UAAkB;QAA7C,iBAAY,GAAZ,YAAY,CAAK;QAAU,eAAU,GAAV,UAAU,CAAQ;IAAG,CAAC;IAErE;;OAEG;IACK,KAAK,CAAC,YAAY,CAAC,MAAS;QAClC,MAAM,IAAI,GAAS;YACjB,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,CAAC,MAAM,CAAC;YACj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EAAE,CAAC;oBAC/B,MAAM,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;oBAC/D,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;gBACtC,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,mBAAmB;QACjB,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE;YACtC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;YACjD,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC;YAEzC,0FAA0F;YAC1F,IAAI,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,CAAC;gBACjC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;YAC3D,CAAC;YACD,IAAI,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,CAAC;gBACnC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;YAC7D,CAAC;YAED,IAAI,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;gBAC/B,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;YACzD,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { fixture, expect } from '@open-wc/testing';\nimport { html } from 'lit';\nimport { Action, Node } from '../src/store/flow-definition';\nimport { assertScreenshot, getClip } from './utils.test';\nimport { Editor } from '../src/flow/Editor';\nimport '../temba-modules';\n\n/**\n * Generic action test framework\n * Tests the complete action lifecycle: render → edit → save → validate\n *\n * For node configuration testing, see NodeHelper.ts\n */\nexport class ActionTest<T extends Action> {\n constructor(private actionConfig: any, private actionName: string) {}\n\n /**\n * Renders an action in the flow editor and returns the flow node\n */\n private async renderAction(action: T): Promise<HTMLElement> {\n const node: Node = {\n uuid: 'test-node',\n actions: [action],\n exits: []\n };\n\n const mockDefinition = {\n nodes: [node],\n _ui: {\n nodes: {\n [node.uuid]: {\n type: 'execute_actions',\n position: { left: 50, top: 50 }\n }\n }\n }\n };\n\n const editor = (await fixture(html`\n <temba-flow-editor>\n <div id=\"canvas\"></div>\n </temba-flow-editor>\n `)) as Editor;\n\n (editor as any).definition = mockDefinition;\n (editor as any).canvasSize = { width: 400, height: 300 };\n await editor.updateComplete;\n\n const flowNode = editor.querySelector('temba-flow-node') as HTMLElement;\n expect(flowNode).to.exist;\n\n return flowNode;\n }\n\n /**\n * Opens the node editor for an action and returns the editor element\n */\n private async openNodeEditor(action: T): Promise<HTMLElement> {\n const nodeEditor = (await fixture(html`\n <temba-node-editor .action=${action} .isOpen=${true}></temba-node-editor>\n `)) as HTMLElement;\n\n await (nodeEditor as any).updateComplete;\n expect(nodeEditor).to.exist;\n\n return nodeEditor;\n }\n\n /**\n * Takes a screenshot of the dialog container within a node editor\n */\n private async assertDialogScreenshot(\n el: HTMLElement,\n screenshotName: string\n ) {\n const dialog = el.shadowRoot\n .querySelector('temba-dialog')\n .shadowRoot.querySelector('.dialog-container') as HTMLElement;\n await assertScreenshot(screenshotName, getClip(dialog));\n }\n\n /**\n * Complete test for an action configuration\n * 1. Renders the action in a flow node (with screenshot)\n * 2. Opens the node editor (with screenshot)\n * 3. Simulates save and validates round-trip conversion\n */\n async testAction(action: T, testName: string) {\n it(`${testName}`, async () => {\n // Step 1: Render action in flow node\n const flowNode = await this.renderAction(action);\n expect(flowNode.querySelector('.body')).to.exist;\n await assertScreenshot(\n `actions/${this.actionName}/render/${testName}`,\n getClip(flowNode)\n );\n\n // Step 2: Open node editor\n const nodeEditor = await this.openNodeEditor(action);\n await this.assertDialogScreenshot(\n nodeEditor,\n `actions/${this.actionName}/editor/${testName}`\n );\n\n // Step 3: Test round-trip conversion (simulates save workflow)\n if (this.actionConfig.toFormData && this.actionConfig.fromFormData) {\n const formData = this.actionConfig.toFormData(action);\n const convertedAction = this.actionConfig.fromFormData(formData) as T;\n\n // Validate the round trip worked\n expect(convertedAction.uuid).to.equal(action.uuid);\n expect(convertedAction.type).to.equal(action.type);\n\n // Validate the converted action\n if (this.actionConfig.validate) {\n const validation = this.actionConfig.validate(convertedAction);\n expect(validation.valid).to.be.true;\n }\n }\n });\n }\n\n /**\n * Run basic property tests\n */\n testBasicProperties() {\n it('has correct basic properties', () => {\n expect(this.actionConfig.name).to.be.a('string');\n expect(this.actionConfig.color).to.exist;\n\n // toFormData and fromFormData are optional - only needed for complex data transformations\n if (this.actionConfig.toFormData) {\n expect(this.actionConfig.toFormData).to.be.a('function');\n }\n if (this.actionConfig.fromFormData) {\n expect(this.actionConfig.fromFormData).to.be.a('function');\n }\n\n if (this.actionConfig.validate) {\n expect(this.actionConfig.validate).to.be.a('function');\n }\n });\n }\n}\n"]}
@@ -0,0 +1,148 @@
1
+ import { fixture, expect } from '@open-wc/testing';
2
+ import { html } from 'lit';
3
+ import { assertScreenshot, getClip } from './utils.test';
4
+ import '../temba-modules';
5
+ /**
6
+ * Generic node test framework
7
+ * Tests the complete node lifecycle: render → edit → save → validate
8
+ *
9
+ * This is the node configuration equivalent of ActionHelper.ts for action configurations.
10
+ * It provides uniform testing for all types of nodes: simple wait nodes, router-based
11
+ * split nodes, and complex form-configured nodes.
12
+ */
13
+ export class NodeTest {
14
+ constructor(nodeConfig, nodeName) {
15
+ this.nodeConfig = nodeConfig;
16
+ this.nodeName = nodeName;
17
+ }
18
+ /**
19
+ * Renders a node in the flow editor and returns the flow node
20
+ */
21
+ async renderNode(node, nodeUI) {
22
+ const mockDefinition = {
23
+ nodes: [node],
24
+ _ui: {
25
+ nodes: {
26
+ [node.uuid]: {
27
+ type: nodeUI.type,
28
+ position: { left: 50, top: 50 },
29
+ ...nodeUI
30
+ }
31
+ }
32
+ }
33
+ };
34
+ const editor = (await fixture(html `
35
+ <temba-flow-editor>
36
+ <div id="canvas"></div>
37
+ </temba-flow-editor>
38
+ `));
39
+ editor.definition = mockDefinition;
40
+ editor.canvasSize = { width: 400, height: 300 };
41
+ await editor.updateComplete;
42
+ const flowNode = editor.querySelector('temba-flow-node');
43
+ expect(flowNode).to.exist;
44
+ return flowNode;
45
+ }
46
+ /**
47
+ * Opens the node editor for a node and returns the editor element
48
+ */
49
+ async openNodeEditor(node, nodeUI) {
50
+ const nodeEditor = (await fixture(html `
51
+ <temba-node-editor
52
+ .node=${node}
53
+ .nodeUI=${nodeUI}
54
+ .isOpen=${true}
55
+ ></temba-node-editor>
56
+ `));
57
+ await nodeEditor.updateComplete;
58
+ // Wait for form data initialization if needed
59
+ await new Promise((resolve) => setTimeout(resolve, 200));
60
+ await nodeEditor.updateComplete;
61
+ expect(nodeEditor).to.exist;
62
+ return nodeEditor;
63
+ }
64
+ /**
65
+ * Takes a screenshot of the dialog container within a node editor
66
+ */
67
+ async assertDialogScreenshot(el, screenshotName) {
68
+ var _a, _b, _c;
69
+ const dialog = (_c = (_b = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('temba-dialog')) === null || _b === void 0 ? void 0 : _b.shadowRoot) === null || _c === void 0 ? void 0 : _c.querySelector('.dialog-container');
70
+ await assertScreenshot(screenshotName, getClip(dialog));
71
+ }
72
+ /**
73
+ * Complete test for a node configuration
74
+ * 1. Renders the node in a flow node (with screenshot)
75
+ * 2. Opens the node editor (with screenshot)
76
+ * 3. Simulates save and validates round-trip conversion
77
+ */
78
+ async testNode(node, nodeUI, testName) {
79
+ it(`${testName}`, async () => {
80
+ var _a;
81
+ // Step 1: Render node in flow node
82
+ const flowNode = await this.renderNode(node, nodeUI);
83
+ // For execute_actions nodes, check for .body, for router nodes check for .router or .categories
84
+ const hasContent = flowNode.querySelector('.body') ||
85
+ flowNode.querySelector('.router') ||
86
+ flowNode.querySelector('.categories') ||
87
+ flowNode.querySelector('.action') ||
88
+ ((_a = flowNode.textContent) === null || _a === void 0 ? void 0 : _a.trim());
89
+ expect(hasContent).to.exist;
90
+ await assertScreenshot(`nodes/${this.nodeName}/render/${testName}`, getClip(flowNode));
91
+ // Step 2: Open node editor
92
+ const nodeEditor = await this.openNodeEditor(node, nodeUI);
93
+ await this.assertDialogScreenshot(nodeEditor, `nodes/${this.nodeName}/editor/${testName}`);
94
+ // Step 3: Test round-trip conversion (simulates save workflow)
95
+ if (this.nodeConfig.toFormData && this.nodeConfig.fromFormData) {
96
+ const formData = this.nodeConfig.toFormData(node);
97
+ const convertedNode = this.nodeConfig.fromFormData(formData, node);
98
+ // Validate the round trip worked
99
+ expect(convertedNode.uuid).to.equal(node.uuid);
100
+ // Validate the converted node has expected structure
101
+ expect(convertedNode).to.have.property('actions');
102
+ expect(convertedNode).to.have.property('exits');
103
+ expect(convertedNode).to.deep.equal(node);
104
+ }
105
+ });
106
+ }
107
+ /**
108
+ * Run basic property tests
109
+ */
110
+ testBasicProperties() {
111
+ it('has correct basic properties', () => {
112
+ expect(this.nodeConfig.type).to.be.a('string');
113
+ // Name is optional - only some node configs have it
114
+ if (this.nodeConfig.name) {
115
+ expect(this.nodeConfig.name).to.be.a('string');
116
+ }
117
+ // Color is optional
118
+ if (this.nodeConfig.color) {
119
+ expect(this.nodeConfig.color).to.be.a('string');
120
+ }
121
+ // toFormData and fromFormData are optional - only needed for complex data transformations
122
+ if (this.nodeConfig.toFormData) {
123
+ expect(this.nodeConfig.toFormData).to.be.a('function');
124
+ }
125
+ if (this.nodeConfig.fromFormData) {
126
+ expect(this.nodeConfig.fromFormData).to.be.a('function');
127
+ }
128
+ // Form configuration is optional
129
+ if (this.nodeConfig.form) {
130
+ expect(this.nodeConfig.form).to.be.an('object');
131
+ }
132
+ // Layout is optional
133
+ if (this.nodeConfig.layout) {
134
+ expect(this.nodeConfig.layout).to.be.an('array');
135
+ }
136
+ // Router config is optional
137
+ if (this.nodeConfig.router) {
138
+ expect(this.nodeConfig.router).to.be.an('object');
139
+ expect(this.nodeConfig.router.type).to.exist;
140
+ }
141
+ // Render function is optional
142
+ if (this.nodeConfig.render) {
143
+ expect(this.nodeConfig.render).to.be.a('function');
144
+ }
145
+ });
146
+ }
147
+ }
148
+ //# sourceMappingURL=NodeHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NodeHelper.js","sourceRoot":"","sources":["../../test/NodeHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAE3B,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEzD,OAAO,kBAAkB,CAAC;AAE1B;;;;;;;GAOG;AACH,MAAM,OAAO,QAAQ;IACnB,YAAoB,UAAe,EAAU,QAAgB;QAAzC,eAAU,GAAV,UAAU,CAAK;QAAU,aAAQ,GAAR,QAAQ,CAAQ;IAAG,CAAC;IAEjE;;OAEG;IACK,KAAK,CAAC,UAAU,CAAC,IAAO,EAAE,MAAW;QAC3C,MAAM,cAAc,GAAG;YACrB,KAAK,EAAE,CAAC,IAAI,CAAC;YACb,GAAG,EAAE;gBACH,KAAK,EAAE;oBACL,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;wBACX,IAAI,EAAE,MAAM,CAAC,IAAI;wBACjB,QAAQ,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE;wBAC/B,GAAG,MAAM;qBACV;iBACF;aACF;SACF,CAAC;QAEF,MAAM,MAAM,GAAG,CAAC,MAAM,OAAO,CAAC,IAAI,CAAA;;;;KAIjC,CAAC,CAAW,CAAC;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C,UAAU,CAAC,CAAC;YAC3D,CAAC;YAED,iCAAiC;YACjC,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;gBACzB,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;YAClD,CAAC;YAED,qBAAqB;YACrB,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;gBAC3B,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;YACnD,CAAC;YAED,4BAA4B;YAC5B,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;gBAC3B,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;gBAClD,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC;YAC/C,CAAC;YAED,8BAA8B;YAC9B,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;gBAC3B,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;YACrD,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { fixture, expect } from '@open-wc/testing';\nimport { html } from 'lit';\nimport { Node } from '../src/store/flow-definition';\nimport { assertScreenshot, getClip } from './utils.test';\nimport { Editor } from '../src/flow/Editor';\nimport '../temba-modules';\n\n/**\n * Generic node test framework\n * Tests the complete node lifecycle: render → edit → save → validate\n *\n * This is the node configuration equivalent of ActionHelper.ts for action configurations.\n * It provides uniform testing for all types of nodes: simple wait nodes, router-based\n * split nodes, and complex form-configured nodes.\n */\nexport class NodeTest<T extends Node> {\n constructor(private nodeConfig: any, private nodeName: string) {}\n\n /**\n * Renders a node in the flow editor and returns the flow node\n */\n private async renderNode(node: T, nodeUI: any): Promise<HTMLElement> {\n const mockDefinition = {\n nodes: [node],\n _ui: {\n nodes: {\n [node.uuid]: {\n type: nodeUI.type,\n position: { left: 50, top: 50 },\n ...nodeUI\n }\n }\n }\n };\n\n const editor = (await fixture(html`\n <temba-flow-editor>\n <div id=\"canvas\"></div>\n </temba-flow-editor>\n `)) as Editor;\n\n (editor as any).definition = mockDefinition;\n (editor as any).canvasSize = { width: 400, height: 300 };\n await editor.updateComplete;\n\n const flowNode = editor.querySelector('temba-flow-node') as HTMLElement;\n expect(flowNode).to.exist;\n\n return flowNode;\n }\n\n /**\n * Opens the node editor for a node and returns the editor element\n */\n private async openNodeEditor(node: T, nodeUI: any): Promise<HTMLElement> {\n const nodeEditor = (await fixture(html`\n <temba-node-editor\n .node=${node}\n .nodeUI=${nodeUI}\n .isOpen=${true}\n ></temba-node-editor>\n `)) as HTMLElement;\n\n await (nodeEditor as any).updateComplete;\n\n // Wait for form data initialization if needed\n await new Promise((resolve) => setTimeout(resolve, 200));\n await (nodeEditor as any).updateComplete;\n\n expect(nodeEditor).to.exist;\n\n return nodeEditor;\n }\n\n /**\n * Takes a screenshot of the dialog container within a node editor\n */\n private async assertDialogScreenshot(\n el: HTMLElement,\n screenshotName: string\n ) {\n const dialog = el.shadowRoot\n ?.querySelector('temba-dialog')\n ?.shadowRoot?.querySelector('.dialog-container') as HTMLElement;\n await assertScreenshot(screenshotName, getClip(dialog));\n }\n\n /**\n * Complete test for a node configuration\n * 1. Renders the node in a flow node (with screenshot)\n * 2. Opens the node editor (with screenshot)\n * 3. Simulates save and validates round-trip conversion\n */\n async testNode(node: T, nodeUI: any, testName: string) {\n it(`${testName}`, async () => {\n // Step 1: Render node in flow node\n const flowNode = await this.renderNode(node, nodeUI);\n\n // For execute_actions nodes, check for .body, for router nodes check for .router or .categories\n const hasContent =\n flowNode.querySelector('.body') ||\n flowNode.querySelector('.router') ||\n flowNode.querySelector('.categories') ||\n flowNode.querySelector('.action') ||\n flowNode.textContent?.trim();\n\n expect(hasContent).to.exist;\n await assertScreenshot(\n `nodes/${this.nodeName}/render/${testName}`,\n getClip(flowNode)\n );\n\n // Step 2: Open node editor\n const nodeEditor = await this.openNodeEditor(node, nodeUI);\n await this.assertDialogScreenshot(\n nodeEditor,\n `nodes/${this.nodeName}/editor/${testName}`\n );\n\n // Step 3: Test round-trip conversion (simulates save workflow)\n if (this.nodeConfig.toFormData && this.nodeConfig.fromFormData) {\n const formData = this.nodeConfig.toFormData(node);\n const convertedNode = this.nodeConfig.fromFormData(formData, node) as T;\n\n // Validate the round trip worked\n expect(convertedNode.uuid).to.equal(node.uuid);\n\n // Validate the converted node has expected structure\n expect(convertedNode).to.have.property('actions');\n expect(convertedNode).to.have.property('exits');\n\n expect(convertedNode).to.deep.equal(node);\n }\n });\n }\n\n /**\n * Run basic property tests\n */\n testBasicProperties() {\n it('has correct basic properties', () => {\n expect(this.nodeConfig.type).to.be.a('string');\n\n // Name is optional - only some node configs have it\n if (this.nodeConfig.name) {\n expect(this.nodeConfig.name).to.be.a('string');\n }\n\n // Color is optional\n if (this.nodeConfig.color) {\n expect(this.nodeConfig.color).to.be.a('string');\n }\n\n // toFormData and fromFormData are optional - only needed for complex data transformations\n if (this.nodeConfig.toFormData) {\n expect(this.nodeConfig.toFormData).to.be.a('function');\n }\n if (this.nodeConfig.fromFormData) {\n expect(this.nodeConfig.fromFormData).to.be.a('function');\n }\n\n // Form configuration is optional\n if (this.nodeConfig.form) {\n expect(this.nodeConfig.form).to.be.an('object');\n }\n\n // Layout is optional\n if (this.nodeConfig.layout) {\n expect(this.nodeConfig.layout).to.be.an('array');\n }\n\n // Router config is optional\n if (this.nodeConfig.router) {\n expect(this.nodeConfig.router).to.be.an('object');\n expect(this.nodeConfig.router.type).to.exist;\n }\n\n // Render function is optional\n if (this.nodeConfig.render) {\n expect(this.nodeConfig.render).to.be.a('function');\n }\n });\n }\n}\n"]}
@@ -0,0 +1,103 @@
1
+ import { expect } from '@open-wc/testing';
2
+ import { call_llm } from '../../src/flow/actions/call_llm';
3
+ import { ActionTest } from '../ActionHelper';
4
+ /**
5
+ * Test suite for the call_llm action configuration.
6
+ */
7
+ describe('call_llm action config', () => {
8
+ const helper = new ActionTest(call_llm, 'call_llm');
9
+ describe('basic properties', () => {
10
+ helper.testBasicProperties();
11
+ it('has correct name', () => {
12
+ expect(call_llm.name).to.equal('Call AI');
13
+ });
14
+ it('has form configuration', () => {
15
+ expect(call_llm.form).to.exist;
16
+ expect(call_llm.form.llm).to.exist;
17
+ expect(call_llm.form.instructions).to.exist;
18
+ expect(call_llm.form.input).to.exist;
19
+ });
20
+ it('has layout configuration', () => {
21
+ expect(call_llm.layout).to.exist;
22
+ expect(call_llm.layout).to.deep.equal(['llm', 'input', 'instructions']);
23
+ });
24
+ it('has data transformation functions', () => {
25
+ expect(call_llm.toFormData).to.be.a('function');
26
+ expect(call_llm.fromFormData).to.be.a('function');
27
+ });
28
+ });
29
+ describe('data transformations', () => {
30
+ it('converts action to form data correctly', () => {
31
+ const action = {
32
+ uuid: 'test-llm-1',
33
+ type: 'call_llm',
34
+ input: '@input',
35
+ llm: { uuid: 'gpt-4', name: 'GPT 4.1' },
36
+ instructions: 'Translate to French',
37
+ result_name: 'translated_text'
38
+ };
39
+ const formData = call_llm.toFormData(action);
40
+ expect(formData.uuid).to.equal('test-llm-1');
41
+ expect(formData.llm).to.deep.equal([{ value: 'gpt-4', name: 'GPT 4.1' }]);
42
+ expect(formData.instructions).to.equal('Translate to French');
43
+ expect(formData.input).to.equal('@input');
44
+ });
45
+ it('converts form data to action correctly', () => {
46
+ const formData = {
47
+ uuid: 'test-llm-2',
48
+ llm: [{ value: 'gpt-5', name: 'GPT 5' }],
49
+ instructions: 'Summarize the following text',
50
+ input: '@input'
51
+ };
52
+ const action = call_llm.fromFormData(formData);
53
+ expect(action.uuid).to.equal('test-llm-2');
54
+ expect(action.type).to.equal('call_llm');
55
+ expect(action.llm).to.deep.equal({ uuid: 'gpt-5', name: 'GPT 5' });
56
+ expect(action.instructions).to.equal('Summarize the following text');
57
+ expect(action.input).to.equal('@input');
58
+ });
59
+ it('handles empty form data', () => {
60
+ const formData = {
61
+ uuid: 'test-llm-3',
62
+ llm: [],
63
+ instructions: '',
64
+ input: ''
65
+ };
66
+ const action = call_llm.fromFormData(formData);
67
+ expect(action.llm).to.deep.equal({ uuid: '', name: '' });
68
+ expect(action.instructions).to.equal('');
69
+ expect(action.input).to.equal('@input');
70
+ });
71
+ });
72
+ describe('action scenarios', () => {
73
+ helper.testAction({
74
+ uuid: 'test-action-1',
75
+ type: 'call_llm',
76
+ llm: { uuid: 'gpt-4', name: 'GPT 4.1' },
77
+ instructions: 'Translate to French',
78
+ input: '@input'
79
+ }, 'translation-task');
80
+ helper.testAction({
81
+ uuid: 'test-action-2',
82
+ type: 'call_llm',
83
+ llm: { uuid: 'gpt-5', name: 'GPT 5' },
84
+ instructions: 'Analyze the sentiment of the following message and classify it as positive, negative, or neutral. Provide a brief explanation for your classification.',
85
+ input: '@input'
86
+ }, 'sentiment-analysis');
87
+ helper.testAction({
88
+ uuid: 'test-action-3',
89
+ type: 'call_llm',
90
+ llm: { uuid: 'gpt-4', name: 'GPT 4.1' },
91
+ instructions: 'Summarize the key points from the conversation above in bullet format.',
92
+ input: '@input'
93
+ }, 'summarization');
94
+ helper.testAction({
95
+ uuid: 'test-action-4',
96
+ type: 'call_llm',
97
+ llm: { uuid: 'gpt-5', name: 'GPT 5' },
98
+ instructions: 'Extract any contact information (phone numbers, email addresses) from the text and format them as a JSON object.',
99
+ input: '@input'
100
+ }, 'information-extraction');
101
+ });
102
+ });
103
+ //# sourceMappingURL=call_llm.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"call_llm.test.js","sourceRoot":"","sources":["../../../test/actions/call_llm.test.ts"],"names":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testing';\nimport { call_llm } from '../../src/flow/actions/call_llm';\nimport { CallLLM } from '../../src/store/flow-definition';\nimport { ActionTest } from '../ActionHelper';\n\n/**\n * Test suite for the call_llm action configuration.\n */\ndescribe('call_llm action config', () => {\n const helper = new ActionTest(call_llm, 'call_llm');\n\n describe('basic properties', () => {\n helper.testBasicProperties();\n\n it('has correct name', () => {\n expect(call_llm.name).to.equal('Call AI');\n });\n\n it('has form configuration', () => {\n expect(call_llm.form).to.exist;\n expect(call_llm.form.llm).to.exist;\n expect(call_llm.form.instructions).to.exist;\n expect(call_llm.form.input).to.exist;\n });\n\n it('has layout configuration', () => {\n expect(call_llm.layout).to.exist;\n expect(call_llm.layout).to.deep.equal(['llm', 'input', 'instructions']);\n });\n\n it('has data transformation functions', () => {\n expect(call_llm.toFormData).to.be.a('function');\n expect(call_llm.fromFormData).to.be.a('function');\n });\n });\n\n describe('data transformations', () => {\n it('converts action to form data correctly', () => {\n const action: CallLLM = {\n uuid: 'test-llm-1',\n type: 'call_llm',\n input: '@input',\n llm: { uuid: 'gpt-4', name: 'GPT 4.1' },\n instructions: 'Translate to French',\n result_name: 'translated_text'\n };\n\n const formData = call_llm.toFormData(action);\n\n expect(formData.uuid).to.equal('test-llm-1');\n expect(formData.llm).to.deep.equal([{ value: 'gpt-4', name: 'GPT 4.1' }]);\n expect(formData.instructions).to.equal('Translate to French');\n expect(formData.input).to.equal('@input');\n });\n\n it('converts form data to action correctly', () => {\n const formData = {\n uuid: 'test-llm-2',\n llm: [{ value: 'gpt-5', name: 'GPT 5' }],\n instructions: 'Summarize the following text',\n input: '@input'\n };\n\n const action = call_llm.fromFormData(formData) as CallLLM;\n\n expect(action.uuid).to.equal('test-llm-2');\n expect(action.type).to.equal('call_llm');\n expect(action.llm).to.deep.equal({ uuid: 'gpt-5', name: 'GPT 5' });\n expect(action.instructions).to.equal('Summarize the following text');\n expect(action.input).to.equal('@input');\n });\n\n it('handles empty form data', () => {\n const formData = {\n uuid: 'test-llm-3',\n llm: [],\n instructions: '',\n input: ''\n };\n\n const action = call_llm.fromFormData(formData) as CallLLM;\n\n expect(action.llm).to.deep.equal({ uuid: '', name: '' });\n expect(action.instructions).to.equal('');\n expect(action.input).to.equal('@input');\n });\n });\n\n describe('action scenarios', () => {\n helper.testAction(\n {\n uuid: 'test-action-1',\n type: 'call_llm',\n llm: { uuid: 'gpt-4', name: 'GPT 4.1' },\n instructions: 'Translate to French',\n input: '@input'\n } as CallLLM,\n 'translation-task'\n );\n\n helper.testAction(\n {\n uuid: 'test-action-2',\n type: 'call_llm',\n llm: { uuid: 'gpt-5', name: 'GPT 5' },\n instructions:\n 'Analyze the sentiment of the following message and classify it as positive, negative, or neutral. Provide a brief explanation for your classification.',\n input: '@input'\n } as CallLLM,\n 'sentiment-analysis'\n );\n\n helper.testAction(\n {\n uuid: 'test-action-3',\n type: 'call_llm',\n llm: { uuid: 'gpt-4', name: 'GPT 4.1' },\n instructions:\n 'Summarize the key points from the conversation above in bullet format.',\n input: '@input'\n } as CallLLM,\n 'summarization'\n );\n\n helper.testAction(\n {\n uuid: 'test-action-4',\n type: 'call_llm',\n llm: { uuid: 'gpt-5', name: 'GPT 5' },\n instructions:\n 'Extract any contact information (phone numbers, email addresses) from the text and format them as a JSON object.',\n input: '@input'\n } as CallLLM,\n 'information-extraction'\n );\n });\n});\n"]}