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: fixed failing GitImport test #34589

Merged
merged 13 commits into from
Jul 15, 2024
Merged

Conversation

NandanAnantharamu
Copy link
Collaborator

@NandanAnantharamu NandanAnantharamu commented Jun 28, 2024

RCA:
Gitimport test was failing at the place of reconnect DS
And also later in 4th test during commit and push

Solution:
replaced some js helper with ts helper
updated commit and push to fix the test

Equivalent EE PR: https://github.com/appsmithorg/appsmith-ee/pull/4683

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

Tip

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


Mon, 15 Jul 2024 09:03:21 UTC

Summary by CodeRabbit

  • Tests
    • Updated Git import flow test scenario to enhance control flow and method calls.
    • Improved commit and push command with additional assertions for element visibility and input in Git sync tests.
    • Updated spec name for limited tests in Cypress test configuration.

Copy link
Contributor

coderabbitai bot commented Jun 28, 2024

Walkthrough

The recent updates in the code primarily focus on enhancing the Git synchronization and import functionalities in the Cypress end-to-end tests. The changes include modifying the control flow in the GitImport_spec.js file by replacing specific method calls, updating the commitAndPush command in gitSync.js to include additional assertions, and ensuring element visibility checks. These improvements aim to streamline the testing process and ensure more robust and reliable testing of the Git integration features.

Changes

File Path Change Summary
app/client/cypress/e2e/Regression/ClientSide/Git/... Updated merging functionality to use gitSync.MergeToMaster() instead of cy.merge(mainBranch). Altered control flow in the Git import flow test scenario.
app/client/cypress/support/gitSync.js Added imports for createMessage and GIT_COMMIT_MESSAGE_PLACEHOLDER. Replaced cy.get(homePage.publishButton) with agHelper.GetNClick(homePage.publishButton). Added assertions and modified typing behavior for commitCommentInput.
app/client/cypress/limited-tests.txt Updated the spec name for limited tests in the Cypress test configuration file.

Sequence Diagram(s)

sequenceDiagram
    participant Cypress Test
    participant GitSync
    participant DataSources

    Cypress Test->>GitSync: MergeToMaster()
    GitSync-->>Cypress Test: Merged to master

    Cypress Test->>DataSources: SaveDatasource(true)
    DataSources-->>Cypress Test: Datasource saved

    Cypress Test->>GitSync: commitAndPush(assertFailure)
    GitSync->>GitSync: Assert visibility of gitSyncModal
    GitSync->>GitSync: Set commit comment placeholder
    GitSync->>GitSync: Type commit message (force: true)
    GitSync-->>Cypress Test: Commit and push completed
Loading

Poem

In the code's deep Git ocean blue,
We merge to master, fresh and new.
Assertions guard our every flow,
Ensuring tests just smoothly go.
With Cypress strong and scripts so bright,
We code with joy from day to night.
🌟🐇✨


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>.
    • 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 Configration 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 Jun 28, 2024
@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e662e7e and d65dedd.

Files selected for processing (2)
  • app/client/cypress/e2e/Regression/ClientSide/Git/GitImport/GitImport_spec.js (1 hunks)
  • app/client/cypress/limited-tests.txt (1 hunks)
Additional context used
LanguageTool
app/client/cypress/limited-tests.txt

[uncategorized] ~1-~1: You might be missing the article “the” here.
Context: ... limited tests - give the spec names in below format: cypress/e2e/Regression/ClientSi...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)


[uncategorized] ~9-~9: Possible missing article found.
Context: ...ile to run minimum of specs. Do not run entire suite with this command.

(AI_HYDRA_LEO_MISSING_THE)

Additional comments not posted (3)
app/client/cypress/limited-tests.txt (2)

2-3: Update to limited test configuration approved.

The paths to the test specs have been updated correctly according to the renaming and restructuring of the test files. This ensures that the CI pipeline will run the intended tests.


Line range hint 9-9: Clarify the instruction in the comment.

The comment could be made clearer. Instead of "Do not run entire suite with this command," consider specifying which command should not be used to run the entire suite.

- #ci-test-limit uses this file to run minimum of specs. Do not run entire suite with this command.
+ #ci-test-limit uses this file to run a minimum set of specs. Avoid using this command to run the entire test suite.
Tools
LanguageTool

[uncategorized] ~1-~1: You might be missing the article “the” here.
Context: ... limited tests - give the spec names in below format: cypress/e2e/Regression/ClientSi...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)

app/client/cypress/e2e/Regression/ClientSide/Git/GitImport/GitImport_spec.js (1)

173-174: Refactor to use the updated Git merge method.

The test has been updated to use gitSync.MergeToMaster() instead of cy.merge(mainBranch). This is a significant improvement as it likely uses a more robust and tailored method for merging branches in the context of the test suite.

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit runId=9714554374

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between d65dedd and 3e8b677.

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

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit

Copy link

github-actions bot commented Jul 1, 2024

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit

Copy link

github-actions bot commented Jul 1, 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 UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 3e8b677 and 778e485.

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

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit

Copy link

github-actions bot commented Jul 1, 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 UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 778e485 and 99757bd.

Files selected for processing (2)
  • app/client/cypress/e2e/Regression/ClientSide/Git/GitImport/GitImport_spec.js (2 hunks)
  • app/client/cypress/support/gitSync.js (1 hunks)
Additional comments not posted (3)
app/client/cypress/e2e/Regression/ClientSide/Git/GitImport/GitImport_spec.js (2)

172-172: Verify the new MergeToMaster command.

Ensure that the new command gitSync.MergeToMaster() is correctly implemented and consistent with the rest of the codebase.

Verification successful

