@nocobase/plugin-workflow-test 0.19.0-alpha.4 → 0.19.0-alpha.6

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.
@@ -254,6 +254,20 @@ export declare class SQLNode {
254
254
  addNodeButton: Locator;
255
255
  constructor(page: Page, nodeName: string);
256
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
+ }
257
271
  declare const _default: {
258
272
  CreateWorkFlow: typeof CreateWorkFlow;
259
273
  EditWorkFlow: typeof EditWorkFlow;
@@ -274,5 +288,6 @@ declare const _default: {
274
288
  ConditionYesNode: typeof ConditionYesNode;
275
289
  ConditionBranchNode: typeof ConditionBranchNode;
276
290
  SQLNode: typeof SQLNode;
291
+ ParallelBranchNode: typeof ParallelBranchNode;
277
292
  };
278
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 });
@@ -517,6 +518,32 @@ class SQLNode {
517
518
  this.addNodeButton = page.getByLabel(`add-button-sql-${nodeName}`, { exact: true });
518
519
  }
519
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
+ }
520
547
  var e2ePageObjectModel_default = module.exports = {
521
548
  CreateWorkFlow,
522
549
  EditWorkFlow,
@@ -536,7 +563,8 @@ var e2ePageObjectModel_default = module.exports = {
536
563
  ManualNode,
537
564
  ConditionYesNode,
538
565
  ConditionBranchNode,
539
- SQLNode
566
+ SQLNode,
567
+ ParallelBranchNode
540
568
  };
541
569
  // Annotate the CommonJS export names for ESM import in node:
542
570
  0 && (module.exports = {
@@ -553,6 +581,7 @@ var e2ePageObjectModel_default = module.exports = {
553
581
  EditWorkFlow,
554
582
  FormEventTriggerNode,
555
583
  ManualNode,
584
+ ParallelBranchNode,
556
585
  QueryRecordNode,
557
586
  SQLNode,
558
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.4",
3
- "@nocobase/utils": "0.19.0-alpha.4",
2
+ "@nocobase/client": "0.19.0-alpha.6",
3
+ "@nocobase/utils": "0.19.0-alpha.6",
4
4
  "lodash": "4.17.21",
5
- "@nocobase/test": "0.19.0-alpha.4",
6
- "@nocobase/server": "0.19.0-alpha.4",
7
- "@nocobase/database": "0.19.0-alpha.4"
5
+ "@nocobase/test": "0.19.0-alpha.6",
6
+ "@nocobase/server": "0.19.0-alpha.6",
7
+ "@nocobase/database": "0.19.0-alpha.6"
8
8
  };
@@ -5,6 +5,7 @@ declare const _default: {
5
5
  on(): void;
6
6
  off(): void;
7
7
  sync: boolean;
8
+ validateEvent(): boolean;
8
9
  };
9
10
  };
10
11
  asyncTrigger: {
@@ -12,6 +13,7 @@ declare const _default: {
12
13
  readonly workflow: any;
13
14
  on(): void;
14
15
  off(): void;
16
+ validateEvent(): boolean;
15
17
  };
16
18
  };
17
19
  };
@@ -30,6 +30,9 @@ var triggers_default = {
30
30
  off() {
31
31
  }
32
32
  sync = true;
33
+ validateEvent() {
34
+ return true;
35
+ }
33
36
  },
34
37
  asyncTrigger: class {
35
38
  constructor(workflow) {
@@ -39,5 +42,8 @@ var triggers_default = {
39
42
  }
40
43
  off() {
41
44
  }
45
+ validateEvent() {
46
+ return true;
47
+ }
42
48
  }
43
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.4",
5
+ "version": "0.19.0-alpha.6",
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": "9583023f7bea828da5192384a5c002782c341b65"
14
+ "gitHead": "2eb524db98c7f4136fe1a9a1b1259cd72cf6635f"
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 });
@@ -537,6 +537,33 @@ export class SQLNode {
537
537
  }
538
538
  }
539
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
+
540
567
  export default module.exports = {
541
568
  CreateWorkFlow,
542
569
  EditWorkFlow,
@@ -557,4 +584,5 @@ export default module.exports = {
557
584
  ConditionYesNode,
558
585
  ConditionBranchNode,
559
586
  SQLNode,
587
+ ParallelBranchNode,
560
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,10 +4,16 @@ export default {
4
4
  on() {}
5
5
  off() {}
6
6
  sync = true;
7
+ validateEvent() {
8
+ return true;
9
+ }
7
10
  },
8
11
  asyncTrigger: class {
9
12
  constructor(public readonly workflow) {}
10
13
  on() {}
11
14
  off() {}
15
+ validateEvent() {
16
+ return true;
17
+ }
12
18
  },
13
19
  };