PromucFlow_constructor/app/client/test/factories/Actions/Postgres.ts
Hetu Nandu 77955a9229
chore: IDE query url render tests (#31919)
## Description

IDE rendering tests for Query routes


Fixes #31865  

## Automation

/ok-to-test tags="@tag.IDE"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!IMPORTANT]  
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/8372729741>
> Commit: `32d0e14a69f0fef33904eab854b691112cdc6046`
> Cypress dashboard url: <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=8372729741&attempt=1"
target="_blank">Click here!</a>
> All cypress tests have passed 🎉🎉🎉

<!-- end of auto-generated comment: Cypress test results  -->



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Enhanced accessibility by adding `aria-label` to close buttons in the
IDE.
- Improved testing capabilities with new `data-testid` attributes across
various components for better identification.
- **Tests**
- Introduced comprehensive test cases for IDE functionalities including
rendering states, adding queries/APIs, and handling different screen
modes.
- Added factories for creating mock actions and states for API, Google
Sheets, Postgres, and IDE testing.
- **Chores**
- Updated and added `data-testid` attributes for improved testability
and maintenance.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-03-21 16:52:36 +05:30

44 lines
1.2 KiB
TypeScript

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";
export const PostgresFactory = Factory.Sync.makeFactory<QueryAction>({
cacheResponse: "",
id: "query_id",
workspaceId: "workspaceId",
pluginType: PluginType.DB,
pluginId: PluginIDs[PluginPackageName.POSTGRES],
name: Factory.each((i) => `Query${i + 1}`),
datasource: {
id: "PostgresDatasourceID",
name: "ExampleDatabase",
pluginId: PluginIDs[PluginPackageName.POSTGRES],
},
pageId: "page_id",
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",
],
});