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

fix: Widget property test case fix #38001

Merged
merged 4 commits into from
Dec 9, 2024
Merged

fix: Widget property test case fix #38001

merged 4 commits into from
Dec 9, 2024

Conversation

sagar-qa007
Copy link
Contributor

@sagar-qa007 sagar-qa007 commented Dec 6, 2024

Description

Fix test case as DB data updated.

Fixes # https://app.zenhub.com/workspaces/stability-pod-6690c4814e31602e25cab7fd/issues/gh/appsmithorg/appsmith/38022

Automation

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

🔍 Cypress test results

Tip

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


Mon, 09 Dec 2024 05:14:24 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

  • Chores
    • Updated test specification to focus on a new TypeScript test file.
    • Streamlined references to column identifiers in widget property navigation tests for consistency.

Copy link
Contributor

coderabbitai bot commented Dec 6, 2024

Walkthrough

The changes in this pull request involve updating the limited-tests.txt file within the Cypress testing environment. Specifically, the test specification has been altered from a JavaScript file, Fork_Template_spec.js, to a TypeScript file, Widget_property_navigation_spec.ts. This indicates a transition in testing focus while maintaining the existing comments regarding test execution.

Changes

File Path Change Summary
app/client/cypress/limited-tests.txt Updated test specification from Fork_Template_spec.js to Widget_property_navigation_spec.ts.
app/client/cypress/e2e/Regression/ClientSide/Debugger/Widget_property_navigation_spec.ts Updated identifiers in test cases, replacing "imdb_id" with "id" across multiple instances.

Possibly related PRs

Suggested labels

skip-changelog, ok-to-test, Test

Suggested reviewers

  • ApekshaBhosale

🌟 In the land of tests, a change took flight,
From JavaScript's grasp to TypeScript's light.
Forks turned to bindings, a shift so grand,
With limited-tests.txt, we take a stand!
Let's run the specs, let the code play,
In the world of Cypress, we pave the way! 🎉


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

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

Reviewing files that changed from the base of the PR and between ba7c158 and ab5e0c8.

📒 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.
🔇 Additional comments (1)
app/client/cypress/limited-tests.txt (1)

2-2: Ensure test file migration is complete

The change from JS to TS suggests a migration. Let's verify no remnants of the old test file exist.

✅ Verification successful

Migration verification complete - no issues found

The TypeScript test file exists at the correct location and there is no remnant of a JavaScript version. The file is properly referenced in the limited-tests configuration.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify complete migration from JS to TS

# Check if old JS file still exists
if fd "Fork_Template_spec.js" app/client/cypress/; then
  echo "Warning: Old JS test file still exists"
fi

# Check for any references to the old test file in the codebase
rg "Fork_Template_spec\.js" --type ts --type js --type txt

Length of output: 194


Script:

#!/bin/bash
# Let's verify if we're looking at the correct file, since the review comment
# mentions PropertyControl_spec.ts but we searched for Fork_Template_spec.js

# Check for the existence of PropertyControl_spec files
fd "PropertyControl_spec" app/client/cypress/

# Check for any old .js version and current .ts version
rg "PropertyControl_spec\.(js|ts)" --type ts --type js --type txt

# Look for the specific test file mentioned in limited-tests.txt
cat app/client/cypress/limited-tests.txt

Length of output: 546

@@ -1,5 +1,6 @@
# To run only limited tests - give the spec names in below format:
cypress/e2e/Regression/ClientSide/Templates/Fork_Template_spec.js
cypress/e2e/Regression/ClientSide/OneClickBinding/PropertyControl_spec.ts
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Test file needs improvements to follow Cypress best practices

  • Remove cy.wait(500) and replace with proper assertions or intercepts
  • Add proper test helper imports for better maintainability
  • Test structure follows describe/it pattern correctly
  • Good use of assertions with expect statements
🔗 Analysis chain

Verify the new test file structure and existence

Let's ensure the new test file exists and follows the required guidelines.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence and content of the new test file

# Check if the file exists
if ! fd "PropertyControl_spec.ts" app/client/cypress/; then
  echo "Error: Test file not found"
  exit 1
fi

# Check for prohibited practices in the test file
echo "Checking for prohibited practices..."

# Check for cy.wait usage
rg "cy\.wait" "app/client/cypress/e2e/Regression/ClientSide/OneClickBinding/PropertyControl_spec.ts"

# Check for cy.pause usage
rg "cy\.pause" "app/client/cypress/e2e/Regression/ClientSide/OneClickBinding/PropertyControl_spec.ts"

# Check for agHelper.sleep usage
rg "agHelper\.sleep" "app/client/cypress/e2e/Regression/ClientSide/OneClickBinding/PropertyControl_spec.ts"

# Check for it.only usage
rg "it\.only" "app/client/cypress/e2e/Regression/ClientSide/OneClickBinding/PropertyControl_spec.ts"

# Check for after/afterEach hooks
rg "after(|afterEach" "app/client/cypress/e2e/Regression/ClientSide/OneClickBinding/PropertyControl_spec.ts"

# Check for proper selector usage (looking for potential CSS/XPath selectors)
rg "\$\(|querySelector|xpath=|//" "app/client/cypress/e2e/Regression/ClientSide/OneClickBinding/PropertyControl_spec.ts"

Length of output: 1011


Script:

#!/bin/bash
# Let's check the test file content to understand its structure and patterns
rg -A 2 "describe|it\(" "app/client/cypress/e2e/Regression/ClientSide/OneClickBinding/PropertyControl_spec.ts"

# Check for test helper imports and patterns
rg "^import.*Helper" "app/client/cypress/e2e/Regression/ClientSide/OneClickBinding/PropertyControl_spec.ts"

