Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/client/cypress/limited-tests.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# To run only limited tests - give the spec names in below format:
cypress/e2e/Regression/ClientSide/Templates/Fork_Template_spec.js
cypress/e2e/Regression/ServerSide/ApiTests/API_Edit_spec.js
cypress/e2e/Regression/ClientSide/VisualTests/JSEditorIndent_spec.js
Comment on lines +2 to +3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Missing test files referenced in limited-tests.txt

The test files specified in limited-tests.txt do not exist in the codebase:

  • cypress/e2e/Regression/ServerSide/ApiTests/API_Edit_spec.js
  • cypress/e2e/Regression/ClientSide/VisualTests/JSEditorIndent_spec.js
🔗 Analysis chain

Verify the existence and implementation of the new test files

Let's ensure the new test files exist and follow the Cypress testing guidelines.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence and content of the new test files

# Check if the files exist
echo "Checking if test files exist..."
for file in "cypress/e2e/Regression/ServerSide/ApiTests/API_Edit_spec.js" "cypress/e2e/Regression/ClientSide/VisualTests/JSEditorIndent_spec.js"; do
  if [ -f "$file" ]; then
    echo "Found: $file"
    
    # Check for prohibited practices
    echo "Checking $file for best practices..."
    
    # Check for cy.wait usage
    rg "cy\.wait" "$file" || echo "✓ No cy.wait found"
    
    # Check for cy.pause usage
    rg "cy\.pause" "$file" || echo "✓ No cy.pause found"
    
    # Check for agHelper.sleep usage
    rg "agHelper\.sleep" "$file" || echo "✓ No agHelper.sleep found"
    
    # Check for it.only usage
    rg "it\.only" "$file" || echo "✓ No it.only found"
    
    # Check for after/afterEach hooks
    rg "after(Each)?\s*\(" "$file" || echo "✓ No after/afterEach hooks found"
    
    echo "---"
  else
    echo "Missing: $file"
  fi
done

Length of output: 833

