mirror of
https://gitee.com/nocobase/nocobase.git
synced 2024-11-30 03:08:31 +08:00
feat(custom-request): support concatenation of variables and strings (#5317)
* feat(custom-request): support concatenation of variables and strings * chore: fix build * chore: make e2e tests pass * chore: make e2e more stable * chore: fix the issue of unit tests not stopping after completion
This commit is contained in:
parent
5fb009ed33
commit
23d55412a0
@ -10,10 +10,10 @@
|
||||
import { css, cx } from '@emotion/css';
|
||||
import { useForm } from '@formily/react';
|
||||
import { Space } from 'antd';
|
||||
import useInputStyle from 'antd/es/input/style';
|
||||
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { renderToString } from 'react-dom/server';
|
||||
import sanitizeHTML from 'sanitize-html';
|
||||
import useInputStyle from 'antd/es/input/style';
|
||||
|
||||
import { error } from '@nocobase/utils/client';
|
||||
|
||||
@ -111,13 +111,13 @@ function renderHTML(exp: string, keyLabelMap) {
|
||||
});
|
||||
}
|
||||
|
||||
function createOptionsValueLabelMap(options: any[]) {
|
||||
function createOptionsValueLabelMap(options: any[], fieldNames = { value: 'value', label: 'label' }) {
|
||||
const map = new Map<string, string[]>();
|
||||
for (const option of options) {
|
||||
map.set(option.value, [option.label]);
|
||||
map.set(option[fieldNames.value], [option[fieldNames.label]]);
|
||||
if (option.children) {
|
||||
for (const [value, labels] of createOptionsValueLabelMap(option.children)) {
|
||||
map.set(`${option.value}.${value}`, [option.label, ...labels]);
|
||||
for (const [value, labels] of createOptionsValueLabelMap(option.children, fieldNames)) {
|
||||
map.set(`${option[fieldNames.value]}.${value}`, [option[fieldNames.label], ...labels]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -149,20 +149,20 @@ function getSingleEndRange(nodes: ChildNode[], index: number, offset: number): [
|
||||
if (index === -1) {
|
||||
let realIndex = offset;
|
||||
let collapseFlag = false;
|
||||
if (realIndex && nodes[realIndex - 1].nodeName === '#text' && nodes[realIndex]?.nodeName === '#text') {
|
||||
if (realIndex && nodes[realIndex - 1]?.nodeName === '#text' && nodes[realIndex]?.nodeName === '#text') {
|
||||
// set a flag for collapse
|
||||
collapseFlag = true;
|
||||
}
|
||||
let textOffset = 0;
|
||||
for (let i = offset - 1; i >= 0; i--) {
|
||||
if (collapseFlag) {
|
||||
if (nodes[i].nodeName === '#text') {
|
||||
if (nodes[i]?.nodeName === '#text') {
|
||||
textOffset += nodes[i].textContent!.length;
|
||||
} else {
|
||||
collapseFlag = false;
|
||||
}
|
||||
}
|
||||
if (nodes[i].nodeName === '#text' && nodes[i + 1]?.nodeName === '#text') {
|
||||
if (nodes[i]?.nodeName === '#text' && nodes[i + 1]?.nodeName === '#text') {
|
||||
realIndex -= 1;
|
||||
}
|
||||
}
|
||||
@ -173,8 +173,8 @@ function getSingleEndRange(nodes: ChildNode[], index: number, offset: number): [
|
||||
let textOffset = 0;
|
||||
for (let i = 0; i < index + 1; i++) {
|
||||
// console.log(i, realIndex, textOffset);
|
||||
if (nodes[i].nodeName === '#text') {
|
||||
if (i !== index && nodes[i + 1] && nodes[i + 1].nodeName !== '#text') {
|
||||
if (nodes[i]?.nodeName === '#text') {
|
||||
if (i !== index && nodes[i + 1] && nodes[i + 1]?.nodeName !== '#text') {
|
||||
realIndex += 1;
|
||||
}
|
||||
textOffset += i === index ? offset : nodes[i].textContent!.length;
|
||||
@ -208,13 +208,18 @@ function getCurrentRange(element: HTMLElement): RangeIndexes {
|
||||
return result;
|
||||
}
|
||||
|
||||
const defaultFieldNames = { value: 'value', label: 'label' };
|
||||
|
||||
export function TextArea(props) {
|
||||
const { wrapSSR, hashId, componentCls } = useStyles();
|
||||
const { value = '', scope, onChange, multiline = true, changeOnSelect, style } = props;
|
||||
const { value = '', scope, onChange, multiline = true, changeOnSelect, style, fieldNames } = props;
|
||||
const inputRef = useRef<HTMLDivElement>(null);
|
||||
const [options, setOptions] = useState([]);
|
||||
const form = useForm();
|
||||
const keyLabelMap = useMemo(() => createOptionsValueLabelMap(options), [options]);
|
||||
const keyLabelMap = useMemo(
|
||||
() => createOptionsValueLabelMap(options, fieldNames || defaultFieldNames),
|
||||
[fieldNames, options],
|
||||
);
|
||||
const [ime, setIME] = useState<boolean>(false);
|
||||
const [changed, setChanged] = useState(false);
|
||||
const [html, setHtml] = useState(() => renderHTML(value ?? '', keyLabelMap));
|
||||
@ -443,7 +448,13 @@ export function TextArea(props) {
|
||||
dangerouslySetInnerHTML={{ __html: html }}
|
||||
/>
|
||||
{!disabled ? (
|
||||
<VariableSelect options={options} setOptions={setOptions} onInsert={onInsert} changeOnSelect={changeOnSelect} />
|
||||
<VariableSelect
|
||||
options={options}
|
||||
setOptions={setOptions}
|
||||
onInsert={onInsert}
|
||||
changeOnSelect={changeOnSelect}
|
||||
fieldNames={fieldNames || defaultFieldNames}
|
||||
/>
|
||||
) : null}
|
||||
</Space.Compact>,
|
||||
);
|
||||
|
@ -10,6 +10,7 @@
|
||||
import { connect, mapReadPretty } from '@formily/react';
|
||||
import React, { createContext, useContext } from 'react';
|
||||
|
||||
import { withDynamicSchemaProps } from '../../../hoc/withDynamicSchemaProps';
|
||||
import { Input } from './Input';
|
||||
import { JSONInput } from './JSONInput';
|
||||
import { RawTextArea } from './RawTextArea';
|
||||
@ -32,7 +33,7 @@ export function Variable() {
|
||||
|
||||
Variable.Input = connect(Input);
|
||||
|
||||
Variable.TextArea = connect(TextArea, mapReadPretty(TextArea.ReadPretty));
|
||||
Variable.TextArea = withDynamicSchemaProps(connect(TextArea, mapReadPretty(TextArea.ReadPretty)));
|
||||
|
||||
Variable.RawTextArea = connect(RawTextArea);
|
||||
|
||||
|
@ -28,6 +28,7 @@ export const useCustomRequestVariableOptions = () => {
|
||||
const [fields, userFields] = useMemo(() => {
|
||||
return [compile(fieldsOptions), compile(userFieldOptions)];
|
||||
}, [fieldsOptions, userFieldOptions]);
|
||||
|
||||
return useMemo(() => {
|
||||
return [
|
||||
recordData && {
|
||||
|
@ -7,8 +7,24 @@
|
||||
* For more information, please refer to: https://www.nocobase.com/agreement.
|
||||
*/
|
||||
|
||||
import { useCustomRequestVariableOptions } from '../hooks/useCustomRequestVariableOptions';
|
||||
import { generateNTemplate } from '../locale';
|
||||
|
||||
const fieldNames = {
|
||||
value: 'name',
|
||||
label: 'title',
|
||||
};
|
||||
|
||||
const useVariableProps = () => {
|
||||
const scope = useCustomRequestVariableOptions();
|
||||
|
||||
return {
|
||||
scope,
|
||||
fieldNames,
|
||||
useTypedConstant: true,
|
||||
};
|
||||
};
|
||||
|
||||
export const CustomRequestConfigurationFieldsSchema = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
@ -42,14 +58,9 @@ export const CustomRequestConfigurationFieldsSchema = {
|
||||
required: true,
|
||||
title: generateNTemplate('URL'),
|
||||
'x-decorator': 'FormItem',
|
||||
'x-component': 'Variable.RawTextArea',
|
||||
'x-component': 'Variable.TextArea',
|
||||
'x-use-component-props': useVariableProps,
|
||||
'x-component-props': {
|
||||
scope: '{{useCustomRequestVariableOptions}}',
|
||||
autoSize: true,
|
||||
fieldNames: {
|
||||
value: 'name',
|
||||
label: 'title',
|
||||
},
|
||||
placeholder: 'https://www.nocobase.com',
|
||||
},
|
||||
},
|
||||
@ -77,15 +88,8 @@ export const CustomRequestConfigurationFieldsSchema = {
|
||||
value: {
|
||||
type: 'string',
|
||||
'x-decorator': 'FormItem',
|
||||
'x-component': 'Variable.Input',
|
||||
'x-component-props': {
|
||||
scope: '{{useCustomRequestVariableOptions}}',
|
||||
fieldNames: {
|
||||
value: 'name',
|
||||
label: 'title',
|
||||
},
|
||||
useTypedConstant: true,
|
||||
},
|
||||
'x-component': 'Variable.TextArea',
|
||||
'x-use-component-props': useVariableProps,
|
||||
},
|
||||
remove: {
|
||||
type: 'void',
|
||||
@ -127,15 +131,8 @@ export const CustomRequestConfigurationFieldsSchema = {
|
||||
value: {
|
||||
type: 'string',
|
||||
'x-decorator': 'FormItem',
|
||||
'x-component': 'Variable.Input',
|
||||
'x-component-props': {
|
||||
scope: '{{useCustomRequestVariableOptions}}',
|
||||
fieldNames: {
|
||||
value: 'name',
|
||||
label: 'title',
|
||||
},
|
||||
useTypedConstant: true,
|
||||
},
|
||||
'x-component': 'Variable.TextArea',
|
||||
'x-use-component-props': useVariableProps,
|
||||
},
|
||||
remove: {
|
||||
type: 'void',
|
||||
|
@ -0,0 +1,42 @@
|
||||
/**
|
||||
* This file is part of the NocoBase (R) project.
|
||||
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
||||
* Authors: NocoBase Team.
|
||||
*
|
||||
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
||||
* For more information, please refer to: https://www.nocobase.com/agreement.
|
||||
*/
|
||||
|
||||
import { getParsedValue } from '../actions/send';
|
||||
|
||||
describe('getParsedValue', () => {
|
||||
it('should correctly parse simple templates', () => {
|
||||
const value = '{{name}} is {{age}} years old';
|
||||
const variables = { name: 'Zhang San', age: 18 };
|
||||
expect(getParsedValue(value, variables)).toBe('Zhang San is 18 years old');
|
||||
});
|
||||
|
||||
it('should correctly parse that the template has just one variable', () => {
|
||||
const value = '{{name}}';
|
||||
const variables = { name: 'Zhang San' };
|
||||
expect(getParsedValue(value, variables)).toBe('Zhang San');
|
||||
});
|
||||
|
||||
it('should handle nested objects', () => {
|
||||
const value = "{{user.name}}'s email is {{user.email}}";
|
||||
const variables = { user: { name: 'Li Si', email: 'lisi@example.com' } };
|
||||
expect(getParsedValue(value, variables)).toBe("Li Si's email is lisi@example.com");
|
||||
});
|
||||
|
||||
it('should handle arrays', () => {
|
||||
const value = '{{fruits.0}} and {{fruits.1}}';
|
||||
const variables = { fruits: ['apple', 'banana'] };
|
||||
expect(getParsedValue(value, variables)).toBe('apple and banana');
|
||||
});
|
||||
|
||||
it('should handle undefined variables', () => {
|
||||
const value = '{{name}} and {{undefinedVar}}';
|
||||
const variables = { name: 'Wang Wu' };
|
||||
expect(getParsedValue(value, variables)).toBe('Wang Wu and ');
|
||||
});
|
||||
});
|
@ -55,6 +55,14 @@ const getCurrentUserAppends = (str: string, user) => {
|
||||
.filter(Boolean);
|
||||
};
|
||||
|
||||
export const getParsedValue = (value, variables) => {
|
||||
const template = parse(value);
|
||||
template.parameters.forEach(({ key }) => {
|
||||
appendArrayColumn(variables, key);
|
||||
});
|
||||
return template(variables);
|
||||
};
|
||||
|
||||
export async function send(this: CustomRequestPlugin, ctx: Context, next: Next) {
|
||||
const resourceName = ctx.action.resourceName;
|
||||
const { filterByTk, values = {} } = ctx.action.params;
|
||||
@ -146,25 +154,17 @@ export async function send(this: CustomRequestPlugin, ctx: Context, next: Next)
|
||||
$nToken: ctx.getBearerToken(),
|
||||
};
|
||||
|
||||
const getParsedValue = (value) => {
|
||||
const template = parse(value);
|
||||
template.parameters.forEach(({ key }) => {
|
||||
appendArrayColumn(variables, key);
|
||||
});
|
||||
return template(variables);
|
||||
};
|
||||
|
||||
const axiosRequestConfig = {
|
||||
baseURL: ctx.origin,
|
||||
...options,
|
||||
url: getParsedValue(url),
|
||||
url: getParsedValue(url, variables),
|
||||
headers: {
|
||||
Authorization: 'Bearer ' + ctx.getBearerToken(),
|
||||
...getHeaders(ctx.headers),
|
||||
...omitNullAndUndefined(getParsedValue(arrayToObject(headers))),
|
||||
...omitNullAndUndefined(getParsedValue(arrayToObject(headers), variables)),
|
||||
},
|
||||
params: getParsedValue(arrayToObject(params)),
|
||||
data: getParsedValue(data),
|
||||
params: getParsedValue(arrayToObject(params), variables),
|
||||
data: getParsedValue(data, variables),
|
||||
};
|
||||
|
||||
console.log(axiosRequestConfig);
|
||||
|
@ -85,7 +85,14 @@ test('Collection event Add Data Trigger, determines that the trigger node single
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.press('ControlOrMeta+ArrowRight');
|
||||
await page.keyboard.type(`=='${conditionalRightConstant}'`, { delay: 100 });
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.press('ArrowRight');
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.pressSequentially(`=='${conditionalRightConstant}'`, { delay: 50 });
|
||||
await expect(conditionNode.conditionExpressionEditBox).toHaveText(
|
||||
`Trigger variables / Trigger data / ${triggerNodeFieldDisplayName}=='${conditionalRightConstant}'`,
|
||||
);
|
||||
@ -202,7 +209,14 @@ test('Collection event Add Data Trigger, determines that the trigger node single
|
||||
await page.getByRole('menuitemcheckbox', { name: triggerNodeFieldDisplayName }).click();
|
||||
const conditionalRightConstant = faker.lorem.words();
|
||||
await page.waitForTimeout(500);
|
||||
await page.keyboard.type(`=='${conditionalRightConstant}'`, { delay: 100 });
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.press('ArrowRight');
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.pressSequentially(`=='${conditionalRightConstant}'`, { delay: 50 });
|
||||
await expect(conditionNode.conditionExpressionEditBox).toHaveText(
|
||||
`Trigger variables / Trigger data / ${triggerNodeFieldDisplayName}=='${conditionalRightConstant}'`,
|
||||
);
|
||||
@ -322,7 +336,14 @@ test('Collection event Add Data Trigger, determines that the trigger node single
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.press('ControlOrMeta+ArrowRight');
|
||||
await page.keyboard.type(`!='${conditionalRightConstant}'`, { delay: 100 });
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.press('ArrowRight');
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.pressSequentially(`!='${conditionalRightConstant}'`, { delay: 50 });
|
||||
await expect(conditionNode.conditionExpressionEditBox).toHaveText(
|
||||
`Trigger variables / Trigger data / ${triggerNodeFieldDisplayName}!='${conditionalRightConstant}'`,
|
||||
);
|
||||
@ -439,7 +460,14 @@ test('Collection event Add Data Trigger, determines that the trigger node single
|
||||
await page.getByRole('menuitemcheckbox', { name: triggerNodeFieldDisplayName }).click();
|
||||
const conditionalRightConstant = faker.lorem.words();
|
||||
await page.waitForTimeout(500);
|
||||
await page.keyboard.type(`!='${conditionalRightConstant}'`, { delay: 100 });
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.press('ArrowRight');
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.pressSequentially(`!='${conditionalRightConstant}'`, { delay: 50 });
|
||||
await expect(conditionNode.conditionExpressionEditBox).toHaveText(
|
||||
`Trigger variables / Trigger data / ${triggerNodeFieldDisplayName}!='${conditionalRightConstant}'`,
|
||||
);
|
||||
@ -579,7 +607,14 @@ test('Collection event add data trigger, determine the trigger node integer vari
|
||||
await page.getByRole('menuitemcheckbox', { name: 'Trigger data' }).click();
|
||||
await page.getByRole('menuitemcheckbox', { name: triggerNodeFieldDisplayName }).click();
|
||||
await page.waitForTimeout(500);
|
||||
await page.keyboard.type('==', { delay: 50 });
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.press('ArrowRight');
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.pressSequentially('==', { delay: 50 });
|
||||
await page.getByLabel('variable-button').click();
|
||||
await page.getByRole('menuitemcheckbox', { name: 'Node result' }).click();
|
||||
await page.getByRole('menuitemcheckbox', { name: preQueryRecordNodeTitle }).click();
|
||||
@ -730,7 +765,14 @@ test('Collection event add data trigger, determine trigger node integer variable
|
||||
await page.getByRole('menuitemcheckbox', { name: 'Trigger data' }).click();
|
||||
await page.getByRole('menuitemcheckbox', { name: triggerNodeFieldDisplayName }).click();
|
||||
await page.waitForTimeout(500);
|
||||
await page.keyboard.type('==', { delay: 50 });
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.press('ArrowRight');
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.pressSequentially('==', { delay: 50 });
|
||||
await page.getByLabel('variable-button').click();
|
||||
await page.getByRole('menuitemcheckbox', { name: 'Node result' }).click();
|
||||
await page.getByRole('menuitemcheckbox', { name: preQueryRecordNodeTitle }).click();
|
||||
@ -871,7 +913,14 @@ test('Collection event add data trigger, determine trigger node integer variable
|
||||
await page.getByRole('menuitemcheckbox', { name: 'Trigger data' }).click();
|
||||
await page.getByRole('menuitemcheckbox', { name: triggerNodeFieldDisplayName }).click();
|
||||
await page.waitForTimeout(500);
|
||||
await page.keyboard.type('!=', { delay: 50 });
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.press('ArrowRight');
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.pressSequentially('!=', { delay: 50 });
|
||||
await page.getByLabel('variable-button').click();
|
||||
await page.getByRole('menuitemcheckbox', { name: 'Node result' }).click();
|
||||
await page.getByRole('menuitemcheckbox', { name: preQueryRecordNodeTitle }).click();
|
||||
@ -1016,7 +1065,14 @@ test('Collection event add data trigger, determine the trigger node integer vari
|
||||
await page.getByRole('menuitemcheckbox', { name: triggerNodeFieldDisplayName }).click();
|
||||
const conditionalRightConstant = faker.lorem.words();
|
||||
await page.waitForTimeout(500);
|
||||
await page.keyboard.type(`!='${conditionalRightConstant}'`, { delay: 50 });
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.press('ArrowRight');
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.pressSequentially(`!='${conditionalRightConstant}'`, { delay: 50 });
|
||||
await expect(conditionNode.conditionExpressionEditBox).toHaveText(
|
||||
`Trigger variables / Trigger data / ${triggerNodeFieldDisplayName}!='${conditionalRightConstant}'`,
|
||||
);
|
||||
|
@ -12,13 +12,9 @@ import {
|
||||
CalculationNode,
|
||||
CollectionTriggerNode,
|
||||
ConditionBranchNode,
|
||||
ConditionYesNode,
|
||||
QueryRecordNode,
|
||||
apiCreateWorkflow,
|
||||
apiCreateWorkflowNode,
|
||||
apiDeleteWorkflow,
|
||||
apiGetWorkflow,
|
||||
apiGetWorkflowNode,
|
||||
apiGetWorkflowNodeExecutions,
|
||||
apiUpdateWorkflowTrigger,
|
||||
appendJsonCollectionName,
|
||||
@ -83,7 +79,14 @@ test('Collection event add data trigger, determine trigger node integer field va
|
||||
await page.getByRole('menuitemcheckbox', { name: triggerNodeFieldDisplayName }).click();
|
||||
const conditionalRightConstant = faker.number.int({ max: 1000 });
|
||||
await page.waitForTimeout(500);
|
||||
await page.keyboard.type(`==${conditionalRightConstant}`, { delay: 50 });
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.press('ArrowRight');
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.pressSequentially(`==${conditionalRightConstant}`, { delay: 50 });
|
||||
await expect(conditionNode.conditionExpressionEditBox).toHaveText(
|
||||
`Trigger variables / Trigger data / ${triggerNodeFieldDisplayName}==${conditionalRightConstant}`,
|
||||
);
|
||||
@ -200,7 +203,14 @@ test('Collection event Add Data Trigger, determines that the trigger node intege
|
||||
await page.getByRole('menuitemcheckbox', { name: triggerNodeFieldDisplayName }).click();
|
||||
const conditionalRightConstant = faker.number.int({ max: 1000 });
|
||||
await page.waitForTimeout(500);
|
||||
await page.keyboard.type(`==${conditionalRightConstant}`, { delay: 50 });
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.press('ArrowRight');
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.pressSequentially(`==${conditionalRightConstant}`, { delay: 50 });
|
||||
await expect(conditionNode.conditionExpressionEditBox).toHaveText(
|
||||
`Trigger variables / Trigger data / ${triggerNodeFieldDisplayName}==${conditionalRightConstant}`,
|
||||
);
|
||||
@ -314,7 +324,14 @@ test('Collection event Add Data Trigger, determines that the trigger node intege
|
||||
await page.getByRole('menuitemcheckbox', { name: triggerNodeFieldDisplayName }).click();
|
||||
const conditionalRightConstant = faker.number.int({ max: 1000 });
|
||||
await page.waitForTimeout(500);
|
||||
await page.keyboard.type(`!=${conditionalRightConstant}`, { delay: 50 });
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.press('ArrowRight');
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.pressSequentially(`!=${conditionalRightConstant}`, { delay: 50 });
|
||||
await expect(conditionNode.conditionExpressionEditBox).toHaveText(
|
||||
`Trigger variables / Trigger data / ${triggerNodeFieldDisplayName}!=${conditionalRightConstant}`,
|
||||
);
|
||||
@ -428,7 +445,14 @@ test('Collection event add data trigger, determines that the trigger node intege
|
||||
await page.getByRole('menuitemcheckbox', { name: triggerNodeFieldDisplayName }).click();
|
||||
const conditionalRightConstant = faker.number.int({ max: 1000 });
|
||||
await page.waitForTimeout(500);
|
||||
await page.keyboard.type(`!=${conditionalRightConstant}`, { delay: 50 });
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.press('ArrowRight');
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.pressSequentially(`!=${conditionalRightConstant}`, { delay: 50 });
|
||||
await expect(conditionNode.conditionExpressionEditBox).toHaveText(
|
||||
`Trigger variables / Trigger data / ${triggerNodeFieldDisplayName}!=${conditionalRightConstant}`,
|
||||
);
|
||||
|
@ -80,7 +80,14 @@ test('Collection event Add Data Trigger, Formula engine, determines that the tri
|
||||
await page.getByRole('menuitemcheckbox', { name: triggerNodeFieldDisplayName }).click();
|
||||
const conditionalRightConstant = faker.string.alphanumeric(10);
|
||||
await page.waitForTimeout(500);
|
||||
await page.keyboard.type(`=='${conditionalRightConstant}'`, { delay: 50 });
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.press('ArrowRight');
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.pressSequentially(`=='${conditionalRightConstant}'`, { delay: 50 });
|
||||
await expect(conditionNode.conditionExpressionEditBox).toHaveText(
|
||||
`Trigger variables / Trigger data / ${triggerNodeFieldDisplayName}=='${conditionalRightConstant}'`,
|
||||
);
|
||||
@ -166,7 +173,14 @@ test('Collection event Add Data Trigger, Formula engine, determines that the tri
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.press('ControlOrMeta+ArrowRight');
|
||||
await page.keyboard.type(`=='${conditionalRightConstant}'`, { delay: 100 });
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.press('ArrowRight');
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.pressSequentially(`=='${conditionalRightConstant}'`, { delay: 50 });
|
||||
await expect(conditionNode.conditionExpressionEditBox).toHaveText(
|
||||
`Trigger variables / Trigger data / ${triggerNodeFieldDisplayName}=='${conditionalRightConstant}'`,
|
||||
);
|
||||
@ -247,7 +261,14 @@ test('Collection event Add Data Trigger, Formula engine, determines that the tri
|
||||
await page.getByRole('menuitemcheckbox', { name: triggerNodeFieldDisplayName }).click();
|
||||
const conditionalRightConstant = faker.string.alphanumeric(10);
|
||||
await page.waitForTimeout(500);
|
||||
await page.keyboard.type(`!='${conditionalRightConstant}'`, { delay: 50 });
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.press('ArrowRight');
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.pressSequentially(`!='${conditionalRightConstant}'`, { delay: 50 });
|
||||
await expect(conditionNode.conditionExpressionEditBox).toHaveText(
|
||||
`Trigger variables / Trigger data / ${triggerNodeFieldDisplayName}!='${conditionalRightConstant}'`,
|
||||
);
|
||||
@ -329,7 +350,14 @@ test('Collection event Add Data Trigger, Formula engine, determines that the tri
|
||||
await page.getByRole('menuitemcheckbox', { name: triggerNodeFieldDisplayName }).click();
|
||||
const conditionalRightConstant = faker.string.alphanumeric(10);
|
||||
await page.waitForTimeout(500);
|
||||
await page.keyboard.type(`!='${conditionalRightConstant}'`, { delay: 50 });
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.press('ArrowRight');
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.pressSequentially(`!='${conditionalRightConstant}'`, { delay: 50 });
|
||||
await expect(conditionNode.conditionExpressionEditBox).toHaveText(
|
||||
`Trigger variables / Trigger data / ${triggerNodeFieldDisplayName}!='${conditionalRightConstant}'`,
|
||||
);
|
||||
@ -437,7 +465,14 @@ test('Collection event add data trigger, Formula engine, determine the trigger n
|
||||
await page.getByRole('menuitemcheckbox', { name: 'Trigger data' }).click();
|
||||
await page.getByRole('menuitemcheckbox', { name: triggerNodeFieldDisplayName }).click();
|
||||
await page.waitForTimeout(500);
|
||||
await page.keyboard.type('==', { delay: 50 });
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.press('ArrowRight');
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.pressSequentially(`==`, { delay: 50 });
|
||||
await page.getByLabel('variable-button').click();
|
||||
await page.getByRole('menuitemcheckbox', { name: 'Node result' }).click();
|
||||
await page.getByRole('menuitemcheckbox', { name: preQueryRecordNodeTitle }).click();
|
||||
@ -548,7 +583,14 @@ test('Collection event add data trigger, Formula engine, determine trigger node
|
||||
await page.getByRole('menuitemcheckbox', { name: 'Trigger data' }).click();
|
||||
await page.getByRole('menuitemcheckbox', { name: triggerNodeFieldDisplayName }).click();
|
||||
await page.waitForTimeout(500);
|
||||
await page.keyboard.type('==', { delay: 50 });
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.press('ArrowRight');
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.pressSequentially(`==`, { delay: 50 });
|
||||
await page.getByLabel('variable-button').click();
|
||||
await page.getByRole('menuitemcheckbox', { name: 'Node result' }).click();
|
||||
await page.getByRole('menuitemcheckbox', { name: preQueryRecordNodeTitle }).click();
|
||||
@ -657,7 +699,14 @@ test('Collection event add data trigger, Formula engine, determine trigger node
|
||||
await page.getByRole('menuitemcheckbox', { name: 'Trigger data' }).click();
|
||||
await page.getByRole('menuitemcheckbox', { name: triggerNodeFieldDisplayName }).click();
|
||||
await page.waitForTimeout(500);
|
||||
await page.keyboard.type('!=', { delay: 50 });
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.press('ArrowRight');
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.pressSequentially(`!=`, { delay: 50 });
|
||||
await page.getByLabel('variable-button').click();
|
||||
await page.getByRole('menuitemcheckbox', { name: 'Node result' }).click();
|
||||
await page.getByRole('menuitemcheckbox', { name: preQueryRecordNodeTitle }).click();
|
||||
@ -768,7 +817,14 @@ test('Collection event add data trigger, Formula engine, determine the trigger n
|
||||
await page.getByRole('menuitemcheckbox', { name: 'Trigger data' }).click();
|
||||
await page.getByRole('menuitemcheckbox', { name: triggerNodeFieldDisplayName }).click();
|
||||
await page.waitForTimeout(500);
|
||||
await page.keyboard.type('!=', { delay: 50 });
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.press('ArrowRight');
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.pressSequentially(`!=`, { delay: 50 });
|
||||
await page.getByLabel('variable-button').click();
|
||||
await page.getByRole('menuitemcheckbox', { name: 'Node result' }).click();
|
||||
await page.getByRole('menuitemcheckbox', { name: preQueryRecordNodeTitle }).click();
|
||||
|
@ -9,16 +9,11 @@
|
||||
|
||||
import { faker } from '@faker-js/faker';
|
||||
import {
|
||||
CalculationNode,
|
||||
CollectionTriggerNode,
|
||||
ConditionBranchNode,
|
||||
ConditionYesNode,
|
||||
QueryRecordNode,
|
||||
apiCreateWorkflow,
|
||||
apiCreateWorkflowNode,
|
||||
apiDeleteWorkflow,
|
||||
apiGetWorkflow,
|
||||
apiGetWorkflowNode,
|
||||
apiGetWorkflowNodeExecutions,
|
||||
apiUpdateWorkflowTrigger,
|
||||
appendJsonCollectionName,
|
||||
@ -83,7 +78,14 @@ test('Collection event add data trigger, Math engine, determine trigger node int
|
||||
await page.getByRole('menuitemcheckbox', { name: triggerNodeFieldDisplayName }).click();
|
||||
const conditionalRightConstant = faker.number.int({ max: 1000 });
|
||||
await page.waitForTimeout(500);
|
||||
await page.keyboard.type(`==${conditionalRightConstant}`, { delay: 50 });
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.press('ArrowRight');
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.pressSequentially(`==${conditionalRightConstant}`, { delay: 50 });
|
||||
await expect(conditionNode.conditionExpressionEditBox).toHaveText(
|
||||
`Trigger variables / Trigger data / ${triggerNodeFieldDisplayName}==${conditionalRightConstant}`,
|
||||
);
|
||||
@ -167,7 +169,14 @@ test('Collection event Add Data Trigger, Math engine, determines that the trigge
|
||||
await page.getByRole('menuitemcheckbox', { name: triggerNodeFieldDisplayName }).click();
|
||||
const conditionalRightConstant = faker.number.int({ max: 1000 });
|
||||
await page.waitForTimeout(500);
|
||||
await page.keyboard.type(`==${conditionalRightConstant}`, { delay: 50 });
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.press('ArrowRight');
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.pressSequentially(`==${conditionalRightConstant}`, { delay: 50 });
|
||||
await expect(conditionNode.conditionExpressionEditBox).toHaveText(
|
||||
`Trigger variables / Trigger data / ${triggerNodeFieldDisplayName}==${conditionalRightConstant}`,
|
||||
);
|
||||
@ -250,7 +259,14 @@ test('Collection event Add Data Trigger, Math engine, determines that the trigge
|
||||
await page.getByRole('menuitemcheckbox', { name: triggerNodeFieldDisplayName }).click();
|
||||
const conditionalRightConstant = faker.number.int({ max: 1000 });
|
||||
await page.waitForTimeout(500);
|
||||
await page.keyboard.type(`!=${conditionalRightConstant}`, { delay: 50 });
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.press('ArrowRight');
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.pressSequentially(`!=${conditionalRightConstant}`, { delay: 50 });
|
||||
await expect(conditionNode.conditionExpressionEditBox).toHaveText(
|
||||
`Trigger variables / Trigger data / ${triggerNodeFieldDisplayName}!=${conditionalRightConstant}`,
|
||||
);
|
||||
@ -333,7 +349,14 @@ test('Collection event add data trigger, Math engine, determines that the trigge
|
||||
await page.getByRole('menuitemcheckbox', { name: triggerNodeFieldDisplayName }).click();
|
||||
const conditionalRightConstant = faker.number.int({ max: 1000 });
|
||||
await page.waitForTimeout(500);
|
||||
await page.keyboard.type(`!=${conditionalRightConstant}`, { delay: 50 });
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.press('ArrowRight');
|
||||
await page
|
||||
.getByLabel('block-item-WorkflowVariableTextArea-workflows-Condition expression')
|
||||
.getByLabel('textbox')
|
||||
.pressSequentially(`!=${conditionalRightConstant}`, { delay: 50 });
|
||||
await expect(conditionNode.conditionExpressionEditBox).toHaveText(
|
||||
`Trigger variables / Trigger data / ${triggerNodeFieldDisplayName}!=${conditionalRightConstant}`,
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user