Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Debug button opens the Error tab #33337

Merged
merged 4 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import * as _ from "../../../../support/Objects/ObjectsCore";
import { PageType } from "../../../../support/Pages/DebuggerHelper";
import EditorNavigation, {
EditorViewMode,
} from "../../../../support/Pages/EditorNavigation";

describe("Api Error Debugger", { tags: ["@tag.IDE"] }, () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

The search for the @tag.IDE configuration within the Cypress directory did not yield any results. This suggests that the tag might not be configured or recognized by the test suite. Given this, it's important to ensure that the new tag is properly set up to avoid any issues with test execution.

  • Ensure the @tag.IDE is added to the test configuration: This tag needs to be defined in the appropriate configuration files to be recognized during test runs. This setup is crucial for the proper categorization and execution of tests.
Analysis chain

The change in test categorization tag from @tag.Debugger to @tag.IDE is noted. Ensure this new tag is correctly configured in the test suite to be recognized and executed.



---

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that the new tag `@tag.IDE` is recognized by the test suite.

# Test: Search for the tag configuration in the test suite. Expect: Configuration for `@tag.IDE`.
rg --type yaml "@tag.IDE" cypress/

Length of output: 83



Script:

#!/bin/bash
# Description: Locate the directory containing Cypress configurations.

# Search for directories or files that might be related to Cypress configurations.
fd --type d "cypress" /

Length of output: 62



Script:

#!/bin/bash
# Description: Verify that the new tag `@tag.IDE` is recognized by the test suite in the identified directory.

# Search for the tag configuration in YAML files within the identified Cypress directory.
rg --type yaml "@tag.IDE" /home/jailuser/git/app/client/cypress/

Length of output: 64

before(() => {
// Create api that causes an error
_.apiPage.CreateAndFillApi("https://fakeapi/user");
});
it("it shows error message", () => {
_.apiPage.RunAPI(false);
_.debuggerHelper.AssertOpen(PageType.API);
_.apiPage.ResponseStatusCheck("PE-RST-5000");
});
it("it shows debug button and navigates", () => {
_.apiPage.DebugError();
_.debuggerHelper.AssertSelectedTab("Error");
_.debuggerHelper.AssertErrorCount(1);
EditorNavigation.SwitchScreenMode(EditorViewMode.SplitScreen);
_.apiPage.DebugError();
_.debuggerHelper.AssertSelectedTab("Error");
_.debuggerHelper.AssertErrorCount(1);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as _ from "../../../../support/Objects/ObjectsCore";
import { PageType } from "../../../../support/Pages/DebuggerHelper";
import EditorNavigation from "../../../../support/Pages/EditorNavigation";

describe("Entity bottom bar", { tags: ["@tag.Debugger"] }, () => {
describe("Entity bottom bar", { tags: ["@tag.IDE"] }, () => {
it("1. Debugger should be closable", () => {
//Verify if bottom bar is closed.
_.debuggerHelper.AssertClosed();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const generateTestLogString = () => {
return logString;
};

describe("Debugger logs", { tags: ["@tag.Debugger"] }, function () {
describe("Debugger logs", { tags: ["@tag.IDE"] }, function () {
this.beforeEach(() => {
logString = generateTestLogString();
});
Expand Down
7 changes: 7 additions & 0 deletions app/client/cypress/support/Pages/ApiPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
PageLeftPane,
PagePaneSegment,
} from "./EditorNavigation";
import * as _ from "../Objects/ObjectsCore";

type RightPaneTabs = "datasources" | "connections";

Expand Down Expand Up @@ -81,6 +82,7 @@ export class ApiPage {
_saveAsDS = ".t--store-as-datasource";
_responseStatus = ".t--response-status-code";
public _responseTabHeader = "[data-testid=t--tab-headers]";
public _headersTabContent = ".t--headers-tab";
public _autoGeneratedHeaderInfoIcon = (key: string) =>
`.t--auto-generated-${key}-info`;
_nextCursorValue = ".t--apiFormPaginationNextCursorValue";
Expand Down Expand Up @@ -458,4 +460,9 @@ export class ApiPage {
this.agHelper.AssertElementVisibility(this._headerKey(index));
this.agHelper.AssertElementVisibility(this._headerValue(index));
}

DebugError() {
this.agHelper.GetNClick(this._responseTabHeader);
cy.get(this._headersTabContent).contains("Debug").click();
}
}
12 changes: 3 additions & 9 deletions app/client/src/components/editorComponents/ApiResponseView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import { getApiPaneDebuggerState } from "selectors/apiPaneSelectors";
import { getIDEViewMode } from "selectors/ideSelectors";
import { EditorViewMode } from "@appsmith/entities/IDE/constants";
import ApiResponseMeta from "./ApiResponseMeta";
import useDebuggerTriggerClick from "./Debugger/hooks/useDebuggerTriggerClick";

const ResponseContainer = styled.div`
${ResizerCSS};
Expand Down Expand Up @@ -257,14 +258,7 @@ function ApiResponseView(props: Props) {

const ideViewMode = useSelector(getIDEViewMode);

const onDebugClick = useCallback(() => {
AnalyticsUtil.logEvent("OPEN_DEBUGGER", {
source: "API",
});
dispatch(
setApiPaneDebuggerState({ selectedTab: DEBUGGER_TAB_KEYS.ERROR_TAB }),
);
}, []);
const onDebugClick = useDebuggerTriggerClick();

const onRunClick = () => {
props.onRunClick();
Expand Down Expand Up @@ -491,7 +485,7 @@ function ApiResponseView(props: Props) {
{
children: "Debug",
endIcon: "bug",
onClick: () => onDebugClick,
onClick: onDebugClick,
to: "",
},
]}
Expand Down