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

48 lines
1.3 KiB
TypeScript
Raw Normal View History

import * as Factory from "factory.ts";
import type { QueryAction } from "entities/Action";
import { PaginationType, PluginPackageName, PluginType } from "entities/Action";
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 PostgresFactory = Factory.Sync.makeFactory<QueryAction>({
cacheResponse: "",
id: "query_id",
baseId: "query_base_id",
workspaceId: "workspaceId",
applicationId: "applicationId",
pluginType: PluginType.DB,
pluginId: PluginIDs[PluginPackageName.POSTGRES],
name: Factory.each((i) => `Query${i + 1}`),
datasource: {
id: "PostgresDatasourceID",
name: "ExampleDatabase",
pluginId: PluginIDs[PluginPackageName.POSTGRES],
},
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,
actionConfiguration: {
timeoutInMillisecond: 10000,
paginationType: PaginationType.NONE,
body: "select * from public.users limit 10",
pluginSpecifiedTemplates: [
{
key: "preparedStatement",
value: false,
},
],
},
executeOnLoad: true,
dynamicBindingPathList: [],
isValid: true,
invalids: [],
messages: [],
jsonPathKeys: [],
confirmBeforeExecute: false,
userPermissions: [
"read:actions",
"delete:actions",
"execute:actions",
"manage:actions",
],
});