Merge branch 'main' into next
Some checks failed
Build Docker Image / build-and-push (push) Waiting to run
Build Pro Image / build-and-push (push) Waiting to run
E2E / Build (push) Waiting to run
E2E / Core and plugins (push) Blocked by required conditions
E2E / plugin-workflow (push) Blocked by required conditions
E2E / plugin-workflow-approval (push) Blocked by required conditions
E2E / plugin-data-source-main (push) Blocked by required conditions
E2E / Comment on PR (push) Blocked by required conditions
NocoBase FrontEnd Test / frontend-test (18) (push) Waiting to run
NocoBase Backend Test / sqlite-test (20, false) (push) Has been cancelled
NocoBase Backend Test / sqlite-test (20, true) (push) Has been cancelled
NocoBase Backend Test / postgres-test (public, 20, nocobase, false) (push) Has been cancelled
NocoBase Backend Test / postgres-test (public, 20, nocobase, true) (push) Has been cancelled
NocoBase Backend Test / postgres-test (public, 20, public, false) (push) Has been cancelled
NocoBase Backend Test / postgres-test (public, 20, public, true) (push) Has been cancelled
NocoBase Backend Test / postgres-test (user_schema, 20, nocobase, false) (push) Has been cancelled
NocoBase Backend Test / postgres-test (user_schema, 20, nocobase, true) (push) Has been cancelled
NocoBase Backend Test / postgres-test (user_schema, 20, public, false) (push) Has been cancelled
NocoBase Backend Test / postgres-test (user_schema, 20, public, true) (push) Has been cancelled
NocoBase Backend Test / mysql-test (20, false) (push) Has been cancelled
NocoBase Backend Test / mysql-test (20, true) (push) Has been cancelled
NocoBase Backend Test / mariadb-test (20, false) (push) Has been cancelled
NocoBase Backend Test / mariadb-test (20, true) (push) Has been cancelled
Test on Windows / build (push) Has been cancelled

This commit is contained in:
Zeke Zhang 2024-07-29 00:00:12 +08:00
commit 3d38ec0858
8 changed files with 111 additions and 17 deletions

View File

@ -0,0 +1,12 @@
import { useTranslation } from 'react-i18next';
// @ts-ignore
import pkg from './../../package.json';
export function usePluginTranslation() {
return useTranslation([pkg.name, 'client'], { nsMode: 'fallback' });
}
export function generatePluginTranslationTemplate(key: string) {
return `{{t('${key}', { ns: ['${pkg.name}', 'client'], nsMode: 'fallback' })}}`;
}

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
{}

View File

