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

fix: Fix test case for api #36083

Merged
merged 10 commits into from
Sep 6, 2024
Merged

fix: Fix test case for api #36083

merged 10 commits into from
Sep 6, 2024

Conversation

sagar-qa007
Copy link
Contributor

@sagar-qa007 sagar-qa007 commented Sep 3, 2024

Description

RCA: Toggle button from log tab is not open always. Due to this next element was not visible.
Fix: Have gone through the test case and found unnecessary steps for verifying successful log. Update the only required code and fixed the test case.

Fixes #36082

Automation

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

🔍 Cypress test results

Tip

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


Thu, 05 Sep 2024 05:42:15 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Enhanced API testing capabilities with updated test cases for various HTTP methods.
    • Introduced new properties for improved API debugging in the UI.
    • Added a method to check the visibility of specific elements in tests.
  • Bug Fixes

    • Improved the validateRequest command to handle multiple API log entries more effectively.
  • Chores

    • Updated the test specifications to focus on server-side API tests, replacing outdated client-side entries.

@sagar-qa007 sagar-qa007 added the ok-to-test Required label for CI label Sep 3, 2024
Copy link
Contributor

coderabbitai bot commented Sep 3, 2024

Walkthrough

The recent changes involve modifications to multiple test files within the Cypress framework, enhancing API interaction logic and updating test specifications. Key updates include the addition of new parameters in API request methods, the introduction of new methods for element visibility checks, and adjustments to the test suite to prioritize server-side API tests over client-side templates.

Changes

Files Change Summary
app/client/cypress/e2e/Regression/ServerSide/ApiTests/API_All_Verb_spec.js Updated API request methods to include new parameters and replaced validation methods to focus on API response logs.
app/client/cypress/limited-tests.txt Replaced a client-side test entry with new server-side API test entries, reflecting a shift in testing focus.
app/client/cypress/locators/ApiEditor.js Introduced new properties for targeting specific UI elements related to API debugging.
app/client/cypress/support/ApiCommands.js Modified the validateRequest command to include an index parameter for improved log entry handling.
app/client/cypress/support/Pages/AggregateHelper.ts Added a new method to check the visibility of elements at specified indices, enhancing element selection capabilities.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Cypress
    participant API

    User->>Cypress: Initiate API request
    Cypress->>API: Send request with parameters (false, 0)
    API-->>Cypress: Return response
    Cypress->>User: Display results
Loading

Assessment against linked issues