The MergeToMaster command is correctly implemented.

The method gitSync.MergeToMaster() in GitSync.ts is correctly defined and handles the merge process appropriately, including conflict checks, button state assertions, and success message verifications.

  • GitSync.ts:381-391
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the implementation of `MergeToMaster` in the codebase.

# Test: Search for the `MergeToMaster` function. Expect: Correct implementation of the function.
rg --type js --type ts $'MergeToMaster'

Length of output: 424



Script:

#!/bin/bash
# Extract the implementation of MergeToMaster from GitSync.ts
ast-grep --lang typescript --pattern $'class $_ {
  $$$
  MergeToMaster() {
    $$$
  }
  $$$
}' app/client/cypress/support/Pages/GitSync.ts

Length of output: 38259


57-57: Verify the new SaveDatasource command.

Ensure that the new command dataSources.SaveDatasource(true) is correctly implemented and consistent with the rest of the codebase.

Verification successful

Verify the implementation of the SaveDatasource function in DataSources.ts.

Ensure that the SaveDatasource function is correctly implemented in app/client/cypress/support/Pages/DataSources.ts.


Verify the implementation of the SaveDatasource function in DataSources.ts.

Ensure that the SaveDatasource function is correctly implemented in app/client/cypress/support/Pages/DataSources.ts.


Verify the implementation of the SaveDatasource function in DataSources.ts.

Ensure that the SaveDatasource function is correctly implemented in app/client/cypress/support/Pages/DataSources.ts.


Verify the implementation of the SaveDatasource function in DataSources.ts.

Ensure that the SaveDatasource function is correctly implemented in app/client/cypress/support/Pages/DataSources.ts.


Verify the implementation of the SaveDatasource function in DataSources.ts.

Ensure that the SaveDatasource function is correctly implemented in app/client/cypress/support/Pages/DataSources.ts.


Verify the implementation of the SaveDatasource function in DataSources.ts.

Ensure that the SaveDatasource function is correctly implemented in app/client/cypress/support/Pages/DataSources.ts.


The SaveDatasource function is correctly implemented.

The SaveDatasource function in app/client/cypress/support/Pages/DataSources.ts is correctly defined and used. The function includes necessary assertions and network status checks, ensuring the datasource is saved properly.

  • app/client/cypress/support/Pages/DataSources.ts: public SaveDatasource(isReconnectModal = false, isSavingEnvInOldDS = false)
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the implementation of `SaveDatasource` in the codebase.

# Test: Search for the `SaveDatasource` function. Expect: Correct implementation of the function.
rg --type js --type ts $'SaveDatasource'

Length of output: 6135



Script:

#!/bin/bash
# Description: Retrieve the implementation of `SaveDatasource` function from `DataSources.ts`.

# Test: Extract the `SaveDatasource` function implementation from `DataSources.ts`.
ast-grep --lang typescript --pattern $'public SaveDatasource($_) {
  $$$
}' "app/client/cypress/support/Pages/DataSources.ts"

Length of output: 582



Script:

#!/bin/bash
# Description: Retrieve the implementation of `SaveDatasource` function from `DataSources.ts`.

# Test: Extract the `SaveDatasource` function implementation from `DataSources.ts`.
ast-grep --lang typescript --pattern 'function SaveDatasource($_) {
  $$$
}' "app/client/cypress/support/Pages/DataSources.ts"

Length of output: 126



Script:

#!/bin/bash
# Description: Retrieve the implementation of the `SaveDatasource` method from `DataSources.ts`.

# Test: Extract the `SaveDatasource` method implementation from `DataSources.ts`.
ast-grep --lang typescript --pattern $'class $_ {
  $$$
  SaveDatasource($_) {
    $$$
  }
  $$$
}' "app/client/cypress/support/Pages/DataSources.ts"

Length of output: 148



Script:

#!/bin/bash
# Description: List all methods in the `DataSources.ts` file to locate `SaveDatasource`.

# Test: Extract all method implementations from `DataSources.ts`.
ast-grep --lang typescript --pattern $'class $_ {
  $$$
  $_() {
    $$$
  }
  $$$
}' "app/client/cypress/support/Pages/DataSources.ts"

Length of output: 134



Script:

#!/bin/bash
# Description: Search for the definition of `SaveDatasource` in `DataSources.ts`.

# Test: Use `rg` to find the `SaveDatasource` method definition in `DataSources.ts`.
rg 'SaveDatasource' "app/client/cypress/support/Pages/DataSources.ts"

Length of output: 466



Script:

#!/bin/bash
# Description: Extract the full implementation of the `SaveDatasource` method from `DataSources.ts`.

# Test: Use `rg` to extract the `SaveDatasource` method implementation in `DataSources.ts`.
rg -A 10 'public SaveDatasource' "app/client/cypress/support/Pages/DataSources.ts"

Length of output: 540

app/client/cypress/support/gitSync.js (1)

77-85: LGTM! But verify the function usage in the codebase.

The changes improve the robustness of the commitAndPush function by adding necessary assertions and ensuring the commit message is typed even if the input is not visible or interactable.

However, ensure that all function calls to commitAndPush are consistent with the new implementation.

Copy link

github-actions bot commented Jul 1, 2024

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

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit runId=9743181100

6 similar comments
@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit runId=9743181100

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit runId=9743181100

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit runId=9743181100

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit runId=9743181100

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit runId=9743181100

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit runId=9743181100

Copy link

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

Copy link

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

Copy link

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

Copy link

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

Copy link

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

Copy link

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

Copy link

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

Copy link

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

Copy link

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

Copy link

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

Copy link

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

Copy link

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

Copy link

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

Copy link

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

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