# For running all specs - uncomment below:
#cypress/e2e/**/**/*

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const PluginActionForm = () => {
const { plugin } = usePluginActionContext();

return (
<Flex flex="1" overflow="auto" p="spaces-4" w="100%">
<Flex flex="1" overflow="hidden" p="spaces-4" w="100%">
{plugin.uiComponent === UIComponentTypes.ApiEditorForm && (
<APIEditorForm />
)}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
import React from "react";
import { Tab, TabsList } from "@appsmith/ads";
import { Flex } from "@appsmith/ads";
import { type Action } from "entities/Action";
import { EditorTheme } from "components/editorComponents/CodeEditor/EditorConfig";
import { API_EDITOR_TABS } from "PluginActionEditor/constants/CommonApiConstants";
import { API_EDITOR_TAB_TITLES, createMessage } from "ee/constants/messages";

import useGetFormActionValues from "./hooks/useGetFormActionValues";
import { DatasourceConfig } from "./components/DatasourceConfig";
import { HintMessages } from "./HintMessages";
import { InfoFields } from "./InfoFields";
import KeyValueFieldArray from "components/editorComponents/form/fields/KeyValueFieldArray";
import ApiAuthentication from "./components/ApiAuthentication";
import { useSelectedFormTab } from "./hooks/useSelectedFormTab";
import { getHeadersCount, getParamsCount } from "./utils";
import * as Styled from "./styles";
import { RequestTabs } from "./RequestTabs";

interface Props {
httpMethodOptions: { value: string }[];
Expand All @@ -26,13 +19,7 @@ interface Props {
}

const CommonEditorForm = (props: Props) => {
const {
action,
bodyUIComponent,
formName,
isChangePermitted,
paginationUiComponent,
} = props;
const { action } = props;
const hintMessages = action.messages || [];
const theme = EditorTheme.LIGHT;
const {
Expand All @@ -43,93 +30,39 @@ const CommonEditorForm = (props: Props) => {
datasourceParams,
} = useGetFormActionValues();

const [currentTab, setCurrentTab] = useSelectedFormTab();
const headersCount = getHeadersCount(
actionHeaders,
datasourceHeaders,
autoGeneratedHeaders,
);
const paramsCount = getParamsCount(actionParams, datasourceHeaders);

return (
<Styled.Tabs
<Flex
data-testid={props.dataTestId}
onValueChange={setCurrentTab}
value={currentTab}
flex="1"
flexDirection="column"
gap="spaces-3"
overflow="hidden"
w="100%"
>
<Styled.FormHeader>
<InfoFields
actionName={action.name}
changePermitted={props.isChangePermitted}
formName={props.formName}
options={props.httpMethodOptions}
pluginId={action.pluginId}
theme={theme}
/>
<HintMessages hintMessages={hintMessages} />
<TabsList>
{Object.values(API_EDITOR_TABS)
.filter((tab) => {
return tab !== API_EDITOR_TABS.SETTINGS;
})
.map((tab) => (
<Tab
data-testid={`t--api-editor-${tab}`}
key={tab}
notificationCount={
tab == "HEADERS"
? headersCount
: tab == "PARAMS"
? paramsCount
: undefined
}
value={tab}
>
{createMessage(API_EDITOR_TAB_TITLES[tab])}
</Tab>
))}
</TabsList>
</Styled.FormHeader>

<Styled.TabPanel value={API_EDITOR_TABS.HEADERS}>
<DatasourceConfig
attributeName="header"
autogeneratedHeaders={autoGeneratedHeaders}
data={datasourceHeaders}
/>
<KeyValueFieldArray
actionConfig={actionHeaders}
dataTreePath={`${action.name}.config.headers`}
hideHeader
label="Headers"
name="actionConfiguration.headers"
placeholder="Value"
pushFields={isChangePermitted}
theme={theme}
/>
</Styled.TabPanel>
<Styled.TabPanel value={API_EDITOR_TABS.PARAMS}>
<DatasourceConfig attributeName={"param"} data={datasourceParams} />
<KeyValueFieldArray
actionConfig={actionParams}
dataTreePath={`${action.name}.config.queryParameters`}
hideHeader
label="Params"
name="actionConfiguration.queryParameters"
pushFields={isChangePermitted}
theme={theme}
/>
</Styled.TabPanel>
<Styled.TabPanel className="h-full" value={API_EDITOR_TABS.BODY}>
{bodyUIComponent}
</Styled.TabPanel>
<Styled.TabPanel value={API_EDITOR_TABS.PAGINATION}>
{paginationUiComponent}
</Styled.TabPanel>
<Styled.TabPanel value={API_EDITOR_TABS.AUTHENTICATION}>
<ApiAuthentication formName={formName} />
</Styled.TabPanel>
</Styled.Tabs>
<InfoFields
actionName={action.name}
changePermitted={props.isChangePermitted}
formName={props.formName}
options={props.httpMethodOptions}
pluginId={action.pluginId}
theme={theme}
/>
<HintMessages hintMessages={hintMessages} />
<RequestTabs
actionConfigurationHeaders={actionHeaders}
actionConfigurationParams={actionParams}
actionName={action.name}
autogeneratedHeaders={autoGeneratedHeaders}
bodyUIComponent={props.bodyUIComponent}
datasourceHeaders={datasourceHeaders}
datasourceParams={datasourceParams}
formName={props.formName}
paginationUiComponent={props.paginationUiComponent}
pushFields={props.isChangePermitted}
showSettings={false}
theme={theme}
/>
</Flex>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ const StyledTooltip = styled.span<{ width?: number }>`
position: absolute;
z-index: 100000;
max-width: 300px;
top: 125%;
bottom: 125%;
left: calc(-10px + ${(props) => (props.width ? props.width / 2 : 0)}px);
margin-left: -60px;

Expand All @@ -172,7 +172,7 @@ const StyledTooltip = styled.span<{ width?: number }>`
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: transparent transparent var(--ads-v2-color-bg-emphasis-max)
border-color: var(--ads-v2-color-bg-emphasis-max) transparent transparent
transparent;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import styled from "styled-components";
import { Tabs as AdsTabs, TabPanel as AdsTabPanel } from "@appsmith/ads";

export const RequestMethodSelectContainer = styled.div`
width: 100px;
Expand All @@ -11,21 +10,3 @@ export const RequestMethodSelectContainer = styled.div`
export const DatasourcePathFieldContainer = styled.div`
width: 100%;
`;

export const FormHeader = styled.div`
position: sticky;
top: calc(-1 * var(--ads-v2-spaces-4));
padding-top: var(--ads-v2-spaces-4);
margin-top: calc(-1 * var(--ads-v2-spaces-4));
z-index: var(--ads-v2-z-index-1);
background-color: var(--ads-color-background);
height: 100px;
`;

export const Tabs = styled(AdsTabs)`
height: max-content;
`;

export const TabPanel = styled(AdsTabPanel)`
margin: 0 auto;
`;
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const UQIEditorForm = () => {
alignItems="center"
data-testid="t--uqi-editor-form"
flexDirection="column"
overflowY="scroll"
w="100%"
>
<FormRender
Expand Down