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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Updating the UX related to Action Response tabs #37859

Closed
wants to merge 13 commits into from

Conversation

ankitakinger
Copy link
Contributor

@ankitakinger ankitakinger commented Nov 29, 2024

Description

Updating the UX related to Action Response tabs:

  • Opening the response tab by default for an API
  • Automatically opening response tab when API/Query error occurs
  • Updating the REST API Headers Tab to simply show the error callout, removing the debug button in the callout and also removing the response headers in case the query has failed.

Fixes #37836 #37767 #37766

Automation

/ok-to-test tags="@tag.All"

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12174790103
Commit: 0690211
Cypress dashboard.
Tags: @tag.All
Spec:


Thu, 05 Dec 2024 10:00:20 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced error handling in the Plugin Action Response component, automatically opening the response tab on execution failures.
    • Improved tab management for API plugins, ensuring the correct tab is displayed based on the plugin type.
  • Bug Fixes

    • Streamlined error message display in the ApiResponseHeaders component, removing unnecessary links for a clearer user experience.
  • Documentation

    • Updated test case descriptions for clarity regarding error message displays in the API response tabs.
  • Style

    • Added a background style to the StatusBar component for improved visual presentation.

Copy link
Contributor

coderabbitai bot commented Nov 29, 2024

Walkthrough

The changes in this pull request primarily involve modifications to several components related to API response handling and error display. The PluginActionResponse component now includes enhanced error handling through the use of the useMemo hook and updated useEffect logic. The ApiResponseHeaders component has simplified its error display by removing unnecessary links. Additionally, the ApiResponseView component has been updated to manage tab behavior more effectively. Test files have also been adjusted for clarity and accuracy in descriptions.

Changes

File Change Summary
app/client/src/PluginActionEditor/components/PluginActionResponse/PluginActionResponse.tsx Added useMemo for executionFailed, updated useEffect to open response tab on execution failure, modified default tab behavior for API plugins.
app/client/src/PluginActionEditor/components/PluginActionResponse/components/ApiResponseHeaders.tsx Removed errorCalloutLinks, simplified rendering logic for error messages based on runHasFailed.
app/client/src/components/editorComponents/ApiResponseView.tsx Added useEffect for default tab management, updated import for PluginType, logged onRunClick event.
app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/ApiError_spec.ts Updated test case descriptions for clarity regarding error message display in response and error tabs.
app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/EntityBottomBar_spec.ts Modified SQL query strings and corrected comments for clarity without altering test logic.
app/client/cypress/support/Pages/ApiPage.ts Removed _responseTabHeader and _headersTabContent, added _debugger property, updated DebugError method.
app/client/src/PluginActionEditor/components/PluginActionResponse/components/QueryResponseTab/styles.ts Added background style to StatusBar component.

Assessment against linked issues

