@nocobase/plugin-workflow-test 0.19.0-alpha.1 → 0.19.0-alpha.10

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.
@@ -221,6 +221,7 @@ export declare class ConditionYesNode {
221
221
  basicRadio: Locator;
222
222
  mathRadio: Locator;
223
223
  formulaRadio: Locator;
224
+ conditionExpressionEditBox: Locator;
224
225
  submitButton: Locator;
225
226
  cancelButton: Locator;
226
227
  addNodeButton: Locator;
@@ -234,6 +235,7 @@ export declare class ConditionBranchNode {
234
235
  basicRadio: Locator;
235
236
  mathRadio: Locator;
236
237
  formulaRadio: Locator;
238
+ conditionExpressionEditBox: Locator;
237
239
  submitButton: Locator;
238
240
  cancelButton: Locator;
239
241
  addNoBranchNode: Locator;
@@ -252,6 +254,20 @@ export declare class SQLNode {
252
254
  addNodeButton: Locator;
253
255
  constructor(page: Page, nodeName: string);
254
256
  }
257
+ export declare class ParallelBranchNode {
258
+ readonly page: Page;
259
+ node: Locator;
260
+ nodeTitle: Locator;
261
+ nodeConfigure: Locator;
262
+ addBranchButton: Locator;
263
+ allSucceededRadio: Locator;
264
+ anySucceededRadio: Locator;
265
+ anySucceededOrFailedRadio: Locator;
266
+ submitButton: Locator;
267
+ cancelButton: Locator;
268
+ addNodeButton: Locator;
269
+ constructor(page: Page, nodeName: string);
270
+ }
255
271
  declare const _default: {
256
272
  CreateWorkFlow: typeof CreateWorkFlow;
257
273
  EditWorkFlow: typeof EditWorkFlow;
@@ -272,5 +288,6 @@ declare const _default: {
272
288
  ConditionYesNode: typeof ConditionYesNode;
273
289
  ConditionBranchNode: typeof ConditionBranchNode;
274
290
  SQLNode: typeof SQLNode;
291
+ ParallelBranchNode: typeof ParallelBranchNode;
275
292
  };
276
293
  export default _default;
@@ -30,6 +30,7 @@ __export(e2ePageObjectModel_exports, {
30
30
  EditWorkFlow: () => EditWorkFlow,
31
31
  FormEventTriggerNode: () => FormEventTriggerNode,
32
32
  ManualNode: () => ManualNode,
33
+ ParallelBranchNode: () => ParallelBranchNode,
33
34
  QueryRecordNode: () => QueryRecordNode,
34
35
  SQLNode: () => SQLNode,
35
36
  ScheduleTriggerNode: () => ScheduleTriggerNode,
@@ -431,11 +432,11 @@ class ManualNode {
431
432
  this.assigneesDropDown = page.getByTestId("select-single");
432
433
  this.configureUserInterfaceButton = page.getByRole("button", { name: "Configure user interface" });
433
434
  this.addBlockButton = page.getByLabel("schema-initializer-Grid-AddBlockButton-workflows");
434
- this.triggerDataMenu = page.getByLabel("Data blocks-triggerData");
435
- this.nodeDataMenu = page.getByLabel("nodes", { exact: true });
435
+ this.triggerDataMenu = page.getByRole("menuitem", { name: "Trigger data" });
436
+ this.nodeDataMenu = page.getByRole("menuitem", { name: "Node result right" });
436
437
  this.customFormMenu = page.getByRole("menuitem", { name: "Custom form" });
437
- this.createRecordFormMenu = page.getByRole("menuitem", { name: "Create record form" });
438
- this.updateRecordFormMenu = page.getByRole("menuitem", { name: "Update record form" });
438
+ this.createRecordFormMenu = page.getByRole("menuitem", { name: "Create record form right" });
439
+ this.updateRecordFormMenu = page.getByRole("menuitem", { name: "Update record form right" });
439
440
  this.submitButton = page.getByLabel("action-Action-Submit-workflows");
440
441
  this.cancelButton = page.getByLabel("action-Action-Cancel-workflows");
441
442
  this.addNodeButton = page.getByLabel(`add-button-manual-${nodeName}`, { exact: true });
@@ -449,6 +450,7 @@ class ConditionYesNode {
449
450
  basicRadio;
450
451
  mathRadio;
451
452
  formulaRadio;
453
+ conditionExpressionEditBox;
452
454
  submitButton;
453
455
  cancelButton;
454
456
  addNodeButton;
@@ -457,6 +459,7 @@ class ConditionYesNode {
457
459
  this.node = page.getByLabel(`Condition-${nodeName}`, { exact: true });
458
460
  this.nodeTitle = page.getByLabel(`Condition-${nodeName}`, { exact: true }).getByRole("textbox");
459
461
  this.nodeConfigure = page.getByLabel(`Condition-${nodeName}`, { exact: true }).getByRole("button", { name: "Configure" });
462
+ this.conditionExpressionEditBox = page.getByLabel("textbox");
460
463
  this.basicRadio = page.getByLabel("Basic");
461
464
  this.mathRadio = page.getByLabel("Math.js");
462
465
  this.formulaRadio = page.getByLabel("Formula.js");
@@ -473,6 +476,7 @@ class ConditionBranchNode {
473
476
  basicRadio;
474
477
  mathRadio;
475
478
  formulaRadio;
479
+ conditionExpressionEditBox;
476
480
  submitButton;
477
481
  cancelButton;
478
482
  addNoBranchNode;
@@ -483,6 +487,7 @@ class ConditionBranchNode {
483
487
  this.node = page.getByLabel(`Condition-${nodeName}`, { exact: true });
484
488
  this.nodeTitle = page.getByLabel(`Condition-${nodeName}`, { exact: true }).getByRole("textbox");
485
489
  this.nodeConfigure = page.getByLabel(`Condition-${nodeName}`, { exact: true }).getByRole("button", { name: "Configure" });
490
+ this.conditionExpressionEditBox = page.getByLabel("textbox");
486
491
  this.submitButton = page.getByLabel("action-Action-Submit-workflows");
487
492
  this.cancelButton = page.getByLabel("action-Action-Cancel-workflows");
488
493
  this.addNodeButton = page.getByLabel(`add-button-condition-${nodeName}`, { exact: true });
@@ -513,6 +518,32 @@ class SQLNode {
513
518
  this.addNodeButton = page.getByLabel(`add-button-sql-${nodeName}`, { exact: true });
514
519
  }
515
520
  }
521
+ class ParallelBranchNode {
522
+ page;
523
+ node;
524
+ nodeTitle;
525
+ nodeConfigure;
526
+ addBranchButton;
527
+ allSucceededRadio;
528
+ anySucceededRadio;
529
+ anySucceededOrFailedRadio;
530
+ submitButton;
531
+ cancelButton;
532
+ addNodeButton;
533
+ constructor(page, nodeName) {
534
+ this.page = page;
535
+ this.node = page.getByLabel(`Parallel branch-${nodeName}`, { exact: true });
536
+ this.nodeTitle = page.locator("textarea").filter({ hasText: nodeName });
537
+ this.nodeConfigure = page.getByLabel(`Parallel branch-${nodeName}`).getByRole("button", { name: "Configure" });
538
+ this.addBranchButton = page.getByLabel(`add-button-parallel-${nodeName}-add-branch`, { exact: true });
539
+ this.allSucceededRadio = page.getByLabel("All succeeded", { exact: true });
540
+ this.anySucceededRadio = page.getByLabel("Any succeeded", { exact: true });
541
+ this.anySucceededOrFailedRadio = page.getByLabel("Any succeeded or failed", { exact: true });
542
+ this.submitButton = page.getByLabel("action-Action-Submit-workflows");
543
+ this.cancelButton = page.getByLabel("action-Action-Cancel-workflows");
544
+ this.addNodeButton = page.getByLabel(`add-button-parallel-${nodeName}`, { exact: true });
545
+ }
546
+ }
516
547
  var e2ePageObjectModel_default = module.exports = {
517
548
  CreateWorkFlow,
518
549
  EditWorkFlow,
@@ -532,7 +563,8 @@ var e2ePageObjectModel_default = module.exports = {
532
563
  ManualNode,
533
564
  ConditionYesNode,
534
565
  ConditionBranchNode,
535
- SQLNode
566
+ SQLNode,
567
+ ParallelBranchNode
536
568
  };
537
569
  // Annotate the CommonJS export names for ESM import in node:
538
570
  0 && (module.exports = {
@@ -549,6 +581,7 @@ var e2ePageObjectModel_default = module.exports = {
549
581
  EditWorkFlow,
550
582
  FormEventTriggerNode,
551
583
  ManualNode,
584
+ ParallelBranchNode,
552
585
  QueryRecordNode,
553
586
  SQLNode,
554
587
  ScheduleTriggerNode,
@@ -10,6 +10,7 @@ export declare const apiGetWorkflowNodeExecutions: (id: number) => Promise<any>;
10
10
  export declare const apiUpdateRecord: (collectionName: string, id: number, data: any) => Promise<any>;
11
11
  export declare const apiGetRecord: (collectionName: string, id: number) => Promise<any>;
12
12
  export declare const apiGetList: (collectionName: string) => Promise<any>;
13
+ export declare const apiFilterList: (collectionName: string, filter: string) => Promise<any>;
13
14
  export declare const apiCreateRecordTriggerFormEvent: (collectionName: string, triggerWorkflows: string, data: any) => Promise<any>;
14
15
  export declare const apiSubmitRecordTriggerFormEvent: (triggerWorkflows: string, data: any) => Promise<any>;
15
16
  declare const _default: {
@@ -27,5 +28,6 @@ declare const _default: {
27
28
  apiGetList: (collectionName: string) => Promise<any>;
28
29
  apiCreateRecordTriggerFormEvent: (collectionName: string, triggerWorkflows: string, data: any) => Promise<any>;
29
30
  apiSubmitRecordTriggerFormEvent: (triggerWorkflows: string, data: any) => Promise<any>;
31
+ apiFilterList: (collectionName: string, filter: string) => Promise<any>;
30
32
  };
31
33
  export default _default;
@@ -21,6 +21,7 @@ __export(e2eUtils_exports, {
21
21
  apiCreateWorkflow: () => apiCreateWorkflow,
22
22
  apiCreateWorkflowNode: () => apiCreateWorkflowNode,
23
23
  apiDeleteWorkflow: () => apiDeleteWorkflow,
24
+ apiFilterList: () => apiFilterList,
24
25
  apiGetList: () => apiGetList,
25
26
  apiGetRecord: () => apiGetRecord,
26
27
  apiGetWorkflow: () => apiGetWorkflow,
@@ -212,6 +213,20 @@ const apiGetList = async (collectionName) => {
212
213
  }
213
214
  return await result.json();
214
215
  };
216
+ const apiFilterList = async (collectionName, filter) => {
217
+ const api = await import_e2e.request.newContext({
218
+ storageState: process.env.PLAYWRIGHT_AUTH_FILE
219
+ });
220
+ const state = await api.storageState();
221
+ const headers = getHeaders(state);
222
+ const result = await api.get(`/api/${collectionName}:list?${filter}`, {
223
+ headers
224
+ });
225
+ if (!result.ok()) {
226
+ throw new Error(await result.text());
227
+ }
228
+ return await result.json();
229
+ };
215
230
  const apiCreateRecordTriggerFormEvent = async (collectionName, triggerWorkflows, data) => {
216
231
  const api = await import_e2e.request.newContext({
217
232
  storageState: process.env.PLAYWRIGHT_AUTH_FILE
@@ -297,7 +312,8 @@ var e2eUtils_default = module.exports = {
297
312
  apiGetRecord,
298
313
  apiGetList,
299
314
  apiCreateRecordTriggerFormEvent,
300
- apiSubmitRecordTriggerFormEvent
315
+ apiSubmitRecordTriggerFormEvent,
316
+ apiFilterList
301
317
  };
302
318
  // Annotate the CommonJS export names for ESM import in node:
303
319
  0 && (module.exports = {
@@ -305,6 +321,7 @@ var e2eUtils_default = module.exports = {
305
321
  apiCreateWorkflow,
306
322
  apiCreateWorkflowNode,
307
323
  apiDeleteWorkflow,
324
+ apiFilterList,
308
325
  apiGetList,
309
326
  apiGetRecord,
310
327
  apiGetWorkflow,
@@ -1,8 +1,8 @@
1
1
  module.exports = {
2
- "@nocobase/client": "0.19.0-alpha.1",
3
- "@nocobase/utils": "0.19.0-alpha.1",
2
+ "@nocobase/client": "0.19.0-alpha.10",
3
+ "@nocobase/utils": "0.19.0-alpha.10",
4
4
  "lodash": "4.17.21",
5
- "@nocobase/test": "0.19.0-alpha.1",
6
- "@nocobase/server": "0.19.0-alpha.1",
7
- "@nocobase/database": "0.19.0-alpha.1"
5
+ "@nocobase/test": "0.19.0-alpha.10",
6
+ "@nocobase/server": "0.19.0-alpha.10",
7
+ "@nocobase/database": "0.19.0-alpha.10"
8
8
  };
@@ -36,6 +36,7 @@ var import_path = __toESM(require("path"));
36
36
  var import_server = require("@nocobase/server");
37
37
  var import_test = require("@nocobase/test");
38
38
  var import_functions = __toESM(require("./functions"));
39
+ var import_triggers = __toESM(require("./triggers"));
39
40
  var import_instructions = __toESM(require("./instructions"));
40
41
  function sleep(ms) {
41
42
  return new Promise((resolve) => {
@@ -57,6 +58,7 @@ async function getApp(options = {}) {
57
58
  [
58
59
  "workflow",
59
60
  {
61
+ triggers: import_triggers.default,
60
62
  instructions: import_instructions.default,
61
63
  functions: import_functions.default
62
64
  }
@@ -8,7 +8,7 @@ declare const _default: {
8
8
  };
9
9
  };
10
10
  error: {
11
- run(node: any, input: any, processor: any): any;
11
+ run(node: any, input: any, processor: any): never;
12
12
  };
13
13
  pending: {
14
14
  run(node: any, input: any, processor: any): {
@@ -33,7 +33,6 @@ var instructions_default = {
33
33
  error: {
34
34
  run(node, input, processor) {
35
35
  throw new Error("definite error");
36
- return null;
37
36
  }
38
37
  },
39
38
  pending: {
@@ -0,0 +1,20 @@
1
+ declare const _default: {
2
+ syncTrigger: {
3
+ new (workflow: any): {
4
+ readonly workflow: any;
5
+ on(): void;
6
+ off(): void;
7
+ sync: boolean;
8
+ validateEvent(): boolean;
9
+ };
10
+ };
11
+ asyncTrigger: {
12
+ new (workflow: any): {
13
+ readonly workflow: any;
14
+ on(): void;
15
+ off(): void;
16
+ validateEvent(): boolean;
17
+ };
18
+ };
19
+ };
20
+ export default _default;
@@ -0,0 +1,49 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var triggers_exports = {};
19
+ __export(triggers_exports, {
20
+ default: () => triggers_default
21
+ });
22
+ module.exports = __toCommonJS(triggers_exports);
23
+ var triggers_default = {
24
+ syncTrigger: class {
25
+ constructor(workflow) {
26
+ this.workflow = workflow;
27
+ }
28
+ on() {
29
+ }
30
+ off() {
31
+ }
32
+ sync = true;
33
+ validateEvent() {
34
+ return true;
35
+ }
36
+ },
37
+ asyncTrigger: class {
38
+ constructor(workflow) {
39
+ this.workflow = workflow;
40
+ }
41
+ on() {
42
+ }
43
+ off() {
44
+ }
45
+ validateEvent() {
46
+ return true;
47
+ }
48
+ }
49
+ };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@nocobase/plugin-workflow-test",
3
3
  "displayName": "Workflow: test kit",
4
4
  "displayName.zh-CN": "工作流:测试工具包",
5
- "version": "0.19.0-alpha.1",
5
+ "version": "0.19.0-alpha.10",
6
6
  "license": "AGPL-3.0",
7
7
  "main": "dist/server/index.js",
8
8
  "types": "./dist/server/index.d.ts",
@@ -11,5 +11,5 @@
11
11
  "@nocobase/server": "0.x",
12
12
  "@nocobase/test": "0.x"
13
13
  },
14
- "gitHead": "64601944412fc4d2e2bd05f4b982118dd28247dc"
14
+ "gitHead": "d09d81eba67339da36bcec27939a85b35d180770"
15
15
  }
@@ -435,11 +435,11 @@ export class ManualNode {
435
435
  this.assigneesDropDown = page.getByTestId('select-single');
436
436
  this.configureUserInterfaceButton = page.getByRole('button', { name: 'Configure user interface' });
437
437
  this.addBlockButton = page.getByLabel('schema-initializer-Grid-AddBlockButton-workflows');
438
- this.triggerDataMenu = page.getByLabel('Data blocks-triggerData');
439
- this.nodeDataMenu = page.getByLabel('nodes', { exact: true });
438
+ this.triggerDataMenu = page.getByRole('menuitem', { name: 'Trigger data' });
439
+ this.nodeDataMenu = page.getByRole('menuitem', { name: 'Node result right' });
440
440
  this.customFormMenu = page.getByRole('menuitem', { name: 'Custom form' });
441
- this.createRecordFormMenu = page.getByRole('menuitem', { name: 'Create record form' });
442
- this.updateRecordFormMenu = page.getByRole('menuitem', { name: 'Update record form' });
441
+ this.createRecordFormMenu = page.getByRole('menuitem', { name: 'Create record form right' });
442
+ this.updateRecordFormMenu = page.getByRole('menuitem', { name: 'Update record form right' });
443
443
  this.submitButton = page.getByLabel('action-Action-Submit-workflows');
444
444
  this.cancelButton = page.getByLabel('action-Action-Cancel-workflows');
445
445
  this.addNodeButton = page.getByLabel(`add-button-manual-${nodeName}`, { exact: true });
@@ -454,6 +454,7 @@ export class ConditionYesNode {
454
454
  basicRadio: Locator;
455
455
  mathRadio: Locator;
456
456
  formulaRadio: Locator;
457
+ conditionExpressionEditBox: Locator;
457
458
  submitButton: Locator;
458
459
  cancelButton: Locator;
459
460
  addNodeButton: Locator;
@@ -464,6 +465,7 @@ export class ConditionYesNode {
464
465
  this.nodeConfigure = page
465
466
  .getByLabel(`Condition-${nodeName}`, { exact: true })
466
467
  .getByRole('button', { name: 'Configure' });
468
+ this.conditionExpressionEditBox = page.getByLabel('textbox');
467
469
  // await page.getByLabel('variable-constant').first().click();
468
470
  // await page.getByLabel('variable-button').first().click();
469
471
  // await page.getByLabel('select-operator-calc').first().click();
@@ -487,6 +489,7 @@ export class ConditionBranchNode {
487
489
  basicRadio: Locator;
488
490
  mathRadio: Locator;
489
491
  formulaRadio: Locator;
492
+ conditionExpressionEditBox: Locator;
490
493
  submitButton: Locator;
491
494
  cancelButton: Locator;
492
495
  addNoBranchNode: Locator;
@@ -499,6 +502,7 @@ export class ConditionBranchNode {
499
502
  this.nodeConfigure = page
500
503
  .getByLabel(`Condition-${nodeName}`, { exact: true })
501
504
  .getByRole('button', { name: 'Configure' });
505
+ this.conditionExpressionEditBox = page.getByLabel('textbox');
502
506
  this.submitButton = page.getByLabel('action-Action-Submit-workflows');
503
507
  this.cancelButton = page.getByLabel('action-Action-Cancel-workflows');
504
508
  this.addNodeButton = page.getByLabel(`add-button-condition-${nodeName}`, { exact: true });
@@ -533,6 +537,33 @@ export class SQLNode {
533
537
  }
534
538
  }
535
539
 
540
+ export class ParallelBranchNode {
541
+ readonly page: Page;
542
+ node: Locator;
543
+ nodeTitle: Locator;
544
+ nodeConfigure: Locator;
545
+ addBranchButton: Locator;
546
+ allSucceededRadio: Locator;
547
+ anySucceededRadio: Locator;
548
+ anySucceededOrFailedRadio: Locator;
549
+ submitButton: Locator;
550
+ cancelButton: Locator;
551
+ addNodeButton: Locator;
552
+ constructor(page: Page, nodeName: string) {
553
+ this.page = page;
554
+ this.node = page.getByLabel(`Parallel branch-${nodeName}`, { exact: true });
555
+ this.nodeTitle = page.locator('textarea').filter({ hasText: nodeName });
556
+ this.nodeConfigure = page.getByLabel(`Parallel branch-${nodeName}`).getByRole('button', { name: 'Configure' });
557
+ this.addBranchButton = page.getByLabel(`add-button-parallel-${nodeName}-add-branch`, { exact: true });
558
+ this.allSucceededRadio = page.getByLabel('All succeeded', { exact: true });
559
+ this.anySucceededRadio = page.getByLabel('Any succeeded', { exact: true });
560
+ this.anySucceededOrFailedRadio = page.getByLabel('Any succeeded or failed', { exact: true });
561
+ this.submitButton = page.getByLabel('action-Action-Submit-workflows');
562
+ this.cancelButton = page.getByLabel('action-Action-Cancel-workflows');
563
+ this.addNodeButton = page.getByLabel(`add-button-parallel-${nodeName}`, { exact: true });
564
+ }
565
+ }
566
+
536
567
  export default module.exports = {
537
568
  CreateWorkFlow,
538
569
  EditWorkFlow,
@@ -553,4 +584,5 @@ export default module.exports = {
553
584
  ConditionYesNode,
554
585
  ConditionBranchNode,
555
586
  SQLNode,
587
+ ParallelBranchNode,
556
588
  };
@@ -605,6 +605,44 @@ export const apiGetList = async (collectionName: string) => {
605
605
  return await result.json();
606
606
  };
607
607
 
608
+ // 查询业务表list
609
+ export const apiFilterList = async (collectionName: string, filter: string) => {
610
+ const api = await request.newContext({
611
+ storageState: process.env.PLAYWRIGHT_AUTH_FILE,
612
+ });
613
+ const state = await api.storageState();
614
+ const headers = getHeaders(state);
615
+ const result = await api.get(`/api/${collectionName}:list?${filter}`, {
616
+ headers,
617
+ });
618
+
619
+ if (!result.ok()) {
620
+ throw new Error(await result.text());
621
+ }
622
+ /*
623
+ {
624
+ "data": [
625
+ {
626
+ "id": 1,
627
+ "createdAt": "2023-12-12T02:43:53.793Z",
628
+ "updatedAt": "2023-12-12T05:41:33.300Z",
629
+ "key": "fzk3j2oj4el",
630
+ "title": "a11",
631
+ "enabled": true,
632
+ "description": null
633
+ }
634
+ ],
635
+ "meta": {
636
+ "count": 1,
637
+ "page": 1,
638
+ "pageSize": 20,
639
+ "totalPage": 1
640
+ }
641
+ }
642
+ */
643
+ return await result.json();
644
+ };
645
+
608
646
  // 添加业务表单条数据触发工作流表单事件,triggerWorkflows=key1!field,key2,key3!field.subfield
609
647
  export const apiCreateRecordTriggerFormEvent = async (collectionName: string, triggerWorkflows: string, data: any) => {
610
648
  const api = await request.newContext({
@@ -744,4 +782,5 @@ export default module.exports = {
744
782
  apiGetList,
745
783
  apiCreateRecordTriggerFormEvent,
746
784
  apiSubmitRecordTriggerFormEvent,
785
+ apiFilterList,
747
786
  };
@@ -4,6 +4,7 @@ import { ApplicationOptions, Plugin } from '@nocobase/server';
4
4
  import { MockServer, createMockServer } from '@nocobase/test';
5
5
 
6
6
  import functions from './functions';
7
+ import triggers from './triggers';
7
8
  import instructions from './instructions';
8
9
 
9
10
  export interface MockServerOptions extends ApplicationOptions {
@@ -38,6 +39,7 @@ export async function getApp(options: MockServerOptions = {}): Promise<MockServe
38
39
  [
39
40
  'workflow',
40
41
  {
42
+ triggers,
41
43
  instructions,
42
44
  functions,
43
45
  },
@@ -13,7 +13,6 @@ export default {
13
13
  error: {
14
14
  run(node, input, processor) {
15
15
  throw new Error('definite error');
16
- return null;
17
16
  },
18
17
  },
19
18
 
@@ -0,0 +1,19 @@
1
+ export default {
2
+ syncTrigger: class {
3
+ constructor(public readonly workflow) {}
4
+ on() {}
5
+ off() {}
6
+ sync = true;
7
+ validateEvent() {
8
+ return true;
9
+ }
10
+ },
11
+ asyncTrigger: class {
12
+ constructor(public readonly workflow) {}
13
+ on() {}
14
+ off() {}
15
+ validateEvent() {
16
+ return true;
17
+ }
18
+ },
19
+ };