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 test for page functionality #38538

Merged
merged 9 commits into from
Jan 18, 2025

Conversation

NandanAnantharamu
Copy link
Collaborator

@NandanAnantharamu NandanAnantharamu commented Jan 8, 2025

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

Tip

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


Mon, 13 Jan 2025 11:37:45 UTC

Summary by CodeRabbit

  • New Features

    • Added comprehensive end-to-end tests for page actions functionality.
    • Introduced new test coverage for page management operations like renaming, cloning, hiding, and setting home pages.
  • Tests

    • Created Cypress tests to verify page actions under different scenarios.
    • Updated test specifications to focus on partial import/export functionality.
  • Improvements

    • Enhanced modal opening methods with dynamic entity name support.
    • Added home icon locator for improved test reliability.

Copy link
Contributor

coderabbitai bot commented Jan 8, 2025

Walkthrough

This pull request introduces a suite of Cypress end-to-end tests aimed at verifying page actions within a web application. The tests encompass various scenarios such as renaming, cloning, hiding pages, setting a page as the home page, and testing partial import/export functionality. The changes also include updates to the modal methods for opening export and import dialogs, allowing for dynamic entity names. Additionally, the test specification file has been modified to focus on these new page action tests.

Changes

File Change Summary
app/client/cypress/e2e/Regression/ClientSide/PartialImportExport/PageActions_spec.ts Added 3 new test cases for page actions:
- Verifying actions when a page is selected
- Checking actions when no page is selected
- Testing actions on home page
app/client/cypress/limited-tests.txt Commented out test specification for visual tests and clarified active test paths
app/client/cypress/support/Pages/PartialImportExport.ts Updated modal methods with dynamic entity name parameters
- Added default parameters for export and import modals
- Removed OpenImportModalWithPage method
app/client/cypress/support/Objects/CommonLocators.ts Added new property _homeIcon for home icon locator

Possibly related PRs

Suggested Labels

Enhancement

Suggested Reviewers

  • ApekshaBhosale
  • sagar-qa007

Poem

🧪 Cypress dances, pages in flight,
Testing actions with pixel-perfect might.
Rename, clone, hide with grace,
Import, export—leave no trace.
Quality code, our testing delight! 🚀


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 350932c and 3de9a64.

📒 Files selected for processing (1)
  • app/client/cypress/limited-tests.txt (0 hunks)
💤 Files with no reviewable changes (1)
  • app/client/cypress/limited-tests.txt
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-build / client-build
  • GitHub Check: client-prettier / prettier-check

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. (Beta)
  • @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-count run_count=1

@github-actions github-actions bot added skip-changelog Adding this label to a PR prevents it from being listed in the changelog Test labels Jan 8, 2025
Copy link

github-actions bot commented Jan 8, 2025

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

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e0e76d6 and a6b9337.

📒 Files selected for processing (3)
  • app/client/cypress/e2e/Regression/ClientSide/PartialImportExport/PageActions_spec.ts (1 hunks)
  • app/client/cypress/limited-tests.txt (1 hunks)
  • app/client/cypress/support/Pages/PartialImportExport.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
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/support/Pages/PartialImportExport.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/PartialImportExport/PageActions_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.
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-build / client-build
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-prettier / prettier-check
🔇 Additional comments (3)
app/client/cypress/support/Pages/PartialImportExport.ts (2)

Line range hint 39-50: LGTM! Method follows Cypress best practices.

The implementation correctly uses data-testid selectors and avoids cy.wait/pause.


52-62: LGTM! Method follows Cypress best practices.

The implementation correctly uses data-testid selectors and avoids cy.wait/pause.

app/client/cypress/limited-tests.txt (1)

2-2: LGTM! Test specification correctly added.

The new test specification is properly formatted and aligns with the PR objective.

partialImportExport.locators.export.modelContents.widgetsSection,
["Text1"],
);
cy.wait(5000);
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Remove hardcoded wait time

Replace cy.wait(5000) with proper assertions or intercepts to make the test more reliable.

Consider using:

-cy.wait(5000);
+agHelper.AssertElementVisibility(locators._successIndicator);

Committable suggestion skipped: line range outside the PR's diff.

partialImportExport.locators.export.modelContents.widgetsSection,
["Text1"],
);
cy.wait(5000);
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Remove hardcoded wait time

Replace cy.wait(5000) with proper assertions or intercepts to make the test more reliable.

Consider using:

-cy.wait(5000);
+agHelper.AssertElementVisibility(locators._successIndicator);

Committable suggestion skipped: line range outside the PR's diff.

Copy link