Objective Addressed Explanation
REST API Headers Tab should display simple text without response headers and remove debug CTA (Issue #37836)

Possibly related PRs

Suggested labels

Bug, Enhancement

Suggested reviewers

  • hetunandu
  • ankitakinger

Poem

In the land of code where errors reside,
A response tab opens, no need to hide.
With hooks and effects, the flow’s now refined,
Simplified headers, clarity aligned.
Debugging made easy, the UI shines bright,
Cheers to the changes, all feels just right! 🎉


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@ankitakinger ankitakinger added the ok-to-test Required label for CI label Nov 29, 2024
@github-actions github-actions bot added IDE Pod Issues that new developers face while exploring the IDE IDE Product Issues related to the IDE Product Task A simple Todo labels Nov 29, 2024
@ankitakinger
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

@github-actions github-actions bot added the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label Nov 29, 2024
Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/12084157350.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 37859.
recreate: .

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Outside diff range and nitpick comments (4)
app/client/src/PluginActionEditor/components/PluginActionResponse/components/ApiResponseHeaders.tsx (1)

87-93: Consider more explicit status code validation

The isEmpty check on statusCode might treat valid status code 0 as empty. Consider using a more explicit validation.

-          {isEmpty(props.actionResponse.statusCode) ? (
+          {props.actionResponse.statusCode === undefined ? (
app/client/src/PluginActionEditor/components/PluginActionResponse/PluginActionResponse.tsx (1)

78-96: Consider potential race condition between useEffects

While the logic is correct, there could be a race condition between this useEffect and the error handling useEffect. Consider combining them or adding a priority mechanism.

Here's a suggested improvement:

 useEffect(
   function openDefaultTabWhenNoTabIsSelected() {
+    // Skip if error handling effect has already set the tab
+    if (executionFailed) return;
+
     if (showSchema && !selectedTab) {
       dispatch(
         setPluginActionEditorDebuggerState({
           open: true,
           selectedTab: DEBUGGER_TAB_KEYS.SCHEMA_TAB,
         }),
       );
     } else if (plugin.type === PluginType.API && !selectedTab) {
       dispatch(
         setPluginActionEditorDebuggerState({
           open: true,
           selectedTab: DEBUGGER_TAB_KEYS.RESPONSE_TAB,
         }),
       );
     }
   },
-  [showSchema, selectedTab, dispatch, plugin.type],
+  [showSchema, selectedTab, dispatch, plugin.type, executionFailed],
 );
app/client/src/PluginActionEditor/components/PluginActionResponse/components/ApiResponse.tsx (1)

145-147: Consider adding error message styling consistency

The body display implementation looks good, but consider wrapping the message in the same styling components used for plugin errors for visual consistency.

 {body && (
-  <div className="t--debugger-log-downstream-message">{body}</div>
+  <ResponseTabErrorContent>
+    <div className="t--debugger-log-downstream-message">{body}</div>
+  </ResponseTabErrorContent>
 )}
app/client/src/components/editorComponents/ApiResponseView.tsx (1)

61-73: Consider adding cleanup to useEffect

While the implementation correctly handles the default tab selection for API plugins, consider adding a cleanup function to handle component unmounting scenarios.

 useEffect(
   function openDefaultTabWhenNoTabIsSelected() {
     if (currentActionConfig.pluginType === PluginType.API && !selectedTab) {
       dispatch(
         setPluginActionEditorDebuggerState({
           open: true,
           selectedTab: DEBUGGER_TAB_KEYS.RESPONSE_TAB,
         }),
       );
     }
+    return () => {
+      // Reset tab state on unmount if needed
+      dispatch(
+        setPluginActionEditorDebuggerState({
+          selectedTab: undefined,
+        }),
+      );
+    };
   },
   [selectedTab, dispatch, currentActionConfig.pluginType],
 );
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 63eec76 and bbd201f.

📒 Files selected for processing (4)
  • app/client/src/PluginActionEditor/components/PluginActionResponse/PluginActionResponse.tsx (4 hunks)
  • app/client/src/PluginActionEditor/components/PluginActionResponse/components/ApiResponse.tsx (4 hunks)
  • app/client/src/PluginActionEditor/components/PluginActionResponse/components/ApiResponseHeaders.tsx (1 hunks)
  • app/client/src/components/editorComponents/ApiResponseView.tsx (3 hunks)
🔇 Additional comments (8)
app/client/src/PluginActionEditor/components/PluginActionResponse/components/ApiResponseHeaders.tsx (1)

83-84: LGTM: Simplified error presentation

The streamlined error callout without debug buttons aligns well with the UX improvement objectives.

app/client/src/PluginActionEditor/components/PluginActionResponse/PluginActionResponse.tsx (2)

1-1: LGTM: Import changes are appropriate

The new imports support the added functionality for plugin type checking and error state detection.

Also applies to: 15-16


65-76: LGTM: Error handling behavior matches requirements

The useEffect correctly implements the requirement to automatically open the response tab when an error occurs.

app/client/src/PluginActionEditor/components/PluginActionResponse/components/ApiResponse.tsx (3)

49-50: LGTM: Styling changes improve readability

The font-size and line-height values provide appropriate spacing for error messages.


124-124: LGTM: Improved error message condition

The enhanced condition properly handles both plugin errors and body content.


96-96: Verify body property usage across components

The addition of body to destructured properties looks good, but let's ensure consistent handling across related components.

✅ Verification successful

Let me search for more information about the usage of these properties.


Let me search for the ActionResponse interface to understand its structure and verify the body property usage.


Addition of body property is correctly implemented

The body property is a standard part of the ActionResponse interface and is consistently used across multiple components in the PluginActionResponse directory for displaying response data, error handling, and format processing. The destructuring in ApiResponse.tsx aligns with the established pattern.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other components that might need similar updates
ast-grep --pattern 'const { $$$, messages, pluginErrorDetails $$$} = $_'

Length of output: 250


Script:

#!/bin/bash
# Search for usage of actionResponse object to find related components
rg "actionResponse" -t typescript -t javascript

# Search for components handling plugin responses
ast-grep --pattern 'interface $_ {
  messages?: $_
  pluginErrorDetails?: $_
  $$$
}'

Length of output: 170


Script:

#!/bin/bash
# Search for actionResponse usage with proper file extension
rg "actionResponse" --type-add 'ts:*.{ts,tsx}' -t ts

# Look for interface definitions related to plugin responses
rg "interface.*Response" --type-add 'ts:*.{ts,tsx}' -t ts -A 5

Length of output: 37308


Script:

#!/bin/bash
# Search for ActionResponse interface definition
rg "interface ActionResponse" --type-add 'ts:*.{ts,tsx}' -t ts -A 10

# Search for body property usage in components
rg "\.body" --type-add 'ts:*.{ts,tsx}' -t ts -g 'PluginActionResponse/**'

Length of output: 985


Script:

#!/bin/bash
# Search for body property usage in components with correct path
rg "\.body" --type-add 'ts:*.{ts,tsx}' -t ts app/client/src/PluginActionEditor/components/PluginActionResponse/

# Search for other components using actionResponse to verify consistency
ast-grep --pattern 'const { $$$, messages $$$} = $_?.actionResponse'

Length of output: 3419

app/client/src/components/editorComponents/ApiResponseView.tsx (2)

20-20: LGTM: Clean import addition

The import addition follows TypeScript best practices by using the type import syntax.


61-73: Verify tab behavior across different scenarios

Let's verify the tab behavior implementation across the codebase.

✅ Verification successful

Tab behavior implementation is consistent and well-structured

The implementation in ApiResponseView.tsx follows the established pattern for tab management. The usePluginActionResponseTabs hook shows that:

  • Response tab is properly configured for API plugin types
  • Tab state management is consistent across different plugin types
  • Default tab selection aligns with the component's purpose
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other components that might be managing the same tab state
ast-grep --pattern 'setPluginActionEditorDebuggerState({
  $$$
  selectedTab: $_, 
  $$$
})'

# Look for potential conflicting tab management logic
rg -l "DEBUGGER_TAB_KEYS.RESPONSE_TAB"

Length of output: 4936


Script:

#!/bin/bash
# Let's examine the implementation of PluginActionResponse to understand the tab behavior
ast-grep --pattern 'function usePluginActionResponseTabs() {
  $$$
}'

# Check the reducer implementation
ast-grep --pattern 'case ReduxActionTypes.SET_PLUGIN_ACTION_EDITOR_DEBUGGER_STATE: {
  $$$
}'

