-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
base: release
Are you sure you want to change the base?
Conversation
WalkthroughThis pull request introduces enhancements to the Cypress testing framework for verifying application import functionality. The changes include adding a new test suite in the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
Documentation and Community
|
/ci-test-limit-count run_count=1 |
Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/12592119039. |
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12592119039.
|
/ci-test-limit-count run_count=1 |
Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/12609690016. |
There was a problem hiding this 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
📒 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", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12609690016.
|
/ci-test-limit-count run_count=15 |
Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/12618072741. |
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12618072741.
|
/ci-test-limit-count run_count=15 |
Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/12633395161. |
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12633395161.
|
There was a problem hiding this 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:
- Import button state verification
- Application creation and navigation
- Import functionality
- 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
📒 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.
agHelper.GetNClick(appSettings.locators._importHeader); | ||
agHelper.AssertElementEnabledDisabled(appSettings.locators._importBtn); |
There was a problem hiding this comment.
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
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
New Features