@ -52,7 +52,7 @@
"dependencies": {
"@faker-js/faker": "8.1.0",
"@nocobase/server": "1.3.0-alpha",
"@playwright/test": "^1.44.0",
"@playwright/test": "^1.45.3",
"@testing-library/jest-dom": "^6.4.2",
"@testing-library/react": "^14.0.0",
"@testing-library/react-hooks": "^8.0.1",

View File

@ -12,6 +12,8 @@ export class CreateWorkFlow {
readonly page: Page;
name: Locator;
triggerType: Locator;
synchronouslyRadio: Locator;
asynchronouslyRadio: Locator;
description: Locator;
autoDeleteHistory: Locator;
submitButton: Locator;
@ -20,6 +22,8 @@ export class CreateWorkFlow {
this.page = page;
this.name = page.getByLabel('block-item-CollectionField-workflows-Name').getByRole('textbox');
this.triggerType = page.getByTestId('select-single');
this.synchronouslyRadio = page.getByLabel('Synchronously', { exact: true });
this.asynchronouslyRadio = page.getByLabel('Asynchronously', { exact: true });
this.description = page.getByTestId('description-item').getByRole('textbox');
this.autoDeleteHistory = page.getByTestId('select-multiple');
this.submitButton = page.getByLabel('action-Action-Submit-workflows');
@ -365,6 +369,30 @@ export class FormEventTriggerNode {
}
}
export class CustomActionEventTriggerNode {
readonly page: Page;
node: Locator;
nodeTitle: Locator;
nodeConfigure: Locator;
collectionDropDown: Locator;
relationalDataDropdown: Locator;
submitButton: Locator;
cancelButton: Locator;
addNodeButton: Locator;
constructor(page: Page, triggerName: string, collectionName: string) {
this.page = page;
this.node = page.getByLabel(`Trigger-${triggerName}`);
this.nodeTitle = page.getByLabel(`Trigger-${triggerName}`).getByRole('textbox');
this.nodeConfigure = page.getByLabel(`Trigger-${triggerName}`).getByRole('button', { name: 'Configure' });
this.collectionDropDown = page
.getByLabel('block-item-DataSourceCollectionCascader-workflows-Collection')
.locator('.ant-select-selection-search-input');
this.relationalDataDropdown = page.getByTestId('select-field-Preload associations');
this.submitButton = page.getByLabel('action-Action-Submit-workflows');
this.cancelButton = page.getByLabel('action-Action-Cancel-workflows');
this.addNodeButton = page.getByLabel('add-button', { exact: true });
}
}
export class CalculationNode {
readonly page: Page;
node: Locator;
@ -746,4 +774,5 @@ export default module.exports = {
SQLNode,
ParallelBranchNode,
ApprovalBranchModeNode,
CustomActionEventTriggerNode,
};

View File

@ -7,7 +7,7 @@
* For more information, please refer to: https://www.nocobase.com/agreement.
*/
import { request, Browser } from '@nocobase/test/e2e';
import { Browser, request } from '@nocobase/test/e2e';
const PORT = process.env.APP_PORT || 20000;
const APP_BASE_URL = process.env.APP_BASE_URL || `http://localhost:${PORT}`;
@ -808,6 +808,57 @@ export const apiCreateRecordTriggerActionEvent = async (
return (await result.json()).data;
};
// 添加业务表单条数据触发工作流表单事件,triggerWorkflows=key1!field,key2,key3!field.subfield
export const apiTriggerCustomActionEvent = async (collectionName: string, triggerWorkflows: string, data: any) => {
const api = await request.newContext({
storageState: process.env.PLAYWRIGHT_AUTH_FILE,
});
const state = await api.storageState();
const headers = getHeaders(state);
/*
{
"title": "a11",
"enabled": true,
"description": null
}
*/
const result = await api.post(`/api/${collectionName}:trigger?triggerWorkflows=${triggerWorkflows}`, {
headers,
data,
});
if (!result.ok()) {
throw new Error(await result.text());
}
/*
{
"data": {
"id": 1,
"createdAt": "2023-12-12T02:43:53.793Z",
"updatedAt": "2023-12-12T05:41:33.300Z",
"key": "fzk3j2oj4el",
"title": "a11",
"enabled": true,
"description": null
},
"meta": {
"allowedActions": {
"view": [
1
],
"update": [
1
],
"destroy": [
1
]
}
}
}
*/
return (await result.json()).data;
};
// 审批中心发起审批
export const apiApplyApprovalEvent = async (data: any) => {
const api = await request.newContext({
@ -1021,4 +1072,5 @@ export default module.exports = {
apiApplyApprovalEvent,
userLogin,
apiCreateField,
apiTriggerCustomActionEvent,
};

View File

@ -30,7 +30,6 @@
"packages/**/dist",
"packages/**/public",
"packages/core/build/bin",
"packages/core/cli/**/*",
"packages/**/lib",
"packages/**/es"
]

View File

@ -5053,12 +5053,12 @@
picocolors "^1.0.0"
tslib "^2.6.0"
"@playwright/test@^1.44.0":
version "1.44.0"
resolved "https://registry.npmmirror.com/@playwright/test/-/test-1.44.0.tgz#ac7a764b5ee6a80558bdc0fcbc525fcb81f83465"
integrity sha512-rNX5lbNidamSUorBhB4XZ9SQTjAqfe5M+p37Z8ic0jPFBMo5iCtQz1kRWkEMg+rYOKSlVycpQmpqjSFq7LXOfg==
"@playwright/test@^1.45.3":
version "1.45.3"
resolved "https://registry.npmmirror.com/@playwright/test/-/test-1.45.3.tgz#22e9c38b3081d6674b28c6e22f784087776c72e5"
integrity sha512-UKF4XsBfy+u3MFWEH44hva1Q8Da28G6RFtR2+5saw+jgAFQV5yYnB1fu68Mz7fO+5GJF3wgwAIs0UelU8TxFrA==
dependencies:
playwright "1.44.0"
playwright "1.45.3"
"@pm2/agent@~2.0.0":
version "2.0.3"
@ -20886,17 +20886,17 @@ platform@^1.3.1:
resolved "https://registry.npmmirror.com/platform/-/platform-1.3.6.tgz#48b4ce983164b209c2d45a107adb31f473a6e7a7"
integrity sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==
playwright-core@1.44.0:
version "1.44.0"
resolved "https://registry.npmmirror.com/playwright-core/-/playwright-core-1.44.0.tgz#316c4f0bca0551ffb88b6eb1c97bc0d2d861b0d5"
integrity sha512-ZTbkNpFfYcGWohvTTl+xewITm7EOuqIqex0c7dNZ+aXsbrLj0qI8XlGKfPpipjm0Wny/4Lt4CJsWJk1stVS5qQ==
playwright-core@1.45.3:
version "1.45.3"
resolved "https://registry.npmmirror.com/playwright-core/-/playwright-core-1.45.3.tgz#e77bc4c78a621b96c3e629027534ee1d25faac93"
integrity sha512-+ym0jNbcjikaOwwSZycFbwkWgfruWvYlJfThKYAlImbxUgdWFO2oW70ojPm4OpE4t6TAo2FY/smM+hpVTtkhDA==
playwright@1.44.0:
version "1.44.0"
resolved "https://registry.npmmirror.com/playwright/-/playwright-1.44.0.tgz#22894e9b69087f6beb639249323d80fe2b5087ff"
integrity sha512-F9b3GUCLQ3Nffrfb6dunPOkE5Mh68tR7zN32L4jCk4FjQamgesGay7/dAAe1WaMEGV04DkdJfcJzjoCKygUaRQ==
playwright@1.45.3:
version "1.45.3"
resolved "https://registry.npmmirror.com/playwright/-/playwright-1.45.3.tgz#75143f73093a6e1467f7097083d2f0846fb8dd2f"
integrity sha512-QhVaS+lpluxCaioejDZ95l4Y4jSFCsBvl2UZkpeXlzxmqS+aABr5c82YmfMHrL6x27nvrvykJAFpkzT2eWdJww==
dependencies:
playwright-core "1.44.0"
playwright-core "1.45.3"
optionalDependencies:
fsevents "2.3.2"