PromucFlow_constructor/app/client/test/factories/Actions/JSObject.ts

117 lines
3.3 KiB
TypeScript
Raw Normal View History

import * as Factory from "factory.ts";
import type { JSCollection } from "entities/JSCollection";
import { PluginPackageName, PluginType } from "entities/Plugin";
import { PluginIDs } from "test/factories/MockPluginsState";
chore: Unify ID extraction regex from browser url (#33925) ## Description Regex update to make it compatible to extract identifiers for both Mongo ObjectIds and UUIDs. This will help us to keep the unified logic required in `pg` branch. ## Automation /ok-to-test tags="@tag.Datasource, @tag.GenerateCRUD, @tag.ImportExport, @tag.Fork, @tag.Workspace, @tag.Sanity" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/9405554200> > Commit: 3959703aab1d10e28d3b80057793476467126929 > Cypress dashboard url: <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=9405554200&attempt=2" target="_blank">Click here!</a> <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced URL path handling to support both UUID and Mongo ObjectIds. - **Refactor** - Replaced hardcoded page IDs with dynamic variables across multiple test files for improved maintainability and flexibility. - **Tests** - Updated test cases to use dynamic page IDs, ensuring consistency and easier updates in the future. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-06-11 09:44:54 +00:00
const pageId = "0123456789abcdef00000000";
export const JSObjectFactory = Factory.Sync.makeFactory<JSCollection>({
id: "js_id",
baseId: "js_base_id",
workspaceId: "workspaceId",
applicationId: "appId",
name: Factory.each((i) => `JSObject${i + 1}`),
chore: Unify ID extraction regex from browser url (#33925) ## Description Regex update to make it compatible to extract identifiers for both Mongo ObjectIds and UUIDs. This will help us to keep the unified logic required in `pg` branch. ## Automation /ok-to-test tags="@tag.Datasource, @tag.GenerateCRUD, @tag.ImportExport, @tag.Fork, @tag.Workspace, @tag.Sanity" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/9405554200> > Commit: 3959703aab1d10e28d3b80057793476467126929 > Cypress dashboard url: <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=9405554200&attempt=2" target="_blank">Click here!</a> <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced URL path handling to support both UUID and Mongo ObjectIds. - **Refactor** - Replaced hardcoded page IDs with dynamic variables across multiple test files for improved maintainability and flexibility. - **Tests** - Updated test cases to use dynamic page IDs, ensuring consistency and easier updates in the future. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-06-11 09:44:54 +00:00
pageId: pageId,
pluginId: PluginIDs[PluginPackageName.JS],
pluginType: PluginType.JS,
actions: [
{
id: "myFunc1_id",
baseId: "myFunc1_base_id",
workspaceId: "workspaceId",
applicationId: "applicationId",
pluginId: PluginIDs[PluginPackageName.JS],
name: "myFun1",
fullyQualifiedName: "JSObject1.myFun1",
chore: Unify ID extraction regex from browser url (#33925) ## Description Regex update to make it compatible to extract identifiers for both Mongo ObjectIds and UUIDs. This will help us to keep the unified logic required in `pg` branch. ## Automation /ok-to-test tags="@tag.Datasource, @tag.GenerateCRUD, @tag.ImportExport, @tag.Fork, @tag.Workspace, @tag.Sanity" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/9405554200> > Commit: 3959703aab1d10e28d3b80057793476467126929 > Cypress dashboard url: <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=9405554200&attempt=2" target="_blank">Click here!</a> <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced URL path handling to support both UUID and Mongo ObjectIds. - **Refactor** - Replaced hardcoded page IDs with dynamic variables across multiple test files for improved maintainability and flexibility. - **Tests** - Updated test cases to use dynamic page IDs, ensuring consistency and easier updates in the future. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-06-11 09:44:54 +00:00
pageId: pageId,
collectionId: "js_id",
actionConfiguration: {
timeoutInMillisecond: 10000,
body: "function (){\n\t\t//\twrite code here\n\t\t//\tthis.myVar1 = [1,2,3]\n\t}",
jsArguments: [],
},
runBehaviour: "MANUAL",
clientSideExecution: true,
dynamicBindingPathList: [
{
key: "body",
},
],
isValid: true,
invalids: [],
messages: [],
jsonPathKeys: [
"function (){\n\t\t//\twrite code here\n\t\t//\tthis.myVar1 = [1,2,3]\n\t}",
],
confirmBeforeExecute: false,
userPermissions: [
"read:actions",
"delete:actions",
"execute:actions",
"manage:actions",
],
cacheResponse: "",
chore: Introduce action isDirty map (#39872) ## Description The server now adds a isDirty map in the action object to signify if any aspect of the action is not saved (is dirty) This is needed for the EE change https://github.com/appsmithorg/appsmith-ee/pull/6713 https://www.notion.so/appsmith/Implement-save-button-for-AI-Query-1b9fe271b0e2808285dcc797ad281141?pvs=4 ## Automation /ok-to-test tags="@tag.Datasource" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/14029254723> > Commit: 4321d95d427a1dfd07aedecd3731390ed0a4688e > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=14029254723&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.Datasource` > Spec: > <hr>Mon, 24 Mar 2025 07:51:29 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit - **New Features** - Added a capability that improves how the app retrieves a specific action from a collection based on unique identifiers, ensuring smoother interaction. - Enhanced state management in actions by introducing a new property to track the update status of schema generation, supporting more robust workflow handling. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-03-24 08:38:43 +00:00
isDirtyMap: {
SCHEMA_GENERATION: false,
},
},
{
id: "myFunc2_id",
baseId: "myFunc2_base_id",
workspaceId: "workspaceId",
applicationId: "applicationId",
pluginId: "613a26d921750e4b557a9241",
name: "myFun2",
fullyQualifiedName: "JSObject1.myFun2",
chore: Unify ID extraction regex from browser url (#33925) ## Description Regex update to make it compatible to extract identifiers for both Mongo ObjectIds and UUIDs. This will help us to keep the unified logic required in `pg` branch. ## Automation /ok-to-test tags="@tag.Datasource, @tag.GenerateCRUD, @tag.ImportExport, @tag.Fork, @tag.Workspace, @tag.Sanity" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/9405554200> > Commit: 3959703aab1d10e28d3b80057793476467126929 > Cypress dashboard url: <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=9405554200&attempt=2" target="_blank">Click here!</a> <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced URL path handling to support both UUID and Mongo ObjectIds. - **Refactor** - Replaced hardcoded page IDs with dynamic variables across multiple test files for improved maintainability and flexibility. - **Tests** - Updated test cases to use dynamic page IDs, ensuring consistency and easier updates in the future. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-06-11 09:44:54 +00:00
pageId: pageId,
collectionId: "660261174b59877d57fc3670",
actionConfiguration: {
timeoutInMillisecond: 10000,
body: "async function () {\n\t\t//\tuse async-await or promises\n\t\t//\tawait storeValue('varName', 'hello world')\n\t}",
jsArguments: [],
},
runBehaviour: "MANUAL",
clientSideExecution: true,
dynamicBindingPathList: [
{
key: "body",
},
],
isValid: true,
invalids: [],
messages: [],
jsonPathKeys: [
"async function () {\n\t\t//\tuse async-await or promises\n\t\t//\tawait storeValue('varName', 'hello world')\n\t}",
],
confirmBeforeExecute: false,
userPermissions: [
"read:actions",
"delete:actions",
"execute:actions",
"manage:actions",
],
cacheResponse: "",
chore: Introduce action isDirty map (#39872) ## Description The server now adds a isDirty map in the action object to signify if any aspect of the action is not saved (is dirty) This is needed for the EE change https://github.com/appsmithorg/appsmith-ee/pull/6713 https://www.notion.so/appsmith/Implement-save-button-for-AI-Query-1b9fe271b0e2808285dcc797ad281141?pvs=4 ## Automation /ok-to-test tags="@tag.Datasource" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/14029254723> > Commit: 4321d95d427a1dfd07aedecd3731390ed0a4688e > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=14029254723&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.Datasource` > Spec: > <hr>Mon, 24 Mar 2025 07:51:29 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit - **New Features** - Added a capability that improves how the app retrieves a specific action from a collection based on unique identifiers, ensuring smoother interaction. - Enhanced state management in actions by introducing a new property to track the update status of schema generation, supporting more robust workflow handling. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-03-24 08:38:43 +00:00
isDirtyMap: {
SCHEMA_GENERATION: false,
},
},
],
body: "export default {\n\tmyVar1: [],\n\tmyVar2: {},\n\tmyFun1 () {\n\t\t//\twrite code here\n\t\t//\tthis.myVar1 = [1,2,3]\n\t},\n\tasync myFun2 () {\n\t\t//\tuse async-await or promises\n\t\t//\tawait storeValue('varName', 'hello world')\n\t}\n}",
variables: [
{
name: "myVar1",
value: [],
},
{
name: "myVar2",
value: {},
},
],
userPermissions: [
"read:actions",
"delete:actions",
"execute:actions",
"manage:actions",
],
});