github-actions bot commented Jan 8, 2025

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12668687355.
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: 54 Total Passed: 3 Total Failed: 0 Total Skipped: 0 *****************************

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit-count run_count=5

@NandanAnantharamu NandanAnantharamu added the ok-to-test Required label for CI label Jan 9, 2025
@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit-count run_count=5

Copy link

github-actions bot commented Jan 9, 2025

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 comments (1)
app/client/cypress/support/Pages/PartialImportExport.ts (1)

Line range hint 1-200: Address Cypress best practices violations

The class contains several Cypress anti-patterns that should be addressed:

  1. Replace xpath selectors with data-testid attributes
  2. Remove cy.wait in favor of route aliases or assertions
  3. Centralize error messages in a constants file

Example improvements:

- cy.xpath(this.homePage._uploadFile)
+ cy.get('[data-testid="upload-file-input"]')

- cy.wait("@partialImportNetworkCall");
+ cy.wait("@partialImportNetworkCall").its('response.statusCode').should('eq', 200);

- "Internal server error while processing request"
+ MESSAGES.INTERNAL_SERVER_ERROR
🧹 Nitpick comments (1)
app/client/cypress/support/Pages/PartialImportExport.ts (1)

39-41: Consider extracting default page name to a constant

The hardcoded "Home" value should be defined as a class constant for better maintainability.

