From d0d6d3ceb833aa4c823768c889f467757671b917 Mon Sep 17 00:00:00 2001 From: Sagar Khalasi Date: Tue, 1 Oct 2024 18:04:01 +0530 Subject: [PATCH] Reverted the change --- .../ServerSide/JsFunctionExecution/Fetch_Spec.ts | 16 ++++------------ 1 file changed, 4 insertions(+), 12 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 a3a130032f0..b59b5fb9dd2 100644 --- a/app/client/cypress/e2e/Regression/ServerSide/JsFunctionExecution/Fetch_Spec.ts +++ b/app/client/cypress/e2e/Regression/ServerSide/JsFunctionExecution/Fetch_Spec.ts @@ -81,19 +81,11 @@ describe("Tests fetch calls", { tags: ["@tag.JS"] }, () => { propPane.TypeTextIntoField("Label", "getUserID"); propPane.EnterJSContext( "onClick", - `{{(async () => { - try { - const response = await fetch('http://host.docker.internal:5001/v1/mock-api?records=1'); - const json = await response.json(); - const user = json[0]; // Get the first record - await storeValue('userId', user.id); - showAlert("UserId: " + appsmith.store.userId); - } catch (error) { - showAlert("Failed to fetch user data."); - } - })()}}`, + `{{fetch('https://jsonplaceholder.typicode.com/todos/1') + .then(res => res.json()) + .then(json => storeValue('userId', json.userId)) + .then(() => showAlert("UserId: " + appsmith.store.userId))}}`, ); - agHelper.Sleep(2000); agHelper.ClickButton("getUserID"); agHelper.AssertContains("UserId: 1", "exist");