chore: fix anvil tests (#39740)

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

<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/13892555180>
> Commit: ff664767ae7d5871a766bf417a2e9755ad0fac53
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=13892555180&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Anvil`
> Spec:
> <hr>Mon, 17 Mar 2025 06:19:10 UTC
<!-- end of auto-generated comment: Cypress test results  -->


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Tests**
- Enhanced the automation for creating new applications during testing.
Under certain test scenarios, the system now alters the payload to
simulate different application configurations, improving test
reliability and consistency.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Pawan Kumar 2025-03-17 12:02:29 +05:30 committed by GitHub
parent f420384dee
commit 28d1bb7f19
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -638,7 +638,20 @@ Cypress.Commands.add("startServerAndRoutes", () => {
cy.intercept("GET", "/api/v1/plugins/*/form").as("getPluginForm");
cy.intercept("DELETE", "/api/v1/applications/*").as("deleteApplication");
cy.intercept("POST", "/api/v1/applications").as("createNewApplication");
cy.intercept("POST", "/api/v1/applications", (req) => {
// we don't let creating application in anvil or ai agents test with create application button,
// but our tests are written to use the create application button, so we override the request body
// to create an application with anvil layout system and hide the navbar
if (
Cypress.currentTest.titlePath[0].includes(ANVIL_EDITOR_TEST) ||
Cypress.currentTest.titlePath[0].includes(AI_AGENTS_TEST)
) {
req.body.positioningType = "ANVIL";
req.body.showNavbar = false;
}
req.continue();
}).as("createNewApplication");
cy.intercept("PUT", "/api/v1/applications/*").as("updateApplication");
cy.intercept("PUT", "/api/v1/actions/*").as("saveAction");
cy.intercept("PUT", "/api/v1/actions/move").as("moveAction");