+ private readonly DEFAULT_HOME_PAGE = "Home";
- OpenExportModal(entityName = "Home") {
+ OpenExportModal(entityName = this.DEFAULT_HOME_PAGE) {
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a6b9337 and 7d659ee.

📒 Files selected for processing (1)
  • app/client/cypress/support/Pages/PartialImportExport.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
app/client/cypress/support/Pages/PartialImportExport.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.
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: perform-test / client-build / client-build
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-build / client-build

Comment on lines +52 to +56
OpenImportModal(entityName = "Page1") {
AppSidebar.navigate(AppSidebarButton.Editor);

this.entityExplorer.ActionContextMenuByEntityName({
entityNameinLeftSidebar: "Page1",
entityNameinLeftSidebar: entityName,
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Extract default page name and remove redundant method

Similar to the export modal, the default page name should be a constant. Additionally, the OpenImportModalWithPage method at the bottom of the file is now redundant.

+ private readonly DEFAULT_IMPORT_PAGE = "Page1";
- OpenImportModal(entityName = "Page1") {
+ OpenImportModal(entityName = this.DEFAULT_IMPORT_PAGE) {

Please remove the redundant OpenImportModalWithPage method as its functionality is now covered by OpenImportModal.

Committable suggestion skipped: line range outside the PR's diff.

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

🧹 Nitpick comments (1)
app/client/cypress/e2e/Regression/ClientSide/PartialImportExport/PageActions_spec.ts (1)

17-79: Test structure follows best practices but needs DRY refactoring

The test cases have similar steps that could be extracted into reusable helper functions to reduce code duplication. Consider creating helper functions for common operations like:

  • Page verification steps
  • Export/Import verification steps

Example helper function:

function verifyPageActions(pageName: string) {
  PageList.ClonePage(pageName);
  PageList.HidePage(`${pageName} Copy`);
  PageList.ShowList();
  agHelper.AssertAttribute(
    locators._entityTestId(`${pageName} Copy`),
    "disabled",
    "disabled"
  );
  PageList.DeletePage(`${pageName} Copy`);
  PageList.assertAbsence(`${pageName} Copy`);
}

Also applies to: 81-101, 103-140

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7d659ee and db56bcc.

📒 Files selected for processing (2)
  • app/client/cypress/e2e/Regression/ClientSide/PartialImportExport/PageActions_spec.ts (1 hunks)
  • app/client/cypress/support/Objects/CommonLocators.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
app/client/cypress/support/Objects/CommonLocators.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/PartialImportExport/PageActions_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.
⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: perform-test / client-build / client-build
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: perform-test / server-build / server-unit-tests
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-prettier / prettier-check
  • GitHub Check: client-build / client-build
🔇 Additional comments (4)
app/client/cypress/support/Objects/CommonLocators.ts (1)

355-355: LGTM! Well-defined locator using data-testid

The new locator follows best practices by using data-testid attribute for test selection.

app/client/cypress/e2e/Regression/ClientSide/PartialImportExport/PageActions_spec.ts (3)

1-16: LGTM! Well-organized imports

The imports are properly organized and use named imports for better code organization.


69-69: Remove hardcoded wait time

Replace cy.wait(5000) with proper assertions or intercepts to make the test more reliable.

-cy.wait(5000);
+agHelper.AssertElementVisibility(locators._successIndicator);

130-130: Remove hardcoded wait time

Replace cy.wait(5000) with proper assertions or intercepts to make the test more reliable.

-cy.wait(5000);
+agHelper.AssertElementVisibility(locators._successIndicator);

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit-count run_count=5

@NandanAnantharamu NandanAnantharamu removed the ok-to-test Required label for CI label Jan 9, 2025
Copy link

github-actions bot commented Jan 9, 2025

@NandanAnantharamu NandanAnantharamu added the ok-to-test Required label for CI label Jan 9, 2025
Copy link

github-actions bot commented Jan 9, 2025

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12694533445.
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: 270 Total Passed: 15 Total Failed: 0 Total Skipped: 0 *****************************

Copy link

github-actions bot commented Jan 9, 2025

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12695142338.
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: 270 Total Passed: 15 Total Failed: 0 Total Skipped: 0 *****************************

@NandanAnantharamu NandanAnantharamu removed the ok-to-test Required label for CI label Jan 10, 2025
@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit-count run_count=5

Copy link

Copy link

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12703244768.
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: 15 Total Passed: 15 Total Failed: 0 Total Skipped: 0 *****************************

partialImportExport.locators.export.modelContents.widgetsSection,
["Text1"],
);
cy.wait(5000);
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 try to remove this sleep? or add proper reason behind this sleep?

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit-count run_count=5

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: 2

🧹 Nitpick comments (2)
app/client/cypress/e2e/Regression/ClientSide/PartialImportExport/PageActions_spec.ts (2)

64-68: Remove magic number and improve export parameters

The number 4 is used without context. Consider using a named constant or configuration value.

-    partialImportExport.PartiallyExportFile(
-      4,
-      partialImportExport.locators.export.modelContents.widgetsSection,
-      ["Text1"],
-    );
+    const WIDGET_EXPORT_CONFIG = {
+      version: 4,
+      section: partialImportExport.locators.export.modelContents.widgetsSection,
+      widgets: ["Text1"],
+    };
+    partialImportExport.PartiallyExportFile(
+      WIDGET_EXPORT_CONFIG.version,
+      WIDGET_EXPORT_CONFIG.section,
+      WIDGET_EXPORT_CONFIG.widgets,
+    );

80-100: Add error handling for page navigation

Consider adding error handling for page navigation failures and assertions.

-    EditorNavigation.NavigateToPage("Page1", true);
+    cy.intercept('GET', '**/page/*').as('pageLoad');
+    EditorNavigation.NavigateToPage("Page1", true);
+    cy.wait('@pageLoad').then((interception) => {
+      expect(interception.response.statusCode).to.eq(200);
+    });
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 669a866 and 8a17ba3.

📒 Files selected for processing (1)
  • app/client/cypress/e2e/Regression/ClientSide/PartialImportExport/PageActions_spec.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
app/client/cypress/e2e/Regression/ClientSide/PartialImportExport/PageActions_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.
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-build / client-build
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-prettier / prettier-check
🔇 Additional comments (2)
app/client/cypress/e2e/Regression/ClientSide/PartialImportExport/PageActions_spec.ts (2)

1-16: Clean imports structure!

The imports are well-organized and follow consistent patterns.


103-103: Duplicate coordinate issue

Same issue with hardcoded coordinates as in test case 1.

it("1. Verify Page Actions when a page is selected", function () {
homePage.RenameApplication("PageActions");
PageList.AddNewPage("New blank page");
entityExplorer.DragDropWidgetNVerify(draggableWidgets.TEXT, 500, 100);
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Avoid using hardcoded coordinates for widget placement

Using fixed coordinates (500, 100) makes the test brittle and susceptible to viewport size changes.

-entityExplorer.DragDropWidgetNVerify(draggableWidgets.TEXT, 500, 100);
+entityExplorer.DragDropWidgetNVerify(draggableWidgets.TEXT);

Committable suggestion skipped: line range outside the PR's diff.

Comment on lines +123 to +137
partialImportExport.OpenExportModal("HomePage");
partialImportExport.PartiallyExportFile(
4,
partialImportExport.locators.export.modelContents.widgetsSection,
["Text1"],
);

//Import the exported App
partialImportExport.OpenImportModal("HomePage");
partialImportExport.ImportPartiallyExportedFile(
"PageActions.json",
"Widgets",
["Text1"],
"downloads",
);
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Extract export/import logic to reusable helper

The export/import logic is duplicated from test case 1. Consider extracting it to a reusable helper function.

+const performWidgetExportImport = (pageName: string, widgetNames: string[]) => {
+  partialImportExport.OpenExportModal(pageName);
+  partialImportExport.PartiallyExportFile(
+    4,
+    partialImportExport.locators.export.modelContents.widgetsSection,
+    widgetNames,
+  );
+
+  partialImportExport.OpenImportModal(pageName);
+  partialImportExport.ImportPartiallyExportedFile(
+    "PageActions.json",
+    "Widgets",
+    widgetNames,
+    "downloads",
+  );
+};
+
-    partialImportExport.OpenExportModal("HomePage");
-    partialImportExport.PartiallyExportFile(
-      4,
-      partialImportExport.locators.export.modelContents.widgetsSection,
-      ["Text1"],
-    );
-
-    //Import the exported App
-    partialImportExport.OpenImportModal("HomePage");
-    partialImportExport.ImportPartiallyExportedFile(
-      "PageActions.json",
-      "Widgets",
-      ["Text1"],
-      "downloads",
-    );
+    performWidgetExportImport("HomePage", ["Text1"]);
📝 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. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
partialImportExport.OpenExportModal("HomePage");
partialImportExport.PartiallyExportFile(
4,
partialImportExport.locators.export.modelContents.widgetsSection,
["Text1"],
);
//Import the exported App
partialImportExport.OpenImportModal("HomePage");
partialImportExport.ImportPartiallyExportedFile(
"PageActions.json",
"Widgets",
["Text1"],
"downloads",
);
const performWidgetExportImport = (pageName: string, widgetNames: string[]) => {
partialImportExport.OpenExportModal(pageName);
partialImportExport.PartiallyExportFile(
4,
partialImportExport.locators.export.modelContents.widgetsSection,
widgetNames,
);
partialImportExport.OpenImportModal(pageName);
partialImportExport.ImportPartiallyExportedFile(
"PageActions.json",
"Widgets",
widgetNames,
"downloads",
);
};
performWidgetExportImport("HomePage", ["Text1"]);

Copy link

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12710653022.
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: 15 Total Passed: 15 Total Failed: 0 Total Skipped: 0 *****************************

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit-count run_count=5

Copy link

Copy link

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12732016623.
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: 15 Total Passed: 15 Total Failed: 0 Total Skipped: 0 *****************************

@NandanAnantharamu NandanAnantharamu added the ok-to-test Required label for CI label Jan 13, 2025
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 comments (1)
app/client/cypress/limited-tests.txt (1)

Line range hint 1-6: Update test specification to match PR objectives

The current configuration runs Anvil/Widgets tests, but based on the PR objectives, we should be running the page functionality tests.

Apply this change to run the correct test file:

# To run only limited tests - give the spec names in below format:
#cypress/e2e/Regression/ClientSide/VisualTests/JSEditorIndent_spec.js
# For running all specs - uncomment below:
#cypress/e2e/**/**/*
-cypress/e2e/Regression/ClientSide/Anvil/Widgets/*
+cypress/e2e/Regression/ClientSide/PartialImportExport/PageActions_spec.ts
🧰 Tools
🪛 LanguageTool

[uncategorized] ~7-~7: You might be missing the article “the” here.
Context: ...ile to run minimum of specs. Do not run entire suite with this command.

(AI_EN_LECTOR_MISSING_DETERMINER_THE)

🧹 Nitpick comments (1)
app/client/cypress/limited-tests.txt (1)

7-7: Fix grammar in the comment

Add the missing article "the" before "minimum".

-#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 entire suite with this command.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~7-~7: You might be missing the article “the” here.
Context: ...ile to run minimum of specs. Do not run entire suite with this command.

(AI_EN_LECTOR_MISSING_DETERMINER_THE)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8a17ba3 and 350932c.

📒 Files selected for processing (1)
  • app/client/cypress/limited-tests.txt (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
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.
🪛 LanguageTool
app/client/cypress/limited-tests.txt

[uncategorized] ~7-~7: You might be missing the article “the” here.
Context: ...ile to run minimum of specs. Do not run entire suite with this command.

(AI_EN_LECTOR_MISSING_DETERMINER_THE)

⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: perform-test / server-build / server-unit-tests
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-prettier / prettier-check
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-build / client-build

@NandanAnantharamu NandanAnantharamu added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Jan 13, 2025
@NandanAnantharamu NandanAnantharamu merged commit fd72197 into release Jan 18, 2025
50 of 57 checks passed
@NandanAnantharamu NandanAnantharamu deleted the test/PageFunctionalityReg branch January 18, 2025 14:56
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