Unit Test running forever when we try to simulate a module input query execution

Scenario: An app with a select that when changed the value, a module input query is triggered.
We've set the option "Disable all network calls while executing test" as true and we tried to mock the query response, but the test runs forever.

An additional test was done setting the option "Disable all network calls while executing test" as false and in this case the test stops but it's returning a fake positive, because we added this assertion to validate await assertEquals(false, true); and the test pass with success.

Hey @gabrielasouza-cit!

Sorry about the late reply here and thanks for reporting this behavior! Would you mind posting the full test code here as well? It may also help if we can see an export of the app in question.

Are the tests being run from the module or the app?

Hey @Kabirdas ! The test is being running from the module. Here's the json. Thank you

{"uuid":"13b06c2c-702b-11ed-a200-0f7e0b7f9f9c","page":{"id":14085,"data":{"appState":"["~#iR",["^ ","n","appTemplate","v",["^ ","isFetching",false,"plugins",["~#iOM",["moduleContainer",["^0",["^ ","n","pluginTemplate","v",["^ ","id","moduleContainer","type","widget","subtype","ModuleContainerWidget","namespace",null,"resourceName",null,"resourceDisplayName",null,"template",["^3",["heightType","fixed","spinWhenChildrenAreFetching",true,"showBorder",true,"showDropShadow",true,"isGlobalWidgetContainer",true,"backgroundColor","white","title","","overflowType","hidden","disabled",""]],"style",null,"position2",["^0",["^ ","n","position2","v",["^ ","container","","rowGroup","body","subcontainer","","row",0,"col",0,"height",12,"width",12,"tabNum",0]]],"mobilePosition2",["^0",["^ ","n","position2","v",["^ ","^<","","^=","body","^>","","row",0,"col",0,"^?",12,"^@",12,"^A",0]]],"mobileAppPosition",null,"tabIndex",null,"^<","","createdAt","~m1669756583448","updatedAt","~m1680099541584","folder","","screen",null]]],"select1",["^0",["^ ","n","pluginTemplate","v",["^ ","id","select1","^4","widget","^5","SelectWidget2","^6",null,"^7",null,"^8",null,"^9",["^3",["imageByIndex",[],"_disabledByIndex",["~#iL",["","",""]],"showSelectionIndicator",true,"_values",["^I",["Option 1","Option 2","Option 3"]],"iconByIndex",[],"values",[],"readOnly",false,"iconAfter","","_iconByIndex",["^I",["","",""]],"overlayMinWidth",null,"allowDeselect",false,"inputValue","","hidden",false,"customValidation","","data",[],"searchMode","fuzzy","hideValidationMessage",false,"fallbackTextByIndex",[],"textBefore","","_fallbackTextByIndex",["^I",["","",""]],"selectedItem",null,"validationMessage","","automaticItemColors",false,"itemAdornmentShape","circle","textAfter","","showInEditor",false,"showClear",false,"tooltipText","","labelAlign","left","formDataKey","{{ self.id }}","value",null,"hiddenByIndex",[],"labelCaption","","labelWidth","33","deprecatedLabels",[],"_hiddenByIndex",["^I",["","",""]],"placeholder","Select an option","_captionByIndex",["^I",["","",""]],"_disclosedFields",[],"itemAdornmentSize","auto","label","Label","_hasMigratedNestedItems",true,"captionByIndex",[],"_validate",false,"itemMode","static","labelWidthUnit","%","allowCustomValue",false,"invalid",false,"selectedIndex",null,"_tooltipByIndex",["^I",["","",""]],"_colorByIndex",["^I",["","",""]],"tooltipByIndex",[],"iconBefore","","colorByIndex",[],"selectedLabel","","events",["^I",[["^3",["event","change","type","datasource","method","trigger","pluginId","select1ChangeHandler","targetId",null,"params",["^3",[]],"waitType","debounce","waitMs","0"]]]],"_ids",["^I",["34f0f","d17fe","5ac49"]],"emptyMessage","No options","overlayMaxHeight",375,"loading",false,"disabled",false,"labelPosition","left","_labels",["^I",["","",""]],"labelWrap",false,"disabledValues",[],"disabledByIndex",[],"maintainSpaceWhenHidden",false,"_imageByIndex",["^I",["","",""]],"required",false,"labels",[]]],"^:",["^3",[]],"^;",["^0",["^ ","n","position2","v",["^ ","^<","moduleContainer","^=","body","^>","","row",0.8,"col",4,"^?",1,"^@",4,"^A",0]]],"^B",null,"^C",null,"^D",null,"^<","","^E","~m1682420058723","^F","~m1682420320736","^G","","^H",null]]],"$main",["^0",["^ ","n","pluginTemplate","v",["^ ","id","$main","^4","frame","^5","Frame","^6",null,"^7",null,"^8",null,"^9",["^3",["type","main","sticky",false,"isHiddenOnDesktop",false,"isHiddenOnMobile",false]],"^:",["^3",[]],"^;",null,"^B",null,"^C",null,"^D",null,"^<","","^E","~m1682420058757","^F","~m1682420058757","^G","","^H",null]]],"select1ChangeHandler",["^0",["^ ","n","pluginTemplate","v",["^ ","id","select1ChangeHandler","^4","datasource","^5","GlobalWidgetQuery","^6",null,"^7","GlobalWidgetQuery","^8",null,"^9",["^3",["queryRefreshTime","","lastReceivedFromResourceAt",null,"queryDisabledMessage","","servedFromCache",false,"offlineUserQueryInputs","","successMessage","","queryDisabled","","playgroundQuerySaveId","latest","resourceNameOverride","","runWhenModelUpdates",false,"showFailureToaster",true,"query","","playgroundQueryUuid","","playgroundQueryId",null,"error",null,"privateParams",["^I",[]],"runWhenPageLoadsDelay","","data",null,"importedQueryInputs",["^3",[]],"isImported",false,"showSuccessToaster",true,"cacheKeyTtl","","requestSentTimestamp",null,"metadata",null,"queryRunTime",null,"changesetObject","","errorTransformer","// The variable 'data' allows you to reference the request's data in the transformer. \n// example: return data.find(element => element.isError)\nreturn data.error","finished",null,"confirmationMessage",null,"isFetching",false,"changeset","","rawData",null,"queryTriggerDelay","0","resourceTypeOverride","","watchedParams",["^I",[]],"enableErrorTransformer",false,"showLatestVersionUpdatedWarning",false,"timestamp",0,"importedQueryDefaults",["^3",[]],"enableTransformer",false,"showUpdateSetValueDynamicallyToggle",true,"runWhenPageLoads",false,"transformer","// type your code here\n// example: return formatDataAsArray(data).filter(row => row.quantity > 20)\nreturn data","events",["^I",[]],"queryTimeout","10000","requireConfirmation",false,"queryFailureConditions","","changesetIsObject",false,"enableCaching",false,"allowedGroups",["^I",[]],"offlineQueryType","None","queryThrottleTime","750","updateSetValueDynamically",false,"notificationDuration",""]],"^:",null,"^;",null,"^B",null,"^C",null,"^D",null,"^<","","^E","~m1682420090176","^F","~m1682420099184","^G","","^H",null]]]]],"^E",null,"version","2.113.3","appThemeId",null,"appMaxWidth","1560px","preloadedAppJavaScript",null,"preloadedAppJSLinks",[],"testEntities",[["^ ","id","e8f4f33e-6d7f-4bba-8a8c-2c52c40f1604","name","test1","body","await select1.setValue('Option 1');\nawait eventTriggers.change('select1');\n//await select1ChangeHandler.trigger();\nawait assertQueryCalled('select1ChangeHandler'); ","state",2,"^4","test","pauseAllQueries",true,"failureMessage",null]],"tests",[],"appStyles","","responsiveLayoutDisabled",false,"loadingIndicatorsDisabled",false,"urlFragmentDefinitions",["^I",[]],"pageLoadValueOverrides",["^I",[]],"customDocumentTitle","","customDocumentTitleEnabled",false,"customShortcuts",[],"isGlobalWidget",true,"isMobileApp",false,"multiScreenMobileApp",false,"mobileAppSettings",["^ ","mobileOfflineModeEnabled",false,"mobileOfflineModeDelaySync",false,"displaySetting",["^ ","landscapeMode",false,"tabletMode",false]],"folders",["^I",[]],"queryStatusVisibility",true,"markdownLinkBehavior","auto","inAppRetoolPillAppearance","NO_OVERRIDE","rootScreen",null,"instrumentationEnabled",false,"experimentalPerfFeatures",["^ ","serverDepGraphEnabled",false,"useRuntimeV2",false,"runtimeV2OptOut",false],"experimentalStabilityFeatures",["^ ","lockModelForUpdates",false],"experimentalDataTabEnabled",false]]]"},"changesRecord":[{"type":"WIDGET_REPOSITION2","payload":{"moves":[{"move":{},"widgetIds":[]}],"largeScreen":true},"hideChangelogEntry":false},{"type":"PLUGIN_DELETE","payload":["select1ChangeHandler2"],"hideChangelogEntry":false}],"gitSha":null,"checksum":null,"createdAt":"2023-04-25T11:01:23.401Z","updatedAt":"2023-04-25T11:01:23.401Z","pageId":3,"userId":5,"branchId":"226519bf-881c-4fbe-beba-134e804a7370"},"modules":{}}

Just want to circle back here in case someone else stumbles across this thread! In the test, one of the queries being triggered was a query input, for that to work properly a test query needs to be assigned to it. If you click on the module container you can assign a predefined query as a test value for your input query:

image

At which point it should function properly!