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

test: adding tests for custom lib #37901

Merged
merged 10 commits into from
Dec 11, 2024
Merged

Conversation

NandanAnantharamu
Copy link
Collaborator

@NandanAnantharamu NandanAnantharamu commented Dec 2, 2024

Adding tests for custom library

https://docs.google.com/spreadsheets/d/1Vq5vRUyAMv2npPv4j41omzZrYcRUb8LEOhNVu_O4OE8/edit?gid=1961024675#gid=1961024675

EE PR: https://github.com/appsmithorg/appsmith-ee/pull/5703

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

Tip

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


Tue, 10 Dec 2024 17:30:21 UTC

Summary by CodeRabbit

  • New Features

    • Introduced a comprehensive suite of end-to-end tests for managing JavaScript libraries, covering functionalities such as installation, usage, error handling, and cleanup.
  • Bug Fixes

    • Enhanced error handling for incompatible library URLs and ensured proper behavior upon library uninstallation and reinstallation.
  • Chores

    • Updated test execution configurations to reference the new TypeScript test specification file.

Copy link
Contributor

coderabbitai bot commented Dec 2, 2024

Walkthrough

The changes in this pull request enhance the testing framework for managing JavaScript libraries using Cypress. A new test suite in Custom_lib_spec.ts introduces multiple end-to-end tests that cover library installation, usage, error handling, and cleanup. Additionally, the test execution configuration in limited-tests.txt is updated to reference the new TypeScript test file, replacing an older JavaScript test specification.

Changes

File Path Change Summary
app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Custom_lib_spec.ts Added a comprehensive suite of end-to-end tests for managing JavaScript libraries, covering installation, usage, and error handling.
app/client/cypress/limited-tests.txt Updated the test specification reference from Fork_Template_spec.js to Custom_lib_spec.ts.

Possibly related PRs

Suggested labels

ok-to-test

Suggested reviewers

  • ApekshaBhosale
  • sagar-qa007

🎉 In the realm of code where tests do dwell,
New libraries thrive, and all works well.
With Cypress in hand, we check and we play,
Ensuring our scripts don’t lead us astray.
From moment to jspdf, we’ve covered it all,
In this dance of code, we stand proud and tall! 🌟


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 5b6e15e and 4f7f3d5.

📒 Files selected for processing (1)
  • app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Custom_lib_spec.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Custom_lib_spec.ts

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 generate docstrings to generate docstrings for this PR. (Experiment)
  • @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.

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit

@github-actions github-actions bot added skip-changelog Adding this label to a PR prevents it from being listed in the changelog Test labels Dec 2, 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 (3)
app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Custom_lib_spec.ts (3)

53-58: Remove commented-out code to maintain code cleanliness

There are blocks of commented-out code in your test cases. Consider removing them if they're no longer needed to keep the codebase clean and maintainable.

Also applies to: 104-109


118-118: Avoid using strings for assertions

Using string literals in assertions can be brittle. Consider using more robust methods provided by your testing framework to validate error messages.


102-102: Enhance download verification without relying on file names

Relying on exact file names for download verification can lead to flaky tests if the file names change. Consider verifying the download by checking the file content or existence instead.

Also applies to: 126-126

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between b5d52e7 and 3e594bc.

