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 flaky case for forkapp #35376

Merged
merged 2 commits into from
Aug 7, 2024
Merged

test: fix flaky case for forkapp #35376

merged 2 commits into from
Aug 7, 2024

Conversation

sagar-qa007
Copy link
Contributor

@sagar-qa007 sagar-qa007 commented Aug 2, 2024

Description

Fix case with adding one more assertion with wait.
RCA:
The issue was not with the function itself but rather with the flaky behavior of the Cypress code. The modal was opening, and our code was attempting to click the “Skip to Application” button too quickly. The actual validation was only for SkipToAppBtn, but in the application, the modal was still loading, causing Cypress to perform the action prematurely, which led to failures. To address this, I added an additional wait for another element, and this resolved the issue.

Fixes #35375

Automation

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

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/10279433214
Commit: 748f4f7
Cypress dashboard.
Tags: @tag.Fork
Spec:


Wed, 07 Aug 2024 07:08:45 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Enhanced test robustness for the ForkApplication component by implementing a prerequisite check for the presence of a critical UI element linked to data sources.
  • Bug Fixes

    • Improved control flow in tests to ensure that necessary elements are available before proceeding with actions, reducing the likelihood of test failures.

Copy link
Contributor

coderabbitai bot commented Aug 2, 2024

Walkthrough

The recent changes enhance the ForkApplication test suite by integrating a new dependency, dataSources. This update introduces a check to ensure that essential UI elements are present before executing further actions, thus improving the reliability of the tests. By waiting for the dataSources._saveDs element to appear, the tests become more robust and less prone to failures stemming from timing issues.

Changes

Files Change Summary
app/client/cypress/e2e/Regression/ClientSide/Fork/ForkApplication_spec.ts Added dataSources import; implemented a conditional wait for dataSources._saveDs element.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant App
    participant DataSources

    User->>App: Initiate ForkApplication
    App->>DataSources: Wait for _saveDs element
    DataSources-->>App: _saveDs element ready
    App->>User: Proceed to SkipToAppBtn
Loading

Poem

🌟 In the land of tests where bugs can creep,
A new check was added, our data to keep.
Wait for the source, let it shine bright,
With ForkApplication, we’ll test with delight!
Robust and ready, our code is now keen,
A victory for testing, a well-oiled machine! 🎉


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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 skip-changelog Adding this label to a PR prevents it from being listed in the changelog Test labels Aug 2, 2024
@sagar-qa007 sagar-qa007 added the ok-to-test Required label for CI label Aug 2, 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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a0f2ee1 and 811e712.

Files selected for processing (1)
  • app/client/cypress/e2e/Regression/ClientSide/Fork/ForkApplication_spec.ts (2 hunks)
Additional context used
Path-based instructions (1)
app/client/cypress/e2e/Regression/ClientSide/Fork/ForkApplication_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 not posted (2)
app/client/cypress/e2e/Regression/ClientSide/Fork/ForkApplication_spec.ts (2)

17-17: Import statement for dataSources looks good.

The import statement follows the correct syntax and is placed appropriately.


114-116: Good use of agHelper.WaitUntilEleAppear for dataSources._saveDs.

This addition ensures that the necessary data source element is available before proceeding, which improves the reliability of the test.

@sagar-qa007 sagar-qa007 added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Aug 2, 2024
@sagar-qa007 sagar-qa007 added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Aug 4, 2024
ApekshaBhosale
ApekshaBhosale previously approved these changes Aug 7, 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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 811e712 and 748f4f7.

Files selected for processing (1)
  • app/client/cypress/e2e/Regression/ClientSide/Fork/ForkApplication_spec.ts (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • app/client/cypress/e2e/Regression/ClientSide/Fork/ForkApplication_spec.ts

@sagar-qa007 sagar-qa007 added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Aug 7, 2024
@sagar-qa007 sagar-qa007 merged commit 6d1b9bd into release Aug 7, 2024
52 checks passed
@sagar-qa007 sagar-qa007 deleted the fix/forkappflakycase branch August 7, 2024 08:25
@coderabbitai coderabbitai bot mentioned this pull request Nov 11, 2024
2 tasks
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