# Look for any tab-related tests
rg -l "test.*tab.*debugger" --type=test

Length of output: 16987

Copy link

Deploy-Preview-URL: https://ce-37859.dp.appsmith.com

hetunandu
hetunandu previously approved these changes Nov 29, 2024
@ankitakinger ankitakinger added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Nov 30, 2024
@ankitakinger
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/12095990785.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 37859.
recreate: .

Copy link

Deploy-Preview-URL: https://ce-37859.dp.appsmith.com

@ankitakinger ankitakinger added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Dec 1, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (6)
app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/ApiError_spec.ts (3)

15-19: Test description accurately reflects the new error handling behavior.

The test aligns well with the PR objectives of showing API errors directly in the response tab.

Consider moving the error code "PE-RST-5000" to a constants file for better maintainability:

// constants/errorCodes.ts
export const API_ERROR_CODES = {
  RUNTIME_ERROR: 'PE-RST-5000'
};

Line range hint 20-33: Test verifies error tab functionality but could be more comprehensive.

The test correctly verifies error display in both normal and split-screen modes.

Add assertions to verify the new simplified error message format mentioned in PR objectives:

// Add after line 32
_.debuggerHelper.AssertErrorMessageFormat({
  shouldHaveHeaders: false,
  shouldHaveDebugButton: false
});

