Skip to content

Conversation

sneha122
Copy link
Contributor

@sneha122 sneha122 commented Jun 17, 2025

Description

This PR fixes client/cypress/e2e/Regression/ClientSide/JSObject/JSObject_Tests_spec.ts. This test started failing after fixing generate crud issue with dynamicBindingPathList. With this fix, dynamicBindingPathList started appearing for generated queries as well and so it started breaking one of the test cases which was asserting the evaluated popup's value.

The test was asserting that value in evaluated value popup should be equal to the query itself earlier, but after the right fix for generate crud, it won't be equal, rather bindings will be replaced by placeholders. This PR fixes the test by adding correct assertion for evaluated value.

Fixes #40857
or
Fixes Issue URL

Warning

If no issue exists, please create an issue first, and check with the maintainers if the issue is valid.

Automation

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

🔍 Cypress test results

Tip

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


Tue, 17 Jun 2025 06:32:51 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • Tests
    • Reactivated and updated a test case for verifying query generation and editing, including improved selection and validation steps for datasource entities and queries.

@sneha122 sneha122 requested a review from ApekshaBhosale as a code owner June 17, 2025 06:12
Copy link
Contributor

coderabbitai bot commented Jun 17, 2025

Walkthrough

The test "8. Verify Queries" in the JSObject_Tests_spec.ts file was reactivated and updated. The test now explicitly selects entities and tables by name, generates a page from the datasource card, updates network waits, changes the query selected for editing, and asserts against a fixed expected SQL string.

Changes

File(s) Change Summary
app/client/cypress/e2e/Regression/ClientSide/JSObject/JSObject_Tests_spec.ts Reactivated and refactored "8. Verify Queries" test: updated entity selection, page generation, query selection, and assertion logic.

Sequence Diagram(s)

sequenceDiagram
    participant TestRunner
    participant AppUI
    participant EditorNavigation
    participant DatasourceCard

    TestRunner->>AppUI: Create Postgres datasource
    TestRunner->>AppUI: Create query
    TestRunner->>EditorNavigation: Select datasource entity by name
    TestRunner->>AppUI: Select "public.users" table
    TestRunner->>DatasourceCard: Generate page from datasource
    TestRunner->>AppUI: Wait for network/UI updates
    TestRunner->>AppUI: Wait for table to load
    TestRunner->>EditorNavigation: Select "DeleteQuery" entity
    TestRunner->>AppUI: Assert evaluated query text equals expected SQL string
Loading

Possibly related PRs

Suggested labels

Bug, ok-to-test, Query Widgets & IDE Pod

Suggested reviewers

  • ApekshaBhosale

Poem

A test once skipped now springs to life,
With queries checked and edits rife.
Tables selected, assertions true,
SQL strings shining, crisp and new.
Cheers to code that runs with grace—
Regression tamed, all in its place!
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this 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.

@github-actions github-actions bot added IDE Pod Issues that new developers face while exploring the IDE Integrations Pod General Issues related to the Integrations Pod that don't fit into other tags. Integrations Pod labels Jun 17, 2025
@sneha122 sneha122 requested a review from ankitakinger June 17, 2025 06:12
@github-actions github-actions bot added Integrations Product Issues related to a specific integration Query Widgets & IDE Pod All issues related to Query, JS, Eval, Widgets & IDE Task A simple Todo Unplanned Work - IDE Unplanned work items of pod IDE Bug Something isn't working labels Jun 17, 2025
@sneha122 sneha122 added the ok-to-test Required label for CI label Jun 17, 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/e2e/Regression/ClientSide/JSObject/JSObject_Tests_spec.ts (1)

267-273: Streamline evaluated-value assertion & avoid DOM juggling

The current pattern fetches CodeMirror DOM, flattens text, and then pulls the evaluated value in a second query. This adds fragile DOM-coupling and extra then nesting.

-cy.get(`${locators._codeMirrorCode} pre`).then(($elements) => {
-  const text = [...$elements].map((el) => el.innerText).join("");
-  agHelper.GetText(locators._evaluatedValue).then((evalText: any) => {
-    expect(evalText.replace(/\n/g, "")).to.eq(
-      'DELETE FROM public."users"  WHERE "id" = $1;',
-    );
-  });
-});
+agHelper
+  .GetText(locators._evaluatedValue)
+  .should("equal", 'DELETE FROM public."users"  WHERE "id" = $1;');

• Removes redundant CodeMirror scrape (not used in the comparison).
• Converts to Cypress’ retry-able should, reducing flake.
• Keeps assertions chainable & eliminates explicit string manipulation.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between ad100b0 and a7041c3.

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

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/JSObject/JSObject_Tests_spec.ts
⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: perform-test / client-build / client-build
  • GitHub Check: perform-test / server-build / server-unit-tests
  • GitHub Check: perform-test / rts-build / build
  • 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

@sneha122 sneha122 merged commit b7510d1 into release Jun 17, 2025
47 checks passed
@sneha122 sneha122 deleted the chore/jsobject-cypress-test-fix branch June 17, 2025 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working IDE Pod Issues that new developers face while exploring the IDE Integrations Pod General Issues related to the Integrations Pod that don't fit into other tags. Integrations Pod Integrations Product Issues related to a specific integration ok-to-test Required label for CI Query Widgets & IDE Pod All issues related to Query, JS, Eval, Widgets & IDE Task A simple Todo Unplanned Work - IDE Unplanned work items of pod IDE
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task]: Fix JSObject_Tests_spec.ts which was failing in TBP after #40833
2 participants