Skip to content

Commit

Permalink
Merge pull request #31156 from appsmithorg/release
Browse files Browse the repository at this point in the history
15/02 daily promotion
  • Loading branch information
trishaanand authored Feb 15, 2024
2 parents b3f3b7f + d350069 commit b35fb23
Show file tree
Hide file tree
Showing 98 changed files with 647 additions and 372 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import { ANVIL_EDITOR_TEST } from "../../../../support/Constants";
import {
agHelper,
homePage,
assertHelper,
anvilLayout,
locators,
wdsWidgets,
} from "../../../../support/Objects/ObjectsCore";
import { featureFlagIntercept } from "../../../../support/Objects/FeatureFlags";
import { WIDGET } from "../../../../locators/WidgetLocators";

describe(
`${ANVIL_EDITOR_TEST}: validating Widget clicks in Anvil Layout Mode`,
{ tags: ["@tag.Anvil"] },
function () {
before(() => {
// intercept features call for Anvil + WDS tests
featureFlagIntercept({
release_anvil_enabled: true,
ab_wds_enabled: true,
});
// Cleanup the canvas before each test
agHelper.SelectAllWidgets();
agHelper.PressDelete();
});
it("1. Click on widget to Select Widget", () => {
anvilLayout.DragDropAnvilWidgetNVerify(WIDGET.WDSSWITCH, 5, 20, {
skipWidgetSearch: true,
});
anvilLayout.DragDropAnvilWidgetNVerify(WIDGET.WDSSWITCH, 5, 20, {
skipWidgetSearch: true,
dropTargetDetails: {
name: "Zone1",
},
});
anvilLayout.DragDropAnvilWidgetNVerify(WIDGET.WDSBUTTON, 5, 20, {
skipWidgetSearch: true,
dropTargetDetails: {
name: "Zone1",
},
});
// deselect all widgets
agHelper.PressEscape();
agHelper.AssertElementLength(locators._selectedWidget, 0);
agHelper.GetNClick(locators._widgetByName("Button1"));
agHelper.AssertElementLength(locators._selectedWidget, 1);
agHelper.GetNClick(locators._widgetByName("Switch1"));
agHelper.AssertElementLength(locators._selectedWidget, 1);
});
it("2. Click on widgets like Switch, Checkbox to toggle selection", () => {
// deselect all widgets
agHelper.PressEscape();
agHelper
.GetNClick(wdsWidgets._switchWidgetTargetSelector("Switch1"))
.then(() => {
wdsWidgets.verifySwitchWidgetState("Switch1", "checked");
});
agHelper
.GetNClick(wdsWidgets._switchWidgetTargetSelector("Switch1"))
.then(() => {
wdsWidgets.verifySwitchWidgetState("Switch1", "unchecked");
});
anvilLayout.DragDropAnvilWidgetNVerify(WIDGET.WDSCHECKBOX, 5, 20, {
skipWidgetSearch: true,
});
wdsWidgets.verifyCheckboxWidgetState("Checkbox1", "checked");
agHelper
.GetNClick(wdsWidgets._checkboxWidgetTargetSelector("Checkbox1"))
.then(() => {
wdsWidgets.verifyCheckboxWidgetState("Checkbox1", "unchecked");
});
});
},
);
2 changes: 2 additions & 0 deletions app/client/cypress/locators/WidgetLocators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export const WIDGET = {
WDSBUTTON: "wdsbuttonwidget",
WDSTABLE: "wdstablewidget",
WDSINPUT: "wdsinputwidget",
WDSSWITCH: "wdsswitchwidget",
WDSCHECKBOX: "wdscheckboxwidget",
BUTTONNAME: (index: string) => `Button${index}`,
CODESCANNER: "codescannerwidget",
CONTAINER: "containerwidget",
Expand Down
1 change: 1 addition & 0 deletions app/client/cypress/support/Objects/ObjectsCore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ export const gsheetHelper = ObjectsRegistry.GSheetHelper;
export const widgetLocators = WIDGETSKIT;
export const communityTemplates = ObjectsRegistry.CommunityTemplates;
export const anvilLayout = ObjectsRegistry.AnvilLayout;
export const wdsWidgets = ObjectsRegistry.WDSWidgets;
export const partialImportExport = ObjectsRegistry.PartialImportExport;
9 changes: 9 additions & 0 deletions app/client/cypress/support/Objects/Registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { GsheetHelper } from "../Pages/GSheetHelper";
import { CommunityTemplates } from "../Pages/CommunityTemplates";
import { AnvilLayout } from "../Pages/AnvilLayout";
import PartialImportExport from "../Pages/PartialImportExport";
import { WDSWidgets } from "../Pages/WDSWidgets";

export class ObjectsRegistry {
private static aggregateHelper__: AggregateHelper;
Expand Down Expand Up @@ -256,6 +257,14 @@ export class ObjectsRegistry {
return ObjectsRegistry.anvilLayout__;
}

private static wdsWidgets__: WDSWidgets;
static get WDSWidgets(): WDSWidgets {
if (ObjectsRegistry.wdsWidgets__ === undefined) {
ObjectsRegistry.wdsWidgets__ = new WDSWidgets();
}
return ObjectsRegistry.wdsWidgets__;
}

private static dataManager__: DataManager;
static get DataManager(): DataManager {
if (ObjectsRegistry.dataManager__ === undefined) {
Expand Down
8 changes: 5 additions & 3 deletions app/client/cypress/support/Pages/DataSources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ export class DataSources {
_entityExplorerID = (dsName: string) =>
"[data-testid='t--entity-item-" + dsName + "']";
_stagingTab = "[data-testid='t--ds-data-filter-Staging']";
_graphQlDsFromRightPane = (dsName: string) =>
_graphQlDsHintOption = (dsName: string) =>
"//div/span[text() ='" + dsName + "']";
_imgFireStoreLogo = "//img[contains(@src, 'firestore.svg')]";
_dsVirtuosoElement = `div .t--schema-virtuoso-container`;
Expand Down Expand Up @@ -743,8 +743,10 @@ export class DataSources {
this.apiPage.EnterURL(
this.dataManager.dsValues[environment].GraphqlApiUrl_TED,
);
else if (enterOrSelectUrl == "select")
this.agHelper.GetNClick(this._graphQlDsFromRightPane(dsNameToSelect));
else if (enterOrSelectUrl == "select") {
this.agHelper.GetNClick(this.apiPage._resourceUrl);
this.agHelper.GetNClick(this._graphQlDsHintOption(dsNameToSelect));
}

this.assertHelper.AssertNetworkStatus("@createNewApi", 201);
cy.wrap("GraphQL_API" + "_" + uid).as("dsName");
Expand Down
22 changes: 22 additions & 0 deletions app/client/cypress/support/Pages/WDSWidgets.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { ObjectsRegistry } from "../Objects/Registry";

export class WDSWidgets {
private locator = ObjectsRegistry.CommonLocators;

public _switchWidgetTargetSelector = (name: string) =>
`${this.locator._widgetByName(name)} label`;
public _checkboxWidgetTargetSelector = this._switchWidgetTargetSelector;

public verifySwitchWidgetState = (
name: string,
expectedState: "checked" | "unchecked",
) => {
const switchLabelSelector = `${this.locator._widgetByName(name)} label`;
cy.get(switchLabelSelector).should(
"have.attr",
"data-state",
expectedState,
);
};
public verifyCheckboxWidgetState = this.verifySwitchWidgetState;
}
2 changes: 1 addition & 1 deletion app/client/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,7 @@ Cypress.Commands.add("startServerAndRoutes", () => {
cy.intercept("PUT", "/api/v1/actions/executeOnLoad/*").as("setExecuteOnLoad");

cy.intercept("POST", "/api/v1/actions").as("createNewApi");
cy.intercept("POST", "/api/v1/import?type=CURL&pageId=*&name=*").as(
cy.intercept("POST", "/api/v1/import?type=CURL&contextId=*&name=*").as(
"curlImport",
);
cy.intercept("DELETE", "/api/v1/actions/*").as("deleteAction");
Expand Down
8 changes: 2 additions & 6 deletions app/client/src/actions/debuggerActions.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants";
import type {
ENTITY_TYPE,
Log,
Message,
SourceEntity,
} from "entities/AppsmithConsole";
import type { Log, Message, SourceEntity } from "entities/AppsmithConsole";
import type { ENTITY_TYPE } from "@appsmith/entities/AppsmithConsole/utils";
import type { DebuggerContext } from "reducers/uiReducers/debuggerReducer";
import type { EventName } from "@appsmith/utils/analyticsUtilTypes";
import type { APP_MODE } from "entities/App";
Expand Down
2 changes: 1 addition & 1 deletion app/client/src/actions/pageActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import type { UrlDataState } from "reducers/entityReducers/appReducer";
import type { APP_MODE } from "entities/App";
import type { CanvasWidgetsReduxState } from "reducers/entityReducers/canvasWidgetsReducer";
import type { GenerateTemplatePageRequest } from "api/PageApi";
import type { ENTITY_TYPE } from "entities/AppsmithConsole";
import type { ENTITY_TYPE } from "@appsmith/entities/AppsmithConsole/utils";
import type { Replayable } from "entities/Replay/ReplayEntity/ReplayEditor";
import * as Sentry from "@sentry/react";

Expand Down
9 changes: 6 additions & 3 deletions app/client/src/api/ImportApi.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import type { AxiosPromise } from "axios";
import Api from "api/Api";
import type { ApiResponse } from "./ApiResponses";
import type { ActionParentEntityTypeInterface } from "@appsmith/entities/Engine/actionHelpers";

export interface CurlImportRequest {
type: string;
pageId: string;
contextId: string;
name: string;
curl: string;
workspaceId: string;
contextType: ActionParentEntityTypeInterface;
}

class CurlImportApi extends Api {
Expand All @@ -16,12 +18,13 @@ class CurlImportApi extends Api {
static async curlImport(
request: CurlImportRequest,
): Promise<AxiosPromise<ApiResponse>> {
const { curl, name, pageId, workspaceId } = request;
const { contextId, contextType, curl, name, workspaceId } = request;
return Api.post(CurlImportApi.curlImportURL, curl, {
type: "CURL",
pageId,
contextId,
name,
workspaceId,
contextType,
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import ActionLink from "components/editorComponents/Debugger/ActionLink";
import DatasourceLink from "components/editorComponents/Debugger/DataSourceLink";
import WidgetLink from "components/editorComponents/Debugger/WidgetLink";
import JSCollectionLink from "components/editorComponents/Debugger/JSCollectionLink";
import { ENTITY_TYPE } from "entities/AppsmithConsole";
import { ENTITY_TYPE } from "@appsmith/entities/AppsmithConsole/utils";

export const entityTypeLinkMap = {
[ENTITY_TYPE.WIDGET]: WidgetLink,
Expand Down
27 changes: 27 additions & 0 deletions app/client/src/ce/entities/AppsmithConsole/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import type { DataTreeEntity } from "entities/DataTree/dataTreeTypes";
import type { DataTreeEntityConfig } from "../DataTree/types";

export enum ENTITY_TYPE {
ACTION = "ACTION",
DATASOURCE = "DATASOURCE",
WIDGET = "WIDGET",
JSACTION = "JSACTION",
}

export enum PLATFORM_ERROR {
PLUGIN_EXECUTION = "PLUGIN_EXECUTION",
JS_FUNCTION_EXECUTION = "JS_FUNCTION_EXECUTION",
}

// export type PlatformErrorTypeValue = ValueOf<typeof PLATFORM_ERROR>;

export const getModuleInstanceInvalidErrors = (
// eslint-disable-next-line @typescript-eslint/no-unused-vars
entity: DataTreeEntity,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
entityConfig: DataTreeEntityConfig,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
propertyPath: string,
) => {
return [];
};
2 changes: 1 addition & 1 deletion app/client/src/ce/sagas/JSActionSagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import { updateCanvasWithDSL } from "@appsmith/sagas/PageSagas";
import type { JSCollectionData } from "@appsmith/reducers/entityReducers/jsActionsReducer";
import type { ApiResponse } from "api/ApiResponses";
import AppsmithConsole from "utils/AppsmithConsole";
import { ENTITY_TYPE } from "entities/AppsmithConsole";
import { ENTITY_TYPE } from "@appsmith/entities/AppsmithConsole/utils";
import LOG_TYPE from "entities/AppsmithConsole/logtype";
import type { CreateJSCollectionRequest } from "@appsmith/api/JSActionAPI";
import * as log from "loglevel";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type { ActionResponse } from "api/ActionAPI";
import { formatBytes } from "utils/helpers";
import type { SourceEntity } from "entities/AppsmithConsole";
import LOG_TYPE from "entities/AppsmithConsole/logtype";
import { ENTITY_TYPE } from "entities/AppsmithConsole";
import { ENTITY_TYPE } from "@appsmith/entities/AppsmithConsole/utils";
import ReadOnlyEditor from "components/editorComponents/ReadOnlyEditor";
import { isArray, isEmpty, isString } from "lodash";
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type CodeMirror from "codemirror";
import { ENTITY_TYPE } from "entities/AppsmithConsole";
import { ENTITY_TYPE } from "@appsmith/entities/AppsmithConsole/utils";
import type {
WidgetEntity,
ActionEntity,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PluginType } from "entities/Action";
import { ENTITY_TYPE } from "entities/AppsmithConsole";
import { ENTITY_TYPE } from "@appsmith/entities/AppsmithConsole/utils";
import React, { useCallback } from "react";
import { useDispatch, useSelector } from "react-redux";
import type { AppState } from "@appsmith/reducers";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import type {
ENTITY_TYPE,
Message,
SourceEntity,
} from "entities/AppsmithConsole";
import type { Message, SourceEntity } from "entities/AppsmithConsole";
import React, { useCallback } from "react";
import type LOG_TYPE from "entities/AppsmithConsole/logtype";
import type { Plugin } from "api/PluginApi";
import { Link } from "design-system";
import type { ENTITY_TYPE } from "@appsmith/entities/AppsmithConsole/utils";

export enum DebuggerLinkUI {
ENTITY_TYPE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,11 @@ function DebuggerTabs() {
},
];

// Do not render if response tab and header tab is selected in the bottom bar.
// Do not render if response, header or schema tab is selected in the bottom bar.
const shouldRender = !(
selectedTab === DEBUGGER_TAB_KEYS.RESPONSE_TAB ||
selectedTab === DEBUGGER_TAB_KEYS.HEADER_TAB
selectedTab === DEBUGGER_TAB_KEYS.HEADER_TAB ||
selectedTab === DEBUGGER_TAB_KEYS.SCHEMA_TAB
);

return shouldRender ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { getDependenciesFromInverseDependencies } from "./helpers";
import { useSelectedEntity, useEntityLink } from "./hooks/debuggerHooks";
import AnalyticsUtil from "utils/AnalyticsUtil";
import { thinScrollbar } from "constants/DefaultTheme";
import { ENTITY_TYPE } from "entities/AppsmithConsole";
import { ENTITY_TYPE } from "@appsmith/entities/AppsmithConsole/utils";
import { useGetEntityInfo } from "./hooks/useGetEntityInfo";
import { Button, Icon, Tooltip } from "design-system";
import { importSvg } from "design-system-old";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { DebuggerEntityLink, type EntityLinkProps } from "./DebuggerEntityLink";
import { useCallback } from "react";
import { navigateToEntity } from "actions/editorActions";
import AnalyticsUtil from "utils/AnalyticsUtil";
import { ENTITY_TYPE } from "entities/AppsmithConsole";
import { ENTITY_TYPE } from "@appsmith/entities/AppsmithConsole/utils";

export default function JSCollectionLink(props: EntityLinkProps) {
const dispatch = useDispatch();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ENTITY_TYPE } from "entities/AppsmithConsole";
import { ENTITY_TYPE } from "@appsmith/entities/AppsmithConsole/utils";
import React, { useCallback } from "react";
import { useDispatch } from "react-redux";
import AnalyticsUtil from "utils/AnalyticsUtil";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useCallback, useEffect, useState } from "react";
import { useSelector } from "react-redux";
import { useParams } from "react-router";
import type { Log } from "entities/AppsmithConsole";
import { ENTITY_TYPE } from "entities/AppsmithConsole";
import { ENTITY_TYPE } from "@appsmith/entities/AppsmithConsole/utils";
import type { AppState } from "@appsmith/reducers";
import { getWidget } from "sagas/selectors";
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { isStoredDatasource } from "entities/Action";
import { ENTITY_TYPE } from "entities/AppsmithConsole";
import { ENTITY_TYPE } from "@appsmith/entities/AppsmithConsole/utils";
import { keyBy } from "lodash";
import equal from "fast-deep-equal/es6";
import { getPluginIcon, jsIcon } from "pages/Editor/Explorer/ExplorerIcons";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ import {
import LogHelper from "./Debugger/ErrorLogs/components/LogHelper";
import LOG_TYPE from "entities/AppsmithConsole/logtype";
import type { SourceEntity, Log } from "entities/AppsmithConsole";
import { ENTITY_TYPE } from "entities/AppsmithConsole";
import { ENTITY_TYPE } from "@appsmith/entities/AppsmithConsole/utils";
import { CloseDebugger } from "./Debugger/DebuggerTabs";

const ResponseContainer = styled.div`
Expand Down
1 change: 1 addition & 0 deletions app/client/src/ee/entities/AppsmithConsole/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "ce/entities/AppsmithConsole/utils";
16 changes: 4 additions & 12 deletions app/client/src/entities/AppsmithConsole/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,10 @@ import type LOG_TYPE from "./logtype";
import type { PropertyEvaluationErrorType } from "utils/DynamicBindingUtils";
import type { PluginType } from "entities/Action";
import type { HTTP_METHOD } from "constants/ApiEditorConstants/CommonApiConstants";

export enum ENTITY_TYPE {
ACTION = "ACTION",
DATASOURCE = "DATASOURCE",
WIDGET = "WIDGET",
JSACTION = "JSACTION",
}

export enum PLATFORM_ERROR {
PLUGIN_EXECUTION = "PLUGIN_EXECUTION",
JS_FUNCTION_EXECUTION = "JS_FUNCTION_EXECUTION",
}
import type {
ENTITY_TYPE,
PLATFORM_ERROR,
} from "@appsmith/entities/AppsmithConsole/utils";

export type Methods =
| "log"
Expand Down
Loading

0 comments on commit b35fb23

Please sign in to comment.