Line range hint 11-14: Consider using a more realistic API endpoint for testing.

The fake API URL could be moved to a test constants file and potentially use a more realistic endpoint.

// constants/testEndpoints.ts
export const TEST_ENDPOINTS = {
  ERROR_ENDPOINT: 'https://api.example.com/error-simulation'
};
app/client/cypress/support/Pages/ApiPage.ts (1)

473-475: Consider enhancing error debugging method

The DebugError method could benefit from additional error handling and validation.

Consider adding error state validation:

 public DebugError() {
+  this.agHelper.AssertElementVisibility(this._responseTabError);
   this.agHelper.GetNClick(this._responseTabError);
+  return this;
 }
app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/EntityBottomBar_spec.ts (2)

Line range hint 1-159: Remove usage of agHelper.Sleep() and optimize wait patterns.

The test contains agHelper.Sleep(1000) which violates our coding guidelines. Replace sleep calls with proper Cypress wait commands that wait for specific conditions.

Consider replacing:

- _.agHelper.Sleep(1000);
+ _.agHelper.WaitUntilToastDisappear();
// or
+ _.agHelper.WaitUntilAllToastsDisappear();
// or wait for specific network request
+ _.agHelper.WaitUntilRequestResponse(requestMatcher);

Line range hint 1-159: Test structure improvements needed.

Several improvements needed based on our guidelines:

  1. Use data-* attributes for selectors
  2. Move login/logout operations to use API calls
  3. Consider combining similar test scenarios

Consider refactoring the test setup to use:

before(() => {
  _.agHelper.LoginFromAPI()
});

after(() => {
  _.agHelper.LogOutviaAPI()
});
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 5ef06c8 and 2985ea9.

📒 Files selected for processing (4)
  • app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/ApiError_spec.ts (1 hunks)
  • app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/EntityBottomBar_spec.ts (2 hunks)
  • app/client/cypress/support/Pages/ApiPage.ts (2 hunks)
  • app/client/src/PluginActionEditor/components/PluginActionResponse/components/QueryResponseTab/styles.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • app/client/src/PluginActionEditor/components/PluginActionResponse/components/QueryResponseTab/styles.ts
🧰 Additional context used
📓 Path-based instructions (3)
app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/ApiError_spec.ts (1)

Pattern app/client/cypress/**/**.*: Review the following e2e test code written using the Cypress test library. Ensure that:

  • Follow best practices for Cypress code and e2e automation.
  • Avoid using cy.wait in code.
  • Avoid using cy.pause in code.
  • Avoid using agHelper.sleep().
  • Use locator variables for locators and do not use plain strings.
  • Use data-* attributes for selectors.
  • Avoid Xpaths, Attributes and CSS path.
  • Avoid selectors like .btn.submit or button[type=submit].
  • Perform logins via API with LoginFromAPI.
  • Perform logout via API with LogOutviaAPI.
  • Perform signup via API with SignupFromAPI.
  • Avoid using it.only.
  • Avoid using after and aftereach in test cases.
  • Use multiple assertions for expect statements.
  • Avoid using strings for assertions.
  • Do not use duplicate filenames even with different paths.
  • Avoid using agHelper.Sleep, this.Sleep in any file in code.
app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/EntityBottomBar_spec.ts (1)

