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: regression tests for import flow #38457

Open
wants to merge 8 commits into
base: release
Choose a base branch
from

Conversation

NandanAnantharamu
Copy link
Collaborator

@NandanAnantharamu NandanAnantharamu commented Jan 2, 2025

Added test for import app validation at app level

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

Tip

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


Wed, 08 Jan 2025 04:28:32 UTC

Summary by CodeRabbit

  • Tests

    • Added a new test suite to verify import functionality for applications
    • Implemented test case to check import options and data source validation at the app level
  • New Features

    • Added new locators for import button and list item title to support testing

Copy link
Contributor

coderabbitai bot commented Jan 2, 2025

Walkthrough

This pull request introduces enhancements to the Cypress testing framework for verifying application import functionality. The changes include adding a new test suite in the VerifyImport_spec.ts file to test import options at the app level, creating a new locator for the import button in AppSettings.ts, and adding a list item title locator in CommonLocators.ts. The modifications aim to improve test coverage for application import processes.

Changes

File Change Summary
app/client/cypress/e2e/Regression/ClientSide/PartialImportExport/VerifyImport_spec.ts Added new test suite and test case for verifying import functionality at the app level
app/client/cypress/support/Pages/AppSettings/AppSettings.ts Added new locator _importBtn for import button
app/client/cypress/support/Objects/CommonLocators.ts Added new property _listItemTitle for list item title selector

Possibly related PRs

Suggested labels

Task

Suggested reviewers

  • ApekshaBhosale
  • sagar-qa007

Poem

🧪 Import magic, tests take flight
Cypress clicks with pixel-perfect might
Buttons dance, locators sing
Quality code on testing's wing! 🚀


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.

@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 2, 2025
@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit-count run_count=1

Copy link

github-actions bot commented Jan 3, 2025

Copy link

github-actions bot commented Jan 3, 2025

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

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit-count run_count=1

Copy link

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

🧹 Nitpick comments (1)
app/client/cypress/support/Objects/CommonLocators.ts (1)

352-352: Use data- attribute for better locator stability.*

Currently, the locator relies on a CSS class, which could change over time and break the test. Consider adding or using a relevant data-* attribute in the DOM for more robust test selectors.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3760bbd and c7fc1f2.

📒 Files selected for processing (2)
  • app/client/cypress/support/Objects/CommonLocators.ts (1 hunks)
  • app/client/cypress/support/Pages/AppSettings/AppSettings.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/support/Pages/AppSettings/AppSettings.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 (1.9.4)
app/client/cypress/support/Pages/AppSettings/AppSettings.ts

[error] 64-64: Did you mean to use a :? An = can only follow a property name when the containing object literal is part of a destructuring pattern.

(parse)

🔇 Additional comments (1)
app/client/cypress/support/Pages/AppSettings/AppSettings.ts (1)

63-63: Good use of a data-testid attribute.

This is aligned with best practices for stable selectors.

@@ -60,6 +60,8 @@ export class AppSettings {
_scrollArrows: ".scroll-arrows",
_getActivePage: (pageName: string) =>
`//span[contains(text(),"${pageName}")]//ancestor::a[contains(@class,'is-active')]`,
_importBtn: "[data-testid='t--app-setting-import-btn']",
_listItemTitle = ".ads-v2-listitem__title",
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

Fix the syntax error in the object literal.

Use a colon (:) instead of an equals sign, otherwise it will not parse correctly as an object property. Also, consider adding or using a data-* attribute for greater stability instead of targeting a CSS class selector.

Apply this diff to fix the syntax error:

- _listItemTitle = ".ads-v2-listitem__title",
+ _listItemTitle: ".ads-v2-listitem__title",

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

🧰 Tools
🪛 Biome (1.9.4)

[error] 64-64: Did you mean to use a :? An = can only follow a property name when the containing object literal is part of a destructuring pattern.

(parse)

Copy link

github-actions bot commented Jan 4, 2025

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

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

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit-count run_count=15

Copy link

github-actions bot commented Jan 5, 2025

Copy link

github-actions bot commented Jan 5, 2025

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

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

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit-count run_count=15

Copy link

github-actions bot commented Jan 6, 2025

Copy link

github-actions bot commented Jan 6, 2025

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12633395161.
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 7, 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

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

20-42: Move datasource array to a constants file.

The large array of datasource names should be moved to a separate constants file for better maintainability and reusability.


19-64: Split the test case into smaller, focused scenarios.

The current test case covers multiple scenarios:

  1. Import button state verification
  2. Application creation and navigation
  3. Import functionality
  4. Datasource verification

Consider splitting these into separate test cases for better maintainability and clearer failure isolation.

Example structure:

it("should have import button disabled for connected git apps", () => {
  // First scenario
});

it("should have import button enabled for new apps", () => {
  // Second scenario
});

it("should successfully import an application", () => {
  // Third scenario
});

it("should verify all datasources after import", () => {
  // Fourth scenario
});
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3aad8e2 and 1ac6a57.

📒 Files selected for processing (2)
  • app/client/cypress/e2e/Regression/ClientSide/PartialImportExport/VerifyImport_spec.ts (1 hunks)
  • app/client/cypress/support/Objects/CommonLocators.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/client/cypress/support/Objects/CommonLocators.ts
🧰 Additional context used
📓 Path-based instructions (1)
app/client/cypress/e2e/Regression/ClientSide/PartialImportExport/VerifyImport_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 (5)
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: client-prettier / prettier-check
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-build / client-build
🔇 Additional comments (2)
app/client/cypress/e2e/Regression/ClientSide/PartialImportExport/VerifyImport_spec.ts (2)

1-13: LGTM! Imports are well-organized.

The imports are properly structured and all imported modules are utilized in the test implementation.


14-18: Verify Git setup requirements.

The Git setup in the before hook looks good, but please verify if this is a mandatory prerequisite for import functionality testing.

Comment on lines +44 to +45
agHelper.GetNClick(appSettings.locators._importHeader);
agHelper.AssertElementEnabledDisabled(appSettings.locators._importBtn);
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

Replace agHelper.GetNClick with direct Cypress commands.

According to the guidelines, we should avoid using cy.wait. Since agHelper.GetNClick likely uses cy.wait internally, consider using direct Cypress commands with proper assertions:

-    agHelper.GetNClick(appSettings.locators._importHeader);
-    agHelper.AssertElementEnabledDisabled(appSettings.locators._importBtn);
+    cy.get(appSettings.locators._importHeader)
+      .should('be.visible')
+      .click();
+    cy.get(appSettings.locators._importBtn)
+      .should('be.enabled');

Also applies to: 50-51, 56-58

@NandanAnantharamu NandanAnantharamu removed the ok-to-test Required label for CI label Jan 8, 2025
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.

2 participants