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: PartialExport_Widgets_spec - updated test validation logic #33371

Merged
merged 16 commits into from
May 21, 2024

Conversation

NandanAnantharamu
Copy link
Collaborator

@NandanAnantharamu NandanAnantharamu commented May 13, 2024

Spec - cypress/e2e/Regression/ClientSide/PartialImportExport/PartialExport_Widgets_spec.ts

RCA:
Comparison of this file post export is failing this file needed change.
closeModal('Insert_Modal')) is changed to closeModal(Insert_Modal.name)) and
showModal('Delete_Modal')) to showModal(Delete_Modal.name))

Solution:
To overcome this issue of frequent updation of file we have come up with a solution to validate the partial import post export in a different way.

  1. We are creating a separate page and importing the partially exported file
  2. We are doing widget validation based on the selection we did during our export
  3. We are checking the properties of the widgets in the process in the new page

@github-actions github-actions bot added skip-changelog Adding this label to a PR prevents it from being listed in the changelog Test labels May 13, 2024
@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit

Copy link

Copy link
Contributor

coderabbitai bot commented May 13, 2024

Walkthrough

Walkthrough

The recent changes focus on enhancing the Cypress test suite for partial import and export of widgets. Key updates include adding helper functions for widget property validation, renaming test cases, and updating import/export functionalities. Additionally, new imports and methods have been introduced to streamline the testing process, ensuring more robust validations and efficient test case management.

Changes

File Path Change Summary
.../PartialExport_Widgets_spec.ts Added imports for agHelper and PageList, renamed test case, modified export/import functions, added widget property validations, and updated spec file paths.
.../AggregateHelper.ts Added imports for EditorNavigator and EntityType, introduced SelectAndValidateParams interface, and added selectAndValidateWidgetNameAndProperty method to AggregateHelper class.

Recent Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 19dadff and 4615121.
Files selected for processing (2)
  • app/client/cypress/limited-tests.txt (1 hunks)
  • app/client/cypress/support/Pages/AggregateHelper.ts (3 hunks)
Files skipped from review due to trivial changes (1)
  • app/client/cypress/support/Pages/AggregateHelper.ts
Additional Context Used
LanguageTool (1)
app/client/cypress/limited-tests.txt (1)

Near line 8: You might be missing the article “the” here.
Context: ...ile to run minimum of specs. Do not run entire suite with this command.

Additional comments not posted (1)
app/client/cypress/limited-tests.txt (1)

1-1: Consider revising the sentence for grammatical accuracy.

- # To run only limited tests - give the spec names in below format:
+ # To run only limited tests - give the spec names in the format below:

Likely invalid or redundant comment.


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>.
    • 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.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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

Copy link

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

@@ -1,5 +1,5 @@
# To run only limited tests - give the spec names in below format:
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider revising the sentence for grammatical accuracy.

- # To run only limited tests - give the spec names in below format:
+ # To run only limited tests - give the spec names in the format below:

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
# To run only limited tests - give the spec names in below format:
# To run only limited tests - give the spec names in the format below:

Copy link

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

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit runId=9058124081

13 similar comments
@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit runId=9058124081

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit runId=9058124081

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit runId=9058124081

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit runId=9058124081

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit runId=9058124081

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit runId=9058124081

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit runId=9058124081

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit runId=9058124081

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit runId=9058124081

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit runId=9058124081

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit runId=9058124081

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit runId=9058124081

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit runId=9058124081

Copy link

Copy link

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit runId=9058124081

1 similar comment
@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit runId=9058124081

Copy link

);
this.agHelper.GetNClick(this.locators.export.modelContents.exportButton);
this.agHelper.FailIfErrorToast(
"Error exporting application. Please try again.",
Copy link
Contributor

Choose a reason for hiding this comment

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

can we move this to messages file please? @NandanAnantharamu

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor

Choose a reason for hiding this comment

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

why do we need this file now? @NandanAnantharamu

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this file is used in another test as well , i updated with latest json file after exporting the partial app.

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit

Copy link

Copy link

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

ApekshaBhosale
ApekshaBhosale previously approved these changes May 21, 2024
ApekshaBhosale
ApekshaBhosale previously approved these changes May 21, 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 (2)
app/client/src/sagas/PartialImportExportSagas/PartialExportSagas.ts (2)

Line range hint 25-82: Consider refactoring the download functionality into a separate function for better testability and maintainability.

- (function downloadJSON(response: unknown) {
-   const dataStr =
-     "data:text/json;charset=utf-8," +
-     encodeURIComponent(JSON.stringify(response));
-   const downloadAnchorNode = document.createElement("a");
-   downloadAnchorNode.setAttribute("href", dataStr);
-   downloadAnchorNode.setAttribute("download", `${application.name}.json`);
-   document.body.appendChild(downloadAnchorNode); // required for firefox
-   downloadAnchorNode.click();
-   downloadAnchorNode.remove();
- })((response as { data: unknown }).data);
+ const downloadJSON = (response: unknown, applicationName: string) => {
+   const dataStr =
+     "data:text/json;charset=utf-8," +
+     encodeURIComponent(JSON.stringify(response));
+   const downloadAnchorNode = document.createElement("a");
+   downloadAnchorNode.setAttribute("href", dataStr);
+   downloadAnchorNode.setAttribute("download", `${applicationName}.json`);
+   document.body.appendChild(downloadAnchorNode); // required for firefox
+   downloadAnchorNode.click();
+   downloadAnchorNode.remove();
+ };
+ downloadJSON((response as { data: unknown }).data, application.name);

Line range hint 82-125: Consider adding user feedback for cases where no widgets are selected.

- if (!selectedWidgets || !selectedWidgets.length) return;
+ if (!selectedWidgets || !selectedWidgets.length) {
+   toast.show(createMessage(ERROR_NO_WIDGETS_SELECTED), {
+     kind: "warning",
+   });
+   return;
+ }

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit

Copy link

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/limited-tests.txt (1)

Line range hint 8-8: Consider adding the article "the" for grammatical correctness.

- #ci-test-limit uses this file to run minimum of specs. Do not run entire suite with this command.
+ #ci-test-limit uses this file to run the minimum of specs. Do not run the entire suite with this command.

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit

Copy link

Copy link

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

@trishaanand trishaanand merged commit 8682dd2 into release May 21, 2024
13 checks passed
@trishaanand trishaanand deleted the test/fixPartialExport branch May 21, 2024 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

None yet

3 participants