📒 Files selected for processing (2)
  • app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Custom_lib_spec.ts (1 hunks)
  • app/client/cypress/limited-tests.txt (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
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/e2e/Regression/ClientSide/JSLibrary/Custom_lib_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.
🔇 Additional comments (1)
app/client/cypress/limited-tests.txt (1)

2-2: LGTM

The test specification file has been correctly updated to include Custom_lib_spec.ts for limited tests.

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit-count run_count=02

Copy link

github-actions bot commented Dec 3, 2024

Copy link

github-actions bot commented Dec 3, 2024

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12132433060.
Cypress dashboard: Click here!
The following are new failures, please fix them before merging the PR:
To know the list of identified flaky tests - Refer here

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

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit-count run_count=25

Copy link

github-actions bot commented Dec 3, 2024

Copy link

github-actions bot commented Dec 3, 2024

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12138513675.
Cypress dashboard: Click here!
The following are new failures, please fix them before merging the PR:
To know the list of identified flaky tests - Refer here

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

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit-count run_count=1

Copy link

github-actions bot commented Dec 7, 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 (3)
app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Library_Test_Git_spec.ts (3)

65-65: Specify the library name in the test description

In the test description at line 65, "Verify install/uninstall of Library", consider specifying the library name (e.g., "Verify install/uninstall of Swiper library") for clarity and better readability.


68-71: Avoid hardcoding library URLs and versions

In lines 68-71, the Swiper library is installed via a hardcoded URL with a specific version. Consider using configuration variables or constants for the library URL and version to facilitate easier updates and maintenance.


78-114: Refactor duplicate test code into reusable functions

The test cases in it("3. Verify jspdf library", ...) (lines 78-114) and it("4. Verify deleting jspdf library deletes all its references as well", ...) (lines 116-145) contain duplicate code for installing the jspdf library, configuring the button click handler, and verifying PDF downloads. Consider refactoring this code into reusable helper functions to improve maintainability and reduce duplication.

Also applies to: 116-145

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 353d924 and 1e5d612.

📒 Files selected for processing (2)
  • app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Library_Test_Git_spec.ts (1 hunks)
  • app/client/cypress/limited-tests.txt (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/client/cypress/limited-tests.txt
🧰 Additional context used
📓 Path-based instructions (1)
app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Library_Test_Git_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.
🔇 Additional comments (2)
app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Library_Test_Git_spec.ts (2)

84-86: Verify the availability of doc.table method in jspdf

Ensure that the doc.table method used in line 86 is available in the jspdf library version you're using. The table method may require an additional plugin or may not be part of the core library.


84-84: Verify the initialization of jsPDF

In line 84, const doc = new jspdf.jsPDF();, ensure that jspdf.jsPDF() is the correct way to initialize the jsPDF object for the version of the library you're using. Depending on the import and version, it might be new jsPDF() or new jspdf().

Copy link

github-actions bot commented Dec 7, 2024

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

***** Repeat Run Summary ***** Total Tests with repeat: 10 Total Passed: 6 Total Failed: 3 Total Skipped: 0 *****************************

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit-count run_count=1

Copy link

github-actions bot commented Dec 9, 2024

Copy link

github-actions bot commented Dec 9, 2024

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

***** Repeat Run Summary ***** Total Tests with repeat: 10 Total Passed: 5 Total Failed: 4 Total Skipped: 0 *****************************

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit-count run_count=1

Copy link

github-actions bot commented Dec 9, 2024

Copy link

github-actions bot commented Dec 9, 2024

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

***** Repeat Run Summary ***** Total Tests with repeat: 10 Total Passed: 5 Total Failed: 4 Total Skipped: 0 *****************************

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit-count run_count=1

Copy link

github-actions bot commented Dec 9, 2024

Copy link

github-actions bot commented Dec 9, 2024

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12241742459.
Cypress dashboard: Click here!
The following are new failures, please fix them before merging the PR:
To know the list of identified flaky tests - Refer here

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

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit-count run_count=25

Copy link

github-actions bot commented Dec 9, 2024

Copy link

github-actions bot commented Dec 9, 2024

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12242146502.
Cypress dashboard: Click here!
The following are new failures, please fix them before merging the PR:
To know the list of identified flaky tests - Refer here

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

@NandanAnantharamu NandanAnantharamu added the ok-to-test Required label for CI label Dec 10, 2024
@NandanAnantharamu NandanAnantharamu added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Dec 10, 2024
@NandanAnantharamu NandanAnantharamu merged commit a430454 into release Dec 11, 2024
67 of 69 checks passed
@NandanAnantharamu NandanAnantharamu deleted the test/customLibNewtests branch December 11, 2024 05:26
github-actions bot pushed a commit to Zeral-Zhang/appsmith that referenced this pull request Dec 12, 2024
Adding tests for custom library



https://docs.google.com/spreadsheets/d/1Vq5vRUyAMv2npPv4j41omzZrYcRUb8LEOhNVu_O4OE8/edit?gid=1961024675#gid=1961024675

EE PR: appsmithorg/appsmith-ee#5703

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



<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/12260773766>
> Commit: 3423a83
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12260773766&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Sanity`
> Spec:
> <hr>Tue, 10 Dec 2024 17:30:21 UTC
<!-- end of auto-generated comment: Cypress test results  -->


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

- **New Features**
- Introduced a comprehensive suite of end-to-end tests for managing
JavaScript libraries, covering functionalities such as installation,
usage, error handling, and cleanup.

- **Bug Fixes**
- Enhanced error handling for incompatible library URLs and ensured
proper behavior upon library uninstallation and reinstallation.

- **Chores**
- Updated test execution configurations to reference the new TypeScript
test specification file.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: “NandanAnantharamu” <“nandan@thinkify.io”>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ok-to-test Required label for CI skip-changelog Adding this label to a PR prevents it from being listed in the changelog Test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants