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: Fix api on load issue due to no setting config issue #38969

Merged
merged 1 commit into from
Feb 3, 2025

Conversation

sagar-qa007
Copy link
Contributor

@sagar-qa007 sagar-qa007 commented Feb 3, 2025

Description

Updated the test case code with import app.

Fixes #Issue Number
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.Binding"

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/13116038995
Commit: 486ff22
Cypress dashboard.
Tags: @tag.Binding
Spec:


Mon, 03 Feb 2025 16:12:35 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • New Features
    • Upgraded page load functionality now triggers API actions seamlessly upon page refresh, ensuring input fields display accurate, up-to-date information.
    • Enhanced application configuration supports dynamic widget behavior for a more responsive and intuitive experience.
    • Overall, these improvements boost reliability and streamline interactions, delivering a more consistent user interface.

@sagar-qa007 sagar-qa007 added the ok-to-test Required label for CI label Feb 3, 2025
Copy link
Contributor

coderabbitai bot commented Feb 3, 2025

Walkthrough

The changes update the Cypress test for the API with page load and input widget binding. The test now imports a JSON fixture instead of relying on external test data and widget locators. The test cases were simplified by selecting an existing API entity, directly validating response status and input values, and deploying the app without intermediate steps. Additionally, a new JSON fixture detail has been added to configure application metadata, page layouts, widget properties, and an API action named "PageLoadApi" that executes on page load.

Changes

File Path (abridged) Change Summary
app/client/cypress/e2e/.../Api_withPageload_Input_spec.js Removed imports for external test data and widget locators; replaced DSL setup with homepage navigation and JSON app import; modified tests to select an API entity and verify inputs.
app/client/cypress/fixtures/.../Api_withPageload_Input_TestData.json Added new JSON fixture containing application configuration, including metadata, page layout, widget definitions, and API action ("PageLoadApi") settings for execution on page load.

Sequence Diagram(s)

sequenceDiagram
  participant TR as Test Runner
  participant HP as Home Page
  participant ED as EditorNavigation
  participant API as "PageLoadApi"
  participant IW as Input Widget

  TR->>HP: Navigate to Home Page
  TR->>HP: Import App Data ("Api_withPageload_Input_TestData.json")
  TR->>ED: Select "PageLoadApi" entity
  HP->>API: Trigger API on page load
  API-->>HP: Return API response
  TR->>IW: Verify widget input values
Loading

Suggested labels

Bug

Suggested reviewers

  • ApekshaBhosale
  • NandanAnantharamu

Poem

In our code realm, tests now shine so bright,
Widgets and API calls dance in the light,
JSON fixtures bring structure with a smile,
Simplified flows make testing worthwhile,
Here's to clean commits and code that's neat—
A little testing magic, playful and sweet!

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

🪧 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 the Bug Something isn't working label Feb 3, 2025
@sagar-qa007
Copy link
Contributor Author

/ci-test-limit-count run_count=30 update_snapshot=false specs_to_run=cypress/e2e/Regression/ClientSide/Binding/Api_withPageload_Input_spec.js

Copy link

github-actions bot commented Feb 3, 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

🔭 Outside diff range comments (1)
app/client/cypress/e2e/Regression/ClientSide/Binding/Api_withPageload_Input_spec.js (1)

37-40: Maintain consistent selector pattern across tests.

Use the same data-* attribute selector pattern for consistency with the previous input widget tests.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between a7d31b5 and 486ff22.

📒 Files selected for processing (2)
  • app/client/cypress/e2e/Regression/ClientSide/Binding/Api_withPageload_Input_spec.js (1 hunks)
  • app/client/cypress/fixtures/Api_withPageload_Input_TestData.json (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
app/client/cypress/fixtures/Api_withPageload_Input_TestData.json (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/e2e/Regression/ClientSide/Binding/Api_withPageload_Input_spec.js (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 (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-lint / client-lint
  • GitHub Check: client-prettier / prettier-check
  • GitHub Check: client-build / client-build
🔇 Additional comments (2)
app/client/cypress/e2e/Regression/ClientSide/Binding/Api_withPageload_Input_spec.js (1)

12-15: LGTM! Good use of ImportApp for test setup.

The change to use ImportApp instead of AddDsl provides a more complete and maintainable test setup.

app/client/cypress/fixtures/Api_withPageload_Input_TestData.json (1)

1-1: LGTM! Well-structured test data configuration.

The JSON configuration provides a complete setup for the test scenario, including necessary widget properties, API actions, and bindings.

Comment on lines 25 to 28
cy.get(publish.inputWidget + " " + "input")
.first()
.invoke("attr", "value")
.should("contain", "3");
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

Use data- attributes for selectors instead of DOM traversal.*

Replace the selector publish.inputWidget + " " + "input" with a data-* attribute selector for better maintainability and reliability.

Example:

-cy.get(publish.inputWidget + " " + "input")
+cy.get("[data-cy=input-widget-field]")

Also applies to: 33-36

Copy link

github-actions bot commented Feb 3, 2025

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

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

@sagar-qa007 sagar-qa007 merged commit 6cd343e into release Feb 3, 2025
48 checks passed
@sagar-qa007 sagar-qa007 deleted the fix/apipaheload branch February 3, 2025 16:16
github-actions bot pushed a commit to Zeral-Zhang/appsmith that referenced this pull request Feb 7, 2025
…g#38969)

## Description
Updated the test case code with import app.


Fixes #`Issue Number`  
_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.Binding"

### 🔍 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/13116038995>
> Commit: 486ff22
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=13116038995&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Binding`
> Spec:
> <hr>Mon, 03 Feb 2025 16:12:35 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

- **New Features**
- Upgraded page load functionality now triggers API actions seamlessly
upon page refresh, ensuring input fields display accurate, up-to-date
information.
- Enhanced application configuration supports dynamic widget behavior
for a more responsive and intuitive experience.
- Overall, these improvements boost reliability and streamline
interactions, delivering a more consistent user interface.

<!-- 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