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: fix tabs skipped test CE #37023

Merged
merged 4 commits into from
Oct 25, 2024
Merged

test: fix tabs skipped test CE #37023

merged 4 commits into from
Oct 25, 2024

Conversation

NandanAnantharamu
Copy link
Collaborator

@NandanAnantharamu NandanAnantharamu commented Oct 23, 2024

NandanAnantharamu
NandanAnantharamu commented 1 hour ago
Skipped test in Tab spec is fixed.
There was change in one of the validation step
/ok-to-test tags="@tag.Sanity"

Tip

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


Thu, 24 Oct 2024 17:52:38 UTC

Summary by CodeRabbit

  • Bug Fixes

    • Re-enabled test case for verifying colors, borders, and shadows of the Tabs widget.
    • Updated border color assertion to dynamically check the widget's border color.
  • Improvements

    • Enhanced verification of property visibility and functionality for the Tabs widget, including tab renaming, deletion, and binding with text widgets.
    • Validated behavior when toggling the "Show Tabs" property and ensured appropriate error handling for invalid default tabs.
  • Chores

    • Updated the test file reference in the limited-tests configuration to focus on the Tabs widget.
    • Introduced new selectors for improved interaction with widget properties.

Copy link
Contributor

coderabbitai bot commented Oct 23, 2024

Walkthrough

The pull request introduces modifications to the test suite for the Tabs widget, re-enabling a previously skipped test case that verifies colors, borders, and shadows. The assertion for border color has been updated to a new expected value. The tests now include checks for property visibility, tab management (renaming, duplication, deletion), and behavior when toggling the "Show Tabs" property. Additionally, error handling for invalid default tabs is validated. Changes also include updating the test file path in the limited tests configuration.

Changes

File Path Change Summary
app/client/cypress/e2e/Regression/ClientSide/Widgets/Tab/Tabs_2_spec.ts Re-enabled test for colors, updated border color assertion, and added various property checks and error handling.
app/client/cypress/limited-tests.txt Updated test file path from Fork_Template_spec.js to Tabs_2_spec.ts for limited tests.
app/client/cypress/support/Objects/CommonLocators.ts Added new property _widgetBorder to target draggable tab widget borders.
app/client/cypress/support/Pages/PropertyPane.ts Introduced new private property _borderColorCursor for border color control element.

Suggested labels

Bug, Widgets Product, Widgets & Accelerators Pod

Suggested reviewers

  • ApekshaBhosale
  • sagar-qa007

🎉 In the land of code where the widgets play,
Tests were updated, come join the fray!
Borders and colors, now shining bright,
Tabs come alive, what a wonderful sight!
With errors caught, and properties checked,
Our testing suite's now truly perfect! 🌟


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 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=25

@NandanAnantharamu NandanAnantharamu added the ok-to-test Required label for CI label Oct 23, 2024
@github-actions github-actions bot added skip-changelog Adding this label to a PR prevents it from being listed in the changelog Test labels Oct 23, 2024
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 (2)
app/client/cypress/e2e/Regression/ClientSide/Widgets/Tab/Tabs_2_spec.ts (2)

191-191: Consider removing hardcoded test number from the title.

Remove the number "7" from the test title to make it more maintainable. Test numbers can change as new tests are added or removed.

-    it("7. Verify colors, borders and shadows", () => {
+    it("Verify colors, borders and shadows", () => {

Line range hint 73-74: Replace agHelper.Sleep() calls with proper Cypress commands.

According to the coding guidelines, we should avoid using agHelper.Sleep(). Instead, use Cypress's built-in commands like cy.wait('@apiCall') for network requests or cy.should() for assertions.

Example refactor:

- agHelper.Sleep(500);
+ cy.get('element').should('exist');  // Wait for element to exist
- agHelper.Sleep(1000);
+ cy.get('element').should('be.visible');  // Wait for element to be visible

Also applies to: 266-266, 276-276, 282-282

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 203b322 and 2b2effc.

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

2-2: LGTM! Verify Template test coverage.

The change aligns with the PR objective to fix the skipped Tab test.

Let's verify that the Template tests are covered elsewhere:

app/client/cypress/e2e/Regression/ClientSide/Widgets/Tab/Tabs_2_spec.ts (1)

Line range hint 191-225: LGTM! Test case successfully re-enabled and follows best practices.

The test case for verifying colors, borders, and shadows has been properly re-enabled and follows Cypress best practices:

  • Uses proper assertions for color verification
  • Avoids cy.wait/pause
  • Uses appropriate selectors

Copy link

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

***** Repeat Run Summary ***** Total Tests with repeat: 200 Total Passed: 175 Total Failed: 25 Total Skipped: 0 *****************************

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit-count run_count=25

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

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 2b2effc and ac79d18.

📒 Files selected for processing (3)
  • app/client/cypress/e2e/Regression/ClientSide/Widgets/Tab/Tabs_2_spec.ts (2 hunks)
  • app/client/cypress/support/Objects/CommonLocators.ts (1 hunks)
  • app/client/cypress/support/Pages/PropertyPane.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/client/cypress/e2e/Regression/ClientSide/Widgets/Tab/Tabs_2_spec.ts
🧰 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/PropertyPane.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/support/Pages/PropertyPane.ts (1)

180-180: LGTM! The selector follows existing patterns.

The new property _borderColorCursor follows the established naming conventions and selector patterns used throughout the file.

@@ -341,4 +341,5 @@ export class CommonLocators {
_saveDatasource = `[data-testid='t--store-as-datasource']`;
_propertyCollapseBody = ".bp3-collapse-body";
_propertyCollapse = ".bp3-collapse";
_widgetBorder = ".t--draggable-tabswidget div div div";
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

Use data- attribute selector instead of CSS path*

The current selector .t--draggable-tabswidget div div div is fragile and depends on DOM structure. Consider:

  1. Using a data-* attribute for better resilience
  2. Making the property name more specific to tabs widget

Apply this diff:

-  _widgetBorder = ".t--draggable-tabswidget div div div";
+  _tabsWidgetBorder = "[data-testid='t--tabs-widget-border']";

Then add the corresponding data-testid attribute to the tabs widget border element.

Committable suggestion was skipped due to low confidence.

Copy link

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

@NandanAnantharamu NandanAnantharamu merged commit 602fe2b into release Oct 25, 2024
43 checks passed
@NandanAnantharamu NandanAnantharamu deleted the test/fixTabsCE branch October 25, 2024 15:52
github-actions bot pushed a commit to Zeral-Zhang/appsmith that referenced this pull request Nov 20, 2024
[NandanAnantharamu](https://github.com/NandanAnantharamu)
NandanAnantharamu commented [1 hour
ago](appsmithorg/appsmith-ee#5425 (comment))
•
Skipped test in Tab spec is fixed.
There was change in one of the validation step
/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/11504174102>
> Commit: 6b0e607
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11504174102&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Sanity`
> Spec:
> <hr>Thu, 24 Oct 2024 17:52:38 UTC
<!-- end of auto-generated comment: Cypress test results  -->


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

- **Bug Fixes**
- Re-enabled test case for verifying colors, borders, and shadows of the
Tabs widget.
- Updated border color assertion to dynamically check the widget's
border color.

- **Improvements**
- Enhanced verification of property visibility and functionality for the
Tabs widget, including tab renaming, deletion, and binding with text
widgets.
- Validated behavior when toggling the "Show Tabs" property and ensured
appropriate error handling for invalid default tabs.

- **Chores**
- Updated the test file reference in the limited-tests configuration to
focus on the Tabs widget.
- Introduced new selectors for improved interaction with widget
properties.
<!-- 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