From 5de5384e7fba5408562000cbddfe4b253b635f62 Mon Sep 17 00:00:00 2001 From: Hetu Nandu Date: Thu, 22 Aug 2024 14:09:52 +0530 Subject: [PATCH 01/23] Sync changes from EE excluding enterprise directory --- app/client/src/actions/jsActionActions.ts | 3 ++ app/client/src/actions/pluginActionActions.ts | 3 ++ .../src/ce/constants/ReduxActionConstants.tsx | 2 +- app/client/src/ce/sagas/JSActionSagas.ts | 31 +++++++------- .../entityReducers/datasourceReducer.ts | 2 +- .../sagas/ActionExecution/PluginActionSaga.ts | 17 ++++---- app/client/src/sagas/ActionSagas.ts | 22 +++++----- app/client/src/sagas/ApiPaneSagas.ts | 21 ++++------ app/client/src/sagas/DatasourcesSagas.ts | 40 +++++++------------ app/client/src/sagas/JSLibrarySaga.ts | 36 +++++++++++------ app/client/src/sagas/JSPaneSagas.ts | 13 +++--- app/client/src/sagas/OneClickBindingSaga.ts | 14 +++---- .../PartialExportSagas.ts | 4 +- app/client/src/sagas/QueryPaneSagas.ts | 19 ++++----- 14 files changed, 113 insertions(+), 114 deletions(-) diff --git a/app/client/src/actions/jsActionActions.ts b/app/client/src/actions/jsActionActions.ts index 00a11cd6189..099bf9937bf 100644 --- a/app/client/src/actions/jsActionActions.ts +++ b/app/client/src/actions/jsActionActions.ts @@ -8,6 +8,7 @@ import type { JSCollection } from "entities/JSCollection"; import type { CreateJSCollectionRequest } from "ee/api/JSActionAPI"; import type { EventLocation } from "ee/utils/analyticsUtilTypes"; import type { ApiResponse } from "api/ApiResponses"; +import type { ErrorPayloadType } from "../sagas/ErrorSagas"; export interface FetchJSCollectionsPayload { applicationId: string; @@ -65,6 +66,7 @@ export const copyJSCollectionSuccess = (payload: JSCollection) => { export const copyJSCollectionError = (payload: { id: string; destinationPageId: string; + error?: ErrorPayloadType; }) => { return { type: ReduxActionErrorTypes.COPY_JS_ACTION_ERROR, @@ -93,6 +95,7 @@ export const moveJSCollectionSuccess = (payload: JSCollection) => { export const moveJSCollectionError = (payload: { id: string; originalPageId: string; + error?: ErrorPayloadType; }) => { return { type: ReduxActionErrorTypes.MOVE_JS_ACTION_ERROR, diff --git a/app/client/src/actions/pluginActionActions.ts b/app/client/src/actions/pluginActionActions.ts index 611beaaa4d0..25055119a98 100644 --- a/app/client/src/actions/pluginActionActions.ts +++ b/app/client/src/actions/pluginActionActions.ts @@ -15,6 +15,7 @@ import type { ModalInfo } from "reducers/uiReducers/modalActionReducer"; import type { OtlpSpan } from "UITelemetry/generateTraces"; import type { ApiResponse } from "api/ApiResponses"; import type { JSCollection } from "entities/JSCollection"; +import type { ErrorPayloadType } from "../sagas/ErrorSagas"; export const createActionRequest = (payload: Partial) => { return { @@ -208,6 +209,7 @@ export const moveActionSuccess = (payload: Action) => { export const moveActionError = (payload: { id: string; originalPageId: string; + error?: ErrorPayloadType; }) => { return { type: ReduxActionErrorTypes.MOVE_ACTION_ERROR, @@ -236,6 +238,7 @@ export const copyActionSuccess = (payload: Action) => { export const copyActionError = (payload: { id: string; destinationPageId: string; + error?: ErrorPayloadType; }) => { return { type: ReduxActionErrorTypes.COPY_ACTION_ERROR, diff --git a/app/client/src/ce/constants/ReduxActionConstants.tsx b/app/client/src/ce/constants/ReduxActionConstants.tsx index e3c5510381f..bfa017a7a1f 100644 --- a/app/client/src/ce/constants/ReduxActionConstants.tsx +++ b/app/client/src/ce/constants/ReduxActionConstants.tsx @@ -368,7 +368,6 @@ const UserAuthActionTypes = { SAAS_GET_OAUTH_ACCESS_TOKEN: "SAAS_GET_OAUTH_ACCESS_TOKEN", GET_OAUTH_ACCESS_TOKEN: "GET_OAUTH_ACCESS_TOKEN", GET_OAUTH_ACCESS_TOKEN_SUCCESS: "GET_OAUTH_ACCESS_TOKEN_SUCCESS", - GET_OAUTH_ACCESS_TOKEN_ERROR: "GET_OAUTH_ACCESS_TOKEN_ERROR", }; const UserAuthActionErrorTypes = { CREATE_USER_ERROR: "CREATE_USER_ERROR", @@ -379,6 +378,7 @@ const UserAuthActionErrorTypes = { LOGOUT_USER_ERROR: "LOGOUT_USER_ERROR", VERIFY_INVITE_ERROR: "VERIFY_INVITE_ERROR", INVITED_USER_SIGNUP_ERROR: "INVITED_USER_SIGNUP_ERROR", + GET_OAUTH_ACCESS_TOKEN_ERROR: "GET_OAUTH_ACCESS_TOKEN_ERROR", }; const UserProfileActionTypes = { diff --git a/app/client/src/ce/sagas/JSActionSagas.ts b/app/client/src/ce/sagas/JSActionSagas.ts index a152a8acd29..44c554d987e 100644 --- a/app/client/src/ce/sagas/JSActionSagas.ts +++ b/app/client/src/ce/sagas/JSActionSagas.ts @@ -192,10 +192,14 @@ export function* copyJSCollectionSaga( } } catch (e) { const actionName = actionObject ? actionObject.name : ""; - toast.show(createMessage(ERROR_JS_ACTION_COPY_FAIL, actionName), { - kind: "error", - }); - yield put(copyJSCollectionError(action.payload)); + yield put( + copyJSCollectionError({ + ...action.payload, + error: { + message: createMessage(ERROR_JS_ACTION_COPY_FAIL, actionName), + }, + }), + ); } } @@ -265,13 +269,13 @@ export function* moveJSCollectionSaga( // @ts-expect-error: response.data is of type unknown yield put(moveJSCollectionSuccess(response.data)); } catch (e) { - toast.show(createMessage(ERROR_JS_ACTION_MOVE_FAIL, actionObject.name), { - kind: "error", - }); yield put( moveJSCollectionError({ id: action.payload.id, originalPageId: actionObject.pageId, + error: { + message: createMessage(ERROR_JS_ACTION_MOVE_FAIL, actionObject.name), + }, }), ); } @@ -375,15 +379,14 @@ export function* saveJSObjectName( payload: { actionId: action.payload.id, oldName: collection.config.name, + error: { + message: createMessage( + ERROR_JS_COLLECTION_RENAME_FAIL, + action.payload.name, + ), + }, }, }); - toast.show( - createMessage(ERROR_JS_COLLECTION_RENAME_FAIL, action.payload.name), - { - kind: "error", - }, - ); - log.error(e); } } diff --git a/app/client/src/reducers/entityReducers/datasourceReducer.ts b/app/client/src/reducers/entityReducers/datasourceReducer.ts index 58aff62daa2..3b02050ae77 100644 --- a/app/client/src/reducers/entityReducers/datasourceReducer.ts +++ b/app/client/src/reducers/entityReducers/datasourceReducer.ts @@ -370,7 +370,7 @@ const datasourceReducer = createReducer(initialState, { loadingTokenForDatasourceId: null, }; }, - [ReduxActionTypes.GET_OAUTH_ACCESS_TOKEN_ERROR]: ( + [ReduxActionErrorTypes.GET_OAUTH_ACCESS_TOKEN_ERROR]: ( state: DatasourceDataState, ) => { return { diff --git a/app/client/src/sagas/ActionExecution/PluginActionSaga.ts b/app/client/src/sagas/ActionExecution/PluginActionSaga.ts index 2759ec73896..534403acaba 100644 --- a/app/client/src/sagas/ActionExecution/PluginActionSaga.ts +++ b/app/client/src/sagas/ActionExecution/PluginActionSaga.ts @@ -9,9 +9,9 @@ import { } from "redux-saga/effects"; import * as Sentry from "@sentry/react"; import type { updateActionDataPayloadType } from "actions/pluginActionActions"; -import { executePageLoadActions } from "actions/pluginActionActions"; import { clearActionResponse, + executePageLoadActions, executePluginActionError, executePluginActionRequest, executePluginActionSuccess, @@ -72,8 +72,7 @@ import { } from "sagas/ErrorSagas"; import AnalyticsUtil from "ee/utils/AnalyticsUtil"; import type { Action } from "entities/Action"; -import { ActionExecutionContext } from "entities/Action"; -import { PluginType } from "entities/Action"; +import { ActionExecutionContext, PluginType } from "entities/Action"; import LOG_TYPE from "entities/AppsmithConsole/logtype"; import { ACTION_EXECUTION_CANCELLED, @@ -173,6 +172,7 @@ import { import type { JSAction, JSCollection } from "entities/JSCollection"; import { getAllowedActionAnalyticsKeys } from "constants/AppsmithActionConstants/formConfig/ActionAnalyticsConfig"; import { setApiPaneDebuggerState } from "../../actions/apiPaneActions"; +import { LOG_CATEGORY, Severity } from "../../entities/AppsmithConsole"; enum ActionResponseDataTypes { BINARY = "BINARY", @@ -1267,10 +1267,13 @@ function* executePageLoadActionsSaga( checkAndLogErrorsIfCyclicDependency(layoutOnLoadActionErrors); } catch (e) { log.error(e); - - toast.show(createMessage(ERROR_FAIL_ON_PAGE_LOAD_ACTIONS), { - kind: "error", - }); + AppsmithConsole.addErrors([ + { + payload: { text: createMessage(ERROR_FAIL_ON_PAGE_LOAD_ACTIONS) }, + severity: Severity.ERROR, + category: LOG_CATEGORY.PLATFORM_GENERATED, + }, + ]); } endSpan(span); } diff --git a/app/client/src/sagas/ActionSagas.ts b/app/client/src/sagas/ActionSagas.ts index 1e4ebe6f687..29a899f06e8 100644 --- a/app/client/src/sagas/ActionSagas.ts +++ b/app/client/src/sagas/ActionSagas.ts @@ -106,7 +106,6 @@ import { createNewQueryAction, } from "actions/apiPaneActions"; import type { Plugin } from "api/PluginApi"; -import * as log from "loglevel"; import { shouldBeDefined } from "utils/helpers"; import { apiEditorIdURL, @@ -704,13 +703,13 @@ function* moveActionSaga( // @ts-expect-error: response is of type unknown yield put(moveActionSuccess(response.data)); } catch (e) { - toast.show(createMessage(ERROR_ACTION_MOVE_FAIL, actionObject.name), { - kind: "error", - }); yield put( moveActionError({ id: action.payload.id, originalPageId: action.payload.originalPageId, + error: { + message: createMessage(ERROR_ACTION_MOVE_FAIL, actionObject.name), + }, }), ); } @@ -797,10 +796,12 @@ function* copyActionSaga( yield put(copyActionSuccess(payload)); } catch (e) { const actionName = actionObject ? actionObject.name : ""; - toast.show(createMessage(ERROR_ACTION_COPY_FAIL, actionName), { - kind: "error", - }); - yield put(copyActionError(action.payload)); + yield put( + copyActionError({ + ...action.payload, + error: { message: createMessage(ERROR_ACTION_COPY_FAIL, actionName) }, + }), + ); } } @@ -899,12 +900,9 @@ function* saveActionName(action: ReduxAction<{ id: string; name: string }>) { payload: { actionId: action.payload.id, oldName: api.config.name, + message: createMessage(ERROR_ACTION_RENAME_FAIL, action.payload.name), }, }); - toast.show(createMessage(ERROR_ACTION_RENAME_FAIL, action.payload.name), { - kind: "error", - }); - log.error(e); } } diff --git a/app/client/src/sagas/ApiPaneSagas.ts b/app/client/src/sagas/ApiPaneSagas.ts index a0e973df329..8752f06a882 100644 --- a/app/client/src/sagas/ApiPaneSagas.ts +++ b/app/client/src/sagas/ApiPaneSagas.ts @@ -4,7 +4,6 @@ import get from "lodash/get"; import omit from "lodash/omit"; import { all, call, put, select, take, takeEvery } from "redux-saga/effects"; -import * as Sentry from "@sentry/react"; import type { ReduxAction, ReduxActionWithMeta, @@ -69,7 +68,6 @@ import { validateResponse } from "./ErrorSagas"; import type { CreateDatasourceSuccessAction } from "actions/datasourceActions"; import { removeTempDatasource } from "actions/datasourceActions"; import { klona } from "klona/lite"; -import { toast } from "@appsmith/ads"; import type { AutoGeneratedHeader } from "pages/Editor/APIEditor/helpers"; import { deriveAutoGeneratedHeaderState } from "pages/Editor/APIEditor/helpers"; import { TEMP_DATASOURCE_ID } from "constants/Datasource"; @@ -744,19 +742,14 @@ function* handleApiNameChangeSuccessSaga( const actionObj: Action | undefined = yield select(getAction, actionId); yield take(ReduxActionTypes.FETCH_ACTIONS_FOR_PAGE_SUCCESS); if (!actionObj) { - // Error case, log to sentry - toast.show(createMessage(ERROR_ACTION_RENAME_FAIL, ""), { - kind: "error", - }); - - Sentry.captureException( - new Error(createMessage(ERROR_ACTION_RENAME_FAIL, "")), - { - extra: { - actionId: actionId, - }, + yield put({ + type: ReduxActionErrorTypes.SAVE_ACTION_NAME_ERROR, + payload: { + actionId, + error: { message: createMessage(ERROR_ACTION_RENAME_FAIL, "") }, + logToSentry: true, }, - ); + }); return; } if (actionObj.pluginType === PluginType.API) { diff --git a/app/client/src/sagas/DatasourcesSagas.ts b/app/client/src/sagas/DatasourcesSagas.ts index 74eeff3d84d..a9d677ca1c5 100644 --- a/app/client/src/sagas/DatasourcesSagas.ts +++ b/app/client/src/sagas/DatasourcesSagas.ts @@ -468,12 +468,9 @@ export function* deleteDatasourceSaga( yield select(getDatasource, actionPayload.payload.id), `Datasource not found for id - ${actionPayload.payload.id}`, ); - toast.show((error as Error).message, { - kind: "error", - }); yield put({ type: ReduxActionErrorTypes.DELETE_DATASOURCE_ERROR, - payload: { error, id: actionPayload.payload.id, show: false }, + payload: { error, id: actionPayload.payload.id }, }); AppsmithConsole.error({ text: (error as Error).message, @@ -733,12 +730,12 @@ function* getOAuthAccessTokenSaga( if (!appsmithToken) { // Error out because auth token should been here log.error(OAUTH_APPSMITH_TOKEN_NOT_FOUND); - toast.show(OAUTH_AUTHORIZATION_APPSMITH_ERROR, { - kind: "error", - }); yield put({ - type: ReduxActionTypes.GET_OAUTH_ACCESS_TOKEN_ERROR, - payload: { datasourceId: datasourceId }, + type: ReduxActionErrorTypes.GET_OAUTH_ACCESS_TOKEN_ERROR, + payload: { + datasourceId: datasourceId, + message: OAUTH_AUTHORIZATION_APPSMITH_ERROR, + }, }); return; } @@ -797,11 +794,11 @@ function* getOAuthAccessTokenSaga( } } catch (e) { yield put({ - type: ReduxActionTypes.GET_OAUTH_ACCESS_TOKEN_ERROR, - payload: { datasourceId: datasourceId }, - }); - toast.show(OAUTH_AUTHORIZATION_FAILED, { - kind: "error", + type: ReduxActionErrorTypes.GET_OAUTH_ACCESS_TOKEN_ERROR, + payload: { + datasourceId: datasourceId, + message: OAUTH_AUTHORIZATION_FAILED, + }, }); log.error(e); } @@ -910,25 +907,19 @@ function* testDatasourceSaga(actionPayload: ReduxAction) { } if (responseData.invalids && responseData.invalids.length) { AnalyticsUtil.logEvent("TEST_DATA_SOURCE_FAILED", { - datasoureId: datasource?.id, + datasourceId: datasource?.id, environmentId: currentEnvironment, environmentName: currentEnvDetails.name, pluginName: plugin?.name, errorMessages: responseData.invalids, messages: responseData.messages, }); - responseData.invalids.forEach((message: string) => { - toast.show(message, { - kind: "error", - }); - }); yield put({ type: ReduxActionErrorTypes.TEST_DATASOURCE_ERROR, payload: { - show: false, id: datasource.id, environmentId: currentEnvironment, - messages: messages, + message: responseData.invalids.join(", "), }, }); AppsmithConsole.error({ @@ -2100,10 +2091,7 @@ function* updateDatasourceAuthStateSaga( } catch (error) { yield put({ type: ReduxActionErrorTypes.UPDATE_DATASOURCE_ERROR, - payload: { error }, - }); - toast.show(OAUTH_AUTHORIZATION_FAILED, { - kind: "error", + payload: { error, message: OAUTH_AUTHORIZATION_FAILED }, }); } } diff --git a/app/client/src/sagas/JSLibrarySaga.ts b/app/client/src/sagas/JSLibrarySaga.ts index 9e09b5e1b7e..375af82efa8 100644 --- a/app/client/src/sagas/JSLibrarySaga.ts +++ b/app/client/src/sagas/JSLibrarySaga.ts @@ -54,10 +54,6 @@ function* handleInstallationFailure( AppsmithConsole.error({ text: `Failed to install library script at ${url}`, }); - - toast.show(message || `Failed to install library script at ${url}`, { - kind: "error", - }); const applicationid: ReturnType = yield select(getCurrentApplicationId); yield put({ @@ -247,7 +243,15 @@ function* uninstallLibrarySaga(action: ReduxAction) { if (!isValidResponse) { yield put({ type: ReduxActionErrorTypes.UNINSTALL_LIBRARY_FAILED, - payload: accessor, + payload: { + accessor, + error: { + message: createMessage( + customJSLibraryMessages.UNINSTALL_FAILED, + name, + ), + }, + }, }); AnalyticsUtil.logEvent("UNINSTALL_LIBRARY", { url: action.payload.url, @@ -270,12 +274,9 @@ function* uninstallLibrarySaga(action: ReduxAction) { accessor, ); if (!success) { - toast.show( - createMessage(customJSLibraryMessages.UNINSTALL_FAILED, name), - { - kind: "error", - }, - ); + AppsmithConsole.error({ + text: createMessage(customJSLibraryMessages.UNINSTALL_FAILED, name), + }); } try { @@ -297,8 +298,17 @@ function* uninstallLibrarySaga(action: ReduxAction) { success: true, }); } catch (e) { - toast.show(createMessage(customJSLibraryMessages.UNINSTALL_FAILED, name), { - kind: "error", + yield put({ + type: ReduxActionErrorTypes.UNINSTALL_LIBRARY_FAILED, + payload: { + accessor, + error: { + message: createMessage( + customJSLibraryMessages.UNINSTALL_FAILED, + name, + ), + }, + }, }); AnalyticsUtil.logEvent("UNINSTALL_LIBRARY", { url: action.payload.url, diff --git a/app/client/src/sagas/JSPaneSagas.ts b/app/client/src/sagas/JSPaneSagas.ts index 7193e993306..42cb6fa1e9f 100644 --- a/app/client/src/sagas/JSPaneSagas.ts +++ b/app/client/src/sagas/JSPaneSagas.ts @@ -86,7 +86,6 @@ import { UserCancelledActionExecutionError } from "sagas/ActionExecution/errorUt import type { EventLocation } from "ee/utils/analyticsUtilTypes"; import AnalyticsUtil from "ee/utils/AnalyticsUtil"; import { checkAndLogErrorsIfCyclicDependency } from "./helper"; -import { toast } from "@appsmith/ads"; import { DEBUGGER_TAB_KEYS } from "components/editorComponents/Debugger/helpers"; import { getJSActionPathNameToDisplay, @@ -371,11 +370,15 @@ function* handleJSObjectNameChangeSuccessSaga( ); yield take(ReduxActionTypes.FETCH_JS_ACTIONS_FOR_PAGE_SUCCESS); if (!actionObj) { - // Error case, log to sentry - toast.show(createMessage(ERROR_JS_COLLECTION_RENAME_FAIL, ""), { - kind: "error", + yield put({ + type: ReduxActionErrorTypes.SAVE_JS_COLLECTION_NAME_ERROR, + payload: { + actionId, + error: { + message: createMessage(ERROR_JS_COLLECTION_RENAME_FAIL, ""), + }, + }, }); - return; } diff --git a/app/client/src/sagas/OneClickBindingSaga.ts b/app/client/src/sagas/OneClickBindingSaga.ts index 7f3a6ee236b..9e331253e2d 100644 --- a/app/client/src/sagas/OneClickBindingSaga.ts +++ b/app/client/src/sagas/OneClickBindingSaga.ts @@ -374,16 +374,14 @@ function* BindWidgetToDatasource( isMock: datasource.isMock, formType: otherFields?.formType, }); - // TODO: Fix this the next time the file is edited - // eslint-disable-next-line @typescript-eslint/no-explicit-any - } catch (e: any) { - toast.show(e.message, { - hideProgressBar: false, - kind: "error", - }); - + } catch (e: unknown) { yield put({ type: ReduxActionTypes.BIND_WIDGET_TO_DATASOURCE_ERROR, + payload: { + error: { + message: e instanceof Error ? e.message : "Failed to Bind to widget", + }, + }, }); } diff --git a/app/client/src/sagas/PartialImportExportSagas/PartialExportSagas.ts b/app/client/src/sagas/PartialImportExportSagas/PartialExportSagas.ts index 7caf770bcb3..9e158d19cb9 100644 --- a/app/client/src/sagas/PartialImportExportSagas/PartialExportSagas.ts +++ b/app/client/src/sagas/PartialImportExportSagas/PartialExportSagas.ts @@ -82,7 +82,9 @@ export function* partialExportSaga(action: ReduxAction) { yield put({ type: ReduxActionErrorTypes.PARTIAL_EXPORT_ERROR, payload: { - error: "Error exporting application", + error: { + message: "Error exporting application", + }, }, }); } diff --git a/app/client/src/sagas/QueryPaneSagas.ts b/app/client/src/sagas/QueryPaneSagas.ts index 89855780738..05fc22c836e 100644 --- a/app/client/src/sagas/QueryPaneSagas.ts +++ b/app/client/src/sagas/QueryPaneSagas.ts @@ -7,7 +7,6 @@ import { takeEvery, fork, } from "redux-saga/effects"; -import * as Sentry from "@sentry/react"; import type { ApplicationPayload } from "entities/Application"; import type { ReduxAction, @@ -70,7 +69,6 @@ import { fetchDynamicValuesSaga } from "./FormEvaluationSaga"; import type { FormEvalOutput } from "reducers/evaluationReducers/formEvaluationReducer"; import { validateResponse } from "./ErrorSagas"; import { getIsGeneratePageInitiator } from "utils/GenerateCrudUtil"; -import { toast } from "@appsmith/ads"; import type { CreateDatasourceSuccessAction } from "actions/datasourceActions"; import { createDefaultActionPayloadWithPluginDefaults } from "./ActionSagas"; import { DB_NOT_SUPPORTED } from "ee/utils/Environments"; @@ -494,18 +492,15 @@ function* handleNameChangeSuccessSaga( yield take(ReduxActionTypes.FETCH_ACTIONS_FOR_PAGE_SUCCESS); if (!actionObj) { // Error case, log to sentry - toast.show(createMessage(ERROR_ACTION_RENAME_FAIL, ""), { - kind: "error", - }); - - Sentry.captureException( - new Error(createMessage(ERROR_ACTION_RENAME_FAIL, "")), - { - extra: { - actionId: actionId, + yield put({ + type: ReduxActionErrorTypes.SAVE_ACTION_NAME_ERROR, + payload: { + error: { + message: createMessage(ERROR_ACTION_RENAME_FAIL, ""), }, + logToSentry: true, }, - ); + }); return; } if (actionObj.pluginType === PluginType.DB) { From 948b85962dadad8934d07ce1a852ddd83ee8f0e4 Mon Sep 17 00:00:00 2001 From: Hetu Nandu Date: Thu, 22 Aug 2024 15:47:50 +0530 Subject: [PATCH 02/23] Sync changes from EE excluding enterprise directory --- app/client/src/sagas/JSLibrarySaga.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/app/client/src/sagas/JSLibrarySaga.ts b/app/client/src/sagas/JSLibrarySaga.ts index 375af82efa8..6e5e4ffe27d 100644 --- a/app/client/src/sagas/JSLibrarySaga.ts +++ b/app/client/src/sagas/JSLibrarySaga.ts @@ -51,9 +51,11 @@ function* handleInstallationFailure( ); } - AppsmithConsole.error({ - text: `Failed to install library script at ${url}`, - }); + AppsmithConsole.addErrors([ + { + payload: { text: `Failed to install library script at ${url}` }, + }, + ]); const applicationid: ReturnType = yield select(getCurrentApplicationId); yield put({ @@ -274,9 +276,13 @@ function* uninstallLibrarySaga(action: ReduxAction) { accessor, ); if (!success) { - AppsmithConsole.error({ - text: createMessage(customJSLibraryMessages.UNINSTALL_FAILED, name), - }); + AppsmithConsole.addErrors([ + { + payload: { + text: createMessage(customJSLibraryMessages.UNINSTALL_FAILED, name), + }, + }, + ]); } try { From 77ece2fda980a93c4893c4bf5af0ca8411cfe030 Mon Sep 17 00:00:00 2001 From: Hetu Nandu Date: Fri, 23 Aug 2024 14:30:06 +0530 Subject: [PATCH 03/23] Sync changes from EE excluding enterprise directory --- app/client/src/sagas/ErrorSagas.tsx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/app/client/src/sagas/ErrorSagas.tsx b/app/client/src/sagas/ErrorSagas.tsx index 8703a2cf439..3151b25080b 100644 --- a/app/client/src/sagas/ErrorSagas.tsx +++ b/app/client/src/sagas/ErrorSagas.tsx @@ -190,7 +190,7 @@ const getErrorMessageFromActionType = ( enum ErrorEffectTypes { SHOW_ALERT = "SHOW_ALERT", SAFE_CRASH = "SAFE_CRASH", - LOG_ERROR = "LOG_ERROR", + LOG_TO_CONSOLE = "LOG_TO_CONSOLE", LOG_TO_SENTRY = "LOG_TO_SENTRY", } @@ -202,9 +202,9 @@ export interface ErrorActionPayload { } export function* errorSaga(errorAction: ReduxAction) { - const effects = [ErrorEffectTypes.LOG_ERROR]; + const effects = [ErrorEffectTypes.LOG_TO_CONSOLE]; const { payload, type } = errorAction; - const { error, logToSentry, show = true } = payload || {}; + const { error, logToSentry, show } = payload || {}; const message = getErrorMessageFromActionType(type, error); if (show) { @@ -222,7 +222,7 @@ export function* errorSaga(errorAction: ReduxAction) { for (const effect of effects) { switch (effect) { - case ErrorEffectTypes.LOG_ERROR: { + case ErrorEffectTypes.LOG_TO_CONSOLE: { logErrorSaga(errorAction); break; } @@ -230,9 +230,7 @@ export function* errorSaga(errorAction: ReduxAction) { // This is the toast that is rendered when any page load API fails. yield call(showToast, message, { kind: "error" }); - // TODO: Fix this the next time the file is edited - // eslint-disable-next-line @typescript-eslint/no-explicit-any - if ((window as any).Cypress) { + if ("Cypress" in window) { if (message === "" || message === null) { yield put( safeCrashApp({ From 462dfdf99736ad793e24b9450109bb8a4d64f8b2 Mon Sep 17 00:00:00 2001 From: Hetu Nandu Date: Fri, 23 Aug 2024 22:42:16 +0530 Subject: [PATCH 04/23] Sync changes from EE excluding enterprise directory --- app/client/src/actions/jsActionActions.ts | 24 +++++++------- app/client/src/actions/pluginActionActions.ts | 24 +++++++------- app/client/src/ce/sagas/JSActionSagas.ts | 3 ++ .../reducers/uiReducers/debuggerReducer.ts | 2 +- .../sagas/ActionExecution/PluginActionSaga.ts | 11 ++----- app/client/src/sagas/ActionSagas.ts | 2 ++ app/client/src/sagas/ApiPaneSagas.ts | 1 + app/client/src/sagas/DatasourcesSagas.ts | 12 ++++--- app/client/src/sagas/JSLibrarySaga.ts | 32 ++++++++++++------- app/client/src/sagas/JSPaneSagas.ts | 1 + app/client/src/sagas/OneClickBindingSaga.ts | 1 + app/client/src/sagas/QueryPaneSagas.ts | 1 + 12 files changed, 68 insertions(+), 46 deletions(-) diff --git a/app/client/src/actions/jsActionActions.ts b/app/client/src/actions/jsActionActions.ts index 099bf9937bf..19caef697dd 100644 --- a/app/client/src/actions/jsActionActions.ts +++ b/app/client/src/actions/jsActionActions.ts @@ -8,7 +8,7 @@ import type { JSCollection } from "entities/JSCollection"; import type { CreateJSCollectionRequest } from "ee/api/JSActionAPI"; import type { EventLocation } from "ee/utils/analyticsUtilTypes"; import type { ApiResponse } from "api/ApiResponses"; -import type { ErrorPayloadType } from "../sagas/ErrorSagas"; +import type { ErrorActionPayload } from "../sagas/ErrorSagas"; export interface FetchJSCollectionsPayload { applicationId: string; @@ -63,11 +63,12 @@ export const copyJSCollectionSuccess = (payload: JSCollection) => { }; }; -export const copyJSCollectionError = (payload: { - id: string; - destinationPageId: string; - error?: ErrorPayloadType; -}) => { +export const copyJSCollectionError = ( + payload: { + id: string; + destinationPageId: string; + } & ErrorActionPayload, +) => { return { type: ReduxActionErrorTypes.COPY_JS_ACTION_ERROR, payload, @@ -92,11 +93,12 @@ export const moveJSCollectionSuccess = (payload: JSCollection) => { }; }; -export const moveJSCollectionError = (payload: { - id: string; - originalPageId: string; - error?: ErrorPayloadType; -}) => { +export const moveJSCollectionError = ( + payload: { + id: string; + originalPageId: string; + } & ErrorActionPayload, +) => { return { type: ReduxActionErrorTypes.MOVE_JS_ACTION_ERROR, payload, diff --git a/app/client/src/actions/pluginActionActions.ts b/app/client/src/actions/pluginActionActions.ts index 25055119a98..81a0edf9d06 100644 --- a/app/client/src/actions/pluginActionActions.ts +++ b/app/client/src/actions/pluginActionActions.ts @@ -15,7 +15,7 @@ import type { ModalInfo } from "reducers/uiReducers/modalActionReducer"; import type { OtlpSpan } from "UITelemetry/generateTraces"; import type { ApiResponse } from "api/ApiResponses"; import type { JSCollection } from "entities/JSCollection"; -import type { ErrorPayloadType } from "../sagas/ErrorSagas"; +import type { ErrorActionPayload } from "sagas/ErrorSagas"; export const createActionRequest = (payload: Partial) => { return { @@ -206,11 +206,12 @@ export const moveActionSuccess = (payload: Action) => { }; }; -export const moveActionError = (payload: { - id: string; - originalPageId: string; - error?: ErrorPayloadType; -}) => { +export const moveActionError = ( + payload: { + id: string; + originalPageId: string; + } & ErrorActionPayload, +) => { return { type: ReduxActionErrorTypes.MOVE_ACTION_ERROR, payload, @@ -235,11 +236,12 @@ export const copyActionSuccess = (payload: Action) => { }; }; -export const copyActionError = (payload: { - id: string; - destinationPageId: string; - error?: ErrorPayloadType; -}) => { +export const copyActionError = ( + payload: { + id: string; + destinationPageId: string; + } & ErrorActionPayload, +) => { return { type: ReduxActionErrorTypes.COPY_ACTION_ERROR, payload, diff --git a/app/client/src/ce/sagas/JSActionSagas.ts b/app/client/src/ce/sagas/JSActionSagas.ts index 44c554d987e..7c72f18b67c 100644 --- a/app/client/src/ce/sagas/JSActionSagas.ts +++ b/app/client/src/ce/sagas/JSActionSagas.ts @@ -195,6 +195,7 @@ export function* copyJSCollectionSaga( yield put( copyJSCollectionError({ ...action.payload, + show: true, error: { message: createMessage(ERROR_JS_ACTION_COPY_FAIL, actionName), }, @@ -273,6 +274,7 @@ export function* moveJSCollectionSaga( moveJSCollectionError({ id: action.payload.id, originalPageId: actionObject.pageId, + show: true, error: { message: createMessage(ERROR_JS_ACTION_MOVE_FAIL, actionObject.name), }, @@ -379,6 +381,7 @@ export function* saveJSObjectName( payload: { actionId: action.payload.id, oldName: collection.config.name, + show: true, error: { message: createMessage( ERROR_JS_COLLECTION_RENAME_FAIL, diff --git a/app/client/src/reducers/uiReducers/debuggerReducer.ts b/app/client/src/reducers/uiReducers/debuggerReducer.ts index 5c0f25ddb79..5926f4b83a2 100644 --- a/app/client/src/reducers/uiReducers/debuggerReducer.ts +++ b/app/client/src/reducers/uiReducers/debuggerReducer.ts @@ -20,7 +20,7 @@ const initialState: DebuggerReduxState = { isOpen: false, errors: {}, expandId: "", - hideErrors: true, + hideErrors: false, context: DefaultDebuggerContext, }; diff --git a/app/client/src/sagas/ActionExecution/PluginActionSaga.ts b/app/client/src/sagas/ActionExecution/PluginActionSaga.ts index 534403acaba..85effcfbec3 100644 --- a/app/client/src/sagas/ActionExecution/PluginActionSaga.ts +++ b/app/client/src/sagas/ActionExecution/PluginActionSaga.ts @@ -172,7 +172,6 @@ import { import type { JSAction, JSCollection } from "entities/JSCollection"; import { getAllowedActionAnalyticsKeys } from "constants/AppsmithActionConstants/formConfig/ActionAnalyticsConfig"; import { setApiPaneDebuggerState } from "../../actions/apiPaneActions"; -import { LOG_CATEGORY, Severity } from "../../entities/AppsmithConsole"; enum ActionResponseDataTypes { BINARY = "BINARY", @@ -1267,13 +1266,9 @@ function* executePageLoadActionsSaga( checkAndLogErrorsIfCyclicDependency(layoutOnLoadActionErrors); } catch (e) { log.error(e); - AppsmithConsole.addErrors([ - { - payload: { text: createMessage(ERROR_FAIL_ON_PAGE_LOAD_ACTIONS) }, - severity: Severity.ERROR, - category: LOG_CATEGORY.PLATFORM_GENERATED, - }, - ]); + AppsmithConsole.error({ + text: createMessage(ERROR_FAIL_ON_PAGE_LOAD_ACTIONS), + }); } endSpan(span); } diff --git a/app/client/src/sagas/ActionSagas.ts b/app/client/src/sagas/ActionSagas.ts index 29a899f06e8..a5f88ef14e0 100644 --- a/app/client/src/sagas/ActionSagas.ts +++ b/app/client/src/sagas/ActionSagas.ts @@ -707,6 +707,7 @@ function* moveActionSaga( moveActionError({ id: action.payload.id, originalPageId: action.payload.originalPageId, + show: true, error: { message: createMessage(ERROR_ACTION_MOVE_FAIL, actionObject.name), }, @@ -799,6 +800,7 @@ function* copyActionSaga( yield put( copyActionError({ ...action.payload, + show: true, error: { message: createMessage(ERROR_ACTION_COPY_FAIL, actionName) }, }), ); diff --git a/app/client/src/sagas/ApiPaneSagas.ts b/app/client/src/sagas/ApiPaneSagas.ts index 8752f06a882..0b8f8ba2537 100644 --- a/app/client/src/sagas/ApiPaneSagas.ts +++ b/app/client/src/sagas/ApiPaneSagas.ts @@ -746,6 +746,7 @@ function* handleApiNameChangeSuccessSaga( type: ReduxActionErrorTypes.SAVE_ACTION_NAME_ERROR, payload: { actionId, + show: true, error: { message: createMessage(ERROR_ACTION_RENAME_FAIL, "") }, logToSentry: true, }, diff --git a/app/client/src/sagas/DatasourcesSagas.ts b/app/client/src/sagas/DatasourcesSagas.ts index a9d677ca1c5..3be9ffef5d0 100644 --- a/app/client/src/sagas/DatasourcesSagas.ts +++ b/app/client/src/sagas/DatasourcesSagas.ts @@ -470,7 +470,7 @@ export function* deleteDatasourceSaga( ); yield put({ type: ReduxActionErrorTypes.DELETE_DATASOURCE_ERROR, - payload: { error, id: actionPayload.payload.id }, + payload: { error, id: actionPayload.payload.id, show: true }, }); AppsmithConsole.error({ text: (error as Error).message, @@ -732,9 +732,12 @@ function* getOAuthAccessTokenSaga( log.error(OAUTH_APPSMITH_TOKEN_NOT_FOUND); yield put({ type: ReduxActionErrorTypes.GET_OAUTH_ACCESS_TOKEN_ERROR, + show: true, payload: { datasourceId: datasourceId, - message: OAUTH_AUTHORIZATION_APPSMITH_ERROR, + error: { + message: OAUTH_AUTHORIZATION_APPSMITH_ERROR, + }, }, }); return; @@ -919,7 +922,8 @@ function* testDatasourceSaga(actionPayload: ReduxAction) { payload: { id: datasource.id, environmentId: currentEnvironment, - message: responseData.invalids.join(", "), + show: true, + error: { message: responseData.invalids.join(", ") }, }, }); AppsmithConsole.error({ @@ -2091,7 +2095,7 @@ function* updateDatasourceAuthStateSaga( } catch (error) { yield put({ type: ReduxActionErrorTypes.UPDATE_DATASOURCE_ERROR, - payload: { error, message: OAUTH_AUTHORIZATION_FAILED }, + payload: { error, show: true, message: OAUTH_AUTHORIZATION_FAILED }, }); } } diff --git a/app/client/src/sagas/JSLibrarySaga.ts b/app/client/src/sagas/JSLibrarySaga.ts index 6e5e4ffe27d..98eda815b75 100644 --- a/app/client/src/sagas/JSLibrarySaga.ts +++ b/app/client/src/sagas/JSLibrarySaga.ts @@ -51,16 +51,19 @@ function* handleInstallationFailure( ); } - AppsmithConsole.addErrors([ - { - payload: { text: `Failed to install library script at ${url}` }, - }, - ]); + AppsmithConsole.error({ + text: `Failed to install library script at ${url}`, + }); + const applicationid: ReturnType = yield select(getCurrentApplicationId); yield put({ type: ReduxActionErrorTypes.INSTALL_LIBRARY_FAILED, - payload: { url, show: false }, + payload: { + url, + show: true, + message: message || `Failed to install library script at ${url}`, + }, }); AnalyticsUtil.logEvent("INSTALL_LIBRARY", { url, @@ -276,13 +279,19 @@ function* uninstallLibrarySaga(action: ReduxAction) { accessor, ); if (!success) { - AppsmithConsole.addErrors([ - { - payload: { - text: createMessage(customJSLibraryMessages.UNINSTALL_FAILED, name), + yield put({ + type: ReduxActionErrorTypes.UNINSTALL_LIBRARY_FAILED, + payload: { + accessor, + show: true, + error: { + message: createMessage( + customJSLibraryMessages.UNINSTALL_FAILED, + name, + ), }, }, - ]); + }); } try { @@ -308,6 +317,7 @@ function* uninstallLibrarySaga(action: ReduxAction) { type: ReduxActionErrorTypes.UNINSTALL_LIBRARY_FAILED, payload: { accessor, + show: true, error: { message: createMessage( customJSLibraryMessages.UNINSTALL_FAILED, diff --git a/app/client/src/sagas/JSPaneSagas.ts b/app/client/src/sagas/JSPaneSagas.ts index 42cb6fa1e9f..aa8b0482715 100644 --- a/app/client/src/sagas/JSPaneSagas.ts +++ b/app/client/src/sagas/JSPaneSagas.ts @@ -374,6 +374,7 @@ function* handleJSObjectNameChangeSuccessSaga( type: ReduxActionErrorTypes.SAVE_JS_COLLECTION_NAME_ERROR, payload: { actionId, + show: true, error: { message: createMessage(ERROR_JS_COLLECTION_RENAME_FAIL, ""), }, diff --git a/app/client/src/sagas/OneClickBindingSaga.ts b/app/client/src/sagas/OneClickBindingSaga.ts index 9e331253e2d..635f83ccad8 100644 --- a/app/client/src/sagas/OneClickBindingSaga.ts +++ b/app/client/src/sagas/OneClickBindingSaga.ts @@ -378,6 +378,7 @@ function* BindWidgetToDatasource( yield put({ type: ReduxActionTypes.BIND_WIDGET_TO_DATASOURCE_ERROR, payload: { + show: true, error: { message: e instanceof Error ? e.message : "Failed to Bind to widget", }, diff --git a/app/client/src/sagas/QueryPaneSagas.ts b/app/client/src/sagas/QueryPaneSagas.ts index 05fc22c836e..61e712e534e 100644 --- a/app/client/src/sagas/QueryPaneSagas.ts +++ b/app/client/src/sagas/QueryPaneSagas.ts @@ -495,6 +495,7 @@ function* handleNameChangeSuccessSaga( yield put({ type: ReduxActionErrorTypes.SAVE_ACTION_NAME_ERROR, payload: { + show: true, error: { message: createMessage(ERROR_ACTION_RENAME_FAIL, ""), }, From b1bd60ff8e0a642ff51ebc8d835aa5723b425039 Mon Sep 17 00:00:00 2001 From: Hetu Nandu Date: Mon, 26 Aug 2024 14:26:48 +0530 Subject: [PATCH 05/23] Open debugger on load error --- app/client/src/sagas/DebuggerSagas.ts | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/app/client/src/sagas/DebuggerSagas.ts b/app/client/src/sagas/DebuggerSagas.ts index 0901a485a32..e655a94b475 100644 --- a/app/client/src/sagas/DebuggerSagas.ts +++ b/app/client/src/sagas/DebuggerSagas.ts @@ -1,6 +1,8 @@ -import type { - DeleteErrorLogPayload, - LogDebuggerErrorAnalyticsPayload, +import { + type DeleteErrorLogPayload, + type LogDebuggerErrorAnalyticsPayload, + setDebuggerSelectedTab, + showDebugger, } from "actions/debuggerActions"; import { addErrorLogs, @@ -40,7 +42,10 @@ import type { JSCollection } from "entities/JSCollection"; import LOG_TYPE from "entities/AppsmithConsole/logtype"; import type { ConfigTree } from "entities/DataTree/dataTreeTypes"; import { getConfigTree } from "selectors/dataTreeSelectors"; -import { createLogTitleString } from "components/editorComponents/Debugger/helpers"; +import { + createLogTitleString, + DEBUGGER_TAB_KEYS, +} from "components/editorComponents/Debugger/helpers"; import AppsmithConsole from "utils/AppsmithConsole"; import { getWidget } from "./selectors"; import AnalyticsUtil, { AnalyticsEventType } from "ee/utils/AnalyticsUtil"; @@ -56,6 +61,7 @@ import { transformAddErrorLogsSaga, transformDeleteErrorLogsSaga, } from "ee/sagas/helpers"; +import { objectKeys } from "@appsmith/utils"; let blockedSource: string | null = null; @@ -812,6 +818,17 @@ function* activeFieldDebuggerErrorHandler( } } +function* handleHideDebuggerSaga(action: ReduxAction) { + const { payload } = action; + const currentDebuggerErrors: Record = + yield select(getDebuggerErrors); + + if (objectKeys(currentDebuggerErrors).length && !payload) { + yield put(showDebugger()); + yield put(setDebuggerSelectedTab(DEBUGGER_TAB_KEYS.ERROR_TAB)); + } +} + export default function* debuggerSagasListeners() { yield all([ takeEvery(ReduxActionTypes.DEBUGGER_LOG_INIT, debuggerLogSaga), @@ -823,5 +840,6 @@ export default function* debuggerSagasListeners() { ReduxActionTypes.DEBUGGER_DELETE_ERROR_LOG_INIT, deleteDebuggerErrorLogsSaga, ), + takeEvery(ReduxActionTypes.HIDE_DEBUGGER_ERRORS, handleHideDebuggerSaga), ]); } From af006a63cad7f3aa48b4c534bd2432d5525566c7 Mon Sep 17 00:00:00 2001 From: Hetu Nandu Date: Mon, 26 Aug 2024 16:35:06 +0530 Subject: [PATCH 06/23] fix js execution opening toasts --- .../sagas/ActionExecution/PostMessageSaga.ts | 4 +- .../src/sagas/ActionExecution/errorUtils.ts | 56 ++++++------------- .../ActionExecution/geolocationSaga.test.ts | 4 +- .../sagas/ActionExecution/geolocationSaga.ts | 11 ++-- app/client/src/sagas/EvaluationsSaga.ts | 4 +- app/client/src/sagas/PostEvaluationSagas.ts | 15 +---- 6 files changed, 29 insertions(+), 65 deletions(-) diff --git a/app/client/src/sagas/ActionExecution/PostMessageSaga.ts b/app/client/src/sagas/ActionExecution/PostMessageSaga.ts index d4adb14be72..d9ff09eb85b 100644 --- a/app/client/src/sagas/ActionExecution/PostMessageSaga.ts +++ b/app/client/src/sagas/ActionExecution/PostMessageSaga.ts @@ -1,6 +1,6 @@ import { call, spawn } from "redux-saga/effects"; import { - logActionExecutionError, + showToastOnExecutionError, TriggerFailureError, } from "sagas/ActionExecution/errorUtils"; import { isEmpty } from "lodash"; @@ -35,6 +35,6 @@ export function* executePostMessage( } } } catch (error) { - yield call(logActionExecutionError, (error as Error).message, true); + yield call(showToastOnExecutionError, (error as Error).message); } } diff --git a/app/client/src/sagas/ActionExecution/errorUtils.ts b/app/client/src/sagas/ActionExecution/errorUtils.ts index 4b142364a63..6fccd50264e 100644 --- a/app/client/src/sagas/ActionExecution/errorUtils.ts +++ b/app/client/src/sagas/ActionExecution/errorUtils.ts @@ -55,35 +55,7 @@ export class ActionValidationError extends TriggerFailureError { } } -export function* logActionExecutionError( - errorMessage: string, - isExecuteJSFunc = true, -) { - //Commenting as per decision taken for the error hanlding epic to not show the trigger errors in the debugger. - // if (triggerPropertyName) { - // AppsmithConsole.addErrors([ - // { - // payload: { - // id: `${source?.id}-${triggerPropertyName}`, - // logType: LOG_TYPE.TRIGGER_EVAL_ERROR, - // text: createMessage(DEBUGGER_TRIGGER_ERROR, triggerPropertyName), - // source: { - // type: ENTITY_TYPE.WIDGET, - // id: source?.id ?? "", - // name: source?.name ?? "", - // propertyPath: triggerPropertyName, - // }, - // messages: [ - // { - // type: errorType, - // message: { name: "TriggerExecutionError", message: errorMessage }, - // }, - // ], - // }, - // }, - // ]); - // } - +export function* showToastOnExecutionError(errorMessage: string) { function onDebugClick() { const appMode = getAppMode(store.getState()); if (appMode === "PUBLISHED") return null; @@ -95,16 +67,22 @@ export function* logActionExecutionError( store.dispatch(setDebuggerSelectedTab(DEBUGGER_TAB_KEYS.ERROR_TAB)); } - if (isExecuteJSFunc) - // This is the toast that is rendered when any unhandled error occurs in JS object. - yield call(showToast, errorMessage, { - kind: "error", - action: { - text: "debug", - effect: () => onDebugClick(), - className: "t--toast-debug-button", - }, - }); + // This is the toast that is rendered when any unhandled error occurs in JS object. + yield call(showToast, errorMessage, { + kind: "error", + action: { + text: "debug", + effect: () => onDebugClick(), + className: "t--toast-debug-button", + }, + }); +} + +export function* showDebuggerOnExecutionError() { + const appMode = getAppMode(store.getState()); + if (appMode === "PUBLISHED") return null; + store.dispatch(showDebugger(true)); + store.dispatch(setDebuggerSelectedTab(DEBUGGER_TAB_KEYS.ERROR_TAB)); } /* diff --git a/app/client/src/sagas/ActionExecution/geolocationSaga.test.ts b/app/client/src/sagas/ActionExecution/geolocationSaga.test.ts index bd846d2b0a7..a2341bb1735 100644 --- a/app/client/src/sagas/ActionExecution/geolocationSaga.test.ts +++ b/app/client/src/sagas/ActionExecution/geolocationSaga.test.ts @@ -5,7 +5,7 @@ import { getUserLocation, } from "./geolocationSaga"; import { setUserCurrentGeoLocation } from "actions/browserRequestActions"; -import { logActionExecutionError } from "./errorUtils"; +import { showToastOnExecutionError } from "./errorUtils"; const mockFn = jest.fn(); @@ -86,7 +86,7 @@ describe("getCurrentLocationSaga", () => { expect(iter.next().value).toHaveProperty( "payload.fn", - logActionExecutionError, + showToastOnExecutionError, ); expect(iter.next().done).toBe(true); }); diff --git a/app/client/src/sagas/ActionExecution/geolocationSaga.ts b/app/client/src/sagas/ActionExecution/geolocationSaga.ts index a47e59cf06d..e0e6bc7db5c 100644 --- a/app/client/src/sagas/ActionExecution/geolocationSaga.ts +++ b/app/client/src/sagas/ActionExecution/geolocationSaga.ts @@ -1,7 +1,7 @@ import type { EventType } from "constants/AppsmithActionConstants/ActionConstants"; import type { TriggerMeta } from "ee/sagas/ActionExecution/ActionExecutionSagas"; import { call, put, spawn, take } from "redux-saga/effects"; -import { logActionExecutionError } from "sagas/ActionExecution/errorUtils"; +import { showToastOnExecutionError } from "sagas/ActionExecution/errorUtils"; import { setUserCurrentGeoLocation } from "actions/browserRequestActions"; import type { Channel } from "redux-saga"; import { channel } from "redux-saga"; @@ -107,7 +107,7 @@ function* errorCallbackHandler(triggerMeta: TriggerMeta, listenerId?: string) { { error: sanitizeGeolocationError(error) }, listenerId, ); - yield call(logActionExecutionError, error.message, true); + yield call(showToastOnExecutionError, error.message); } } @@ -122,7 +122,7 @@ export function* getCurrentLocationSaga(action: TGetGeoLocationDescription) { yield put(setUserCurrentGeoLocation(currentLocation)); return currentLocation; } catch (error) { - yield call(logActionExecutionError, (error as Error).message, true); + yield call(showToastOnExecutionError, (error as Error).message); if (error instanceof GeolocationPositionError) { const sanitizedError = sanitizeGeolocationError(error); throw new GeoLocationError(sanitizedError.message, [sanitizedError]); @@ -141,9 +141,8 @@ export function* watchCurrentLocation( // When a watch is already active, we will not start a new watch. // at a given point in time, only one watch is active yield call( - logActionExecutionError, + showToastOnExecutionError, "A watchLocation is already active. Clear it before before starting a new one", - true, ); return; @@ -171,7 +170,7 @@ export function* watchCurrentLocation( export function* stopWatchCurrentLocation() { if (watchId === undefined) { - yield call(logActionExecutionError, "No location watch active", true); + yield call(showToastOnExecutionError, "No location watch active"); return; } navigator.geolocation.clearWatch(watchId); diff --git a/app/client/src/sagas/EvaluationsSaga.ts b/app/client/src/sagas/EvaluationsSaga.ts index 51c59541321..a5a9cb74cd7 100644 --- a/app/client/src/sagas/EvaluationsSaga.ts +++ b/app/client/src/sagas/EvaluationsSaga.ts @@ -48,7 +48,6 @@ import { } from "actions/evaluationActions"; import ConfigTreeActions from "utils/configTree"; import { - dynamicTriggerErrorHandler, handleJSFunctionExecutionErrorLog, logJSVarCreatedEvent, logSuccessfulBindings, @@ -111,6 +110,7 @@ import { evalErrorHandler } from "./EvalErrorHandler"; import AnalyticsUtil from "ee/utils/AnalyticsUtil"; import { endSpan, startRootSpan } from "UITelemetry/generateTraces"; import { transformTriggerEvalErrors } from "ee/sagas/helpers"; +import { showDebuggerOnExecutionError } from "./ActionExecution/errorUtils"; const APPSMITH_CONFIGS = getAppsmithConfigs(); export const evalWorker = new GracefulWorkerService( @@ -350,7 +350,7 @@ export function* evaluateAndExecuteDynamicTrigger( errors, ); - yield call(dynamicTriggerErrorHandler, transformedErrors); + yield fork(showDebuggerOnExecutionError); yield fork(logDynamicTriggerExecution, { dynamicTrigger, errors: transformedErrors, diff --git a/app/client/src/sagas/PostEvaluationSagas.ts b/app/client/src/sagas/PostEvaluationSagas.ts index a20413dbee9..20017ca5c56 100644 --- a/app/client/src/sagas/PostEvaluationSagas.ts +++ b/app/client/src/sagas/PostEvaluationSagas.ts @@ -20,7 +20,7 @@ import type { EvaluationError } from "utils/DynamicBindingUtils"; import { getEvalErrorPath } from "utils/DynamicBindingUtils"; import { find, get, some } from "lodash"; import LOG_TYPE from "entities/AppsmithConsole/logtype"; -import { call, put, select } from "redux-saga/effects"; +import { put, select } from "redux-saga/effects"; import type { AnyReduxAction } from "ee/constants/ReduxActionConstants"; import AppsmithConsole from "utils/AppsmithConsole"; import AnalyticsUtil from "ee/utils/AnalyticsUtil"; @@ -35,7 +35,6 @@ import { isWidgetPropertyNamePath } from "utils/widgetEvalUtils"; import type { ActionEntityConfig } from "ee/entities/DataTree/types"; import type { SuccessfulBindings } from "utils/SuccessfulBindingsMap"; import SuccessfulBindingMap from "utils/SuccessfulBindingsMap"; -import { logActionExecutionError } from "./ActionExecution/errorUtils"; import { getCurrentWorkspaceId } from "ee/selectors/selectedWorkspaceSelectors"; import { getInstanceId } from "ee/selectors/tenantSelectors"; import type { EvalTreeResponseData } from "workers/Evaluation/types"; @@ -57,18 +56,6 @@ export function* logJSVarCreatedEvent( }); } -// TODO: Fix this the next time the file is edited -// eslint-disable-next-line @typescript-eslint/no-explicit-any -export function* dynamicTriggerErrorHandler(errors: any[]) { - if (errors.length > 0) { - for (const error of errors) { - const errorMessage = - error.errorMessage.message.message || error.errorMessage.message; - yield call(logActionExecutionError, errorMessage, true); - } - } -} - export function* logSuccessfulBindings( unEvalTree: UnEvalTree, dataTree: DataTree, From 3657462e066f81bb23905fecb2ec60e0015945f6 Mon Sep 17 00:00:00 2001 From: Hetu Nandu Date: Mon, 26 Aug 2024 22:53:06 +0530 Subject: [PATCH 07/23] fix tests --- .../integrations/sagas/pasteSagas/index.ts | 1 + .../src/sagas/ActionExecution/errorUtils.ts | 31 +++++++++++-------- .../sagas/CanvasSagas/DraggingCanvasSagas.ts | 2 ++ app/client/src/sagas/ErrorSagas.tsx | 31 +++++++++++++++++-- app/client/src/sagas/EvaluationsSaga.ts | 4 +-- app/client/src/sagas/ModalSagas.ts | 1 + app/client/src/sagas/PostEvaluationSagas.ts | 25 ++++++++++++++- app/client/src/sagas/WidgetAdditionSagas.ts | 2 ++ app/client/src/sagas/WidgetDeletionSagas.ts | 2 ++ app/client/src/sagas/WidgetOperationSagas.tsx | 2 ++ 10 files changed, 83 insertions(+), 18 deletions(-) diff --git a/app/client/src/layoutSystems/anvil/integrations/sagas/pasteSagas/index.ts b/app/client/src/layoutSystems/anvil/integrations/sagas/pasteSagas/index.ts index 99c347e049e..8464a30f2ea 100644 --- a/app/client/src/layoutSystems/anvil/integrations/sagas/pasteSagas/index.ts +++ b/app/client/src/layoutSystems/anvil/integrations/sagas/pasteSagas/index.ts @@ -158,6 +158,7 @@ export function* pasteWidgetSagas() { payload: { action: ReduxActionTypes.PASTE_COPIED_WIDGET_INIT, error, + logToDebugger: true, }, }); } diff --git a/app/client/src/sagas/ActionExecution/errorUtils.ts b/app/client/src/sagas/ActionExecution/errorUtils.ts index 6fccd50264e..f630f6a8a61 100644 --- a/app/client/src/sagas/ActionExecution/errorUtils.ts +++ b/app/client/src/sagas/ActionExecution/errorUtils.ts @@ -5,15 +5,15 @@ import { import type { ApiResponse } from "api/ApiResponses"; import { isString } from "lodash"; import type { Types } from "utils/TypeHelpers"; -import type { ActionTriggerKeys } from "ee/workers/Evaluation/fns/index"; -import { getActionTriggerFunctionNames } from "ee/workers/Evaluation/fns/index"; +import type { ActionTriggerKeys } from "ee/workers/Evaluation/fns"; +import { getActionTriggerFunctionNames } from "ee/workers/Evaluation/fns"; import { getAppMode } from "ee/selectors/applicationSelectors"; import AnalyticsUtil from "ee/utils/AnalyticsUtil"; import { setDebuggerSelectedTab, showDebugger } from "actions/debuggerActions"; import { DEBUGGER_TAB_KEYS } from "components/editorComponents/Debugger/helpers"; import store from "store"; import showToast from "sagas/ToastSagas"; -import { call } from "redux-saga/effects"; +import { call, put } from "redux-saga/effects"; /* * The base trigger error that also logs the errors in the debugger. @@ -55,7 +55,10 @@ export class ActionValidationError extends TriggerFailureError { } } -export function* showToastOnExecutionError(errorMessage: string) { +export function* showToastOnExecutionError( + errorMessage: string, + showCTA = true, +) { function onDebugClick() { const appMode = getAppMode(store.getState()); if (appMode === "PUBLISHED") return null; @@ -67,22 +70,24 @@ export function* showToastOnExecutionError(errorMessage: string) { store.dispatch(setDebuggerSelectedTab(DEBUGGER_TAB_KEYS.ERROR_TAB)); } + const action = showCTA + ? { + text: "debug", + effect: () => onDebugClick(), + className: "t--toast-debug-button", + } + : undefined; + // This is the toast that is rendered when any unhandled error occurs in JS object. yield call(showToast, errorMessage, { kind: "error", - action: { - text: "debug", - effect: () => onDebugClick(), - className: "t--toast-debug-button", - }, + action, }); } export function* showDebuggerOnExecutionError() { - const appMode = getAppMode(store.getState()); - if (appMode === "PUBLISHED") return null; - store.dispatch(showDebugger(true)); - store.dispatch(setDebuggerSelectedTab(DEBUGGER_TAB_KEYS.ERROR_TAB)); + yield put(showDebugger(true)); + yield put(setDebuggerSelectedTab(DEBUGGER_TAB_KEYS.ERROR_TAB)); } /* diff --git a/app/client/src/sagas/CanvasSagas/DraggingCanvasSagas.ts b/app/client/src/sagas/CanvasSagas/DraggingCanvasSagas.ts index d93af9d4c73..9f3f3bb0dcf 100644 --- a/app/client/src/sagas/CanvasSagas/DraggingCanvasSagas.ts +++ b/app/client/src/sagas/CanvasSagas/DraggingCanvasSagas.ts @@ -199,6 +199,7 @@ export function* addWidgetAndMoveWidgetsSaga( payload: { action: ReduxActionTypes.WIDGETS_ADD_CHILD_AND_MOVE, error, + logToDebugger: true, }, }); } @@ -424,6 +425,7 @@ function* moveWidgetsSaga( payload: { action: ReduxActionTypes.WIDGETS_MOVE, error, + logToDebugger: true, }, }); } diff --git a/app/client/src/sagas/ErrorSagas.tsx b/app/client/src/sagas/ErrorSagas.tsx index 3151b25080b..a1445e24b5e 100644 --- a/app/client/src/sagas/ErrorSagas.tsx +++ b/app/client/src/sagas/ErrorSagas.tsx @@ -30,6 +30,15 @@ import { axiosConnectionAbortedCode } from "ee/api/ApiUtils"; import { getLoginUrl } from "ee/utils/adminSettingsHelpers"; import type { PluginErrorDetails } from "api/ActionAPI"; import showToast from "sagas/ToastSagas"; +import AppsmithConsole from "../utils/AppsmithConsole"; +import type { SourceEntity } from "../entities/AppsmithConsole"; +import { + setDebuggerSelectedTab, + showDebugger, +} from "../actions/debuggerActions"; +import { DEBUGGER_TAB_KEYS } from "../components/editorComponents/Debugger/helpers"; +import { getAppMode } from "ee/selectors/applicationSelectors"; +import type { APP_MODE } from "../entities/App"; /** * making with error message with action name @@ -192,6 +201,7 @@ enum ErrorEffectTypes { SAFE_CRASH = "SAFE_CRASH", LOG_TO_CONSOLE = "LOG_TO_CONSOLE", LOG_TO_SENTRY = "LOG_TO_SENTRY", + LOG_TO_DEBUGGER = "LOG_TO_DEBUGGER", } export interface ErrorActionPayload { @@ -199,18 +209,26 @@ export interface ErrorActionPayload { show?: boolean; crash?: boolean; logToSentry?: boolean; + logToDebugger?: boolean; + sourceEntity?: SourceEntity; } export function* errorSaga(errorAction: ReduxAction) { const effects = [ErrorEffectTypes.LOG_TO_CONSOLE]; const { payload, type } = errorAction; - const { error, logToSentry, show } = payload || {}; + const { error, logToDebugger, logToSentry, show, sourceEntity } = + payload || {}; const message = getErrorMessageFromActionType(type, error); + const appMode: APP_MODE = yield select(getAppMode); - if (show) { + if (show || appMode === "PUBLISHED") { effects.push(ErrorEffectTypes.SHOW_ALERT); } + if (logToDebugger) { + effects.push(ErrorEffectTypes.LOG_TO_DEBUGGER); + } + if (error && error.crash) { effects.push(ErrorEffectTypes.LOG_TO_SENTRY); effects.push(ErrorEffectTypes.SAFE_CRASH); @@ -226,6 +244,15 @@ export function* errorSaga(errorAction: ReduxAction) { logErrorSaga(errorAction); break; } + case ErrorEffectTypes.LOG_TO_DEBUGGER: { + AppsmithConsole.error({ + text: message, + source: sourceEntity, + }); + yield put(showDebugger()); + yield put(setDebuggerSelectedTab(DEBUGGER_TAB_KEYS.LOGS_TAB)); + break; + } case ErrorEffectTypes.SHOW_ALERT: { // This is the toast that is rendered when any page load API fails. yield call(showToast, message, { kind: "error" }); diff --git a/app/client/src/sagas/EvaluationsSaga.ts b/app/client/src/sagas/EvaluationsSaga.ts index a5a9cb74cd7..52930d6ef05 100644 --- a/app/client/src/sagas/EvaluationsSaga.ts +++ b/app/client/src/sagas/EvaluationsSaga.ts @@ -48,6 +48,7 @@ import { } from "actions/evaluationActions"; import ConfigTreeActions from "utils/configTree"; import { + showExecutionErrors, handleJSFunctionExecutionErrorLog, logJSVarCreatedEvent, logSuccessfulBindings, @@ -110,7 +111,6 @@ import { evalErrorHandler } from "./EvalErrorHandler"; import AnalyticsUtil from "ee/utils/AnalyticsUtil"; import { endSpan, startRootSpan } from "UITelemetry/generateTraces"; import { transformTriggerEvalErrors } from "ee/sagas/helpers"; -import { showDebuggerOnExecutionError } from "./ActionExecution/errorUtils"; const APPSMITH_CONFIGS = getAppsmithConfigs(); export const evalWorker = new GracefulWorkerService( @@ -350,7 +350,7 @@ export function* evaluateAndExecuteDynamicTrigger( errors, ); - yield fork(showDebuggerOnExecutionError); + yield fork(showExecutionErrors, transformedErrors); yield fork(logDynamicTriggerExecution, { dynamicTrigger, errors: transformedErrors, diff --git a/app/client/src/sagas/ModalSagas.ts b/app/client/src/sagas/ModalSagas.ts index b57cb919c62..22b0132e3b4 100644 --- a/app/client/src/sagas/ModalSagas.ts +++ b/app/client/src/sagas/ModalSagas.ts @@ -311,6 +311,7 @@ export function* resizeModalSaga(resizeAction: ReduxAction) { payload: { action: WidgetReduxActionTypes.WIDGET_RESIZE, error, + logToDebugger: true, }, }); } diff --git a/app/client/src/sagas/PostEvaluationSagas.ts b/app/client/src/sagas/PostEvaluationSagas.ts index 20017ca5c56..054e14ba258 100644 --- a/app/client/src/sagas/PostEvaluationSagas.ts +++ b/app/client/src/sagas/PostEvaluationSagas.ts @@ -20,7 +20,7 @@ import type { EvaluationError } from "utils/DynamicBindingUtils"; import { getEvalErrorPath } from "utils/DynamicBindingUtils"; import { find, get, some } from "lodash"; import LOG_TYPE from "entities/AppsmithConsole/logtype"; -import { put, select } from "redux-saga/effects"; +import { call, put, select } from "redux-saga/effects"; import type { AnyReduxAction } from "ee/constants/ReduxActionConstants"; import AppsmithConsole from "utils/AppsmithConsole"; import AnalyticsUtil from "ee/utils/AnalyticsUtil"; @@ -40,6 +40,10 @@ import { getInstanceId } from "ee/selectors/tenantSelectors"; import type { EvalTreeResponseData } from "workers/Evaluation/types"; import { endSpan, startRootSpan } from "UITelemetry/generateTraces"; import { getCollectionNameToDisplay } from "ee/utils/actionExecutionUtils"; +import { + showDebuggerOnExecutionError, + showToastOnExecutionError, +} from "./ActionExecution/errorUtils"; let successfulBindingsMap: SuccessfulBindingMap | undefined; @@ -56,6 +60,25 @@ export function* logJSVarCreatedEvent( }); } +export function* showExecutionErrors(errors: EvaluationError[]) { + const appMode: APP_MODE = yield select(getAppMode); + if (appMode === APP_MODE.EDIT) { + // In edit mode, we will instead show the debugger + // and not show any toast + yield call(showDebuggerOnExecutionError); + } else { + for (const error of errors) { + // in view mode we will show the error messages in toast + const errorMessage = get( + error, + "errorMessage.message.message", + error.errorMessage.message, + ); + yield call(showToastOnExecutionError, errorMessage, false); + } + } +} + export function* logSuccessfulBindings( unEvalTree: UnEvalTree, dataTree: DataTree, diff --git a/app/client/src/sagas/WidgetAdditionSagas.ts b/app/client/src/sagas/WidgetAdditionSagas.ts index 61518df9004..cf0bb6ba4da 100644 --- a/app/client/src/sagas/WidgetAdditionSagas.ts +++ b/app/client/src/sagas/WidgetAdditionSagas.ts @@ -434,6 +434,7 @@ export function* addChildSaga( payload: { action: WidgetReduxActionTypes.WIDGET_ADD_CHILD, error, + logToDebugger: true, }, }); } @@ -533,6 +534,7 @@ function* addUIEntitySaga(addEntityAction: ReduxAction) { payload: { action: WidgetReduxActionTypes.WIDGET_ADD_CHILD, error, + logToDebugger: true, }, }); } diff --git a/app/client/src/sagas/WidgetDeletionSagas.ts b/app/client/src/sagas/WidgetDeletionSagas.ts index 84720338d4f..ac11cd52161 100644 --- a/app/client/src/sagas/WidgetDeletionSagas.ts +++ b/app/client/src/sagas/WidgetDeletionSagas.ts @@ -322,6 +322,7 @@ function* deleteSaga(deleteAction: ReduxAction) { payload: { action: WidgetReduxActionTypes.WIDGET_DELETE, error, + logToDebugger: true, }, }); } @@ -463,6 +464,7 @@ function* deleteAllSelectedWidgetsSaga( payload: { action: WidgetReduxActionTypes.WIDGET_DELETE, error, + logToDebugger: true, }, }); } diff --git a/app/client/src/sagas/WidgetOperationSagas.tsx b/app/client/src/sagas/WidgetOperationSagas.tsx index 9c2f356da04..7f770a80fde 100644 --- a/app/client/src/sagas/WidgetOperationSagas.tsx +++ b/app/client/src/sagas/WidgetOperationSagas.tsx @@ -281,6 +281,7 @@ export function* resizeSaga(resizeAction: ReduxAction) { payload: { action: WidgetReduxActionTypes.WIDGET_RESIZE, error, + logToDebugger: true, }, }); } @@ -1644,6 +1645,7 @@ function* pasteWidgetSaga(action: ReduxAction) { payload: { action: ReduxActionTypes.PASTE_COPIED_WIDGET_INIT, error, + logToDebugger: true, }, }); } From 3189c9e2a320d68ebaaf6dcf86e53d27e85e37f4 Mon Sep 17 00:00:00 2001 From: Hetu Nandu Date: Mon, 26 Aug 2024 23:10:04 +0530 Subject: [PATCH 08/23] fix tests --- .../Regression/ClientSide/BugTests/Moment_Spec.ts | 1 - .../ClientSide/ExplorerTests/Pages_spec.js | 5 +---- .../OtherUIFeatures/Inspect_Element_spec.js | 1 - .../Widgets/Button/ButtonLintErrorValidation_spec.js | 8 -------- .../Widgets/List/ListWidgetLintErrorValidation.js | 8 -------- .../ClientSide/Widgets/ListV2/DataIdentifier_spec.ts | 1 + .../Widgets/ListV2/ListV2_nested_List_widget_spec.js | 7 ++++++- .../Text/TextWidget_LintErrorValidation_spec.js | 8 -------- .../ClientSide/Workspace/ShareAppTests_Spec.ts | 12 +++++++++++- .../ServerSide/OnLoadTests/APIOnLoad_Spec.ts | 8 +++++++- .../ServerSide/OnLoadTests/JSOnLoad2_Spec.ts | 2 +- app/client/cypress/support/Objects/CommonLocators.ts | 2 ++ 12 files changed, 29 insertions(+), 34 deletions(-) diff --git a/app/client/cypress/e2e/Regression/ClientSide/BugTests/Moment_Spec.ts b/app/client/cypress/e2e/Regression/ClientSide/BugTests/Moment_Spec.ts index 9cb9c89457f..32099f0309a 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/BugTests/Moment_Spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/BugTests/Moment_Spec.ts @@ -122,7 +122,6 @@ describe( deployMode.NavigateBacktoEditor(); //verify runAstros triggered on PageLaoad of Edit page! - debuggerHelper.ClickDebuggerIcon(); debuggerHelper.ClickLogsTab(); debuggerHelper.DebuggerLogsFilter("JSObject1.runAstros"); debuggerHelper.DoesConsoleLogExist("JS Function executed successfully"); diff --git a/app/client/cypress/e2e/Regression/ClientSide/ExplorerTests/Pages_spec.js b/app/client/cypress/e2e/Regression/ClientSide/ExplorerTests/Pages_spec.js index ed8b4056207..cf1d77b9dd1 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/ExplorerTests/Pages_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/ExplorerTests/Pages_spec.js @@ -3,9 +3,6 @@ import EditorNavigation, { EntityType, } from "../../../../support/Pages/EditorNavigation"; import PageList from "../../../../support/Pages/PageList"; -const locators = { - errorPageTitle: ".t--error-page-title", -}; describe("Pages", { tags: ["@tag.IDE"] }, function () { let veryLongPageName = `abcdefghijklmnopqrstuvwxyz1234`; @@ -36,7 +33,7 @@ describe("Pages", { tags: ["@tag.IDE"] }, function () { EditorNavigation.SelectEntityByName("Page1 Copy", EntityType.Page); //Checks if 404 is showing correct route cy.visit("/route-that-does-not-exist"); - cy.get(locators.errorPageTitle).should(($x) => { + cy.get(_.locators.errorPageTitle).should(($x) => { expect($x).contain(Cypress.env("MESSAGES").PAGE_NOT_FOUND()); }); }); diff --git a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Inspect_Element_spec.js b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Inspect_Element_spec.js index ca9ba9a553f..ef587710513 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Inspect_Element_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Inspect_Element_spec.js @@ -7,7 +7,6 @@ describe("Inspect Entity", function () { it("1. Check whether depedencies and references are shown correctly", function () { cy.openPropertyPane("inputwidgetv2"); cy.testJsontext("defaultvalue", "{{Button1.text}}"); - _.agHelper.GetNClick(".t--debugger-count"); cy.contains(".ads-v2-tabs__list-tab", "Inspect entity").click(); cy.contains(".t--dependencies-item", "Button1").click(); cy.contains(".t--dependencies-item", "Input1"); diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Button/ButtonLintErrorValidation_spec.js b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Button/ButtonLintErrorValidation_spec.js index c65da176829..29a0c6f5daf 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Button/ButtonLintErrorValidation_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Button/ButtonLintErrorValidation_spec.js @@ -43,14 +43,6 @@ describe( .should("be.visible") .contains("'lintError' is not defined."); - cy.get(commonlocators.debugger) - .should("be.visible") - .click({ force: true }); - - cy.get(commonlocators.errorTab) - .should("be.visible") - .click({ force: true }); - cy.get(commonlocators.debugErrorMsg).should("have.length", 3); }); }, diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/List/ListWidgetLintErrorValidation.js b/app/client/cypress/e2e/Regression/ClientSide/Widgets/List/ListWidgetLintErrorValidation.js index 60b164133a0..c0091ef6e52 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/List/ListWidgetLintErrorValidation.js +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/List/ListWidgetLintErrorValidation.js @@ -43,14 +43,6 @@ describe( .should("be.visible") .contains("'DATA' is not defined."); - cy.get(commonlocators.debugger) - .should("be.visible") - .click({ force: true }); - - cy.get(commonlocators.errorTab) - .should("be.visible") - .click({ force: true }); - cy.get(commonlocators.debugErrorMsg).should("have.length", 6); }); }, diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/DataIdentifier_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/DataIdentifier_spec.ts index d0f15f8e521..2d96035e01b 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/DataIdentifier_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/DataIdentifier_spec.ts @@ -38,6 +38,7 @@ describe( () => { before(() => { agHelper.AddDsl("Listv2/ListV2WithNullPrimaryKey"); + debuggerHelper.ClickDebuggerIcon(); }); it("1. Widgets get displayed when PrimaryKey doesn't exist - SSP", () => { diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/ListV2_nested_List_widget_spec.js b/app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/ListV2_nested_List_widget_spec.js index 6c42b5af52d..54f70722a01 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/ListV2_nested_List_widget_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/ListV2_nested_List_widget_spec.js @@ -6,9 +6,11 @@ const commonlocators = require("../../../../../locators/commonlocators.json"); import { agHelper, assertHelper, + debuggerHelper, entityExplorer, propPane, } from "../../../../../support/Objects/ObjectsCore"; +import * as _ from "../../../../../support/Objects/ObjectsCore"; const widgetsPage = require("../../../../../locators/Widgets.json"); const widgetSelector = (name) => `[data-widgetname-cy="${name}"]`; @@ -72,7 +74,10 @@ describe( .type(`{${modifierKey}}{v}`); cy.wait(500); - cy.validateToastMessage("Cannot have more than 3 levels of nesting"); + _.debuggerHelper.DoesConsoleLogExist( + "Cannot have more than 3 levels of nesting", + true, + ); cy.get(`${widgetSelector("List2Copy1")}`).should("not.exist"); }); diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Text/TextWidget_LintErrorValidation_spec.js b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Text/TextWidget_LintErrorValidation_spec.js index 2a941b2004c..2930e8457d8 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Text/TextWidget_LintErrorValidation_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Text/TextWidget_LintErrorValidation_spec.js @@ -44,14 +44,6 @@ describe( .should("be.visible") .contains("'lintErrror' is not defined."); - cy.get(commonlocators.debugger) - .should("be.visible") - .click({ force: true }); - - cy.get(commonlocators.errorTab) - .should("be.visible") - .click({ force: true }); - cy.get(commonlocators.debugErrorMsg).should("have.length", 3); }); }, diff --git a/app/client/cypress/e2e/Regression/ClientSide/Workspace/ShareAppTests_Spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Workspace/ShareAppTests_Spec.ts index 9dbc5a43a00..ee6b2466475 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Workspace/ShareAppTests_Spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Workspace/ShareAppTests_Spec.ts @@ -124,7 +124,17 @@ describe( Cypress.env("TESTPASSWORD2"), ); agHelper.VisitNAssert(currentUrl); - agHelper.ValidateToastMessage("Resource Not Found"); //for 404 screen + cy.get(locators.errorPageTitle).should(($x) => { + //for 404 screen + expect($x).contain(Cypress.env("MESSAGES").PAGE_NOT_FOUND()); + }); + cy.get(locators.errorPageDescription).should(($x) => { + //for 404 screen + expect($x).contain( + "Either this page doesn't exist, or you don't have access to this page", + ); + }); + agHelper.ValidateToastMessage("Resource Not Found"); homePage.LogOutviaAPI(); // visit the app as anonymous user and validate redirection to login page agHelper.VisitNAssert(currentUrl); diff --git a/app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/APIOnLoad_Spec.ts b/app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/APIOnLoad_Spec.ts index dd100ab787c..1613a2fc444 100644 --- a/app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/APIOnLoad_Spec.ts +++ b/app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/APIOnLoad_Spec.ts @@ -2,6 +2,7 @@ import { agHelper, apiPage, assertHelper, + debuggerHelper, entityExplorer, entityItems, propPane, @@ -58,7 +59,12 @@ describe( `{{PageLoadApi2.data.data}}`, ); agHelper.RefreshPage(); - agHelper.ValidateToastMessage(`The action "PageLoadApi2" has failed.`); + debuggerHelper.AssertDebugError( + 'The action "PageLoadApi2" has failed.', + "", + false, + false, + ); }); after(() => { diff --git a/app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JSOnLoad2_Spec.ts b/app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JSOnLoad2_Spec.ts index 6d246804da3..d5c2be09734 100644 --- a/app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JSOnLoad2_Spec.ts +++ b/app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JSOnLoad2_Spec.ts @@ -35,7 +35,7 @@ describe( AssertJSOnPageLoad("runSpaceCraftImages"); }); - it("3. Tc #59 Verify JSOnPageload with ConfirmBefore calling - while imported - failing JSObj", () => { + it.only("3. Tc #59 Verify JSOnPageload with ConfirmBefore calling - while imported - failing JSObj", () => { homePage.ImportApp("ImportApps/JSOnLoadFailureTest.json", "JSOnLoadTest"); cy.wait("@importNewApplication").then(() => { homePage.AssertImportToast(); diff --git a/app/client/cypress/support/Objects/CommonLocators.ts b/app/client/cypress/support/Objects/CommonLocators.ts index dd3b8744564..f4a95af2b66 100644 --- a/app/client/cypress/support/Objects/CommonLocators.ts +++ b/app/client/cypress/support/Objects/CommonLocators.ts @@ -334,4 +334,6 @@ export class CommonLocators { _menuItem = ".bp3-menu-item"; _slashCommandHintText = ".slash-command-hint-text"; _selectionItem = ".rc-select-selection-item"; + errorPageTitle = ".t--error-page-title"; + errorPageDescription = ".t--error-page-description"; } From b2cd8c0c72423f6076c0101fc61872ed0774a287 Mon Sep 17 00:00:00 2001 From: Hetu Nandu Date: Tue, 27 Aug 2024 13:06:42 +0530 Subject: [PATCH 09/23] more test cases --- .../ActionExecution/StoreValue_spec.ts | 2 +- .../Debugger/Api_pane_navigation_spec.ts | 2 +- .../Debugger/JSObjects_navigation_spec.ts | 2 +- .../Debugger/Query_pane_navigation.ts | 2 +- .../Widget_property_navigation_spec.ts | 14 +++++------ .../OtherUIFeatures/EntityBottomBar_spec.ts | 10 ++++---- .../ClientSide/OtherUIFeatures/Logs1_spec.js | 20 ++++++++-------- .../ClientSide/OtherUIFeatures/Logs2_spec.js | 4 ++-- .../OtherUIFeatures/Widget_Error_spec.js | 2 +- .../Widgets/ListV2/DataIdentifier_spec.ts | 4 ++-- .../JSFunctionExecution_spec.ts | 7 +++--- .../ServerSide/OnLoadTests/JSOnLoad2_Spec.ts | 2 +- .../cypress/support/Pages/DebuggerHelper.ts | 23 ++++++++----------- app/client/src/sagas/DebuggerSagas.ts | 8 +++---- app/client/src/sagas/EvaluationsSaga.ts | 9 ++++---- 15 files changed, 51 insertions(+), 60 deletions(-) diff --git a/app/client/cypress/e2e/Regression/ClientSide/ActionExecution/StoreValue_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/ActionExecution/StoreValue_spec.ts index 8ce32c6a015..e13c374025a 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/ActionExecution/StoreValue_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/ActionExecution/StoreValue_spec.ts @@ -238,7 +238,7 @@ describe("storeValue Action test", { tags: ["@tag.JS"] }, () => { }); agHelper.ClickButton("Test store logs"); - debuggerHelper.ClickDebuggerIcon(); + debuggerHelper.OpenDebugger(); debuggerHelper.ClickLogsTab(); debuggerHelper.changeLogsGroup("System logs"); debuggerHelper.DoesConsoleLogExist("storeValue('xyz', '123', true)"); diff --git a/app/client/cypress/e2e/Regression/ClientSide/Debugger/Api_pane_navigation_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Debugger/Api_pane_navigation_spec.ts index d8d69058335..5bacf30fa3d 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Debugger/Api_pane_navigation_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Debugger/Api_pane_navigation_spec.ts @@ -27,7 +27,7 @@ describe( apiPage.EnterHeader("test", "test"); debuggerHelper.AssertErrorCount(1); EditorNavigation.ShowCanvas(); - debuggerHelper.ClickDebuggerIcon(); + debuggerHelper.OpenDebugger(); debuggerHelper.ClicklogEntityLink(); agHelper.AssertElementVisibility(apiPage._nextCursorValue); diff --git a/app/client/cypress/e2e/Regression/ClientSide/Debugger/JSObjects_navigation_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Debugger/JSObjects_navigation_spec.ts index 0446d7cb696..6d00f9aecd6 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Debugger/JSObjects_navigation_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Debugger/JSObjects_navigation_spec.ts @@ -30,7 +30,7 @@ describe("JSObjects", () => { shouldCreateNewJSObj: true, }); - debuggerHelper.ClickDebuggerIcon(); + debuggerHelper.OpenDebugger(); debuggerHelper.ClicklogEntityLink(); agHelper.AssertCursorInput(".js-editor", { ch: 20, line: 6 }); diff --git a/app/client/cypress/e2e/Regression/ClientSide/Debugger/Query_pane_navigation.ts b/app/client/cypress/e2e/Regression/ClientSide/Debugger/Query_pane_navigation.ts index 4dc7732fb30..fad1610109d 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Debugger/Query_pane_navigation.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Debugger/Query_pane_navigation.ts @@ -66,7 +66,7 @@ describe( ); debuggerHelper.AssertErrorCount(2); - debuggerHelper.ClickDebuggerIcon(); + debuggerHelper.OpenDebugger(); debuggerHelper.ClicklogEntityLink(); agHelper.AssertElementVisibility( ".t--actionConfiguration\\.formData\\.limitDocuments\\.data", diff --git a/app/client/cypress/e2e/Regression/ClientSide/Debugger/Widget_property_navigation_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Debugger/Widget_property_navigation_spec.ts index 1f9699579c2..30a27209444 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Debugger/Widget_property_navigation_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Debugger/Widget_property_navigation_spec.ts @@ -14,7 +14,7 @@ describe( _.debuggerHelper.AssertErrorCount(1); _.propPane.ToggleSection("general"); _.agHelper.AssertElementAbsence("animateloading"); - _.debuggerHelper.ClickDebuggerIcon(); + _.debuggerHelper.OpenDebugger(); _.debuggerHelper.ClicklogEntityLink(); _.propPane.AssertIfPropertyIsVisible("animateloading"); @@ -28,7 +28,7 @@ describe( _.propPane.EnterJSContext("visible", "{{test}}", true, false); _.debuggerHelper.AssertErrorCount(1); _.propPane.NavigateBackToPropertyPane(); - _.debuggerHelper.ClickDebuggerIcon(); + _.debuggerHelper.OpenDebugger(); _.debuggerHelper.ClicklogEntityLink(); _.agHelper.GetNAssertContains(_.propPane._paneTitle, "Tab 2"); _.propPane.AssertIfPropertyIsVisible("visible"); @@ -48,7 +48,7 @@ describe( _.debuggerHelper.AssertErrorCount(1); _.propPane.NavigateBackToPropertyPane(false); _.propPane.NavigateBackToPropertyPane(); - _.debuggerHelper.ClickDebuggerIcon(); + _.debuggerHelper.OpenDebugger(); _.debuggerHelper.ClicklogEntityLink(); _.agHelper.GetNAssertContains(_.propPane._paneTitle, "Menu Item"); _.propPane.AssertIfPropertyIsVisible("icon"); @@ -65,7 +65,7 @@ describe( _.propPane.MoveToTab("Style"); _.debuggerHelper.AssertErrorCount(1); _.propPane.NavigateBackToPropertyPane(); - _.debuggerHelper.ClickDebuggerIcon(); + _.debuggerHelper.OpenDebugger(); _.debuggerHelper.ClicklogEntityLink(); _.agHelper.GetNAssertContains(_.propPane._paneTitle, "Second Menu Item"); _.propPane.AssertIfPropertyIsVisible("disabled"); @@ -110,7 +110,7 @@ describe( _.propPane.NavigateBackToPropertyPane(false); _.propPane.NavigateBackToPropertyPane(); - _.debuggerHelper.ClickDebuggerIcon(); + _.debuggerHelper.OpenDebugger(); _.debuggerHelper.ClicklogEntityLink(); _.agHelper.GetNAssertContains(_.propPane._paneTitle, "Custom Field 2"); _.propPane.AssertIfPropertyIsVisible("borderradius"); @@ -133,7 +133,7 @@ describe( _.propPane.EnterJSContext("disabled", "{{test}}", true, false); _.debuggerHelper.AssertErrorCount(2); - _.debuggerHelper.ClickDebuggerIcon(); + _.debuggerHelper.OpenDebugger(); _.debuggerHelper.ClicklogEntityLink(true); _.agHelper.GetNAssertContains(_.propPane._paneTitle, "First Menu Item"); _.debuggerHelper.CloseBottomBar(); @@ -173,7 +173,7 @@ describe( _.propPane.ToggleSection("validation"); _.propPane.NavigateBackToPropertyPane(); - _.debuggerHelper.ClickDebuggerIcon(); + _.debuggerHelper.OpenDebugger(); _.debuggerHelper.ClicklogEntityLink(); _.agHelper.GetNAssertContains(_.propPane._paneTitle, "imdb_id"); _.debuggerHelper.CloseBottomBar(); diff --git a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/EntityBottomBar_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/EntityBottomBar_spec.ts index fae97f66f8e..23d9464dffc 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/EntityBottomBar_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/EntityBottomBar_spec.ts @@ -7,7 +7,7 @@ describe("Entity bottom bar", { tags: ["@tag.IDE"] }, () => { //Verify if bottom bar is closed. _.debuggerHelper.AssertClosed(); //verify if bottom bar is open on clicking debugger icon in canvas. - _.debuggerHelper.ClickDebuggerIcon(); + _.debuggerHelper.OpenDebugger(); _.debuggerHelper.AssertOpen(PageType.Canvas); //Verify if selected tab is errors in tab title. _.debuggerHelper.AssertSelectedTab( @@ -48,7 +48,7 @@ describe("Entity bottom bar", { tags: ["@tag.IDE"] }, () => { //Verify that the errors tab is still closed. _.debuggerHelper.AssertClosed(); //Verify if bottom bar opens on clicking debugger icon in api page. - _.debuggerHelper.ClickDebuggerIcon(); + _.debuggerHelper.OpenDebugger(); _.debuggerHelper.AssertOpen(PageType.API); //Verify if selected tab is errors in tab title. _.debuggerHelper.AssertSelectedTab( @@ -70,7 +70,7 @@ describe("Entity bottom bar", { tags: ["@tag.IDE"] }, () => { //Expecting errors tab to be closed as this is now a datasource _.debuggerHelper.AssertClosed(); //Verify if bottom bar opens on clicking debugger icon in datasource page. - _.debuggerHelper.ClickDebuggerIcon(); + _.debuggerHelper.OpenDebugger(); _.debuggerHelper.AssertOpen(PageType.DataSources); }); @@ -91,7 +91,7 @@ describe("Entity bottom bar", { tags: ["@tag.IDE"] }, () => { _.debuggerHelper.AssertClosed(); //Verify if bottom bar opens on clicking debugger icon in query page. _.dataSources.CreateQueryAfterDSSaved(); - _.debuggerHelper.ClickDebuggerIcon(); + _.debuggerHelper.OpenDebugger(); _.debuggerHelper.AssertOpen(PageType.Query); //Verify if bottom bar is closed on clicking close icon in query page. _.debuggerHelper.CloseBottomBar(); @@ -130,7 +130,7 @@ describe("Entity bottom bar", { tags: ["@tag.IDE"] }, () => { _.debuggerHelper.AssertClosed(); //Verify if bottom bar opens on clicking debugger icon in query page. _.dataSources.CreateQueryAfterDSSaved(); - _.debuggerHelper.ClickDebuggerIcon(); + _.debuggerHelper.OpenDebugger(); _.debuggerHelper.AssertOpen(PageType.Query); //Verify if bottom bar is closed on clicking close icon in query page. _.debuggerHelper.CloseBottomBar(); diff --git a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Logs1_spec.js b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Logs1_spec.js index a3e7ffa11e7..42b84b43474 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Logs1_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Logs1_spec.js @@ -1,5 +1,3 @@ -import commonlocators from "../../../../locators/commonlocators.json"; -import { homePage } from "../../../../support/Objects/ObjectsCore"; import { ObjectsRegistry } from "../../../../support/Objects/Registry"; import EditorNavigation, { EntityType, @@ -26,18 +24,18 @@ describe("Debugger logs", function () { logString = generateTestLogString(); }); - it("3. Console log on button click with normal moustache binding", function () { + it("1. Console log on button click with normal moustache binding", function () { ee.DragDropWidgetNVerify("buttonwidget", 200, 200); // Testing with normal log in moustache binding propPane.EnterJSContext("onClick", `{{console.log("${logString}")}}`); agHelper.Sleep(2000); agHelper.ClickButton("Submit"); - debuggerHelper.ClickDebuggerIcon(); + debuggerHelper.OpenDebugger(); agHelper.GetNClick(jsEditor._logsTab); debuggerHelper.DoesConsoleLogExist(logString); }); - it("4. Console log on button click with arrow function IIFE", function () { + it("2. Console log on button click with arrow function IIFE", function () { debuggerHelper.ClearLogs(); EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); // Testing with normal log in iifee @@ -51,7 +49,7 @@ describe("Debugger logs", function () { debuggerHelper.DoesConsoleLogExist(logString); }); - it("5. Console log on button click with function keyword IIFE", function () { + it("3. Console log on button click with function keyword IIFE", function () { debuggerHelper.ClearLogs(); EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); // Testing with normal log in iifee @@ -65,7 +63,7 @@ describe("Debugger logs", function () { debuggerHelper.DoesConsoleLogExist(logString); }); - it("6. Console log on button click with async function IIFE", function () { + it("4. Console log on button click with async function IIFE", function () { debuggerHelper.ClearLogs(); // Testing with normal log in iifee EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); @@ -79,7 +77,7 @@ describe("Debugger logs", function () { debuggerHelper.DoesConsoleLogExist(logString); }); - it("7. Console log on button click with mixed function IIFE", function () { + it("5. Console log on button click with mixed function IIFE", function () { debuggerHelper.ClearLogs(); // Testing with normal log in iifee EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); @@ -96,7 +94,7 @@ describe("Debugger logs", function () { debuggerHelper.DoesConsoleLogExist(logStringChild); }); - it("8. Console log grouping on button click", function () { + it("6. Console log grouping on button click", function () { debuggerHelper.ClearLogs(); // Testing with normal log in iifee EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); @@ -116,7 +114,7 @@ describe("Debugger logs", function () { debuggerHelper.AssertConsecutiveConsoleLogCount(5); }); - it("9. Console log grouping on button click with different log in between", function () { + it("7. Console log grouping on button click with different log in between", function () { debuggerHelper.ClearLogs(); // Testing with normal log in iifee EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); @@ -135,7 +133,7 @@ describe("Debugger logs", function () { debuggerHelper.AssertConsecutiveConsoleLogCount(2); }); - it("10. Console log grouping on button click from different source", function () { + it("8. Console log grouping on button click from different source", function () { debuggerHelper.ClearLogs(); // Testing with normal log in iifee EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); diff --git a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Logs2_spec.js b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Logs2_spec.js index 84207474a4c..fa3358209b5 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Logs2_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Logs2_spec.js @@ -34,7 +34,7 @@ describe("Debugger logs", { tags: ["@tag.IDE"] }, function () { _.agHelper.RefreshPage(); // Wait for the debugger icon to be visible _.agHelper.AssertElementVisibility(".t--debugger-count"); - _.debuggerHelper.ClickDebuggerIcon(); + _.debuggerHelper.OpenDebugger(); _.agHelper.GetNClick(_.jsEditor._logsTab); _.debuggerHelper.DoesConsoleLogExist(logString); }); @@ -286,7 +286,7 @@ describe("Debugger logs", { tags: ["@tag.IDE"] }, function () { EditorNavigation.SelectEntityByName("Page1", EntityType.Page); _.agHelper.AssertElementVisibility(".t--debugger-count"); - _.debuggerHelper.ClickDebuggerIcon(); + _.debuggerHelper.OpenDebugger(); _.debuggerHelper.ClicklogEntityLink(); diff --git a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Widget_Error_spec.js b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Widget_Error_spec.js index ae53291a32a..afa69d28542 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Widget_Error_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Widget_Error_spec.js @@ -23,7 +23,7 @@ describe("Widget error state", function () { //Check if the current value is shown in the debugger - _.debuggerHelper.ClickDebuggerIcon(); + _.debuggerHelper.OpenDebugger(); cy.get("[data-testid=t--tab-ERROR]").click(); //This feature is disabled in updated error log - epic 17720 // _.debuggerHelper.LogStateContains("Test"); diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/DataIdentifier_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/DataIdentifier_spec.ts index 2d96035e01b..bcc13daeb54 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/DataIdentifier_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/DataIdentifier_spec.ts @@ -38,7 +38,7 @@ describe( () => { before(() => { agHelper.AddDsl("Listv2/ListV2WithNullPrimaryKey"); - debuggerHelper.ClickDebuggerIcon(); + debuggerHelper.OpenDebugger(); }); it("1. Widgets get displayed when PrimaryKey doesn't exist - SSP", () => { @@ -92,7 +92,7 @@ describe( 1, ); //Open debugger by clicking debugger icon in canvas. - debuggerHelper.ClickDebuggerIcon(); + debuggerHelper.OpenDebugger(); agHelper.GetNAssertContains( debuggerHelper.locators._debuggerList, "This data identifier is evaluating to a duplicate value. Please use an identifier that evaluates to a unique value.", diff --git a/app/client/cypress/e2e/Regression/ServerSide/JsFunctionExecution/JSFunctionExecution_spec.ts b/app/client/cypress/e2e/Regression/ServerSide/JsFunctionExecution/JSFunctionExecution_spec.ts index a77af1001a6..201b69d0e61 100644 --- a/app/client/cypress/e2e/Regression/ServerSide/JsFunctionExecution/JSFunctionExecution_spec.ts +++ b/app/client/cypress/e2e/Regression/ServerSide/JsFunctionExecution/JSFunctionExecution_spec.ts @@ -126,7 +126,7 @@ describe("JS Function Execution", { tags: ["@tag.JS"] }, function () { //It should open only in case of execution error. debuggerHelper.AssertClosed(); //Verify there is no error shown in the response tab. - debuggerHelper.ClickDebuggerIcon(); + debuggerHelper.OpenDebugger(); debuggerHelper.ClickResponseTab(); jsEditor.AssertParseError(false); agHelper.ActionContextMenuWithInPane({ @@ -400,7 +400,6 @@ describe("JS Function Execution", { tags: ["@tag.JS"] }, function () { jsEditor.EnableDisableAsyncFuncSettings( functionSetting.name, functionSetting.onPageLoad, - functionSetting.confirmBeforeExecute, ); }, ); @@ -496,12 +495,12 @@ return "yes";`; // Switch to settings tab agHelper.GetNClick(jsEditor._settingsTab); // Enable all settings - jsEditor.EnableDisableAsyncFuncSettings("asyncToSync", true, false); + jsEditor.EnableDisableAsyncFuncSettings("asyncToSync", true); // Modify js object jsEditor.EditJSObj(syncJSCode, false); agHelper.RefreshPage(); - jsEditor.VerifyAsyncFuncSettings("asyncToSync", true, false); + jsEditor.VerifyAsyncFuncSettings("asyncToSync", true); agHelper.ActionContextMenuWithInPane({ action: "Delete", entityType: entityItems.JSObject, diff --git a/app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JSOnLoad2_Spec.ts b/app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JSOnLoad2_Spec.ts index d5c2be09734..5bb511eac2e 100644 --- a/app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JSOnLoad2_Spec.ts +++ b/app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JSOnLoad2_Spec.ts @@ -91,7 +91,7 @@ describe( EditorNavigation.SelectEntityByName("Page1", EntityType.Page); agHelper.RefreshPage(); - debuggerHelper.ClickDebuggerIcon(); + debuggerHelper.OpenDebugger(); debuggerHelper.ClickLogsTab(); debuggerHelper.DebuggerLogsFilter("JSObject1.astros"); debuggerHelper.DoesConsoleLogExist("JS Function executed successfully"); diff --git a/app/client/cypress/support/Pages/DebuggerHelper.ts b/app/client/cypress/support/Pages/DebuggerHelper.ts index 2dabfb70711..16a4cfdc5a8 100644 --- a/app/client/cypress/support/Pages/DebuggerHelper.ts +++ b/app/client/cypress/support/Pages/DebuggerHelper.ts @@ -49,17 +49,14 @@ export class DebuggerHelper { _downStreamLogMessage: ".t--debugger-log-downstream-message", }; - ClickDebuggerIcon( - index?: number, - force?: boolean, - waitTimeInterval?: number, - ) { - this.agHelper.GetNClick( - this.locators._debuggerIcon, - index, - force, - waitTimeInterval, - ); + OpenDebugger() { + // Open opens if it is not open yet + cy.get("body").then(($body) => { + if ($body.find(this.locators._tabsContainer).length === 0) { + this.agHelper.GetNClick(this.locators._debuggerIcon, 0, false); + } + }); + this.agHelper.AssertElementVisibility(this.locators._tabsContainer); } ClickDebuggerToggle(expand = true, index = 0) { @@ -189,7 +186,7 @@ export class DebuggerHelper { shouldToggleDebugger = true, ) { if (shouldOpenDebugger) { - this.ClickDebuggerIcon(); + this.OpenDebugger(); } this.agHelper.GetNClick(this.commonLocators._errorTab, 0, true, 0); @@ -222,7 +219,7 @@ export class DebuggerHelper { AssertDownStreamLogError(message: string, shouldOpenDebugger = true) { if (shouldOpenDebugger) { - this.ClickDebuggerIcon(); + this.OpenDebugger(); } this.agHelper.GetNClick(this.commonLocators._responseTab, 0, true, 0); diff --git a/app/client/src/sagas/DebuggerSagas.ts b/app/client/src/sagas/DebuggerSagas.ts index e655a94b475..d0fb7a22b81 100644 --- a/app/client/src/sagas/DebuggerSagas.ts +++ b/app/client/src/sagas/DebuggerSagas.ts @@ -29,7 +29,7 @@ import { takeEvery, } from "redux-saga/effects"; import { findIndex, get, isEmpty, isMatch, set } from "lodash"; -import { getDebuggerErrors } from "selectors/debuggerSelectors"; +import { getDebuggerErrors, getErrorCount } from "selectors/debuggerSelectors"; import { getAction, getPlugin, @@ -61,7 +61,6 @@ import { transformAddErrorLogsSaga, transformDeleteErrorLogsSaga, } from "ee/sagas/helpers"; -import { objectKeys } from "@appsmith/utils"; let blockedSource: string | null = null; @@ -820,10 +819,9 @@ function* activeFieldDebuggerErrorHandler( function* handleHideDebuggerSaga(action: ReduxAction) { const { payload } = action; - const currentDebuggerErrors: Record = - yield select(getDebuggerErrors); + const errorCount: number = yield select(getErrorCount); - if (objectKeys(currentDebuggerErrors).length && !payload) { + if (errorCount > 0 && !payload) { yield put(showDebugger()); yield put(setDebuggerSelectedTab(DEBUGGER_TAB_KEYS.ERROR_TAB)); } diff --git a/app/client/src/sagas/EvaluationsSaga.ts b/app/client/src/sagas/EvaluationsSaga.ts index 52930d6ef05..707642636c4 100644 --- a/app/client/src/sagas/EvaluationsSaga.ts +++ b/app/client/src/sagas/EvaluationsSaga.ts @@ -341,16 +341,15 @@ export function* evaluateAndExecuteDynamicTrigger( triggerMeta, }, ); - // TODO: Fix this the next time the file is edited - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const { errors = [] } = response as any; + const { errors = [] } = response; const transformedErrors: EvaluationError[] = yield call( transformTriggerEvalErrors, errors, ); - - yield fork(showExecutionErrors, transformedErrors); + if (transformedErrors.length) { + yield fork(showExecutionErrors, transformedErrors); + } yield fork(logDynamicTriggerExecution, { dynamicTrigger, errors: transformedErrors, From 13c8a2fbbab301537b3b389ce46f1dacc1360e3f Mon Sep 17 00:00:00 2001 From: Hetu Nandu Date: Tue, 27 Aug 2024 18:18:25 +0530 Subject: [PATCH 10/23] fix selector --- .../OtherUIFeatures/ErrorMessages_spec.ts | 21 +++++++++++++++---- .../OtherUIFeatures/Widget_Error_spec.js | 3 +-- .../Widgets/ListV2/ListV2_NestedList_spec.ts | 4 +++- .../TextWidget_LintErrorValidation_spec.js | 2 +- .../cypress/support/Pages/DebuggerHelper.ts | 11 +++++++--- app/client/src/IDE/Components/BottomView.tsx | 2 +- 6 files changed, 31 insertions(+), 12 deletions(-) diff --git a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/ErrorMessages_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/ErrorMessages_spec.ts index c0e974e15a0..9797076406c 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/ErrorMessages_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/ErrorMessages_spec.ts @@ -33,14 +33,19 @@ describe("Sanitise toast error messages", () => { EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); _.propPane.EnterJSContext("onClick", "{{a.kjbfjdfbkds()}}"); _.agHelper.ClickButton("Submit"); - _.agHelper.WaitUntilToastDisappear("a is not defined"); + _.debuggerHelper.AssertDebugError("'a' is not defined.", "", false, false); }); it("2. Does not show type error label when js obj function does not exist", () => { EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); _.propPane.EnterJSContext("onClick", "{{JSObject1.myFun1efef()}}"); _.agHelper.ClickButton("Submit"); - _.agHelper.WaitUntilToastDisappear("Object1.myFun1efef is not a function"); + _.debuggerHelper.AssertDebugError( + "Object1.myFun1efef is not a function", + "", + false, + false, + ); }); it("3. Does not show any label when msg is not given for post message", () => { @@ -67,8 +72,11 @@ describe("Sanitise toast error messages", () => { EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); _.propPane.EnterJSContext("onClick", "{{JSObject1.myFun1()}}"); _.agHelper.ClickButton("Submit"); - _.agHelper.WaitUntilToastDisappear( + _.debuggerHelper.AssertDebugError( "Cannot read properties of null (reading ':')", + "", + false, + false, ); }); @@ -81,6 +89,11 @@ describe("Sanitise toast error messages", () => { _.agHelper.GetNClick(_.propPane._actionSelectorDelete); _.propPane.SelectPlatformFunction("onClick", "Navigate to"); _.agHelper.ClickButton("Submit"); - _.agHelper.WaitUntilToastDisappear("Enter a valid URL or page name"); + _.debuggerHelper.AssertDebugError( + "Enter a valid URL or page name", + "", + false, + false, + ); }); }); diff --git a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Widget_Error_spec.js b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Widget_Error_spec.js index afa69d28542..278906f6cde 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Widget_Error_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Widget_Error_spec.js @@ -29,14 +29,13 @@ describe("Widget error state", function () { // _.debuggerHelper.LogStateContains("Test"); }); - it("2. Switch to error tab when clicked on the debug button", function () { + it("2. Switch to error tab when execution error occurs", function () { cy.get("[data-testid=t--tab-LOGS_TAB]").click(); cy.get(".t--property-control-onclick").find(".t--js-toggle").click(); cy.EnableAllCodeEditors(); cy.testJsontext("onclick", "{{testApi.run()}}"); cy.get(widgetLocators.buttonWidget).click(); - cy.get(".t--toast-debug-button").click(); cy.get("[data-testid='t--tab-ERROR']").should( "have.attr", "aria-selected", diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/ListV2_NestedList_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/ListV2_NestedList_spec.ts index 2ce68154fbc..f417174a4d9 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/ListV2_NestedList_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/ListV2_NestedList_spec.ts @@ -9,6 +9,7 @@ import { import EditorNavigation, { EntityType, } from "../../../../../support/Pages/EditorNavigation"; +import * as _ from "../../../../../support/Objects/ObjectsCore"; describe( "Nested List widget V2 ", @@ -40,8 +41,9 @@ describe( "List3", ]); agHelper.GetElement("body").type(`{${agHelper._modifierKey}}{v}`); - agHelper.ValidateToastMessage( + _.debuggerHelper.DoesConsoleLogExist( "Cannot have more than 3 levels of nesting in the list widget", + true, ); }); diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Text/TextWidget_LintErrorValidation_spec.js b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Text/TextWidget_LintErrorValidation_spec.js index 2930e8457d8..b473a01b24d 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Text/TextWidget_LintErrorValidation_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Text/TextWidget_LintErrorValidation_spec.js @@ -44,7 +44,7 @@ describe( .should("be.visible") .contains("'lintErrror' is not defined."); - cy.get(commonlocators.debugErrorMsg).should("have.length", 3); + _.debuggerHelper.AssertErrorCount(3); }); }, ); diff --git a/app/client/cypress/support/Pages/DebuggerHelper.ts b/app/client/cypress/support/Pages/DebuggerHelper.ts index 16a4cfdc5a8..87224129f4e 100644 --- a/app/client/cypress/support/Pages/DebuggerHelper.ts +++ b/app/client/cypress/support/Pages/DebuggerHelper.ts @@ -34,6 +34,7 @@ export class DebuggerHelper { [PageType.JsEditor]: ".t--js-editor-bottom-pane-container", [PageType.DataSources]: ".t--datasource-bottom-pane-container", }, + _ideBottomViewContainer: ".t--ide-bottom-view", _debuggerList: ".debugger-list", _debuggerFilter: "input[data-testid=t--debugger-search]", _debuggerSelectedTab: ".ads-v2-tabs__list-tab", @@ -52,11 +53,11 @@ export class DebuggerHelper { OpenDebugger() { // Open opens if it is not open yet cy.get("body").then(($body) => { - if ($body.find(this.locators._tabsContainer).length === 0) { + if ($body.find(this.locators._ideBottomViewContainer).length === 0) { this.agHelper.GetNClick(this.locators._debuggerIcon, 0, false); } }); - this.agHelper.AssertElementVisibility(this.locators._tabsContainer); + this.AssertOpen(); } ClickDebuggerToggle(expand = true, index = 0) { @@ -90,7 +91,7 @@ export class DebuggerHelper { this.agHelper.GetNClick(this.locators._closeButton); } - AssertOpen(pageType: PageType) { + AssertOpen(pageType?: PageType) { switch (pageType) { case PageType.Canvas: this.agHelper.AssertElementExist(this.locators._tabsContainer); @@ -103,6 +104,10 @@ export class DebuggerHelper { this.locators._bottomPaneContainer[pageType], ); break; + default: + this.agHelper.AssertElementVisibility( + this.locators._ideBottomViewContainer, + ); } } diff --git a/app/client/src/IDE/Components/BottomView.tsx b/app/client/src/IDE/Components/BottomView.tsx index 022a4fe89ad..8d8555bb2f0 100644 --- a/app/client/src/IDE/Components/BottomView.tsx +++ b/app/client/src/IDE/Components/BottomView.tsx @@ -126,7 +126,7 @@ const BottomView = (props: Props) => { return ( From a2de7e76014d4ee95a040b5bf560fcc4b9fe601b Mon Sep 17 00:00:00 2001 From: Hetu Nandu Date: Wed, 28 Aug 2024 15:10:22 +0530 Subject: [PATCH 11/23] fix most scenarios --- .../Debugger/Query_pane_navigation.ts | 1 + .../OtherUIFeatures/Inspect_Element_spec.js | 1 + .../Button/ButtonLintErrorValidation_spec.js | 2 + .../List/ListWidgetLintErrorValidation.js | 2 + .../Widgets/ListV2/DataIdentifier_spec.ts | 8 +- .../Sanity/Datasources/MySQLNoiseTest_spec.js | 16 +- .../cypress/support/Pages/DebuggerHelper.ts | 12 +- app/client/src/IDE/Components/BottomView.tsx | 7 +- ceChanges.patch | 237 ++++++++++++++++++ 9 files changed, 276 insertions(+), 10 deletions(-) create mode 100644 ceChanges.patch diff --git a/app/client/cypress/e2e/Regression/ClientSide/Debugger/Query_pane_navigation.ts b/app/client/cypress/e2e/Regression/ClientSide/Debugger/Query_pane_navigation.ts index fad1610109d..e458fbe8463 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Debugger/Query_pane_navigation.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Debugger/Query_pane_navigation.ts @@ -67,6 +67,7 @@ describe( debuggerHelper.AssertErrorCount(2); debuggerHelper.OpenDebugger(); + debuggerHelper.ClickLogsTab(); debuggerHelper.ClicklogEntityLink(); agHelper.AssertElementVisibility( ".t--actionConfiguration\\.formData\\.limitDocuments\\.data", diff --git a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Inspect_Element_spec.js b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Inspect_Element_spec.js index ef587710513..b4f51bc7282 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Inspect_Element_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Inspect_Element_spec.js @@ -7,6 +7,7 @@ describe("Inspect Entity", function () { it("1. Check whether depedencies and references are shown correctly", function () { cy.openPropertyPane("inputwidgetv2"); cy.testJsontext("defaultvalue", "{{Button1.text}}"); + _.debuggerHelper.OpenDebugger(); cy.contains(".ads-v2-tabs__list-tab", "Inspect entity").click(); cy.contains(".t--dependencies-item", "Button1").click(); cy.contains(".t--dependencies-item", "Input1"); diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Button/ButtonLintErrorValidation_spec.js b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Button/ButtonLintErrorValidation_spec.js index 29a0c6f5daf..93bcb3dbd81 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Button/ButtonLintErrorValidation_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Button/ButtonLintErrorValidation_spec.js @@ -43,6 +43,8 @@ describe( .should("be.visible") .contains("'lintError' is not defined."); + _.debuggerHelper.OpenDebugger(); + cy.get(commonlocators.debugErrorMsg).should("have.length", 3); }); }, diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/List/ListWidgetLintErrorValidation.js b/app/client/cypress/e2e/Regression/ClientSide/Widgets/List/ListWidgetLintErrorValidation.js index c0091ef6e52..87c5d382fdd 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/List/ListWidgetLintErrorValidation.js +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/List/ListWidgetLintErrorValidation.js @@ -43,6 +43,8 @@ describe( .should("be.visible") .contains("'DATA' is not defined."); + _.debuggerHelper.OpenDebugger(); + cy.get(commonlocators.debugErrorMsg).should("have.length", 6); }); }, diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/DataIdentifier_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/DataIdentifier_spec.ts index bcc13daeb54..1d64e70592b 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/DataIdentifier_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/DataIdentifier_spec.ts @@ -38,7 +38,6 @@ describe( () => { before(() => { agHelper.AddDsl("Listv2/ListV2WithNullPrimaryKey"); - debuggerHelper.OpenDebugger(); }); it("1. Widgets get displayed when PrimaryKey doesn't exist - SSP", () => { @@ -92,10 +91,11 @@ describe( 1, ); //Open debugger by clicking debugger icon in canvas. - debuggerHelper.OpenDebugger(); - agHelper.GetNAssertContains( - debuggerHelper.locators._debuggerList, + debuggerHelper.AssertDebugError( "This data identifier is evaluating to a duplicate value. Please use an identifier that evaluates to a unique value.", + "", + true, + false, ); }); }, diff --git a/app/client/cypress/e2e/Sanity/Datasources/MySQLNoiseTest_spec.js b/app/client/cypress/e2e/Sanity/Datasources/MySQLNoiseTest_spec.js index f1a4d43fb66..ecbc34e0248 100644 --- a/app/client/cypress/e2e/Sanity/Datasources/MySQLNoiseTest_spec.js +++ b/app/client/cypress/e2e/Sanity/Datasources/MySQLNoiseTest_spec.js @@ -4,7 +4,11 @@ import { } from "../../../support/Pages/EditorNavigation"; const datasourceEditor = require("../../../locators/DatasourcesEditor.json"); -import { agHelper, dataSources } from "../../../support/Objects/ObjectsCore"; +import { + agHelper, + dataSources, + debuggerHelper, +} from "../../../support/Objects/ObjectsCore"; const commonlocators = require("../../../locators/commonlocators.json"); describe( @@ -60,9 +64,15 @@ describe( force: true, }); cy.wait(2000); - cy.get(commonlocators.toastmsg).contains( - "NoiseTestQuery failed to execute", + + debuggerHelper.OpenDebugger(); + debuggerHelper.ClickLogsTab(); + debuggerHelper.DoesConsoleLogExist( + "Execution failed with status PE-STC-5000", + true, + "NoiseTestQuery", ); + cy.wait("@postExecute").then(({ response }) => { expect(response.body.data.statusCode).to.eq("200 OK"); }); diff --git a/app/client/cypress/support/Pages/DebuggerHelper.ts b/app/client/cypress/support/Pages/DebuggerHelper.ts index 87224129f4e..5fd3117192e 100644 --- a/app/client/cypress/support/Pages/DebuggerHelper.ts +++ b/app/client/cypress/support/Pages/DebuggerHelper.ts @@ -120,12 +120,19 @@ export class DebuggerHelper { this.agHelper.AssertSelectedTab(this.locators._debuggerSelectedTab, "true"); } - DoesConsoleLogExist(text: string, exists = true) { + DoesConsoleLogExist(text: string, exists = true, entityName?: string) { this.agHelper.GetNAssertContains( this.locators._logMessage, text, exists ? "exist" : "not.exist", ); + if (entityName) { + this.agHelper + .GetElement(this.locators._logMessage) + .contains(text) + .closest(".error") + .contains(this.locators._logEntityLink, entityName); + } } DebuggerLogsFilter(text: string) { @@ -189,6 +196,7 @@ export class DebuggerHelper { message: string, shouldOpenDebugger = true, shouldToggleDebugger = true, + errorLabelIndex = 0, ) { if (shouldOpenDebugger) { this.OpenDebugger(); @@ -200,7 +208,7 @@ export class DebuggerHelper { } this.agHelper - .GetText(this.locators._debuggerLabel, "text", 0) + .GetText(this.locators._debuggerLabel, "text", errorLabelIndex) .then(($text) => { expect($text).to.eq(label); }); diff --git a/app/client/src/IDE/Components/BottomView.tsx b/app/client/src/IDE/Components/BottomView.tsx index 8d8555bb2f0..89470b86130 100644 --- a/app/client/src/IDE/Components/BottomView.tsx +++ b/app/client/src/IDE/Components/BottomView.tsx @@ -6,6 +6,7 @@ import Resizer, { import { CodeEditorWithGutterStyles } from "pages/Editor/JSEditor/styledComponents"; import { ViewDisplayMode, ViewHideBehaviour } from "IDE/Interfaces/View"; import { Button } from "@appsmith/ads"; +import classNames from "classnames"; const VIEW_MIN_HEIGHT = 38; @@ -112,6 +113,7 @@ const ViewHide = (props: ViewHideProps) => { const BottomView = (props: Props) => { const panelRef = useRef(null); + const { className = "" } = props; // Handle the height of the view when toggling the hidden state useEffect(() => { @@ -126,7 +128,10 @@ const BottomView = (props: Props) => { return ( diff --git a/ceChanges.patch b/ceChanges.patch new file mode 100644 index 00000000000..fa805e1f712 --- /dev/null +++ b/ceChanges.patch @@ -0,0 +1,237 @@ +Subject: [PATCH] fix most scenarios +--- +Index: app/client/cypress/e2e/Regression/ClientSide/Debugger/Query_pane_navigation.ts +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/app/client/cypress/e2e/Regression/ClientSide/Debugger/Query_pane_navigation.ts b/app/client/cypress/e2e/Regression/ClientSide/Debugger/Query_pane_navigation.ts +--- a/app/client/cypress/e2e/Regression/ClientSide/Debugger/Query_pane_navigation.ts (revision d0794fac1053f54f7c58ff589c6efbac850dfc5d) ++++ b/app/client/cypress/e2e/Regression/ClientSide/Debugger/Query_pane_navigation.ts (date 1724837762084) +@@ -67,6 +67,7 @@ + debuggerHelper.AssertErrorCount(2); + + debuggerHelper.OpenDebugger(); ++ debuggerHelper.ClickLogsTab(); + debuggerHelper.ClicklogEntityLink(); + agHelper.AssertElementVisibility( + ".t--actionConfiguration\\.formData\\.limitDocuments\\.data", +Index: app/client/cypress/e2e/Sanity/Datasources/MySQLNoiseTest_spec.js +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/app/client/cypress/e2e/Sanity/Datasources/MySQLNoiseTest_spec.js b/app/client/cypress/e2e/Sanity/Datasources/MySQLNoiseTest_spec.js +--- a/app/client/cypress/e2e/Sanity/Datasources/MySQLNoiseTest_spec.js (revision d0794fac1053f54f7c58ff589c6efbac850dfc5d) ++++ b/app/client/cypress/e2e/Sanity/Datasources/MySQLNoiseTest_spec.js (date 1724837762092) +@@ -4,7 +4,11 @@ + } from "../../../support/Pages/EditorNavigation"; + + const datasourceEditor = require("../../../locators/DatasourcesEditor.json"); +-import { agHelper, dataSources } from "../../../support/Objects/ObjectsCore"; ++import { ++ agHelper, ++ dataSources, ++ debuggerHelper, ++} from "../../../support/Objects/ObjectsCore"; + const commonlocators = require("../../../locators/commonlocators.json"); + + describe( +@@ -60,9 +64,15 @@ + force: true, + }); + cy.wait(2000); +- cy.get(commonlocators.toastmsg).contains( +- "NoiseTestQuery failed to execute", ++ ++ debuggerHelper.OpenDebugger(); ++ debuggerHelper.ClickLogsTab(); ++ debuggerHelper.DoesConsoleLogExist( ++ "Execution failed with status PE-STC-5000", ++ true, ++ "NoiseTestQuery", + ); ++ + cy.wait("@postExecute").then(({ response }) => { + expect(response.body.data.statusCode).to.eq("200 OK"); + }); +Index: app/client/cypress/e2e/Regression/ClientSide/Widgets/List/ListWidgetLintErrorValidation.js +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/List/ListWidgetLintErrorValidation.js b/app/client/cypress/e2e/Regression/ClientSide/Widgets/List/ListWidgetLintErrorValidation.js +--- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/List/ListWidgetLintErrorValidation.js (revision d0794fac1053f54f7c58ff589c6efbac850dfc5d) ++++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/List/ListWidgetLintErrorValidation.js (date 1724837762088) +@@ -43,6 +43,8 @@ + .should("be.visible") + .contains("'DATA' is not defined."); + ++ _.debuggerHelper.OpenDebugger(); ++ + cy.get(commonlocators.debugErrorMsg).should("have.length", 6); + }); + }, +Index: app/client/src/sagas/ErrorSagas.tsx +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/app/client/src/sagas/ErrorSagas.tsx b/app/client/src/sagas/ErrorSagas.tsx +--- a/app/client/src/sagas/ErrorSagas.tsx (revision d0794fac1053f54f7c58ff589c6efbac850dfc5d) ++++ b/app/client/src/sagas/ErrorSagas.tsx (date 1724837762093) +@@ -130,7 +130,7 @@ + payload: { + error: new Error(response.responseMeta.error.message), + logToSentry, +- show, ++ show: true, + }, + }); + throw Error(response.responseMeta.error.message); +Index: app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/DataIdentifier_spec.ts +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/DataIdentifier_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/DataIdentifier_spec.ts +--- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/DataIdentifier_spec.ts (revision d0794fac1053f54f7c58ff589c6efbac850dfc5d) ++++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/DataIdentifier_spec.ts (date 1724837762090) +@@ -38,7 +38,6 @@ + () => { + before(() => { + agHelper.AddDsl("Listv2/ListV2WithNullPrimaryKey"); +- debuggerHelper.OpenDebugger(); + }); + + it("1. Widgets get displayed when PrimaryKey doesn't exist - SSP", () => { +@@ -92,10 +91,11 @@ + 1, + ); + //Open debugger by clicking debugger icon in canvas. +- debuggerHelper.OpenDebugger(); +- agHelper.GetNAssertContains( +- debuggerHelper.locators._debuggerList, ++ debuggerHelper.AssertDebugError( + "This data identifier is evaluating to a duplicate value. Please use an identifier that evaluates to a unique value.", ++ "", ++ true, ++ false, + ); + }); + }, +Index: app/client/src/IDE/Components/BottomView.tsx +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/app/client/src/IDE/Components/BottomView.tsx b/app/client/src/IDE/Components/BottomView.tsx +--- a/app/client/src/IDE/Components/BottomView.tsx (revision d0794fac1053f54f7c58ff589c6efbac850dfc5d) ++++ b/app/client/src/IDE/Components/BottomView.tsx (date 1724837762093) +@@ -6,6 +6,7 @@ + import { CodeEditorWithGutterStyles } from "pages/Editor/JSEditor/styledComponents"; + import { ViewDisplayMode, ViewHideBehaviour } from "IDE/Interfaces/View"; + import { Button } from "@appsmith/ads"; ++import classNames from "classnames"; + + const VIEW_MIN_HEIGHT = 38; + +@@ -112,6 +113,7 @@ + + const BottomView = (props: Props) => { + const panelRef = useRef(null); ++ const { className = "" } = props; + + // Handle the height of the view when toggling the hidden state + useEffect(() => { +@@ -126,7 +128,10 @@ + + return ( + +Index: app/client/cypress/e2e/Regression/ClientSide/Widgets/Button/ButtonLintErrorValidation_spec.js +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Button/ButtonLintErrorValidation_spec.js b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Button/ButtonLintErrorValidation_spec.js +--- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Button/ButtonLintErrorValidation_spec.js (revision d0794fac1053f54f7c58ff589c6efbac850dfc5d) ++++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Button/ButtonLintErrorValidation_spec.js (date 1724837762087) +@@ -43,6 +43,8 @@ + .should("be.visible") + .contains("'lintError' is not defined."); + ++ _.debuggerHelper.OpenDebugger(); ++ + cy.get(commonlocators.debugErrorMsg).should("have.length", 3); + }); + }, +Index: app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Inspect_Element_spec.js +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Inspect_Element_spec.js b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Inspect_Element_spec.js +--- a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Inspect_Element_spec.js (revision d0794fac1053f54f7c58ff589c6efbac850dfc5d) ++++ b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Inspect_Element_spec.js (date 1724837762085) +@@ -7,6 +7,7 @@ + it("1. Check whether depedencies and references are shown correctly", function () { + cy.openPropertyPane("inputwidgetv2"); + cy.testJsontext("defaultvalue", "{{Button1.text}}"); ++ _.debuggerHelper.OpenDebugger(); + cy.contains(".ads-v2-tabs__list-tab", "Inspect entity").click(); + cy.contains(".t--dependencies-item", "Button1").click(); + cy.contains(".t--dependencies-item", "Input1"); +Index: app/client/cypress/support/Pages/DebuggerHelper.ts +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/app/client/cypress/support/Pages/DebuggerHelper.ts b/app/client/cypress/support/Pages/DebuggerHelper.ts +--- a/app/client/cypress/support/Pages/DebuggerHelper.ts (revision d0794fac1053f54f7c58ff589c6efbac850dfc5d) ++++ b/app/client/cypress/support/Pages/DebuggerHelper.ts (date 1724837762092) +@@ -120,12 +120,19 @@ + this.agHelper.AssertSelectedTab(this.locators._debuggerSelectedTab, "true"); + } + +- DoesConsoleLogExist(text: string, exists = true) { ++ DoesConsoleLogExist(text: string, exists = true, entityName?: string) { + this.agHelper.GetNAssertContains( + this.locators._logMessage, + text, + exists ? "exist" : "not.exist", + ); ++ if (entityName) { ++ this.agHelper ++ .GetElement(this.locators._logMessage) ++ .contains(text) ++ .closest(".error") ++ .contains(this.locators._logEntityLink, entityName); ++ } + } + + DebuggerLogsFilter(text: string) { +@@ -189,6 +196,7 @@ + message: string, + shouldOpenDebugger = true, + shouldToggleDebugger = true, ++ errorLabelIndex = 0, + ) { + if (shouldOpenDebugger) { + this.OpenDebugger(); +@@ -200,7 +208,7 @@ + } + + this.agHelper +- .GetText(this.locators._debuggerLabel, "text", 0) ++ .GetText(this.locators._debuggerLabel, "text", errorLabelIndex) + .then(($text) => { + expect($text).to.eq(label); + }); From 037dd82305ad11f6d9a28f4fe903c5a59e21b7e8 Mon Sep 17 00:00:00 2001 From: Hetu Nandu Date: Fri, 30 Aug 2024 10:01:30 +0530 Subject: [PATCH 12/23] remove patch file --- ceChanges.patch | 237 ------------------------------------------------ 1 file changed, 237 deletions(-) delete mode 100644 ceChanges.patch diff --git a/ceChanges.patch b/ceChanges.patch deleted file mode 100644 index fa805e1f712..00000000000 --- a/ceChanges.patch +++ /dev/null @@ -1,237 +0,0 @@ -Subject: [PATCH] fix most scenarios ---- -Index: app/client/cypress/e2e/Regression/ClientSide/Debugger/Query_pane_navigation.ts -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== -diff --git a/app/client/cypress/e2e/Regression/ClientSide/Debugger/Query_pane_navigation.ts b/app/client/cypress/e2e/Regression/ClientSide/Debugger/Query_pane_navigation.ts ---- a/app/client/cypress/e2e/Regression/ClientSide/Debugger/Query_pane_navigation.ts (revision d0794fac1053f54f7c58ff589c6efbac850dfc5d) -+++ b/app/client/cypress/e2e/Regression/ClientSide/Debugger/Query_pane_navigation.ts (date 1724837762084) -@@ -67,6 +67,7 @@ - debuggerHelper.AssertErrorCount(2); - - debuggerHelper.OpenDebugger(); -+ debuggerHelper.ClickLogsTab(); - debuggerHelper.ClicklogEntityLink(); - agHelper.AssertElementVisibility( - ".t--actionConfiguration\\.formData\\.limitDocuments\\.data", -Index: app/client/cypress/e2e/Sanity/Datasources/MySQLNoiseTest_spec.js -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== -diff --git a/app/client/cypress/e2e/Sanity/Datasources/MySQLNoiseTest_spec.js b/app/client/cypress/e2e/Sanity/Datasources/MySQLNoiseTest_spec.js ---- a/app/client/cypress/e2e/Sanity/Datasources/MySQLNoiseTest_spec.js (revision d0794fac1053f54f7c58ff589c6efbac850dfc5d) -+++ b/app/client/cypress/e2e/Sanity/Datasources/MySQLNoiseTest_spec.js (date 1724837762092) -@@ -4,7 +4,11 @@ - } from "../../../support/Pages/EditorNavigation"; - - const datasourceEditor = require("../../../locators/DatasourcesEditor.json"); --import { agHelper, dataSources } from "../../../support/Objects/ObjectsCore"; -+import { -+ agHelper, -+ dataSources, -+ debuggerHelper, -+} from "../../../support/Objects/ObjectsCore"; - const commonlocators = require("../../../locators/commonlocators.json"); - - describe( -@@ -60,9 +64,15 @@ - force: true, - }); - cy.wait(2000); -- cy.get(commonlocators.toastmsg).contains( -- "NoiseTestQuery failed to execute", -+ -+ debuggerHelper.OpenDebugger(); -+ debuggerHelper.ClickLogsTab(); -+ debuggerHelper.DoesConsoleLogExist( -+ "Execution failed with status PE-STC-5000", -+ true, -+ "NoiseTestQuery", - ); -+ - cy.wait("@postExecute").then(({ response }) => { - expect(response.body.data.statusCode).to.eq("200 OK"); - }); -Index: app/client/cypress/e2e/Regression/ClientSide/Widgets/List/ListWidgetLintErrorValidation.js -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== -diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/List/ListWidgetLintErrorValidation.js b/app/client/cypress/e2e/Regression/ClientSide/Widgets/List/ListWidgetLintErrorValidation.js ---- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/List/ListWidgetLintErrorValidation.js (revision d0794fac1053f54f7c58ff589c6efbac850dfc5d) -+++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/List/ListWidgetLintErrorValidation.js (date 1724837762088) -@@ -43,6 +43,8 @@ - .should("be.visible") - .contains("'DATA' is not defined."); - -+ _.debuggerHelper.OpenDebugger(); -+ - cy.get(commonlocators.debugErrorMsg).should("have.length", 6); - }); - }, -Index: app/client/src/sagas/ErrorSagas.tsx -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== -diff --git a/app/client/src/sagas/ErrorSagas.tsx b/app/client/src/sagas/ErrorSagas.tsx ---- a/app/client/src/sagas/ErrorSagas.tsx (revision d0794fac1053f54f7c58ff589c6efbac850dfc5d) -+++ b/app/client/src/sagas/ErrorSagas.tsx (date 1724837762093) -@@ -130,7 +130,7 @@ - payload: { - error: new Error(response.responseMeta.error.message), - logToSentry, -- show, -+ show: true, - }, - }); - throw Error(response.responseMeta.error.message); -Index: app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/DataIdentifier_spec.ts -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== -diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/DataIdentifier_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/DataIdentifier_spec.ts ---- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/DataIdentifier_spec.ts (revision d0794fac1053f54f7c58ff589c6efbac850dfc5d) -+++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/DataIdentifier_spec.ts (date 1724837762090) -@@ -38,7 +38,6 @@ - () => { - before(() => { - agHelper.AddDsl("Listv2/ListV2WithNullPrimaryKey"); -- debuggerHelper.OpenDebugger(); - }); - - it("1. Widgets get displayed when PrimaryKey doesn't exist - SSP", () => { -@@ -92,10 +91,11 @@ - 1, - ); - //Open debugger by clicking debugger icon in canvas. -- debuggerHelper.OpenDebugger(); -- agHelper.GetNAssertContains( -- debuggerHelper.locators._debuggerList, -+ debuggerHelper.AssertDebugError( - "This data identifier is evaluating to a duplicate value. Please use an identifier that evaluates to a unique value.", -+ "", -+ true, -+ false, - ); - }); - }, -Index: app/client/src/IDE/Components/BottomView.tsx -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== -diff --git a/app/client/src/IDE/Components/BottomView.tsx b/app/client/src/IDE/Components/BottomView.tsx ---- a/app/client/src/IDE/Components/BottomView.tsx (revision d0794fac1053f54f7c58ff589c6efbac850dfc5d) -+++ b/app/client/src/IDE/Components/BottomView.tsx (date 1724837762093) -@@ -6,6 +6,7 @@ - import { CodeEditorWithGutterStyles } from "pages/Editor/JSEditor/styledComponents"; - import { ViewDisplayMode, ViewHideBehaviour } from "IDE/Interfaces/View"; - import { Button } from "@appsmith/ads"; -+import classNames from "classnames"; - - const VIEW_MIN_HEIGHT = 38; - -@@ -112,6 +113,7 @@ - - const BottomView = (props: Props) => { - const panelRef = useRef(null); -+ const { className = "" } = props; - - // Handle the height of the view when toggling the hidden state - useEffect(() => { -@@ -126,7 +128,10 @@ - - return ( - -Index: app/client/cypress/e2e/Regression/ClientSide/Widgets/Button/ButtonLintErrorValidation_spec.js -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== -diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Button/ButtonLintErrorValidation_spec.js b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Button/ButtonLintErrorValidation_spec.js ---- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Button/ButtonLintErrorValidation_spec.js (revision d0794fac1053f54f7c58ff589c6efbac850dfc5d) -+++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Button/ButtonLintErrorValidation_spec.js (date 1724837762087) -@@ -43,6 +43,8 @@ - .should("be.visible") - .contains("'lintError' is not defined."); - -+ _.debuggerHelper.OpenDebugger(); -+ - cy.get(commonlocators.debugErrorMsg).should("have.length", 3); - }); - }, -Index: app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Inspect_Element_spec.js -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== -diff --git a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Inspect_Element_spec.js b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Inspect_Element_spec.js ---- a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Inspect_Element_spec.js (revision d0794fac1053f54f7c58ff589c6efbac850dfc5d) -+++ b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Inspect_Element_spec.js (date 1724837762085) -@@ -7,6 +7,7 @@ - it("1. Check whether depedencies and references are shown correctly", function () { - cy.openPropertyPane("inputwidgetv2"); - cy.testJsontext("defaultvalue", "{{Button1.text}}"); -+ _.debuggerHelper.OpenDebugger(); - cy.contains(".ads-v2-tabs__list-tab", "Inspect entity").click(); - cy.contains(".t--dependencies-item", "Button1").click(); - cy.contains(".t--dependencies-item", "Input1"); -Index: app/client/cypress/support/Pages/DebuggerHelper.ts -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== -diff --git a/app/client/cypress/support/Pages/DebuggerHelper.ts b/app/client/cypress/support/Pages/DebuggerHelper.ts ---- a/app/client/cypress/support/Pages/DebuggerHelper.ts (revision d0794fac1053f54f7c58ff589c6efbac850dfc5d) -+++ b/app/client/cypress/support/Pages/DebuggerHelper.ts (date 1724837762092) -@@ -120,12 +120,19 @@ - this.agHelper.AssertSelectedTab(this.locators._debuggerSelectedTab, "true"); - } - -- DoesConsoleLogExist(text: string, exists = true) { -+ DoesConsoleLogExist(text: string, exists = true, entityName?: string) { - this.agHelper.GetNAssertContains( - this.locators._logMessage, - text, - exists ? "exist" : "not.exist", - ); -+ if (entityName) { -+ this.agHelper -+ .GetElement(this.locators._logMessage) -+ .contains(text) -+ .closest(".error") -+ .contains(this.locators._logEntityLink, entityName); -+ } - } - - DebuggerLogsFilter(text: string) { -@@ -189,6 +196,7 @@ - message: string, - shouldOpenDebugger = true, - shouldToggleDebugger = true, -+ errorLabelIndex = 0, - ) { - if (shouldOpenDebugger) { - this.OpenDebugger(); -@@ -200,7 +208,7 @@ - } - - this.agHelper -- .GetText(this.locators._debuggerLabel, "text", 0) -+ .GetText(this.locators._debuggerLabel, "text", errorLabelIndex) - .then(($text) => { - expect($text).to.eq(label); - }); From 9ceb9d42b50f411919aa30e633b4d63ed79fdac3 Mon Sep 17 00:00:00 2001 From: Hetu Nandu Date: Fri, 30 Aug 2024 10:17:41 +0530 Subject: [PATCH 13/23] Remove merge markers --- app/client/cypress/support/Objects/CommonLocators.ts | 3 --- app/client/src/sagas/ApiPaneSagas.ts | 6 +----- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/app/client/cypress/support/Objects/CommonLocators.ts b/app/client/cypress/support/Objects/CommonLocators.ts index 541f4fcc171..3152737bfa0 100644 --- a/app/client/cypress/support/Objects/CommonLocators.ts +++ b/app/client/cypress/support/Objects/CommonLocators.ts @@ -334,11 +334,8 @@ export class CommonLocators { _menuItem = ".bp3-menu-item"; _slashCommandHintText = ".slash-command-hint-text"; _selectionItem = ".rc-select-selection-item"; -<<<<<<< HEAD errorPageTitle = ".t--error-page-title"; errorPageDescription = ".t--error-page-description"; -======= _selectClearButton_testId = "selectbutton.btn.cancel"; _selectClearButton_dataTestId = `[data-testid="${this._selectClearButton_testId}"]`; ->>>>>>> release } diff --git a/app/client/src/sagas/ApiPaneSagas.ts b/app/client/src/sagas/ApiPaneSagas.ts index 569eafd66e6..d14c54f947d 100644 --- a/app/client/src/sagas/ApiPaneSagas.ts +++ b/app/client/src/sagas/ApiPaneSagas.ts @@ -67,11 +67,6 @@ import { getCurrentBasePageId } from "selectors/editorSelectors"; import { validateResponse } from "./ErrorSagas"; import type { CreateDatasourceSuccessAction } from "actions/datasourceActions"; import { removeTempDatasource } from "actions/datasourceActions"; -<<<<<<< HEAD -import { klona } from "klona/lite"; -======= -import { toast } from "@appsmith/ads"; ->>>>>>> release import type { AutoGeneratedHeader } from "pages/Editor/APIEditor/helpers"; import { deriveAutoGeneratedHeaderState } from "pages/Editor/APIEditor/helpers"; import { TEMP_DATASOURCE_ID } from "constants/Datasource"; @@ -747,6 +742,7 @@ function* handleApiNameChangeSaga( ) { yield put(change(API_EDITOR_FORM_NAME, "name", action.payload.name)); } + function* handleApiNameChangeSuccessSaga( action: ReduxAction<{ actionId: string }>, ) { From e42babe72e856ef6165f83ac0516ddb738a97924 Mon Sep 17 00:00:00 2001 From: Hetu Nandu Date: Fri, 30 Aug 2024 12:26:37 +0530 Subject: [PATCH 14/23] fix debugger tests not force opening --- .../cypress/e2e/Regression/ClientSide/BugTests/Moment_Spec.ts | 1 + .../Regression/ClientSide/OtherUIFeatures/ErrorMessages_spec.ts | 2 +- .../ClientSide/Widgets/ListV2/ListV2_NestedList_spec.ts | 2 ++ .../ClientSide/Widgets/ListV2/ListV2_nested_List_widget_spec.js | 2 ++ .../e2e/Regression/ServerSide/OnLoadTests/APIOnLoad_Spec.ts | 2 +- 5 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/client/cypress/e2e/Regression/ClientSide/BugTests/Moment_Spec.ts b/app/client/cypress/e2e/Regression/ClientSide/BugTests/Moment_Spec.ts index 32099f0309a..a17f26f0953 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/BugTests/Moment_Spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/BugTests/Moment_Spec.ts @@ -122,6 +122,7 @@ describe( deployMode.NavigateBacktoEditor(); //verify runAstros triggered on PageLaoad of Edit page! + debuggerHelper.OpenDebugger(); debuggerHelper.ClickLogsTab(); debuggerHelper.DebuggerLogsFilter("JSObject1.runAstros"); debuggerHelper.DoesConsoleLogExist("JS Function executed successfully"); diff --git a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/ErrorMessages_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/ErrorMessages_spec.ts index 9797076406c..a52623e2fc8 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/ErrorMessages_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/ErrorMessages_spec.ts @@ -33,7 +33,7 @@ describe("Sanitise toast error messages", () => { EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); _.propPane.EnterJSContext("onClick", "{{a.kjbfjdfbkds()}}"); _.agHelper.ClickButton("Submit"); - _.debuggerHelper.AssertDebugError("'a' is not defined.", "", false, false); + _.debuggerHelper.AssertDebugError("'a' is not defined.", "", true, false); }); it("2. Does not show type error label when js obj function does not exist", () => { diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/ListV2_NestedList_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/ListV2_NestedList_spec.ts index f417174a4d9..594f05b4474 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/ListV2_NestedList_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/ListV2_NestedList_spec.ts @@ -41,6 +41,8 @@ describe( "List3", ]); agHelper.GetElement("body").type(`{${agHelper._modifierKey}}{v}`); + _.debuggerHelper.OpenDebugger(); + _.debuggerHelper.ClickLogsTab(); _.debuggerHelper.DoesConsoleLogExist( "Cannot have more than 3 levels of nesting in the list widget", true, diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/ListV2_nested_List_widget_spec.js b/app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/ListV2_nested_List_widget_spec.js index 54f70722a01..4d6a2525baa 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/ListV2_nested_List_widget_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/ListV2/ListV2_nested_List_widget_spec.js @@ -74,6 +74,8 @@ describe( .type(`{${modifierKey}}{v}`); cy.wait(500); + _.debuggerHelper.OpenDebugger(); + _.debuggerHelper.ClickLogsTab(); _.debuggerHelper.DoesConsoleLogExist( "Cannot have more than 3 levels of nesting", true, diff --git a/app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/APIOnLoad_Spec.ts b/app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/APIOnLoad_Spec.ts index 1613a2fc444..b89bc975b8b 100644 --- a/app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/APIOnLoad_Spec.ts +++ b/app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/APIOnLoad_Spec.ts @@ -62,7 +62,7 @@ describe( debuggerHelper.AssertDebugError( 'The action "PageLoadApi2" has failed.', "", - false, + true, false, ); }); From b04b164d8663870bbee6d6b0326b03805c3cac8c Mon Sep 17 00:00:00 2001 From: Hetu Nandu Date: Mon, 2 Sep 2024 12:34:13 +0530 Subject: [PATCH 15/23] dont force debugger open --- .../Linting/utils/getEntityUniqueIdForLogs.ts | 5 ++++- .../utils/isLintErrorLoggingEnabledForEntity.ts | 12 ++++++++++-- app/client/src/sagas/LintingSagas.ts | 1 + app/client/src/sagas/PostLintingSagas.ts | 10 +++++++--- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/app/client/src/ce/plugins/Linting/utils/getEntityUniqueIdForLogs.ts b/app/client/src/ce/plugins/Linting/utils/getEntityUniqueIdForLogs.ts index 414cb362e70..619de80cc86 100644 --- a/app/client/src/ce/plugins/Linting/utils/getEntityUniqueIdForLogs.ts +++ b/app/client/src/ce/plugins/Linting/utils/getEntityUniqueIdForLogs.ts @@ -1,4 +1,4 @@ -import type { JSActionEntity } from "ee/entities/DataTree/types"; +import type { JSActionEntity, WidgetEntity } from "ee/entities/DataTree/types"; import { ENTITY_TYPE } from "entities/DataTree/dataTreeFactory"; import type { DataTreeEntity } from "entities/DataTree/dataTreeTypes"; @@ -9,6 +9,9 @@ const entityUniqueIdGetterMap: Record< [ENTITY_TYPE.JSACTION]: (entity) => { return (entity as JSActionEntity).actionId; }, + [ENTITY_TYPE.WIDGET]: (entity) => { + return (entity as WidgetEntity).widgetId; + }, }; export default function getEntityUniqueIdForLogs(entity: DataTreeEntity) { diff --git a/app/client/src/ce/plugins/Linting/utils/isLintErrorLoggingEnabledForEntity.ts b/app/client/src/ce/plugins/Linting/utils/isLintErrorLoggingEnabledForEntity.ts index c5bad4b96ff..15b205c7698 100644 --- a/app/client/src/ce/plugins/Linting/utils/isLintErrorLoggingEnabledForEntity.ts +++ b/app/client/src/ce/plugins/Linting/utils/isLintErrorLoggingEnabledForEntity.ts @@ -1,8 +1,16 @@ -import { isJSAction } from "ee/workers/Evaluation/evaluationUtils"; +import { isJSAction, isWidget } from "ee/workers/Evaluation/evaluationUtils"; import type { DataTreeEntity } from "entities/DataTree/dataTreeTypes"; +import type { DataTreeEntityConfig } from "ee/entities/DataTree/types"; export default function isLintErrorLoggingEnabledForEntity( entity: DataTreeEntity, + propertyPath: string, + config: DataTreeEntityConfig, ) { - return isJSAction(entity); + if (isJSAction(entity)) { + return true; + } + if (isWidget(entity)) { + return !(propertyPath in config.reactivePaths); + } } diff --git a/app/client/src/sagas/LintingSagas.ts b/app/client/src/sagas/LintingSagas.ts index 6e2d4fafd78..b1217aa520c 100644 --- a/app/client/src/sagas/LintingSagas.ts +++ b/app/client/src/sagas/LintingSagas.ts @@ -103,6 +103,7 @@ export function* lintTreeSaga(payload: LintTreeSagaRequestData) { yield call(logLatestLintPropertyErrors, { errors, dataTree: unevalTree, + configTree, }); } diff --git a/app/client/src/sagas/PostLintingSagas.ts b/app/client/src/sagas/PostLintingSagas.ts index 5d35b0bc517..280da72e243 100644 --- a/app/client/src/sagas/PostLintingSagas.ts +++ b/app/client/src/sagas/PostLintingSagas.ts @@ -1,6 +1,6 @@ import { Severity } from "entities/AppsmithConsole"; import LOG_TYPE from "entities/AppsmithConsole/logtype"; -import type { DataTree } from "entities/DataTree/dataTreeTypes"; +import type { ConfigTree, DataTree } from "entities/DataTree/dataTreeTypes"; import { isEmpty } from "lodash"; import AppsmithConsole from "utils/AppsmithConsole"; import { getEntityNameAndPropertyPath } from "ee/workers/Evaluation/evaluationUtils"; @@ -11,11 +11,13 @@ import type { ENTITY_TYPE } from "ee/entities/AppsmithConsole/utils"; // We currently only log lint errors in JSObjects export function* logLatestLintPropertyErrors({ + configTree, dataTree, errors, }: { - errors: LintErrorsStore; + configTree: ConfigTree; dataTree: DataTree; + errors: LintErrorsStore; }) { const errorsToAdd = []; const errorsToRemove = []; @@ -23,8 +25,10 @@ export function* logLatestLintPropertyErrors({ for (const path of Object.keys(errors)) { const { entityName, propertyPath } = getEntityNameAndPropertyPath(path); const entity = dataTree[entityName]; + const config = configTree[entityName]; // only log lint errors in JSObjects - if (!isLintErrorLoggingEnabledForEntity(entity)) continue; + if (!isLintErrorLoggingEnabledForEntity(entity, propertyPath, config)) + continue; // only log lint errors (not warnings) const lintErrorsInPath = errors[path].filter( (error) => error.severity === Severity.ERROR, From ed43ff5ae2d8ce41e4e29d497be137a68ba03607 Mon Sep 17 00:00:00 2001 From: Hetu Nandu Date: Mon, 2 Sep 2024 13:00:32 +0530 Subject: [PATCH 16/23] revert execution error toast message --- .../src/sagas/ActionExecution/errorUtils.ts | 4 --- app/client/src/sagas/PostEvaluationSagas.ts | 26 +++++++++---------- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/app/client/src/sagas/ActionExecution/errorUtils.ts b/app/client/src/sagas/ActionExecution/errorUtils.ts index f630f6a8a61..ff3ae8dacc6 100644 --- a/app/client/src/sagas/ActionExecution/errorUtils.ts +++ b/app/client/src/sagas/ActionExecution/errorUtils.ts @@ -7,7 +7,6 @@ import { isString } from "lodash"; import type { Types } from "utils/TypeHelpers"; import type { ActionTriggerKeys } from "ee/workers/Evaluation/fns"; import { getActionTriggerFunctionNames } from "ee/workers/Evaluation/fns"; -import { getAppMode } from "ee/selectors/applicationSelectors"; import AnalyticsUtil from "ee/utils/AnalyticsUtil"; import { setDebuggerSelectedTab, showDebugger } from "actions/debuggerActions"; import { DEBUGGER_TAB_KEYS } from "components/editorComponents/Debugger/helpers"; @@ -60,9 +59,6 @@ export function* showToastOnExecutionError( showCTA = true, ) { function onDebugClick() { - const appMode = getAppMode(store.getState()); - if (appMode === "PUBLISHED") return null; - AnalyticsUtil.logEvent("OPEN_DEBUGGER", { source: "TOAST", }); diff --git a/app/client/src/sagas/PostEvaluationSagas.ts b/app/client/src/sagas/PostEvaluationSagas.ts index 3fc39cef750..b05716a3cdc 100644 --- a/app/client/src/sagas/PostEvaluationSagas.ts +++ b/app/client/src/sagas/PostEvaluationSagas.ts @@ -59,20 +59,18 @@ export function* logJSVarCreatedEvent( export function* showExecutionErrors(errors: EvaluationError[]) { const appMode: APP_MODE = yield select(getAppMode); - if (appMode === APP_MODE.EDIT) { - // In edit mode we do not show any toast - // Current we are doing nothing here to tell the user there is an error - // TODO: At least we should add these to the debugger - } else { - for (const error of errors) { - // in view mode we will show the error messages in toast - const errorMessage = get( - error, - "errorMessage.message.message", - error.errorMessage.message, - ); - yield call(showToastOnExecutionError, errorMessage, false); - } + for (const error of errors) { + // in view mode we will show the error messages in toast + const errorMessage = get( + error, + "errorMessage.message.message", + error.errorMessage.message, + ); + yield call( + showToastOnExecutionError, + errorMessage, + appMode === APP_MODE.EDIT, + ); } } From e1388086de31480566a2dc348642aa1942194ef5 Mon Sep 17 00:00:00 2001 From: Hetu Nandu Date: Mon, 2 Sep 2024 14:49:48 +0530 Subject: [PATCH 17/23] test cases --- .../BugTests/InputTruncateCheck_Spec.ts | 13 ++++++++++++- .../Debugger/Query_pane_navigation.ts | 2 -- .../OtherUIFeatures/ErrorMessages_spec.ts | 19 +++++++------------ .../OtherUIFeatures/Widget_Error_spec.js | 3 ++- .../cypress/support/Pages/DebuggerHelper.ts | 2 ++ 5 files changed, 23 insertions(+), 16 deletions(-) diff --git a/app/client/cypress/e2e/Regression/ClientSide/BugTests/InputTruncateCheck_Spec.ts b/app/client/cypress/e2e/Regression/ClientSide/BugTests/InputTruncateCheck_Spec.ts index df67f114d67..bbdce699aa0 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/BugTests/InputTruncateCheck_Spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/BugTests/InputTruncateCheck_Spec.ts @@ -11,6 +11,7 @@ import { draggableWidgets, fakerHelper, dataManager, + debuggerHelper, } from "../../../../support/Objects/ObjectsCore"; const widgetsToTest = { @@ -180,8 +181,18 @@ Object.entries(widgetsToTest).forEach(([widgetSelector, testConfig], index) => { agHelper.GetNClick(locators._widgetInputSelector(widgetSelector)); agHelper.PressDelete(); + //Since widget is removed & Button is still holding its reference + debuggerHelper.AssertDebugError( + `'${testConfig.widgetPrefixName}1' is not defined.`, + "", + true, + false, + ); + debuggerHelper.CloseBottomBar(); agHelper.GetNClick(getWidgetSelector(draggableWidgets.BUTTON)); - agHelper.AssertContains("is not defined"); //Since widget is removed & Button is still holding its reference + agHelper.ValidateToastMessage( + `'${testConfig.widgetPrefixName}1' is not defined`, + ); agHelper.PressDelete(); agHelper.GetNClick(getWidgetSelector(draggableWidgets.TEXT)).click(); diff --git a/app/client/cypress/e2e/Regression/ClientSide/Debugger/Query_pane_navigation.ts b/app/client/cypress/e2e/Regression/ClientSide/Debugger/Query_pane_navigation.ts index e458fbe8463..5ba9fa87bc5 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Debugger/Query_pane_navigation.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Debugger/Query_pane_navigation.ts @@ -67,8 +67,6 @@ describe( debuggerHelper.AssertErrorCount(2); debuggerHelper.OpenDebugger(); - debuggerHelper.ClickLogsTab(); - debuggerHelper.ClicklogEntityLink(); agHelper.AssertElementVisibility( ".t--actionConfiguration\\.formData\\.limitDocuments\\.data", ); diff --git a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/ErrorMessages_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/ErrorMessages_spec.ts index a52623e2fc8..6bc10f52d43 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/ErrorMessages_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/ErrorMessages_spec.ts @@ -39,13 +39,16 @@ describe("Sanitise toast error messages", () => { it("2. Does not show type error label when js obj function does not exist", () => { EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); _.propPane.EnterJSContext("onClick", "{{JSObject1.myFun1efef()}}"); - _.agHelper.ClickButton("Submit"); + // Assert the lint error that shows up _.debuggerHelper.AssertDebugError( - "Object1.myFun1efef is not a function", + `"myFun1efef" doesn't exist in JSObject1`, "", false, false, ); + _.agHelper.ClickButton("Submit"); + // Assert the execution error that shows up + _.agHelper.WaitUntilToastDisappear("Object1.myFun1efef is not a function"); }); it("3. Does not show any label when msg is not given for post message", () => { @@ -72,11 +75,8 @@ describe("Sanitise toast error messages", () => { EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); _.propPane.EnterJSContext("onClick", "{{JSObject1.myFun1()}}"); _.agHelper.ClickButton("Submit"); - _.debuggerHelper.AssertDebugError( + _.agHelper.WaitUntilToastDisappear( "Cannot read properties of null (reading ':')", - "", - false, - false, ); }); @@ -89,11 +89,6 @@ describe("Sanitise toast error messages", () => { _.agHelper.GetNClick(_.propPane._actionSelectorDelete); _.propPane.SelectPlatformFunction("onClick", "Navigate to"); _.agHelper.ClickButton("Submit"); - _.debuggerHelper.AssertDebugError( - "Enter a valid URL or page name", - "", - false, - false, - ); + _.agHelper.WaitUntilToastDisappear("Enter a valid URL or page name"); }); }); diff --git a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Widget_Error_spec.js b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Widget_Error_spec.js index 278906f6cde..afa69d28542 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Widget_Error_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Widget_Error_spec.js @@ -29,13 +29,14 @@ describe("Widget error state", function () { // _.debuggerHelper.LogStateContains("Test"); }); - it("2. Switch to error tab when execution error occurs", function () { + it("2. Switch to error tab when clicked on the debug button", function () { cy.get("[data-testid=t--tab-LOGS_TAB]").click(); cy.get(".t--property-control-onclick").find(".t--js-toggle").click(); cy.EnableAllCodeEditors(); cy.testJsontext("onclick", "{{testApi.run()}}"); cy.get(widgetLocators.buttonWidget).click(); + cy.get(".t--toast-debug-button").click(); cy.get("[data-testid='t--tab-ERROR']").should( "have.attr", "aria-selected", diff --git a/app/client/cypress/support/Pages/DebuggerHelper.ts b/app/client/cypress/support/Pages/DebuggerHelper.ts index 5fd3117192e..979b8f2d842 100644 --- a/app/client/cypress/support/Pages/DebuggerHelper.ts +++ b/app/client/cypress/support/Pages/DebuggerHelper.ts @@ -55,6 +55,8 @@ export class DebuggerHelper { cy.get("body").then(($body) => { if ($body.find(this.locators._ideBottomViewContainer).length === 0) { this.agHelper.GetNClick(this.locators._debuggerIcon, 0, false); + } else { + this.agHelper.GetNClick(this.commonLocators._errorTab, 0, true, 0); } }); this.AssertOpen(); From 12749bdf626d66444681aa5b8a9018a01e9b248f Mon Sep 17 00:00:00 2001 From: Hetu Nandu Date: Tue, 3 Sep 2024 09:57:14 +0530 Subject: [PATCH 18/23] fix final tests --- .../Regression/ClientSide/BugTests/InputTruncateCheck_Spec.ts | 2 +- .../ClientSide/OtherUIFeatures/Widget_Error_spec.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/client/cypress/e2e/Regression/ClientSide/BugTests/InputTruncateCheck_Spec.ts b/app/client/cypress/e2e/Regression/ClientSide/BugTests/InputTruncateCheck_Spec.ts index bbdce699aa0..d3c7ca26b1d 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/BugTests/InputTruncateCheck_Spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/BugTests/InputTruncateCheck_Spec.ts @@ -191,7 +191,7 @@ Object.entries(widgetsToTest).forEach(([widgetSelector, testConfig], index) => { debuggerHelper.CloseBottomBar(); agHelper.GetNClick(getWidgetSelector(draggableWidgets.BUTTON)); agHelper.ValidateToastMessage( - `'${testConfig.widgetPrefixName}1' is not defined`, + `${testConfig.widgetPrefixName}1 is not defined`, ); agHelper.PressDelete(); diff --git a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Widget_Error_spec.js b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Widget_Error_spec.js index afa69d28542..b0ff3abbda5 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Widget_Error_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Widget_Error_spec.js @@ -44,8 +44,8 @@ describe("Widget error state", function () { ); // All errors should be expanded by default - //Updated count to 1 as the decision not to show triggerexecution/uncaughtpromise error in - epic 17720 - _.debuggerHelper.AssertVisibleErrorMessagesCount(1); + //Updated count to 2 as the decision to show the widget trigger lint errors to show in the debugger + _.debuggerHelper.AssertVisibleErrorMessagesCount(2); // Recent errors are shown at the top of the list cy.testJsontext("label", "{{[]}}"); From 7156738d784e7449bc450ed84c1b4d869e824be3 Mon Sep 17 00:00:00 2001 From: Hetu Nandu Date: Tue, 3 Sep 2024 12:29:51 +0530 Subject: [PATCH 19/23] more check fixes --- .../ClientSide/OtherUIFeatures/Widget_Error_spec.js | 2 +- .../Regression/ServerSide/OnLoadTests/JSOnLoad2_Spec.ts | 2 +- .../src/components/editorComponents/Debugger/LogItem.tsx | 4 +--- app/client/src/sagas/ActionExecution/errorUtils.ts | 2 +- .../src/sagas/ActionExecution/geolocationSaga.test.ts | 2 +- app/client/src/sagas/PostEvaluationSagas.ts | 7 ++++++- app/client/src/utils/AppsmithConsole.ts | 5 ++--- 7 files changed, 13 insertions(+), 11 deletions(-) diff --git a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Widget_Error_spec.js b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Widget_Error_spec.js index b0ff3abbda5..5b35f24d796 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Widget_Error_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Widget_Error_spec.js @@ -63,7 +63,7 @@ describe("Widget error state", function () { cy.deleteWidget(); _.debuggerHelper.AssertVisibleErrorMessagesCount(0); cy.get("body").type(`{${modifierKey}}z`); - _.debuggerHelper.AssertVisibleErrorMessagesCount(2); + _.debuggerHelper.AssertVisibleErrorMessagesCount(3); //Bug-2760: Error log on a widget property not clearing out when the widget property is deleted _.entityExplorer.DragDropWidgetNVerify(WIDGET.TABLE, 150, 300); diff --git a/app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JSOnLoad2_Spec.ts b/app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JSOnLoad2_Spec.ts index 5bb511eac2e..300d27e0578 100644 --- a/app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JSOnLoad2_Spec.ts +++ b/app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JSOnLoad2_Spec.ts @@ -35,7 +35,7 @@ describe( AssertJSOnPageLoad("runSpaceCraftImages"); }); - it.only("3. Tc #59 Verify JSOnPageload with ConfirmBefore calling - while imported - failing JSObj", () => { + it("3. Tc #59 Verify JSOnPageload with ConfirmBefore calling - while imported - failing JSObj", () => { homePage.ImportApp("ImportApps/JSOnLoadFailureTest.json", "JSOnLoadTest"); cy.wait("@importNewApplication").then(() => { homePage.AssertImportToast(); diff --git a/app/client/src/components/editorComponents/Debugger/LogItem.tsx b/app/client/src/components/editorComponents/Debugger/LogItem.tsx index 90d76e7a955..b8c06c08053 100644 --- a/app/client/src/components/editorComponents/Debugger/LogItem.tsx +++ b/app/client/src/components/editorComponents/Debugger/LogItem.tsx @@ -267,9 +267,7 @@ function LogItem(props: LogItemProps) { size="md" /> - {props.severity === Severity.ERROR - ? moment(parseInt(props.timestamp)).format("HH:mm:ss") - : props.timestamp} + {moment(parseInt(props.timestamp)).format("HH:mm:ss")}