PromucFlow_constructor/app/client/test/factories/Actions/API.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

75 lines
1.6 KiB
TypeScript

import * as Factory from "factory.ts";
import type { ApiAction } from "entities/Action";
import { PaginationType, PluginPackageName, PluginType } from "entities/Action";
import { PluginIDs } from "test/factories/MockPluginsState";
export const APIFactory = Factory.Sync.makeFactory<ApiAction>({
name: Factory.each((i) => `Api${i + 1}`),
id: "api_id",
pageId: "page_id",
pluginId: PluginIDs[PluginPackageName.REST_API],
pluginType: PluginType.API,
workspaceId: "workspaceId",
actionConfiguration: {
timeoutInMillisecond: 10000,
paginationType: PaginationType.NONE,
headers: [
{
key: "",
value: "",
},
{
key: "",
value: "",
},
],
encodeParamsToggle: true,
queryParameters: [
{
key: "",
value: "",
},
{
key: "",
value: "",
},
],
body: "",
bodyFormData: [],
httpMethod: "GET",
httpVersion: "HTTP11",
pluginSpecifiedTemplates: [
{
value: true,
},
],
formData: {
apiContentType: "none",
},
},
cacheResponse: "",
datasource: {
userPermissions: [],
name: "DEFAULT_REST_DATASOURCE",
pluginId: PluginIDs[PluginPackageName.REST_API],
workspaceId: "workspaceId",
invalids: [],
messages: [],
isValid: true,
datasourceConfiguration: { url: "www.mock-api.appsmith.com" },
},
dynamicBindingPathList: [],
executeOnLoad: false,
invalids: [],
isValid: true,
jsonPathKeys: [],
messages: [],
userPermissions: [
"read:actions",
"delete:actions",
"execute:actions",
"manage:actions",
],
confirmBeforeExecute: false,
});