Objective Addressed Explanation
Fix API test cases in API_All_Verb_spec.js (#36082)
Update test specifications to reflect server-side focus
Enhance API command functionality

In the realm of tests, changes take flight,
Parameters added, making things right.
API calls now dance with precision and grace,
A shift in focus, a new testing space.
With methods anew, visibility's clear,
Together we code, together we cheer! 🎉


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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.

@sagar-qa007
Copy link
Contributor Author

/ci-test-limit-count run_count=15

@github-actions github-actions bot added the Bug Something isn't working label Sep 3, 2024
Copy link

github-actions bot commented Sep 3, 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, codebase verification and nitpick comments (2)
app/client/cypress/limited-tests.txt (1)

2-4: Ensure the added API tests follow best practices and align with the testing strategy.

As you focus on testing server-side APIs, it's crucial to keep the following points in mind:

  1. Use API endpoints consistently: Ensure that the API endpoints used in the tests match the actual endpoints in the application. Avoid hardcoding URLs and consider using environment variables or configuration files to manage the API endpoints.

  2. Handle authentication and authorization: If the APIs require authentication or authorization, make sure to include the necessary steps in the tests to obtain and include the required tokens or credentials in the API requests.

  3. Validate response data: Thoroughly validate the response data returned by the APIs. Check for the expected status codes, headers, and response body structure. Verify that the response data aligns with the API documentation and meets the expected format and constraints.

  4. Test edge cases and error scenarios: In addition to testing the happy path, include test cases that cover edge cases and error scenarios. Verify that the APIs handle invalid inputs, missing parameters, and unauthorized access appropriately and return the expected error responses.

  5. Maintain test isolation: Ensure that each test case is independent and does not rely on the state modified by previous tests. Use appropriate setup and teardown mechanisms to create a clean and consistent environment for each test.

  6. Follow naming conventions: Use descriptive and meaningful names for the test files, test cases, and assertions. Follow a consistent naming convention that reflects the purpose and scope of each test.

  7. Keep tests focused and maintainable: Aim for concise and focused test cases that test a single functionality or scenario. Avoid including unnecessary steps or assertions that can make the tests brittle and difficult to maintain.

By adhering to these best practices, you can create a robust and reliable test suite for the server-side APIs. Let me know if you have any further questions or if you need assistance in implementing these practices in your tests.

app/client/cypress/support/Pages/AggregateHelper.ts (1)

1559-1560: Simplify the ternary operator.

The ternary operator used to assign isVisible can be simplified by directly returning the boolean result:

- const isVisible = Cypress.$($element).length > 0 ? true : false;
+ const isVisible = Cypress.$($element).length > 0;

This will make the code more concise without changing the behavior.

Tools
Biome

[error] 1559-1560: Unnecessary use of boolean literals in conditional expression.

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

(lint/complexity/noUselessTernary)

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between f02b448 and ea4f5b3.

Files selected for processing (5)
  • app/client/cypress/e2e/Regression/ServerSide/ApiTests/API_All_Verb_spec.js (9 hunks)
  • app/client/cypress/limited-tests.txt (1 hunks)
  • app/client/cypress/locators/ApiEditor.js (1 hunks)
  • app/client/cypress/support/ApiCommands.js (1 hunks)
  • app/client/cypress/support/Pages/AggregateHelper.ts (1 hunks)
Additional context used
Path-based instructions (5)
app/client/cypress/limited-tests.txt (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/locators/ApiEditor.js (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/ServerSide/ApiTests/API_All_Verb_spec.js (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/ApiCommands.js (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/AggregateHelper.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.
Biome
app/client/cypress/support/Pages/AggregateHelper.ts

[error] 1559-1560: Unnecessary use of boolean literals in conditional expression.

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

(lint/complexity/noUselessTernary)

Additional comments not posted (11)
app/client/cypress/locators/ApiEditor.js (1)

37-37: Great job adding the new property for the API log result pointer! 👍

The property name is descriptive and the CSS selector precisely targets the desired element.

Just a friendly reminder to consider using data-* attributes for selectors whenever possible, as they provide a more reliable and maintainable way to identify elements in the UI. For example:

apiLogResultPointer: "div.debugger-list div.cursor-pointer button[data-testid='api-log-result-pointer']",

This approach can help make the selectors more resilient to changes in the UI structure or styling.

Keep up the good work! Let me know if you have any questions or need further assistance.

app/client/cypress/e2e/Regression/ServerSide/ApiTests/API_All_Verb_spec.js (9)

47-48: Verify the purpose and impact of the new arguments in cy.validateRequest.

Dear student, let's take a closer look at the changes made to the cy.validateRequest function call. Two new arguments, false and 0, have been added. It's important to understand the purpose and impact of these arguments on the test behavior.

Please consider the following:

  • What is the significance of the false and 0 values in the context of the cy.validateRequest function?
  • How do these new arguments align with the test objectives?
  • Could these changes potentially introduce any unintended consequences or affect the reliability of the test?

Let's discuss this further to ensure that the modifications enhance the test suite's functionality without compromising its integrity.


73-74: Refer to the previous comment regarding the new arguments in cy.validateRequest.

Dear student, the changes made to the cy.validateRequest function call in this test case are identical to the ones discussed in the previous comment. Please refer to the earlier comment for a detailed discussion on verifying the purpose and impact of the new arguments.


99-100: Refer to the previous comments regarding the new arguments in cy.validateRequest.

Dear student, once again, the changes made to the cy.validateRequest function call in this test case are identical to the ones discussed in the previous comments. Please refer to the earlier comments for a detailed discussion on verifying the purpose and impact of the new arguments.


125-126: Refer to the previous comments regarding the new arguments in cy.validateRequest.

Dear student, as observed in the previous test cases, the changes made to the cy.validateRequest function call in this test case are also identical. Please refer to the earlier comments for a detailed discussion on verifying the purpose and impact of the new arguments.


143-144: Refer to the previous comments regarding the new arguments in cy.validateRequest.

Dear student, the changes made to the cy.validateRequest function call in this test case follow the same pattern as the previous ones. Please refer to the earlier comments for a detailed discussion on verifying the purpose and impact of the new arguments.


162-163: Refer to the previous comments regarding the new arguments in cy.validateRequest.

Dear student, once again, the changes made to the cy.validateRequest function call in this test case are consistent with the previous ones. Please refer to the earlier comments for a detailed discussion on verifying the purpose and impact of the new arguments.


180-181: Refer to the previous comments regarding the new arguments in cy.validateRequest.

Dear student, the changes made to the cy.validateRequest function call in this test case are identical to the ones discussed in the previous comments. Please refer to the earlier comments for a detailed discussion on verifying the purpose and impact of the new arguments.


196-197: Refer to the previous comments regarding the new arguments in cy.validateRequest.

Dear student, as observed in the previous test cases, the changes made to the cy.validateRequest function call in this test case are also identical. Please refer to the earlier comments for a detailed discussion on verifying the purpose and impact of the new arguments.


213-213: Verify the purpose and impact of the true argument in cy.validateRequest for the invalid header test case.

Dear student, in this test case for checking the API with an invalid header, the cy.validateRequest function call includes true as an argument, which is different from the false argument used in the previous test cases. Let's discuss the significance of this change.

Please consider the following:

  • What is the purpose of using true instead of false in this specific test case?
  • How does this change align with the test objective of checking the API's behavior with an invalid header?
  • Could this modification potentially affect the reliability or accuracy of the test?

Let's ensure that the change is intentional and serves the purpose of validating the API's response to an invalid header.

app/client/cypress/support/ApiCommands.js (1)

88-99: Great job enhancing the validateRequest function! The changes look good to me.

The updates to the function signature and body improve its capability to handle multiple log entries by allowing the specification of the log entry index. This enhances the precision and robustness of the API request validation process.

A few additional suggestions:

  1. Consider adding JSDoc comments to document the new index parameter and its purpose.
  2. If the index parameter is expected to be a non-negative integer, you could add a type check or assertion to ensure its validity.

Overall, the changes follow the existing coding style and conventions, and they do not introduce any breaking changes or new dependencies. Well done!

@sagar-qa007 sagar-qa007 added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Sep 3, 2024
Copy link

github-actions bot commented Sep 3, 2024

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/10681955777.
Cypress dashboard url: Click here!
All cypress tests have passed 🎉🎉🎉

***** Repeat Run Summary ***** Total Tests with repeat: 210 Total Passed: 210 Total Failed: 0 Total Skipped: 0 *****************************

@sagar-qa007
Copy link
Contributor Author

/ci-test-limit-count run_count=15

Copy link

github-actions bot commented Sep 3, 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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ea4f5b3 and 402b556.

Files selected for processing (2)
  • app/client/cypress/support/ApiCommands.js (1 hunks)
  • app/client/cypress/support/Pages/AggregateHelper.ts (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • app/client/cypress/support/ApiCommands.js
  • app/client/cypress/support/Pages/AggregateHelper.ts

Copy link

github-actions bot commented Sep 3, 2024

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/10687468793.
Cypress dashboard url: Click here!
All cypress tests have passed 🎉🎉🎉

***** Repeat Run Summary ***** Total Tests with repeat: 210 Total Passed: 210 Total Failed: 0 Total Skipped: 0 *****************************

@sagar-qa007 sagar-qa007 added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Sep 4, 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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 402b556 and 0afea03.

Files selected for processing (3)
  • app/client/cypress/e2e/Regression/ServerSide/ApiTests/API_All_Verb_spec.js (10 hunks)
  • app/client/cypress/limited-tests.txt (1 hunks)
  • app/client/cypress/locators/ApiEditor.js (1 hunks)
Files skipped from review as they are similar to previous changes (3)
  • app/client/cypress/e2e/Regression/ServerSide/ApiTests/API_All_Verb_spec.js
  • app/client/cypress/limited-tests.txt
  • app/client/cypress/locators/ApiEditor.js

@sagar-qa007
Copy link
Contributor Author

/ci-test-limit-count run_count=15

Copy link

github-actions bot commented Sep 4, 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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 0afea03 and 6278831.

Files selected for processing (1)
  • app/client/cypress/e2e/Regression/ServerSide/ApiTests/API_All_Verb_spec.js (10 hunks)
Additional context used
Path-based instructions (1)
app/client/cypress/e2e/Regression/ServerSide/ApiTests/API_All_Verb_spec.js (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 not posted (12)
app/client/cypress/e2e/Regression/ServerSide/ApiTests/API_All_Verb_spec.js (12)

15-15: Great job importing the ApiEditor locator!

The import statement is correctly implemented.


43-44: Excellent work updating the test assertions!

The code changes are correctly implemented and indicate a shift in the testing strategy, emphasizing interaction with the API response logs instead of direct validation of the request execution.


63-64: Great job maintaining consistency in the test assertions!

The code changes are correctly implemented and consistent with the previous code segment, indicating a comprehensive update to the test suite's approach to API interaction and response verification.


83-84: Excellent work updating the test assertions for the PATCH method!

The code changes are correctly implemented and consistent with the previous code segments, indicating a comprehensive update to the test suite's approach to API interaction and response verification.


103-104: Great job updating the test assertions for the DELETE method!

The code changes are correctly implemented and consistent with the previous code segments, indicating a comprehensive update to the test suite's approach to API interaction and response verification.


115-116: Excellent work updating the test assertions for the GET method!

The code changes are correctly implemented and consistent with the previous code segments, indicating a comprehensive update to the test suite's approach to API interaction and response verification.


128-129: Great job updating the test assertions for the pagination functionality!

The code changes are correctly implemented and consistent with the previous code segments, indicating a comprehensive update to the test suite's approach to API interaction and response verification.


140-141: Excellent work maintaining consistency in the test assertions for the pagination functionality!

The code changes are correctly implemented and consistent with the previous code segments, indicating a comprehensive update to the test suite's approach to API interaction and response verification.


150-151: Great job updating the test assertions for the API check with query params!

The code changes are correctly implemented and consistent with the previous code segments, indicating a comprehensive update to the test suite's approach to API interaction and response verification.


160-161: Excellent work updating the test assertions for the API check with invalid header!

The code changes are correctly implemented and consistent with the previous code segments, indicating a comprehensive update to the test suite's approach to API interaction and response verification.


165-165: Great job closing the describe block!

The code segment is correctly implemented.


Line range hint 1-165: Excellent work on updating the test suite's approach to API interaction and response verification!

The code changes are correctly implemented and consistent across the entire file, indicating a comprehensive update to the test suite's approach to API interaction and response verification. The changes align with the best practices for Cypress code and e2e automation, and the file does not contain any issues or violations of the additional instructions provided.

Some key highlights:

  • The cy.validateRequest function calls have been replaced with agHelper.GetNClickByContains and agHelper.AssertContains, focusing on checking for the presence of specific log messages.
  • The changes are consistent across all HTTP methods (PUT, POST, PATCH, DELETE, and GET), indicating a comprehensive update to the test suite's approach.
  • The file follows the best practices for Cypress code and e2e automation, such as using locator variables, data-* attributes for selectors, and avoiding the use of cy.wait, cy.pause, and agHelper.sleep().

Great job on implementing these changes and maintaining a high-quality test suite!

Copy link

github-actions bot commented Sep 4, 2024

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/10701472265.
Cypress dashboard url: Click here!
All cypress tests have passed 🎉🎉🎉

***** Repeat Run Summary ***** Total Tests with repeat: 105 Total Passed: 105 Total Failed: 0 Total Skipped: 0 *****************************

@sagar-qa007 sagar-qa007 added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Sep 4, 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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 6278831 and 4892b04.

Files selected for processing (2)
  • app/client/cypress/e2e/Regression/ServerSide/ApiTests/API_All_Verb_spec.js (10 hunks)
  • app/client/cypress/support/Pages/AggregateHelper.ts (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • app/client/cypress/support/Pages/AggregateHelper.ts
Additional context used
Path-based instructions (1)
app/client/cypress/e2e/Regression/ServerSide/ApiTests/API_All_Verb_spec.js (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 not posted (5)
app/client/cypress/e2e/Regression/ServerSide/ApiTests/API_All_Verb_spec.js (5)

15-15: Great job importing the ApiEditor locator!

The import statement is correctly written and follows the proper syntax.


63-64: Duplicate comment: Avoid using agHelper.Sleep or this.Sleep in the code.

The code changes are consistent with the previous segment and follow the same pattern.


83-84: Duplicate comment: Avoid using agHelper.Sleep or this.Sleep in the code.

The code changes are consistent with the previous segments and follow the same pattern.


103-104: Duplicate comment: Avoid using agHelper.Sleep or this.Sleep in the code.

The code changes are consistent with the previous segments and follow the same pattern.


115-116: Duplicate comment: Avoid using agHelper.Sleep or this.Sleep in the code.

The code changes are consistent with the previous segments and follow the same pattern.

Also applies to: 128-129, 140-141, 150-151, 160-161

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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4892b04 and 56a0518.

Files selected for processing (1)
  • app/client/cypress/e2e/Regression/ServerSide/ApiTests/API_All_Verb_spec.js (11 hunks)
Additional context used
Path-based instructions (1)
app/client/cypress/e2e/Regression/ServerSide/ApiTests/API_All_Verb_spec.js (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 not posted (5)
app/client/cypress/e2e/Regression/ServerSide/ApiTests/API_All_Verb_spec.js (5)

43-44: Verify the usage of agHelper functions.

The changes align with the shift in the testing strategy, emphasizing interaction with the API response logs. However, please ensure that the usage of agHelper.GetNClickByContains and agHelper.AssertContains adheres to the best practices for Cypress test code.

Consider the following:

  • Use locator variables for selectors instead of plain strings.
  • Use data-* attributes for selectors.
  • Avoid using agHelper.Sleep or this.Sleep in the code.

If necessary, refactor the code to follow these best practices and improve the maintainability and reliability of the tests.


63-64: The previous comment regarding the usage of agHelper functions is still applicable to this code segment. Skipping generating a similar comment.


83-84: The previous comments regarding the usage of agHelper functions are still applicable to this code segment. Skipping generating a similar comment.


103-104: The previous comments regarding the usage of agHelper functions are still applicable to this code segment. Skipping generating a similar comment.


115-116: The previous comments regarding the usage of agHelper functions are still applicable to these code segments. Skipping generating similar comments.

Also applies to: 128-129, 140-141, 150-151

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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 56a0518 and 21c2795.

Files selected for processing (1)
  • app/client/cypress/e2e/Regression/ServerSide/ApiTests/API_All_Verb_spec.js (10 hunks)
Additional context used
Path-based instructions (1)
app/client/cypress/e2e/Regression/ServerSide/ApiTests/API_All_Verb_spec.js (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 not posted (1)
app/client/cypress/e2e/Regression/ServerSide/ApiTests/API_All_Verb_spec.js (1)

43-44: The past review comment suggesting to avoid using agHelper.Sleep or this.Sleep is still valid and applicable to the current changes. Please ensure that you follow this guideline while making the modifications.

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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 21c2795 and f22a8d7.

Files selected for processing (1)
  • app/client/cypress/support/Pages/AggregateHelper.ts (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • app/client/cypress/support/Pages/AggregateHelper.ts

@sagar-qa007 sagar-qa007 added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Sep 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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between f22a8d7 and bd850ca.

Files selected for processing (1)
  • app/client/cypress/e2e/Regression/ServerSide/ApiTests/API_All_Verb_spec.js (11 hunks)
Files skipped from review as they are similar to previous changes (1)
  • app/client/cypress/e2e/Regression/ServerSide/ApiTests/API_All_Verb_spec.js

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

Files that changed from the base of the PR and between f22a8d7 and bd850ca.

Files selected for processing (1)
  • app/client/cypress/e2e/Regression/ServerSide/ApiTests/API_All_Verb_spec.js (11 hunks)
Additional context used
Path-based instructions (1)
app/client/cypress/e2e/Regression/ServerSide/ApiTests/API_All_Verb_spec.js (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 not posted (4)
app/client/cypress/e2e/Regression/ServerSide/ApiTests/API_All_Verb_spec.js (4)

8-8: Use of locators from a separate file is a good practice.

Importing apiLocators from a separate file promotes modularity and reusability, which is a commendable practice in test automation.


21-21: Good use of constants for messages.

Defining successMsg as a constant is a good practice as it avoids hardcoding strings within test assertions, making the code cleaner and easier to maintain.


Line range hint 21-162: Ensure consistent error handling and cleanup.

The afterEach block is used to clean up after tests by deleting APIs and navigating back to the editor. This is a good practice as it helps maintain a clean state between tests. However, ensure that this cleanup process is robust enough to handle errors that might occur during test execution.


Line range hint 21-162: Avoid potential flakiness in tests.

The tests rely heavily on UI elements and specific messages. Ensure that these elements are always available and that the messages do not change without corresponding updates to the tests. This will help avoid flakiness and ensure that the tests are reliable.

Consider adding checks to ensure that the elements and messages used in the tests are always available and consistent. This can be done by adding more robust error handling and fallback mechanisms in the tests.

@sagar-qa007 sagar-qa007 merged commit 7f55626 into release Sep 6, 2024
48 of 50 checks passed
@sagar-qa007 sagar-qa007 deleted the fix/apivalidatefunction branch September 6, 2024 05:01
Shivam-z pushed a commit to Shivam-z/appsmith that referenced this pull request Sep 26, 2024
## Description
RCA: Toggle button from log tab is not open always. Due to this next
element was not visible.
Fix: Have gone through the test case and found unnecessary steps for
verifying successful log. Update the only required code and fixed the
test case.

Fixes #`36082`  

## Automation

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

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/10714184973>
> Commit: bd850ca
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=10714184973&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Datasource`
> Spec:
> <hr>Thu, 05 Sep 2024 05:42:15 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [x] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

## Summary by CodeRabbit

- **New Features**
- Enhanced API testing capabilities with updated test cases for various
HTTP methods.
	- Introduced new properties for improved API debugging in the UI.
	- Added a method to check the visibility of specific elements in tests.

- **Bug Fixes**
- Improved the `validateRequest` command to handle multiple API log
entries more effectively.

- **Chores**
- Updated the test specifications to focus on server-side API tests,
replacing outdated client-side entries.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working ok-to-test Required label for CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants