chore: Add changes for new API contracts in GitSync.ts (#41101)

## Description
EE Counterpart: https://github.com/appsmithorg/appsmith-ee/pull/7963

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.Git"

### 🔍 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/16177814474>
> Commit: fddb1629889967638a5675cb6f005b08c113f770
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=16177814474&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Git`
> Spec:
> <hr>Wed, 09 Jul 2025 19:50:34 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**
* Added support for using updated API endpoints during Git connection
setup in tests via an optional parameter.

* **Tests**
* Enhanced test setup flexibility by allowing selection between original
and new API endpoints for Git-related operations.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
subratadeypappu 2025-07-10 11:13:17 +06:00 committed by GitHub
parent d34336e578
commit 3981590006
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -159,23 +159,38 @@ export class GitSync {
repoName = "Repo", repoName = "Repo",
assertConnect = true, assertConnect = true,
privateFlag = false, privateFlag = false,
useNewAPI = false,
) { ) {
this.agHelper.GenerateUUID(); this.agHelper.GenerateUUID();
cy.get("@guid").then((uid) => { cy.get("@guid").then((uid) => {
repoName += uid; repoName += uid;
this.CreateTestGiteaRepo(repoName, privateFlag); this.CreateTestGiteaRepo(repoName, privateFlag);
cy.intercept("POST", "/api/v1/applications/ssh-keypair/*").as( if (useNewAPI) {
`generateKey-${repoName}`, cy.intercept("POST", "/api/v1/git/applications/*/ssh-keypair*").as(
); `generateKey-${repoName}`,
);
cy.intercept("GET", "/api/v1/git/branch/app/*/protected").as( cy.intercept("GET", "/api/v1/git/applications/*/protected-branches").as(
`protected-${repoName}`, `protected-${repoName}`,
); );
cy.intercept("GET", "/api/v1/git/branch/app/*").as( cy.intercept("GET", "/api/v1/git/applications/*/refs").as(
`branches-${repoName}`, `branches-${repoName}`,
); );
} else {
cy.intercept("POST", "/api/v1/applications/ssh-keypair/*").as(
`generateKey-${repoName}`,
);
cy.intercept("GET", "/api/v1/git/branch/app/*/protected").as(
`protected-${repoName}`,
);
cy.intercept("GET", "/api/v1/git/branch/app/*").as(
`branches-${repoName}`,
);
}
this.OpenConnectModal(); this.OpenConnectModal();