Pattern app/client/cypress/**/**.*: Review the following e2e test code written using the Cypress test library. Ensure that:

  • Follow best practices for Cypress code and e2e automation.
  • Avoid using cy.wait in code.
  • Avoid using cy.pause in code.
  • Avoid using agHelper.sleep().
  • Use locator variables for locators and do not use plain strings.
  • Use data-* attributes for selectors.
  • Avoid Xpaths, Attributes and CSS path.
  • Avoid selectors like .btn.submit or button[type=submit].
  • Perform logins via API with LoginFromAPI.
  • Perform logout via API with LogOutviaAPI.
  • Perform signup via API with SignupFromAPI.
  • Avoid using it.only.
  • Avoid using after and aftereach in test cases.
  • Use multiple assertions for expect statements.
  • Avoid using strings for assertions.
  • Do not use duplicate filenames even with different paths.
  • Avoid using agHelper.Sleep, this.Sleep in any file in code.
app/client/cypress/support/Pages/ApiPage.ts (1)

Pattern app/client/cypress/**/**.*: Review the following e2e test code written using the Cypress test library. Ensure that:

  • Follow best practices for Cypress code and e2e automation.
  • Avoid using cy.wait in code.
  • Avoid using cy.pause in code.
  • Avoid using agHelper.sleep().
  • Use locator variables for locators and do not use plain strings.
  • Use data-* attributes for selectors.
  • Avoid Xpaths, Attributes and CSS path.
  • Avoid selectors like .btn.submit or button[type=submit].
  • Perform logins via API with LoginFromAPI.
  • Perform logout via API with LogOutviaAPI.
  • Perform signup via API with SignupFromAPI.
  • Avoid using it.only.
  • Avoid using after and aftereach in test cases.
  • Use multiple assertions for expect statements.
  • Avoid using strings for assertions.
  • Do not use duplicate filenames even with different paths.
  • Avoid using agHelper.Sleep, this.Sleep in any file in code.
🔇 Additional comments (2)
app/client/cypress/support/Pages/ApiPage.ts (2)

85-85: LGTM! Good use of data-testid attribute

The new _responseTabError property follows Cypress best practices by using data-testid for element selection.


Line range hint 1-497: Verify test coverage for error scenarios

The class handles various API response scenarios. Ensure comprehensive test coverage for all error cases, especially with the new error tab functionality.

Let's check the test coverage:

✅ Verification successful

Based on the shell script results, I can now generate the final response:

Error handling test coverage appears comprehensive

The codebase includes dedicated test files covering error scenarios:

  • ApiError_spec.ts tests API error responses and debugger integration
  • ErrorMessages_spec.ts verifies error message display and handling
  • Multiple test files validate error states through AssertDebugError
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Find related test files and verify error scenario coverage

# Look for test files that use ApiPage
fd -e ts -e js --full-path '.*spec|.*test' | xargs rg "ApiPage"

# Check for error scenario tests
rg -A 5 "DebugError|_responseTabError" 

Length of output: 7062

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 2985ea9 and 94ce98d.

📒 Files selected for processing (1)
  • app/client/cypress/support/Pages/ApiPage.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
app/client/cypress/support/Pages/ApiPage.ts (1)

Pattern app/client/cypress/**/**.*: Review the following e2e test code written using the Cypress test library. Ensure that:

  • Follow best practices for Cypress code and e2e automation.
  • Avoid using cy.wait in code.
  • Avoid using cy.pause in code.
  • Avoid using agHelper.sleep().
  • Use locator variables for locators and do not use plain strings.
  • Use data-* attributes for selectors.
  • Avoid Xpaths, Attributes and CSS path.
  • Avoid selectors like .btn.submit or button[type=submit].
  • Perform logins via API with LoginFromAPI.
  • Perform logout via API with LogOutviaAPI.
  • Perform signup via API with SignupFromAPI.
  • Avoid using it.only.
  • Avoid using after and aftereach in test cases.
  • Use multiple assertions for expect statements.
  • Avoid using strings for assertions.
  • Do not use duplicate filenames even with different paths.
  • Avoid using agHelper.Sleep, this.Sleep in any file in code.