# Check for proper test assertions
rg "expect|should|assert" "app/client/cypress/e2e/Regression/ClientSide/OneClickBinding/PropertyControl_spec.ts"

Length of output: 1663

@sagar-qa007
Copy link
Contributor Author

/ci-test-limit-count run_count=5

Copy link

github-actions bot commented Dec 6, 2024

Copy link

github-actions bot commented Dec 6, 2024

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

@sagar-qa007
Copy link
Contributor Author

/ci-test-limit-count run_count=20 runId=12194882553

Copy link

github-actions bot commented Dec 6, 2024

@sagar-qa007
Copy link
Contributor Author

/ci-test-limit-count run_count=20 runId=12194882553

Copy link

github-actions bot commented Dec 6, 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 (1)
app/client/cypress/e2e/Regression/ClientSide/Debugger/Widget_property_navigation_spec.ts (1)

167-171: Consider adding validation pattern assertion.

While testing the regex validation, it would be good to assert that the validation actually works with a valid pattern.

 _.propPane.OpenTableColumnSettings("id");
 _.propPane.TypeTextIntoField("Regex", "{{test}}");
 _.debuggerHelper.AssertErrorCount(1);
+// Add test with valid regex pattern
+_.propPane.TypeTextIntoField("Regex", "^[0-9]+$");
+_.debuggerHelper.AssertErrorCount(0);
 _.propPane.ToggleSection("validation");
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 7037a89 and d01a8b3.

📒 Files selected for processing (1)
  • app/client/cypress/e2e/Regression/ClientSide/Debugger/Widget_property_navigation_spec.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
app/client/cypress/e2e/Regression/ClientSide/Debugger/Widget_property_navigation_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.
🔇 Additional comments (2)
app/client/cypress/e2e/Regression/ClientSide/Debugger/Widget_property_navigation_spec.ts (2)

163-164: LGTM! Column selection change looks consistent.

The update from 'imdb_id' to 'id' in the column selection follows the changes mentioned in the summary.


167-167: Verify the column name change impact.

The column name changes from 'imdb_id' to 'id' appear correct, but let's verify there are no remaining references to the old column name.

Also applies to: 175-175

✅ Verification successful

Column name change appears safe to proceed

Based on the codebase analysis:

  • Only two references to 'imdb_id' were found in an unrelated test file (Date_column_editing_1_spec.ts)
  • The current test file correctly uses 'id' in table column settings and widget interactions
  • No conflicting column definitions found in test fixtures or setup
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining references to 'imdb_id' in test files
rg -g '*.{ts,js}' 'imdb_id' app/client/cypress/

# Search for test data structure to verify column name
rg -g '*.{ts,js}' 'movies.*columns.*id' app/client/cypress/

Length of output: 359


Script:

#!/bin/bash
# Search for table data structure and column definitions in the test file
rg -A 10 -B 10 "OpenTableColumnSettings.*id" app/client/cypress/e2e/Regression/ClientSide/Debugger/Widget_property_navigation_spec.ts

# Search for any table data or mock data setup in the test file
rg "const.*movies.*=" app/client/cypress/e2e/Regression/ClientSide/Debugger/Widget_property_navigation_spec.ts

Length of output: 1240


Script:

#!/bin/bash
# Search for table data setup in the test file's beforeEach or before blocks
rg -A 10 "before(Each)?\s*\(" app/client/cypress/e2e/Regression/ClientSide/Debugger/Widget_property_navigation_spec.ts

# Search for any JSON mock data files that might be used in the test
fd -e json . app/client/cypress/fixtures/ -x rg -l "movies.*id"

Length of output: 366


Script:

#!/bin/bash
# Check the content of the found JSON files for the movies data structure
cat app/client/cypress/fixtures/mongouri_data_spec.json app/client/cypress/fixtures/mongo_PUT_replaceLayoutWithCRUD.json app/client/cypress/fixtures/mongo_GET_selectTableDropdown.json | jq -c '.[] | select(.movies)'

# Search for any table widget setup or configuration in the test file
rg -B 5 -A 5 "Table.*Widget" app/client/cypress/e2e/Regression/ClientSide/Debugger/Widget_property_navigation_spec.ts

Length of output: 682

@sagar-qa007 sagar-qa007 changed the title DNM: Running case to check failure fix: Running case to check failure Dec 6, 2024
@sagar-qa007 sagar-qa007 changed the title fix: Running case to check failure fix: Widget property test case fix Dec 6, 2024
@github-actions github-actions bot added the Bug Something isn't working label Dec 6, 2024
Copy link

github-actions bot commented Dec 6, 2024

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

***** Repeat Run Summary ***** Total Tests with repeat: 140 Total Passed: 126 Total Failed: 14 Total Skipped: 0 *****************************

@sagar-qa007 sagar-qa007 added the ok-to-test Required label for CI label Dec 9, 2024
@NandanAnantharamu NandanAnantharamu self-requested a review December 9, 2024 05:37
Copy link
Collaborator

@NandanAnantharamu NandanAnantharamu left a comment

Choose a reason for hiding this comment

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

LGTM

github-actions bot pushed a commit to Zeral-Zhang/appsmith that referenced this pull request Dec 12, 2024
## Description
Fix test case as DB data updated.


Fixes #
https://app.zenhub.com/workspaces/stability-pod-6690c4814e31602e25cab7fd/issues/gh/appsmithorg/appsmith/38022

## Automation

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

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/12228999115>
> Commit: 9eb9d98
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12228999115&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Sanity`
> Spec:
> <hr>Mon, 09 Dec 2024 05:14:24 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [x] No


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

- **Chores**
	- Updated test specification to focus on a new TypeScript test file.
- Streamlined references to column identifiers in widget property
navigation tests for consistency.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working ok-to-test Required label for CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants