diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Debugger/Logs_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Debugger/Logs_spec.js index e884caf535..992fe23a68 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Debugger/Logs_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Debugger/Logs_spec.js @@ -1,4 +1,6 @@ const dsl = require("../../../../fixtures/buttondsl.json"); +const commonlocators = require("../../../../locators/commonlocators.json"); +const debuggerLocators = require("../../../../locators/Debugger.json"); describe("Debugger logs", function() { before(() => { @@ -11,4 +13,18 @@ describe("Debugger logs", function() { cy.get(".t--debugger").click(); cy.get(".t--debugger-log-state").contains("Test"); }); + + it("Reset debugger state", function() { + cy.get(".t--property-control-visible") + .find(".t--js-toggle") + .click(); + cy.testJsontext("visible", "Test"); + + cy.get(commonlocators.homeIcon).click({ force: true }); + cy.generateUUID().then((id) => { + cy.CreateAppInFirstListedOrg(id); + + cy.contains(debuggerLocators.debuggerIcon, 0); + }); + }); }); diff --git a/app/client/cypress/locators/Debugger.json b/app/client/cypress/locators/Debugger.json new file mode 100644 index 0000000000..f2186aa053 --- /dev/null +++ b/app/client/cypress/locators/Debugger.json @@ -0,0 +1,3 @@ +{ + "debuggerIcon": ".t--debugger" +} \ No newline at end of file diff --git a/app/client/src/actions/debuggerActions.ts b/app/client/src/actions/debuggerActions.ts index a0ca54e4a7..a44558e514 100644 --- a/app/client/src/actions/debuggerActions.ts +++ b/app/client/src/actions/debuggerActions.ts @@ -29,3 +29,7 @@ export const updateErrorLog = (payload: Message) => ({ type: ReduxActionTypes.DEBUGGER_UPDATE_ERROR_LOG, payload, }); + +export const resetDebuggerState = () => ({ + type: ReduxActionTypes.RESET_DEBUGGER_STATE, +}); diff --git a/app/client/src/constants/ReduxActionConstants.tsx b/app/client/src/constants/ReduxActionConstants.tsx index 9fc10fd0c2..0d02d16487 100644 --- a/app/client/src/constants/ReduxActionConstants.tsx +++ b/app/client/src/constants/ReduxActionConstants.tsx @@ -76,6 +76,7 @@ export const ReduxActionTypes: { [key: string]: string } = { DEBUGGER_UPDATE_ERROR_LOG: "DEBUGGER_UPDATE_ERROR_LOG", DEBUGGER_UPDATE_ERROR_LOGS: "DEBUGGER_UPDATE_ERROR_LOGS", CLEAR_DEBUGGER_LOGS: "CLEAR_DEBUGGER_LOGS", + RESET_DEBUGGER_STATE: "RESET_DEBUGGER_STATE", SHOW_DEBUGGER: "SHOW_DEBUGGER", SET_THEME: "SET_THEME", FETCH_WIDGET_CARDS: "FETCH_WIDGET_CARDS", diff --git a/app/client/src/reducers/uiReducers/debuggerReducer.ts b/app/client/src/reducers/uiReducers/debuggerReducer.ts index 4ad5fa9126..ea8901f307 100644 --- a/app/client/src/reducers/uiReducers/debuggerReducer.ts +++ b/app/client/src/reducers/uiReducers/debuggerReducer.ts @@ -105,6 +105,11 @@ const debuggerReducer = createReducer(initialState, { errors: { ...action.payload }, }; }, + [ReduxActionTypes.RESET_DEBUGGER_STATE]: () => { + return { + ...initialState, + }; + }, }); export interface DebuggerReduxState { diff --git a/app/client/src/sagas/InitSagas.ts b/app/client/src/sagas/InitSagas.ts index b062e74110..7a3665cb31 100644 --- a/app/client/src/sagas/InitSagas.ts +++ b/app/client/src/sagas/InitSagas.ts @@ -46,6 +46,7 @@ import PerformanceTracker, { PerformanceTransactionName, } from "utils/PerformanceTracker"; import { executePageLoadActions } from "actions/widgetActions"; +import { resetDebuggerState } from "actions/debuggerActions"; function* failFastApiCalls( triggerActions: Array | ReduxActionWithoutPayload>, @@ -267,6 +268,7 @@ export function* initializeAppViewerSaga( function* resetEditorSaga() { yield put(resetEditorSuccess()); yield put(resetRecentEntities()); + yield put(resetDebuggerState()); } export default function* watchInitSagas() {