From a01edffbc3b5c5b2c0811789dd6e0dcdc01ad18d Mon Sep 17 00:00:00 2001 From: Sagar Khalasi Date: Thu, 3 Oct 2024 12:44:04 +0530 Subject: [PATCH] chore: fetch spec with removed third party (#36636) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description Updated third party URLs. Fixes #`36437` ## Automation /ok-to-test tags="@tag.JS" ### :mag: Cypress test results > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: > Commit: 3a3ab548300e8e8a7338b93491dab0ce36c33fda > Cypress dashboard. > Tags: `@tag.JS` > Spec: >
Thu, 03 Oct 2024 07:04:14 UTC ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No ## Summary by CodeRabbit - **New Features** - Enhanced fetch functionality with improved error handling and updated button interactions. - Introduced delay mechanism for fetch calls to ensure functionality after a timeout. - **Bug Fixes** - Updated button label and fetch endpoint to correctly retrieve and display user names. - **Documentation** - Updated test specifications to focus on server-side JavaScript function execution. --- .../JsFunctionExecution/Fetch_Spec.ts | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/app/client/cypress/e2e/Regression/ServerSide/JsFunctionExecution/Fetch_Spec.ts b/app/client/cypress/e2e/Regression/ServerSide/JsFunctionExecution/Fetch_Spec.ts index b59b5fb9dd..feff456776 100644 --- a/app/client/cypress/e2e/Regression/ServerSide/JsFunctionExecution/Fetch_Spec.ts +++ b/app/client/cypress/e2e/Regression/ServerSide/JsFunctionExecution/Fetch_Spec.ts @@ -1,5 +1,7 @@ import { agHelper, + apiPage, + dataManager, entityExplorer, jsEditor, propPane, @@ -76,18 +78,25 @@ describe("Tests fetch calls", { tags: ["@tag.JS"] }, () => { }); it("3. Tests if fetch works with store value", function () { + apiPage.CreateAndFillApi( + dataManager.dsValues[dataManager.defaultEnviorment].mockGenderAge + + `{{this.params.person}}`, + "Gender_Age", + ); + apiPage.RunAPI(); entityExplorer.DragDropWidgetNVerify("buttonwidget", 500, 200); EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); - propPane.TypeTextIntoField("Label", "getUserID"); + propPane.TypeTextIntoField("Label", "getUserName"); propPane.EnterJSContext( "onClick", - `{{fetch('https://jsonplaceholder.typicode.com/todos/1') - .then(res => res.json()) - .then(json => storeValue('userId', json.userId)) - .then(() => showAlert("UserId: " + appsmith.store.userId))}}`, + `{{(async function(){ + const gender = await Gender_Age.run({ person: "sagar" }); + storeValue("Gender", gender); + showAlert("Your name is " + appsmith.store.Gender.name); + })()}}`, ); - agHelper.Sleep(2000); - agHelper.ClickButton("getUserID"); - agHelper.AssertContains("UserId: 1", "exist"); + + agHelper.ClickButton("getUserName"); + agHelper.AssertContains("Your name is sagar", "exist"); }); });