🔇 Additional comments (1)
app/client/cypress/support/Pages/ApiPage.ts (1)

85-85: Verify the debugger selector's uniqueness

The new selector .t--debugger-count should be unique across the application to ensure reliable test execution.

✅ Verification successful

The .t--debugger-count selector is consistently used across the application

The selector is properly defined in the common locators and used consistently:

  • As a debugger trigger button in the UI component
  • Referenced uniformly across test files for assertions
  • Properly shared between ApiPage and DebuggerHelper test utilities
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for uniqueness of the debugger selector
# Test: Search for all occurrences of the debugger selector
rg -l "t--debugger-count" 

Length of output: 385


Script:

#!/bin/bash
# Check the usage context of the selector to ensure it's used consistently
rg "t--debugger-count" -C 2

Length of output: 4223

app/client/cypress/support/Pages/ApiPage.ts Show resolved Hide resolved
@ankitakinger
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

Copy link

github-actions bot commented Dec 2, 2024

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/12120760247.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 37859.
recreate: .

Copy link

github-actions bot commented Dec 2, 2024

Deploy-Preview-URL: https://ce-37859.dp.appsmith.com

alex-golovanov
alex-golovanov previously approved these changes Dec 3, 2024
@github-actions github-actions bot added the Debugger Product Issues related to the debugger label Dec 5, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
app/client/cypress/support/Pages/ApiPage.ts (1)

Line range hint 1-500: Replace sleep/wait calls with proper assertions

Several instances of agHelper.Sleep() and cy.wait() were found in the code. According to the guidelines, these should be replaced with proper assertions:

  1. Line 134: this.agHelper.Sleep()
  2. Line 479: this.agHelper.Sleep(500)

Consider using Cypress's built-in retry-ability with assertions instead:

- this.agHelper.Sleep() //Is needed for the entered url value to be registered
+ this.agHelper.AssertElementContains(ApiEditor.dataSourceField, url)

- this.agHelper.Sleep(500) //Clicking import after value settled
+ this.agHelper.AssertElementEnabled(ApiEditor.curlImportBtn)
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 94ce98d and 0690211.

⛔ Files ignored due to path filters (1)
  • app/client/cypress/snapshots/Regression/ClientSide/VisualTests/JSEditorIndent_spec.js/formattedJSONBodyAfterSave.snap.png is excluded by !**/*.png
📒 Files selected for processing (1)
  • app/client/cypress/support/Pages/ApiPage.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
app/client/cypress/support/Pages/ApiPage.ts (1)

Pattern app/client/cypress/**/**.*: Review the following e2e test code written using the Cypress test library. Ensure that:

  • Follow best practices for Cypress code and e2e automation.
  • Avoid using cy.wait in code.
  • Avoid using cy.pause in code.
  • Avoid using agHelper.sleep().
  • Use locator variables for locators and do not use plain strings.
  • Use data-* attributes for selectors.
  • Avoid Xpaths, Attributes and CSS path.
  • Avoid selectors like .btn.submit or button[type=submit].
  • Perform logins via API with LoginFromAPI.
  • Perform logout via API with LogOutviaAPI.
  • Perform signup via API with SignupFromAPI.
  • Avoid using it.only.
  • Avoid using after and aftereach in test cases.
  • Use multiple assertions for expect statements.
  • Avoid using strings for assertions.
  • Do not use duplicate filenames even with different paths.
  • Avoid using agHelper.Sleep, this.Sleep in any file in code.
🔇 Additional comments (2)
app/client/cypress/support/Pages/ApiPage.ts (2)

86-86: LGTM! Property follows naming conventions

The new _debugger property follows the established pattern of using data-testid selectors.


473-473: Consider adding validation for debugger element

The DebugError method should verify the debugger element's presence and state before clicking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Debugger Product Issues related to the debugger IDE Pod Issues that new developers face while exploring the IDE IDE Product Issues related to the IDE Product ok-to-test Required label for CI skip-changelog Adding this label to a PR prevents it from being listed in the changelog Task A simple Todo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task]: Update Rest Api Headers tab for errors
4 participants