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

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.
@@ -189,6 +189,7 @@ export declare class AggregateNode {
189
189
  linkedDataTableDataRadio: Locator;
190
190
  collectionDropDown: Locator;
191
191
  aggregatedFieldDropDown: Locator;
192
+ distinctCheckBox: Locator;
192
193
  submitButton: Locator;
193
194
  cancelButton: Locator;
194
195
  addNodeButton: Locator;
@@ -240,6 +241,17 @@ export declare class ConditionBranchNode {
240
241
  addNodeButton: Locator;
241
242
  constructor(page: Page, nodeName: string);
242
243
  }
244
+ export declare class SQLNode {
245
+ readonly page: Page;
246
+ node: Locator;
247
+ nodeTitle: Locator;
248
+ nodeConfigure: Locator;
249
+ sqlEditBox: Locator;
250
+ submitButton: Locator;
251
+ cancelButton: Locator;
252
+ addNodeButton: Locator;
253
+ constructor(page: Page, nodeName: string);
254
+ }
243
255
  declare const _default: {
244
256
  CreateWorkFlow: typeof CreateWorkFlow;
245
257
  EditWorkFlow: typeof EditWorkFlow;
@@ -259,5 +271,6 @@ declare const _default: {
259
271
  ManualNode: typeof ManualNode;
260
272
  ConditionYesNode: typeof ConditionYesNode;
261
273
  ConditionBranchNode: typeof ConditionBranchNode;
274
+ SQLNode: typeof SQLNode;
262
275
  };
263
276
  export default _default;
@@ -31,6 +31,7 @@ __export(e2ePageObjectModel_exports, {
31
31
  FormEventTriggerNode: () => FormEventTriggerNode,
32
32
  ManualNode: () => ManualNode,
33
33
  QueryRecordNode: () => QueryRecordNode,
34
+ SQLNode: () => SQLNode,
34
35
  ScheduleTriggerNode: () => ScheduleTriggerNode,
35
36
  UpdateRecordNode: () => UpdateRecordNode,
36
37
  WorkflowListRecords: () => WorkflowListRecords,
@@ -380,6 +381,7 @@ class AggregateNode {
380
381
  linkedDataTableDataRadio;
381
382
  collectionDropDown;
382
383
  aggregatedFieldDropDown;
384
+ distinctCheckBox;
383
385
  submitButton;
384
386
  cancelButton;
385
387
  addNodeButton;
@@ -399,6 +401,7 @@ class AggregateNode {
399
401
  this.aggregatedFieldDropDown = page.locator(
400
402
  'input.ant-select-selection-search-input[role="combobox"][aria-haspopup="listbox"]'
401
403
  );
404
+ this.distinctCheckBox = page.getByLabel("block-item-Checkbox-workflows-Distinct").locator('input.ant-checkbox-input[type="checkbox"]');
402
405
  this.submitButton = page.getByLabel("action-Action-Submit-workflows");
403
406
  this.cancelButton = page.getByLabel("action-Action-Cancel-workflows");
404
407
  this.addNodeButton = page.getByLabel(`add-button-aggregate-${nodeName}`, { exact: true });
@@ -490,6 +493,26 @@ class ConditionBranchNode {
490
493
  this.addYesBranchNode = page.getByLabel(`add-button-condition-${nodeName}-1`);
491
494
  }
492
495
  }
496
+ class SQLNode {
497
+ page;
498
+ node;
499
+ nodeTitle;
500
+ nodeConfigure;
501
+ sqlEditBox;
502
+ submitButton;
503
+ cancelButton;
504
+ addNodeButton;
505
+ constructor(page, nodeName) {
506
+ this.page = page;
507
+ this.node = page.getByLabel(`SQL action-${nodeName}`, { exact: true });
508
+ this.nodeTitle = page.getByLabel(`SQL action-${nodeName}`, { exact: true }).getByRole("textbox");
509
+ this.nodeConfigure = page.getByLabel(`SQL action-${nodeName}`, { exact: true }).getByRole("button", { name: "Configure" });
510
+ this.sqlEditBox = page.getByLabel("block-item-WorkflowVariableRawTextArea-workflows-SQL").getByRole("textbox");
511
+ this.submitButton = page.getByLabel("action-Action-Submit-workflows");
512
+ this.cancelButton = page.getByLabel("action-Action-Cancel-workflows");
513
+ this.addNodeButton = page.getByLabel(`add-button-sql-${nodeName}`, { exact: true });
514
+ }
515
+ }
493
516
  var e2ePageObjectModel_default = module.exports = {
494
517
  CreateWorkFlow,
495
518
  EditWorkFlow,
@@ -508,7 +531,8 @@ var e2ePageObjectModel_default = module.exports = {
508
531
  AggregateNode,
509
532
  ManualNode,
510
533
  ConditionYesNode,
511
- ConditionBranchNode
534
+ ConditionBranchNode,
535
+ SQLNode
512
536
  };
513
537
  // Annotate the CommonJS export names for ESM import in node:
514
538
  0 && (module.exports = {
@@ -526,6 +550,7 @@ var e2ePageObjectModel_default = module.exports = {
526
550
  FormEventTriggerNode,
527
551
  ManualNode,
528
552
  QueryRecordNode,
553
+ SQLNode,
529
554
  ScheduleTriggerNode,
530
555
  UpdateRecordNode,
531
556
  WorkflowListRecords,
@@ -1,8 +1,8 @@
1
1
  module.exports = {
2
- "@nocobase/client": "0.18.0-alpha.8",
3
- "@nocobase/utils": "0.18.0-alpha.8",
2
+ "@nocobase/client": "0.19.0-alpha.1",
3
+ "@nocobase/utils": "0.19.0-alpha.1",
4
4
  "lodash": "4.17.21",
5
- "@nocobase/test": "0.18.0-alpha.8",
6
- "@nocobase/server": "0.18.0-alpha.8",
7
- "@nocobase/database": "0.18.0-alpha.8"
5
+ "@nocobase/test": "0.19.0-alpha.1",
6
+ "@nocobase/server": "0.19.0-alpha.1",
7
+ "@nocobase/database": "0.19.0-alpha.1"
8
8
  };
@@ -1,13 +1,10 @@
1
- import { Plugin, ApplicationOptions } from '@nocobase/server';
1
+ import { ApplicationOptions, Plugin } from '@nocobase/server';
2
2
  import { MockServer } from '@nocobase/test';
3
- interface MockServerOptions extends ApplicationOptions {
4
- autoStart?: boolean;
3
+ export interface MockServerOptions extends ApplicationOptions {
5
4
  collectionsPath?: string;
6
- cleanDb?: boolean;
7
5
  }
8
6
  export declare function sleep(ms: number): Promise<unknown>;
9
- export declare function getApp({ autoStart, cleanDb, plugins, ...options }?: MockServerOptions): Promise<MockServer>;
7
+ export declare function getApp(options?: MockServerOptions): Promise<MockServer>;
10
8
  export default class WorkflowTestPlugin extends Plugin {
11
9
  load(): Promise<void>;
12
10
  }
13
- export {};
@@ -35,42 +35,24 @@ module.exports = __toCommonJS(server_exports);
35
35
  var import_path = __toESM(require("path"));
36
36
  var import_server = require("@nocobase/server");
37
37
  var import_test = require("@nocobase/test");
38
- var import_instructions = __toESM(require("./instructions"));
39
38
  var import_functions = __toESM(require("./functions"));
40
- async function createMockServer({ autoStart, collectionsPath, cleanDb, ...options }) {
41
- const app = (0, import_test.mockServer)(options);
42
- if (cleanDb) {
43
- await app.cleanDb();
44
- }
45
- await app.load();
46
- if (collectionsPath) {
47
- await app.db.import({ directory: collectionsPath });
48
- }
49
- try {
50
- await app.db.sync();
51
- } catch (error) {
52
- console.error(error);
53
- }
54
- if (autoStart) {
55
- await app.start();
56
- }
57
- return app;
58
- }
39
+ var import_instructions = __toESM(require("./instructions"));
59
40
  function sleep(ms) {
60
41
  return new Promise((resolve) => {
61
42
  setTimeout(resolve, ms);
62
43
  });
63
44
  }
64
- async function getApp({
65
- autoStart = true,
66
- cleanDb = true,
67
- plugins = [],
68
- ...options
69
- } = {}) {
70
- return createMockServer({
71
- ...options,
72
- autoStart,
73
- cleanDb,
45
+ async function getApp(options = {}) {
46
+ const { plugins = [], collectionsPath, ...others } = options;
47
+ class TestCollectionPlugin extends import_server.Plugin {
48
+ async load() {
49
+ if (collectionsPath) {
50
+ await this.db.import({ directory: collectionsPath });
51
+ }
52
+ }
53
+ }
54
+ return (0, import_test.createMockServer)({
55
+ ...others,
74
56
  plugins: [
75
57
  [
76
58
  "workflow",
@@ -79,16 +61,15 @@ async function getApp({
79
61
  functions: import_functions.default
80
62
  }
81
63
  ],
82
- WorkflowTestPlugin,
64
+ "workflow-test",
65
+ TestCollectionPlugin,
83
66
  ...plugins
84
67
  ]
85
68
  });
86
69
  }
87
70
  class WorkflowTestPlugin extends import_server.Plugin {
88
71
  async load() {
89
- await this.db.import({
90
- directory: import_path.default.resolve(__dirname, "collections")
91
- });
72
+ await this.importCollections(import_path.default.resolve(__dirname, "collections"));
92
73
  }
93
74
  }
94
75
  // Annotate the CommonJS export names for ESM import in node:
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.18.0-alpha.8",
5
+ "version": "0.19.0-alpha.1",
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": "727d42f6f14e5f863831da3dbf3255ba1165b567"
14
+ "gitHead": "64601944412fc4d2e2bd05f4b982118dd28247dc"
15
15
  }
@@ -377,6 +377,7 @@ export class AggregateNode {
377
377
  linkedDataTableDataRadio: Locator;
378
378
  collectionDropDown: Locator;
379
379
  aggregatedFieldDropDown: Locator;
380
+ distinctCheckBox: Locator;
380
381
  submitButton: Locator;
381
382
  cancelButton: Locator;
382
383
  addNodeButton: Locator;
@@ -399,6 +400,9 @@ export class AggregateNode {
399
400
  this.aggregatedFieldDropDown = page.locator(
400
401
  'input.ant-select-selection-search-input[role="combobox"][aria-haspopup="listbox"]',
401
402
  );
403
+ this.distinctCheckBox = page
404
+ .getByLabel('block-item-Checkbox-workflows-Distinct')
405
+ .locator('input.ant-checkbox-input[type="checkbox"]');
402
406
  this.submitButton = page.getByLabel('action-Action-Submit-workflows');
403
407
  this.cancelButton = page.getByLabel('action-Action-Cancel-workflows');
404
408
  this.addNodeButton = page.getByLabel(`add-button-aggregate-${nodeName}`, { exact: true });
@@ -506,6 +510,29 @@ export class ConditionBranchNode {
506
510
  }
507
511
  }
508
512
 
513
+ export class SQLNode {
514
+ readonly page: Page;
515
+ node: Locator;
516
+ nodeTitle: Locator;
517
+ nodeConfigure: Locator;
518
+ sqlEditBox: Locator;
519
+ submitButton: Locator;
520
+ cancelButton: Locator;
521
+ addNodeButton: Locator;
522
+ constructor(page: Page, nodeName: string) {
523
+ this.page = page;
524
+ this.node = page.getByLabel(`SQL action-${nodeName}`, { exact: true });
525
+ this.nodeTitle = page.getByLabel(`SQL action-${nodeName}`, { exact: true }).getByRole('textbox');
526
+ this.nodeConfigure = page
527
+ .getByLabel(`SQL action-${nodeName}`, { exact: true })
528
+ .getByRole('button', { name: 'Configure' });
529
+ this.sqlEditBox = page.getByLabel('block-item-WorkflowVariableRawTextArea-workflows-SQL').getByRole('textbox');
530
+ this.submitButton = page.getByLabel('action-Action-Submit-workflows');
531
+ this.cancelButton = page.getByLabel('action-Action-Cancel-workflows');
532
+ this.addNodeButton = page.getByLabel(`add-button-sql-${nodeName}`, { exact: true });
533
+ }
534
+ }
535
+
509
536
  export default module.exports = {
510
537
  CreateWorkFlow,
511
538
  EditWorkFlow,
@@ -525,4 +552,5 @@ export default module.exports = {
525
552
  ManualNode,
526
553
  ConditionYesNode,
527
554
  ConditionBranchNode,
555
+ SQLNode,
528
556
  };
@@ -1,43 +1,21 @@
1
1
  import path from 'path';
2
2
 
3
- import { Plugin, ApplicationOptions } from '@nocobase/server';
4
- import { MockServer, mockServer } from '@nocobase/test';
3
+ import { ApplicationOptions, Plugin } from '@nocobase/server';
4
+ import { MockServer, createMockServer } from '@nocobase/test';
5
5
 
6
- import instructions from './instructions';
7
6
  import functions from './functions';
7
+ import instructions from './instructions';
8
8
 
9
- interface MockServerOptions extends ApplicationOptions {
10
- autoStart?: boolean;
9
+ export interface MockServerOptions extends ApplicationOptions {
11
10
  collectionsPath?: string;
12
- cleanDb?: boolean;
13
11
  }
14
12
 
15
- async function createMockServer({ autoStart, collectionsPath, cleanDb, ...options }: MockServerOptions) {
16
- const app = mockServer(options);
17
-
18
- if (cleanDb) {
19
- await app.cleanDb();
20
- }
21
-
22
- await app.load();
23
-
24
- if (collectionsPath) {
25
- await app.db.import({ directory: collectionsPath });
26
- }
27
-
28
- try {
29
- await app.db.sync();
30
- } catch (error) {
31
- console.error(error);
32
- }
33
-
34
- if (autoStart) {
35
- await app.start();
36
- // await app.runCommand('start', '--quickstart');
37
- }
38
-
39
- return app;
40
- }
13
+ // async function createMockServer(options: MockServerOptions) {
14
+ // const app = mockServer(options);
15
+ // await app.cleanDb();
16
+ // await app.runCommand('start', '--quickstart');
17
+ // return app;
18
+ // }
41
19
 
42
20
  export function sleep(ms: number) {
43
21
  return new Promise((resolve) => {
@@ -45,16 +23,17 @@ export function sleep(ms: number) {
45
23
  });
46
24
  }
47
25
 
48
- export async function getApp({
49
- autoStart = true,
50
- cleanDb = true,
51
- plugins = [],
52
- ...options
53
- }: MockServerOptions = {}): Promise<MockServer> {
26
+ export async function getApp(options: MockServerOptions = {}): Promise<MockServer> {
27
+ const { plugins = [], collectionsPath, ...others } = options;
28
+ class TestCollectionPlugin extends Plugin {
29
+ async load() {
30
+ if (collectionsPath) {
31
+ await this.db.import({ directory: collectionsPath });
32
+ }
33
+ }
34
+ }
54
35
  return createMockServer({
55
- ...options,
56
- autoStart,
57
- cleanDb,
36
+ ...others,
58
37
  plugins: [
59
38
  [
60
39
  'workflow',
@@ -63,7 +42,8 @@ export async function getApp({
63
42
  functions,
64
43
  },
65
44
  ],
66
- WorkflowTestPlugin,
45
+ 'workflow-test',
46
+ TestCollectionPlugin,
67
47
  ...plugins,
68
48
  ],
69
49
  });
@@ -71,8 +51,6 @@ export async function getApp({
71
51
 
72
52
  export default class WorkflowTestPlugin extends Plugin {
73
53
  async load() {
74
- await this.db.import({
75
- directory: path.resolve(__dirname, 'collections'),
76
- });
54
+ await this.importCollections(path.resolve(__dirname, 'collections'));
77
55
  }
78
56
  }