From 1f7b923ad9b53737cda51742334cbd51d162236c Mon Sep 17 00:00:00 2001 From: Parthvi <80334441+Parthvi12@users.noreply.github.com> Date: Fri, 8 Jul 2022 16:18:20 +0530 Subject: [PATCH] test: Automate JSObject app in cypress and fix few flaky tests (#14613) * add tests for promises * update dsl * fix deleteBranch_spec * fix ImportExportForkApplication_spec * update test Co-authored-by: Parthvi Goswami --- app/client/cypress.json | 3 +- .../fixtures/promisesStoreValueDsl.json | 1327 +++++++++++++++++ .../ImportExportForkApplication_spec.js | 3 +- .../Application/PromisesApp_spec.js | 142 ++ .../Git/GitSync/DeleteBranch_spec.js | 3 + app/client/cypress/support/queryCommands.js | 10 + 6 files changed, 1486 insertions(+), 2 deletions(-) create mode 100644 app/client/cypress/fixtures/promisesStoreValueDsl.json create mode 100644 app/client/cypress/integration/Smoke_TestSuite/Application/PromisesApp_spec.js diff --git a/app/client/cypress.json b/app/client/cypress.json index a8d3c6ae99..71716870aa 100644 --- a/app/client/cypress.json +++ b/app/client/cypress.json @@ -14,7 +14,8 @@ "json": false }, "ignoreTestFiles": [ - "**/Smoke_TestSuite/Application/PgAdmin_spec*.js" + "**/Smoke_TestSuite/Application/PgAdmin_spec*.js", + "**/Smoke_TestSuite/Application/PromisesApp_spec.js" ], "chromeWebSecurity": false, "viewportHeight": 1100, diff --git a/app/client/cypress/fixtures/promisesStoreValueDsl.json b/app/client/cypress/fixtures/promisesStoreValueDsl.json new file mode 100644 index 0000000000..2d9ed94a81 --- /dev/null +++ b/app/client/cypress/fixtures/promisesStoreValueDsl.json @@ -0,0 +1,1327 @@ +{ + "dsl": { + "widgetName": "MainContainer", + "backgroundColor": "none", + "rightColumn": 1224, + "snapColumns": 64, + "detachFromLayout": true, + "widgetId": "0", + "topRow": 0, + "bottomRow": 1380, + "containerStyle": "none", + "snapRows": 66, + "parentRowSpace": 1, + "type": "CANVAS_WIDGET", + "canExtend": true, + "version": 59, + "minHeight": 670, + "parentColumnSpace": 1, + "dynamicBindingPathList": [], + "leftColumn": 0, + "children": [ + { + "tabId": "", + "boxShadow": "NONE", + "widgetName": "Container3", + "borderColor": "transparent", + "isCanvas": true, + "displayName": "Container", + "iconSVG": "/static/media/icon.1977dca3.svg", + "searchTags": [ + "div", + "parent", + "group" + ], + "topRow": 61, + "bottomRow": 136, + "parentRowSpace": 10, + "type": "CONTAINER_WIDGET", + "hideCard": false, + "animateLoading": true, + "parentColumnSpace": 9.496093988418579, + "dynamicTriggerPathList": [], + "leftColumn": 0, + "dynamicBindingPathList": [], + "children": [ + { + "rightColumn": 607.7500152587891, + "widgetName": "Canvas4", + "detachFromLayout": true, + "widgetId": "ijtgmtni2k", + "containerStyle": "none", + "bottomRow": 740, + "topRow": 0, + "parentRowSpace": 1, + "isVisible": true, + "type": "CANVAS_WIDGET", + "canExtend": false, + "version": 1, + "parentId": "p7fos7awt2", + "props": { + "containerStyle": "none", + "canExtend": false, + "detachFromLayout": true, + "children": [] + }, + "isLoading": false, + "minHeight": 486.20001220703125, + "renderMode": "CANVAS", + "parentColumnSpace": 1, + "leftColumn": 0, + "children": [ + { + "widgetName": "Text2CopyCopy", + "displayName": "Text", + "iconSVG": "/static/media/icon.97c59b52.svg", + "topRow": 8, + "bottomRow": 18, + "parentRowSpace": 10, + "type": "TEXT_WIDGET", + "hideCard": false, + "animateLoading": true, + "overflow": "NONE", + "fontFamily": "{{appsmith.theme.fontFamily.appFont}}", + "parentColumnSpace": 14.062695503234863, + "dynamicTriggerPathList": [], + "leftColumn": 31, + "dynamicBindingPathList": [ + { + "key": "borderRadius" + }, + { + "key": "fontFamily" + } + ], + "shouldTruncate": false, + "truncateButtonColor": "#FFC13D", + "text": "Step 1: Clear stored values\nStep 2: Use promise.all function to trigger sequential store values\nStep 3: Use then/catch block to trigger second set of sequential store values. This function only triggers store value in catch block", + "key": "yvaa42nezb", + "isDeprecated": false, + "rightColumn": 64, + "textAlign": "LEFT", + "widgetId": "5zjwcuucs2", + "isVisible": true, + "fontStyle": "", + "textColor": "#231F20", + "version": 1, + "parentId": "ijtgmtni2k", + "renderMode": "CANVAS", + "isLoading": false, + "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}", + "fontSize": "0.875rem" + }, + { + "widgetName": "Text3CopyCopy", + "displayName": "Text", + "iconSVG": "/static/media/icon.97c59b52.svg", + "topRow": 0, + "bottomRow": 6, + "parentRowSpace": 10, + "type": "TEXT_WIDGET", + "hideCard": false, + "animateLoading": true, + "overflow": "NONE", + "fontFamily": "{{appsmith.theme.fontFamily.appFont}}", + "parentColumnSpace": 14.062695503234863, + "dynamicTriggerPathList": [], + "leftColumn": 18, + "dynamicBindingPathList": [ + { + "key": "borderRadius" + }, + { + "key": "fontFamily" + } + ], + "shouldTruncate": false, + "truncateButtonColor": "#FFC13D", + "text": "Automation TC2", + "key": "86ix69se60", + "isDeprecated": false, + "rightColumn": 48, + "textAlign": "CENTER", + "widgetId": "pv5wh9p2rb", + "isVisible": true, + "fontStyle": "BOLD", + "textColor": "#231F20", + "version": 1, + "parentId": "ijtgmtni2k", + "renderMode": "CANVAS", + "isLoading": false, + "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}", + "fontSize": "1.875rem" + }, + { + "boxShadow": "none", + "widgetName": "Button3Copy", + "onClick": "{{TC3.myFun2()}}", + "buttonColor": "{{appsmith.theme.colors.primaryColor}}", + "displayName": "Button", + "iconSVG": "/static/media/icon.cca02633.svg", + "searchTags": [ + "click", + "submit" + ], + "topRow": 18, + "bottomRow": 23, + "parentRowSpace": 10, + "type": "BUTTON_WIDGET", + "hideCard": false, + "animateLoading": true, + "parentColumnSpace": 9.496093988418579, + "dynamicTriggerPathList": [ + { + "key": "onClick" + } + ], + "leftColumn": 0, + "dynamicBindingPathList": [ + { + "key": "buttonColor" + }, + { + "key": "borderRadius" + } + ], + "text": "Store values using then/catch", + "isDisabled": false, + "key": "tf875ip5ma", + "isDeprecated": false, + "rightColumn": 24, + "isDefaultClickDisabled": true, + "widgetId": "tvwn4pxtjo", + "isVisible": true, + "recaptchaType": "V3", + "version": 1, + "parentId": "ijtgmtni2k", + "renderMode": "CANVAS", + "isLoading": false, + "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}", + "buttonVariant": "PRIMARY", + "placement": "CENTER" + }, + { + "boxShadow": "none", + "widgetName": "Button3", + "onClick": "{{TC3.myFun1()}}", + "buttonColor": "{{appsmith.theme.colors.primaryColor}}", + "displayName": "Button", + "iconSVG": "/static/media/icon.cca02633.svg", + "searchTags": [ + "click", + "submit" + ], + "topRow": 13, + "bottomRow": 18, + "parentRowSpace": 10, + "type": "BUTTON_WIDGET", + "hideCard": false, + "animateLoading": true, + "parentColumnSpace": 9.496093988418579, + "dynamicTriggerPathList": [ + { + "key": "onClick" + } + ], + "leftColumn": 0, + "dynamicBindingPathList": [ + { + "key": "buttonColor" + }, + { + "key": "borderRadius" + } + ], + "text": "Store values using promise.all", + "isDisabled": false, + "key": "tf875ip5ma", + "isDeprecated": false, + "rightColumn": 24, + "isDefaultClickDisabled": true, + "widgetId": "bs6qb7yb4u", + "isVisible": true, + "recaptchaType": "V3", + "version": 1, + "parentId": "ijtgmtni2k", + "renderMode": "CANVAS", + "isLoading": false, + "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}", + "buttonVariant": "PRIMARY", + "placement": "CENTER" + }, + { + "boxShadow": "none", + "widgetName": "Button2", + "onClick": "{{JSObject1.clearStore()}}", + "buttonColor": "{{appsmith.theme.colors.primaryColor}}", + "displayName": "Button", + "iconSVG": "/static/media/icon.cca02633.svg", + "searchTags": [ + "click", + "submit" + ], + "topRow": 8, + "bottomRow": 13, + "parentRowSpace": 10, + "type": "BUTTON_WIDGET", + "hideCard": false, + "animateLoading": true, + "parentColumnSpace": 9.496093988418579, + "dynamicTriggerPathList": [ + { + "key": "onClick" + } + ], + "leftColumn": 0, + "dynamicBindingPathList": [ + { + "key": "buttonColor" + }, + { + "key": "borderRadius" + } + ], + "text": "Clear store", + "isDisabled": false, + "key": "tf875ip5ma", + "isDeprecated": false, + "rightColumn": 24, + "isDefaultClickDisabled": true, + "widgetId": "qcnf9yi3kl", + "isVisible": true, + "recaptchaType": "V3", + "version": 1, + "parentId": "ijtgmtni2k", + "renderMode": "CANVAS", + "isLoading": false, + "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}", + "buttonVariant": "PRIMARY", + "placement": "CENTER" + }, + { + "boxShadow": "none", + "widgetName": "Image1", + "displayName": "Image", + "iconSVG": "/static/media/icon.52d8fb96.svg", + "topRow": 31, + "bottomRow": 47, + "parentRowSpace": 10, + "type": "IMAGE_WIDGET", + "hideCard": false, + "animateLoading": true, + "parentColumnSpace": 13.75, + "dynamicTriggerPathList": [], + "imageShape": "RECTANGLE", + "leftColumn": 0, + "dynamicBindingPathList": [ + { + "key": "borderRadius" + }, + { + "key": "image" + } + ], + "defaultImage": "", + "key": "q7e2c15fyz", + "image": "{{appsmith.store.pic}}", + "isDeprecated": false, + "rightColumn": 16, + "objectFit": "contain", + "widgetId": "18m6ehwqyv", + "isVisible": true, + "version": 1, + "parentId": "ijtgmtni2k", + "renderMode": "CANVAS", + "isLoading": false, + "maxZoomLevel": 1, + "enableDownload": false, + "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}", + "enableRotation": false + }, + { + "widgetName": "Text7", + "displayName": "Text", + "iconSVG": "/static/media/icon.97c59b523e6f70ba6f40a10fc2c7c5b5.svg", + "searchTags": [ + "typography", + "paragraph" + ], + "topRow": 26, + "bottomRow": 30, + "parentRowSpace": 10, + "type": "TEXT_WIDGET", + "hideCard": false, + "animateLoading": true, + "overflow": "NONE", + "fontFamily": "{{appsmith.theme.fontFamily.appFont}}", + "parentColumnSpace": 13.75, + "dynamicTriggerPathList": [], + "leftColumn": 0, + "dynamicBindingPathList": [ + { + "key": "borderRadius" + }, + { + "key": "fontFamily" + }, + { + "key": "text" + } + ], + "shouldTruncate": false, + "truncateButtonColor": "#FFC13D", + "text": "{{appsmith.store.title}} {{appsmith.store.first}} {{appsmith.store.last}}", + "key": "8vc77e1j1z", + "isDeprecated": false, + "rightColumn": 16, + "textAlign": "LEFT", + "widgetId": "96dlxdqrnf", + "isVisible": true, + "fontStyle": "BOLD", + "textColor": "#231F20", + "version": 1, + "parentId": "ijtgmtni2k", + "renderMode": "CANVAS", + "isLoading": false, + "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}", + "fontSize": "1rem" + }, + { + "zoomLevel": 0, + "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}", + "widgetName": "Map1", + "defaultMarkers": "[{\n \"lat\": {{appsmith.store.lat}},\n \"long\": {{appsmith.store.long}},\n\t\t\"title\": \"User location\"\n}]", + "dynamicPropertyPathList": [ + { + "key": "mapCenter" + } + ], + "displayName": "Map", + "iconSVG": "/static/media/icon.ddde7d1b6b4d64050fde21a347260464.svg", + "topRow": 40, + "bottomRow": 69, + "parentRowSpace": 10, + "type": "MAP_WIDGET", + "hideCard": false, + "animateLoading": true, + "allowZoom": true, + "parentColumnSpace": 13.75, + "dynamicTriggerPathList": [], + "leftColumn": 36, + "dynamicBindingPathList": [ + { + "key": "borderRadius" + }, + { + "key": "boxShadow" + }, + { + "key": "defaultMarkers" + }, + { + "key": "mapCenter" + } + ], + "enablePickLocation": true, + "mapCenter": "{\n \"lat\": {{appsmith.store.lat}},\n \"long\": {{appsmith.store.long}}\n}", + "isClickedMarkerCentered": true, + "isDisabled": false, + "enableSearch": false, + "key": "xpdrclix9k", + "isDeprecated": false, + "rightColumn": 62, + "widgetId": "lvbo7v7lxh", + "enableCreateMarker": false, + "isVisible": true, + "version": 1, + "parentId": "ijtgmtni2k", + "renderMode": "CANVAS", + "isLoading": false, + "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}" + }, + { + "boxShadow": "none", + "widgetName": "DatePicker1", + "minDate": "1920-12-31T18:30:00.000Z", + "dateFormat": "LLL", + "dynamicPropertyPathList": [ + { + "key": "defaultDate" + } + ], + "displayName": "DatePicker", + "iconSVG": "/static/media/icon.300e5ab8e2e1c26c7a0bad06116842b7.svg", + "searchTags": [ + "calendar" + ], + "topRow": 49, + "bottomRow": 53, + "shortcuts": false, + "parentRowSpace": 10, + "labelWidth": "6", + "type": "DATE_PICKER_WIDGET2", + "hideCard": false, + "animateLoading": true, + "parentColumnSpace": 13.75, + "dynamicTriggerPathList": [], + "leftColumn": 0, + "dynamicBindingPathList": [ + { + "key": "accentColor" + }, + { + "key": "borderRadius" + }, + { + "key": "defaultDate" + } + ], + "labelPosition": "Left", + "isDisabled": false, + "key": "x339tqgav5", + "labelTextSize": "0.875rem", + "isRequired": false, + "defaultDate": "{{appsmith.store.dob}}", + "isDeprecated": false, + "rightColumn": 21, + "widgetId": "v1h32cg7fe", + "accentColor": "{{appsmith.theme.colors.primaryColor}}", + "isVisible": true, + "datePickerType": "DATE_PICKER", + "label": "Date of birth", + "version": 2, + "parentId": "ijtgmtni2k", + "labelAlignment": "left", + "renderMode": "CANVAS", + "isLoading": false, + "timePrecision": "minute", + "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}", + "firstDayOfWeek": 0, + "closeOnSelection": true, + "maxDate": "2121-12-31T18:29:00.000Z" + }, + { + "boxShadow": "none", + "widgetName": "PhoneInput1", + "dynamicPropertyPathList": [ + { + "key": "defaultDialCode" + } + ], + "displayName": "Phone Input", + "iconSVG": "/static/media/icon.108789d7165de30306435ab3c24e6cad.svg", + "searchTags": [ + "call" + ], + "topRow": 54, + "bottomRow": 58, + "parentRowSpace": 10, + "labelWidth": "4", + "defaultDialCode": "{{appsmith.store.phone}}", + "autoFocus": false, + "type": "PHONE_INPUT_WIDGET", + "hideCard": false, + "animateLoading": true, + "parentColumnSpace": 13.75, + "dynamicTriggerPathList": [], + "resetOnSubmit": true, + "leftColumn": 0, + "dynamicBindingPathList": [ + { + "key": "accentColor" + }, + { + "key": "borderRadius" + }, + { + "key": "defaultText" + }, + { + "key": "defaultDialCode" + } + ], + "labelPosition": "Left", + "labelStyle": "", + "isDisabled": false, + "key": "3lpv64df30", + "labelTextSize": "0.875rem", + "isRequired": false, + "isDeprecated": false, + "rightColumn": 22, + "widgetId": "2c96r94kzy", + "accentColor": "{{appsmith.theme.colors.primaryColor}}", + "allowDialCodeChange": false, + "isVisible": true, + "label": "Landline", + "version": 1, + "parentId": "ijtgmtni2k", + "labelAlignment": "left", + "allowFormatting": true, + "renderMode": "CANVAS", + "isLoading": false, + "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}", + "iconAlign": "left", + "defaultText": "{{appsmith.store.phone}}" + }, + { + "boxShadow": "none", + "widgetName": "PhoneInput2", + "dynamicPropertyPathList": [ + { + "key": "defaultDialCode" + } + ], + "displayName": "Phone Input", + "iconSVG": "/static/media/icon.108789d7165de30306435ab3c24e6cad.svg", + "searchTags": [ + "call" + ], + "topRow": 59, + "bottomRow": 63, + "parentRowSpace": 10, + "labelWidth": "3", + "defaultDialCode": "", + "autoFocus": false, + "type": "PHONE_INPUT_WIDGET", + "hideCard": false, + "animateLoading": true, + "parentColumnSpace": 13.75, + "dynamicTriggerPathList": [], + "resetOnSubmit": true, + "leftColumn": 0, + "dynamicBindingPathList": [ + { + "key": "accentColor" + }, + { + "key": "borderRadius" + }, + { + "key": "defaultText" + } + ], + "labelPosition": "Left", + "labelStyle": "", + "isDisabled": false, + "key": "3lpv64df30", + "labelTextSize": "0.875rem", + "isRequired": false, + "isDeprecated": false, + "rightColumn": 20, + "widgetId": "qppi9qtlwp", + "accentColor": "{{appsmith.theme.colors.primaryColor}}", + "allowDialCodeChange": false, + "isVisible": true, + "label": "Phone", + "version": 1, + "parentId": "ijtgmtni2k", + "labelAlignment": "left", + "allowFormatting": true, + "renderMode": "CANVAS", + "isLoading": false, + "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}", + "iconAlign": "left", + "defaultText": "{{appsmith.store.cell}}" + }, + { + "boxShadow": "none", + "widgetName": "RadioGroup1", + "displayName": "Radio Group", + "iconSVG": "/static/media/icon.ba2b2ee006e51a5c681d7964d7777481.svg", + "searchTags": [ + "choice" + ], + "topRow": 64, + "bottomRow": 72, + "parentRowSpace": 10, + "labelWidth": 5, + "type": "RADIO_GROUP_WIDGET", + "hideCard": false, + "defaultOptionValue": "{{appsmith.store.gender == \"female\" ? 'F' : 'M'}}", + "animateLoading": true, + "parentColumnSpace": 13.75, + "dynamicTriggerPathList": [], + "leftColumn": 0, + "dynamicBindingPathList": [ + { + "key": "defaultOptionValue" + } + ], + "labelPosition": "Left", + "options": [ + { + "label": "Male", + "value": "M" + }, + { + "label": "Female", + "value": "F" + } + ], + "isDisabled": false, + "key": "rdqw0n133t", + "labelTextSize": "0.875rem", + "isRequired": false, + "isDeprecated": false, + "rightColumn": 20, + "widgetId": "4bqyoh6ydq", + "accentColor": "#d4cab8", + "isVisible": true, + "label": "Gender", + "version": 1, + "parentId": "ijtgmtni2k", + "labelAlignment": "left", + "renderMode": "CANVAS", + "isLoading": false, + "isInline": true, + "alignment": "left" + }, + { + "boxShadow": "none", + "widgetName": "Input1", + "displayName": "Input", + "iconSVG": "/static/media/icon.9f505595da61a34f563dba82adeb06ec.svg", + "searchTags": [ + "form", + "text input", + "number", + "textarea" + ], + "topRow": 30, + "bottomRow": 34, + "parentRowSpace": 10, + "labelWidth": 5, + "autoFocus": false, + "type": "INPUT_WIDGET_V2", + "hideCard": false, + "animateLoading": true, + "parentColumnSpace": 13.75, + "dynamicTriggerPathList": [], + "resetOnSubmit": true, + "leftColumn": 39, + "dynamicBindingPathList": [ + { + "key": "accentColor" + }, + { + "key": "borderRadius" + }, + { + "key": "defaultText" + } + ], + "labelPosition": "Left", + "labelStyle": "", + "inputType": "EMAIL", + "isDisabled": false, + "key": "3u43ehne15", + "labelTextSize": "0.875rem", + "isRequired": false, + "isDeprecated": false, + "rightColumn": 60, + "widgetId": "bzi10gk5x2", + "accentColor": "{{appsmith.theme.colors.primaryColor}}", + "isVisible": true, + "label": "", + "version": 2, + "parentId": "ijtgmtni2k", + "labelAlignment": "left", + "renderMode": "CANVAS", + "isLoading": false, + "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}", + "iconAlign": "left", + "defaultText": "{{appsmith.store.email}}" + }, + { + "boxShadow": "none", + "widgetName": "Input2", + "displayName": "Input", + "iconSVG": "/static/media/icon.9f505595da61a34f563dba82adeb06ec.svg", + "searchTags": [ + "form", + "text input", + "number", + "textarea" + ], + "topRow": 35, + "bottomRow": 39, + "parentRowSpace": 10, + "labelWidth": 5, + "autoFocus": false, + "type": "INPUT_WIDGET_V2", + "hideCard": false, + "animateLoading": true, + "parentColumnSpace": 13.75, + "dynamicTriggerPathList": [], + "resetOnSubmit": true, + "leftColumn": 40, + "dynamicBindingPathList": [ + { + "key": "accentColor" + }, + { + "key": "borderRadius" + }, + { + "key": "defaultText" + } + ], + "labelPosition": "Left", + "labelStyle": "", + "inputType": "PASSWORD", + "isDisabled": false, + "key": "3u43ehne15", + "labelTextSize": "0.875rem", + "isRequired": false, + "isDeprecated": false, + "rightColumn": 59, + "widgetId": "ce3xigfkiy", + "accentColor": "{{appsmith.theme.colors.primaryColor}}", + "isVisible": true, + "label": "", + "version": 2, + "parentId": "ijtgmtni2k", + "labelAlignment": "left", + "renderMode": "CANVAS", + "isLoading": false, + "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}", + "iconAlign": "left", + "defaultText": "{{appsmith.store.password}}" + } + ] + } + ], + "borderWidth": "0", + "key": "qmr0vxzj8r", + "backgroundColor": "#eff6ff", + "isDeprecated": false, + "rightColumn": 64, + "widgetId": "p7fos7awt2", + "containerStyle": "card", + "isVisible": true, + "version": 1, + "parentId": "0", + "renderMode": "CANVAS", + "isLoading": false + }, + { + "tabId": "", + "boxShadow": "NONE", + "widgetName": "Container1", + "borderColor": "transparent", + "isCanvas": true, + "displayName": "Container", + "iconSVG": "/static/media/icon.1977dca3.svg", + "topRow": 0, + "bottomRow": 54, + "parentRowSpace": 10, + "type": "CONTAINER_WIDGET", + "hideCard": false, + "animateLoading": true, + "parentColumnSpace": 14.062695503234863, + "dynamicTriggerPathList": [], + "leftColumn": 0, + "dynamicBindingPathList": [], + "children": [ + { + "rightColumn": 900.0125122070312, + "widgetName": "Canvas1", + "detachFromLayout": true, + "widgetId": "kk1k58hv9w", + "containerStyle": "none", + "bottomRow": 730, + "topRow": 0, + "parentRowSpace": 1, + "isVisible": true, + "type": "CANVAS_WIDGET", + "canExtend": false, + "version": 1, + "parentId": "fprx0bu1rp", + "props": { + "containerStyle": "none", + "canExtend": false, + "detachFromLayout": true, + "children": [] + }, + "isLoading": false, + "minHeight": 731.2601661682129, + "renderMode": "CANVAS", + "parentColumnSpace": 1, + "leftColumn": 0, + "children": [ + { + "widgetName": "Text1", + "borderColor": "#854d0e", + "dynamicPropertyPathList": [ + { + "key": "backgroundColor" + } + ], + "displayName": "Text", + "iconSVG": "/static/media/icon.97c59b52.svg", + "topRow": 47, + "bottomRow": 52, + "parentRowSpace": 10, + "type": "TEXT_WIDGET", + "hideCard": false, + "animateLoading": true, + "overflow": "NONE", + "fontFamily": "{{appsmith.theme.fontFamily.appFont}}", + "parentColumnSpace": 14.062695503234863, + "dynamicTriggerPathList": [], + "leftColumn": 0, + "dynamicBindingPathList": [ + { + "key": "borderRadius" + }, + { + "key": "fontFamily" + }, + { + "key": "text" + }, + { + "key": "backgroundColor" + } + ], + "shouldTruncate": false, + "borderWidth": "2", + "truncateButtonColor": "#FFC13D", + "text": "Step 4: Value is {{Select1.selectedOptionLabel}} and will default to {{appsmith.store.selected}}", + "key": "lk4gyh2a8t", + "isDeprecated": false, + "rightColumn": 33, + "backgroundColor": "{{Select1.selectedOptionLabel}}", + "textAlign": "CENTER", + "widgetId": "iv3qlgn05v", + "isVisible": true, + "fontStyle": "", + "textColor": "#e4e4e7", + "version": 1, + "parentId": "kk1k58hv9w", + "renderMode": "CANVAS", + "isLoading": false, + "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}", + "fontSize": "0.875rem" + }, + { + "boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}", + "widgetName": "Table1", + "defaultPageSize": 0, + "columnOrder": [ + "userId", + "id", + "title", + "body" + ], + "isVisibleDownload": true, + "dynamicPropertyPathList": [], + "displayName": "Table", + "iconSVG": "/static/media/icon.db8a9cbd.svg", + "topRow": 18, + "bottomRow": 46, + "isSortable": true, + "parentRowSpace": 10, + "type": "TABLE_WIDGET", + "defaultSelectedRow": "0", + "hideCard": false, + "animateLoading": true, + "parentColumnSpace": 14.062695503234863, + "dynamicTriggerPathList": [], + "dynamicBindingPathList": [ + { + "key": "accentColor" + }, + { + "key": "borderRadius" + }, + { + "key": "boxShadow" + }, + { + "key": "childStylesheet.button.buttonColor" + }, + { + "key": "childStylesheet.button.borderRadius" + }, + { + "key": "childStylesheet.menuButton.menuColor" + }, + { + "key": "childStylesheet.menuButton.borderRadius" + }, + { + "key": "childStylesheet.iconButton.menuColor" + }, + { + "key": "childStylesheet.iconButton.borderRadius" + }, + { + "key": "tableData" + }, + { + "key": "primaryColumns.id.computedValue" + }, + { + "key": "primaryColumns.userId.computedValue" + }, + { + "key": "primaryColumns.title.computedValue" + }, + { + "key": "primaryColumns.body.computedValue" + } + ], + "leftColumn": 0, + "primaryColumns": { + "id": { + "index": 0, + "width": 150, + "id": "id", + "horizontalAlignment": "LEFT", + "verticalAlignment": "CENTER", + "columnType": "text", + "textSize": "0.875rem", + "enableFilter": true, + "enableSort": true, + "isVisible": true, + "isDisabled": false, + "isCellVisible": true, + "isDerived": false, + "label": "id", + "computedValue": "{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.id))}}" + }, + "userId": { + "index": 0, + "width": 150, + "id": "userId", + "horizontalAlignment": "LEFT", + "verticalAlignment": "CENTER", + "columnType": "text", + "textColor": "", + "textSize": "0.875rem", + "enableFilter": true, + "enableSort": true, + "isVisible": true, + "isDisabled": false, + "isCellVisible": true, + "isDerived": false, + "label": "userId", + "computedValue": "{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.userId))}}", + "cellBackground": "" + }, + "title": { + "index": 2, + "width": 150, + "id": "title", + "horizontalAlignment": "LEFT", + "verticalAlignment": "CENTER", + "columnType": "text", + "textColor": "", + "textSize": "0.875rem", + "enableFilter": true, + "enableSort": true, + "isVisible": true, + "isDisabled": false, + "isCellVisible": true, + "isDerived": false, + "label": "title", + "computedValue": "{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.title))}}", + "cellBackground": "" + }, + "body": { + "index": 3, + "width": 150, + "id": "body", + "horizontalAlignment": "LEFT", + "verticalAlignment": "CENTER", + "columnType": "text", + "textColor": "", + "textSize": "0.875rem", + "enableFilter": true, + "enableSort": true, + "isVisible": true, + "isDisabled": false, + "isCellVisible": true, + "isDerived": false, + "label": "body", + "computedValue": "{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.body))}}", + "cellBackground": "" + } + }, + "delimiter": ",", + "key": "sbikkpxlt6", + "derivedColumns": {}, + "isDeprecated": false, + "rightColumn": 35, + "textSize": "0.875rem", + "widgetId": "hzi419yzw9", + "accentColor": "{{appsmith.theme.colors.primaryColor}}", + "isVisibleFilters": true, + "tableData": "{{TC1api.data.users}}", + "isVisible": true, + "label": "Data", + "searchKey": "", + "enableClientSideSearch": true, + "version": 3, + "totalRecordsCount": 0, + "parentId": "kk1k58hv9w", + "renderMode": "CANVAS", + "isLoading": false, + "horizontalAlignment": "LEFT", + "isVisibleSearch": true, + "childStylesheet": { + "button": { + "buttonColor": "{{appsmith.theme.colors.primaryColor}}", + "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}", + "boxShadow": "none" + }, + "menuButton": { + "menuColor": "{{appsmith.theme.colors.primaryColor}}", + "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}", + "boxShadow": "none" + }, + "iconButton": { + "menuColor": "{{appsmith.theme.colors.primaryColor}}", + "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}", + "boxShadow": "none" + } + }, + "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}", + "isVisiblePagination": true, + "verticalAlignment": "CENTER", + "columnSizeMap": { + "task": 245, + "step": 62, + "status": 75 + } + }, + { + "boxShadow": "none", + "widgetName": "Audio1", + "dynamicPropertyPathList": [ + { + "key": "onPlay" + } + ], + "displayName": "Audio", + "iconSVG": "/static/media/icon.cb54df7a.svg", + "topRow": 18, + "bottomRow": 22, + "parentRowSpace": 10, + "type": "AUDIO_WIDGET", + "hideCard": false, + "animateLoading": true, + "parentColumnSpace": 14.062695503234863, + "dynamicTriggerPathList": [ + { + "key": "onPlay" + } + ], + "leftColumn": 36, + "dynamicBindingPathList": [ + { + "key": "borderRadius" + }, + { + "key": "accentColor" + } + ], + "key": "1ujq0d6hyd", + "isDeprecated": false, + "rightColumn": 63, + "widgetId": "8bjrosh0ou", + "accentColor": "{{appsmith.theme.colors.primaryColor}}", + "isVisible": true, + "version": 1, + "onPlay": "{{JSObject1.myFun1()}}", + "url": "https://assets.appsmith.com/widgets/birds_chirping.mp3", + "parentId": "kk1k58hv9w", + "renderMode": "CANVAS", + "isLoading": false, + "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}", + "autoPlay": false + }, + { + "boxShadow": "none", + "widgetName": "Select1", + "isFilterable": true, + "displayName": "Select", + "iconSVG": "/static/media/icon.bd99caba.svg", + "labelText": "Step 2:", + "topRow": 12, + "bottomRow": 16, + "parentRowSpace": 10, + "labelWidth": 5, + "type": "SELECT_WIDGET", + "serverSideFiltering": false, + "hideCard": false, + "defaultOptionValue": "Green", + "animateLoading": true, + "parentColumnSpace": 14.062695503234863, + "dynamicTriggerPathList": [], + "leftColumn": 0, + "dynamicBindingPathList": [ + { + "key": "accentColor" + }, + { + "key": "borderRadius" + } + ], + "labelPosition": "Left", + "options": "[\n {\n \"label\": \"Blue\",\n \"value\": \"BLUE\"\n },\n {\n \"label\": \"Green\",\n \"value\": \"GREEN\"\n },\n {\n \"label\": \"Red\",\n \"value\": \"RED\"\n },\n\t{\n \"label\": \"Yellow\",\n \"value\": \"YELLOW\"\n },\n\t{\n \"label\": \"Grey\",\n \"value\": \"GREY\"\n }\n]", + "placeholderText": "Select option", + "isDisabled": false, + "key": "2uz2gkca46", + "labelTextSize": "0.875rem", + "isRequired": false, + "isDeprecated": false, + "rightColumn": 20, + "widgetId": "h3jvfg6ol2", + "accentColor": "{{appsmith.theme.colors.primaryColor}}", + "isVisible": true, + "version": 1, + "parentId": "kk1k58hv9w", + "labelAlignment": "left", + "renderMode": "CANVAS", + "isLoading": false, + "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}" + }, + { + "widgetName": "Text2", + "displayName": "Text", + "iconSVG": "/static/media/icon.97c59b52.svg", + "topRow": 8, + "bottomRow": 16, + "parentRowSpace": 10, + "type": "TEXT_WIDGET", + "hideCard": false, + "animateLoading": true, + "overflow": "NONE", + "fontFamily": "{{appsmith.theme.fontFamily.appFont}}", + "parentColumnSpace": 14.062695503234863, + "dynamicTriggerPathList": [], + "leftColumn": 26, + "dynamicBindingPathList": [ + { + "key": "borderRadius" + }, + { + "key": "fontFamily" + } + ], + "shouldTruncate": false, + "truncateButtonColor": "#FFC13D", + "text": "Step 1: Change toggle to off on Switch widget\nStep 2: Change dropdown option from Green to any another option\nStep 3: Go to page 4 of table widget\nStep 4: Hit Audio button play button to trigger actions", + "key": "yvaa42nezb", + "isDeprecated": false, + "rightColumn": 64, + "textAlign": "LEFT", + "widgetId": "ohazs8n5hb", + "isVisible": true, + "fontStyle": "", + "textColor": "#231F20", + "version": 1, + "parentId": "kk1k58hv9w", + "renderMode": "CANVAS", + "isLoading": false, + "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}", + "fontSize": "0.875rem" + }, + { + "boxShadow": "none", + "widgetName": "Switch1", + "displayName": "Switch", + "iconSVG": "/static/media/icon.a3115bc1.svg", + "topRow": 7, + "bottomRow": 11, + "parentRowSpace": 10, + "type": "SWITCH_WIDGET", + "alignWidget": "RIGHT", + "hideCard": false, + "animateLoading": true, + "parentColumnSpace": 14.062695503234863, + "dynamicTriggerPathList": [ + { + "key": "onChange" + } + ], + "leftColumn": 0, + "dynamicBindingPathList": [], + "labelPosition": "Left", + "isDisabled": false, + "key": "633iji72ol", + "isDeprecated": false, + "rightColumn": 12, + "onChange": "{{showAlert('Switch widget has changed')}}", + "widgetId": "0hmn8m90ei", + "accentColor": "#d4cab8", + "isVisible": true, + "label": "Step 1:", + "defaultSwitchState": true, + "version": 1, + "parentId": "kk1k58hv9w", + "renderMode": "CANVAS", + "isLoading": false + }, + { + "widgetName": "Text3", + "displayName": "Text", + "iconSVG": "/static/media/icon.97c59b52.svg", + "topRow": 0, + "bottomRow": 6, + "parentRowSpace": 10, + "type": "TEXT_WIDGET", + "hideCard": false, + "animateLoading": true, + "overflow": "NONE", + "fontFamily": "{{appsmith.theme.fontFamily.appFont}}", + "parentColumnSpace": 14.062695503234863, + "dynamicTriggerPathList": [], + "leftColumn": 17, + "dynamicBindingPathList": [ + { + "key": "borderRadius" + }, + { + "key": "fontFamily" + } + ], + "shouldTruncate": false, + "truncateButtonColor": "#FFC13D", + "text": "Automation TC1", + "key": "86ix69se60", + "isDeprecated": false, + "rightColumn": 47, + "textAlign": "CENTER", + "widgetId": "046n7liqib", + "isVisible": true, + "fontStyle": "BOLD", + "textColor": "#231F20", + "version": 1, + "parentId": "kk1k58hv9w", + "renderMode": "CANVAS", + "isLoading": false, + "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}", + "fontSize": "1.875rem" + } + ] + } + ], + "borderWidth": "0", + "key": "d713hjidlo", + "backgroundColor": "#eff6ff", + "isDeprecated": false, + "rightColumn": 64, + "widgetId": "fprx0bu1rp", + "containerStyle": "card", + "isVisible": true, + "version": 1, + "parentId": "0", + "renderMode": "CANVAS", + "isLoading": false + } + ] + } + } \ No newline at end of file diff --git a/app/client/cypress/integration/Smoke_TestSuite/Application/ImportExportForkApplication_spec.js b/app/client/cypress/integration/Smoke_TestSuite/Application/ImportExportForkApplication_spec.js index 469923152a..a9a8692c8c 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/Application/ImportExportForkApplication_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/Application/ImportExportForkApplication_spec.js @@ -42,6 +42,7 @@ describe("Import, Export and Fork application and validate data binding", functi cy.get(homePage.applicationName) .clear() .type(appName); + cy.wait(2000); cy.wrap(appName).as("appname"); cy.wait(2000); // validating data binding for the imported application @@ -57,7 +58,7 @@ describe("Import, Export and Fork application and validate data binding", functi // fork application cy.get(homePage.homeIcon).click(); cy.get(homePage.searchInput).type(`${appName}`); - cy.wait(2000); + cy.wait(3000); cy.get(homePage.applicationCard) .first() .trigger("mouseover"); diff --git a/app/client/cypress/integration/Smoke_TestSuite/Application/PromisesApp_spec.js b/app/client/cypress/integration/Smoke_TestSuite/Application/PromisesApp_spec.js new file mode 100644 index 0000000000..711e4bb8d0 --- /dev/null +++ b/app/client/cypress/integration/Smoke_TestSuite/Application/PromisesApp_spec.js @@ -0,0 +1,142 @@ +import { ObjectsRegistry } from "../../../support/Objects/Registry"; +const homePage = require("../../../locators/HomePage"); +const dsl = require("../../../fixtures/promisesStoreValueDsl.json"); +const widgetsPage = require("../../../locators/Widgets.json"); +const commonlocators = require("../../../locators/commonlocators.json"); +const jsEditorLocators = require("../../../locators/JSEditor.json"); +let agHelper = ObjectsRegistry.AggregateHelper, + ee = ObjectsRegistry.EntityExplorer, + jsEditor = ObjectsRegistry.JSEditor; +const newPage = "TableTest"; + +describe("JSEditor tests", function() { + before(() => { + cy.addDsl(dsl); + }); + beforeEach(() => { + cy.startServerAndRoutes(); + }); + it("Testing promises with resetWidget, storeValue action and API call", () => { + cy.NavigateToAPI_Panel(); + cy.CreateAPI("TC1api"); + cy.enterDatasourceAndPath("https://mock-api.appsmith.com/", "users"); + cy.WaitAutoSave(); + cy.CheckAndUnfoldEntityItem("PAGES"); + jsEditor.CreateJSObject( + `export default { + myFun1: async () => { //comment + await this.clearStore() //clear store value before running the case + return resetWidget('Switch1') + .then(() => { + resetWidget('Select1') + resetWidget('Table1') + return this.myFun2() //return a toast message + .then(() => { + storeValue('selected', Select1.selectedOptionValue) + showAlert(appsmith.store.selected) }) }) //return a second toast message + .catch(() => { + resetWidget('RadioGroup1') + showAlert("Couldn't execute all the success call steps, hence now in the fail part") }) + }, + myFun2: () => { + return TC1api.run() + .then (() => {return showAlert("Success running API query")}) + .catch (() => {return showAlert("Couldn't run API query")}) + }, + clearStore: async () => { //function to clear store values + Object.keys(appsmith.store).forEach((eachKey) => { + storeValue(eachKey, 'undefined') + //return showAlert(eachKey) + }) + } + }`, + { + paste: true, + completeReplace: true, + toRun: false, + shouldCreateNewJSObj: true, + }, + ); + //cy.wait(10000); + // run the jsObject + /* cy.SelecJSFunctionAndRun('myFun1') + cy.wait(3000); + cy.wait("@postExecute").should( + "have.nested.property", + "response.body.responseMeta.status", + 200, + ); */ + cy.Createpage(newPage); + cy.get(`.t--entity-item:contains(${newPage})`).click(); + cy.wait(1000); + cy.get(".t--entity-item:contains(Page1)") + .first() + .click(); + cy.wait("@getPage"); + // verify text in the text widget + cy.get(".t--draggable-textwidget span") + .eq(2) + .invoke("text") + .then((text) => { + expect(text).to.equal( + "Step 4: Value is Green and will default to undefined", + ); + }); + // toggle off the switch + cy.get(".t--switch-widget-active .bp3-control-indicator").click({ + force: true, + }); + cy.get(homePage.toastMessage).should( + "contain", + "Switch widget has changed", + ); + // select an option from select widget + cy.get(".bp3-button.select-button").click({ force: true }); + cy.get(".menu-item-text") + .eq(2) + .click({ force: true }); + // verify text is visible + cy.get(".t--draggable-textwidget span") + .eq(2) + .invoke("text") + .then((text) => { + expect(text).to.equal("Step 4: Value is Green and will default to Red"); + }); + // hit audio play button and trigger actions + cy.openPropertyPane("audiowidget"); + cy.get(widgetsPage.autoPlay).click({ force: true }); + cy.wait("@postExecute").should( + "have.nested.property", + "response.body.responseMeta.status", + 200, + ); + cy.get(homePage.toastMessage).should( + "contain", + "Success running API query", + "GREEN", + ); + }); + it("Testing dynamic widgets display using consecutive storeValue calls", () => { + cy.CheckAndUnfoldEntityItem("QUERIES/JS"); + cy.get(".t--entity-item:contains(JSObject1)"); + cy.xpath("//span[name='expand-more']").click(); + cy.get("[data-cy='t--dropdown-option-clearStore']").click(); + cy.get(jsEditorLocators.runButton) + .first() + .click(); + cy.wait("@postExecute").should( + "have.nested.property", + "response.body.responseMeta.status", + 200, + ); + cy.xpath("//span[text()='Clear store']").click({ force: true }); + cy.get(".t--draggable-textwidget span") + .eq(2) + .invoke("text") + .then((text) => { + expect(text).to.equal( + "Step 4: Value is Green and will default to undefined", + ); + }); + }); +}); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Git/GitSync/DeleteBranch_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Git/GitSync/DeleteBranch_spec.js index 483305cbdd..4d4f16a63f 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Git/GitSync/DeleteBranch_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Git/GitSync/DeleteBranch_spec.js @@ -95,12 +95,15 @@ describe("Delete branch flow", () => { cy.commitAndPush(); cy.wait(1000); cy.switchGitBranch("master"); + cy.wait(3000); cy.get(gitSyncLocators.branchButton).click(); cy.get(gitSyncLocators.branchListItem) .eq(1) .trigger("mouseenter") .within(() => { + cy.wait(1000); cy.get(gitSyncLocators.gitBranchContextMenu).click(); + cy.wait(1000); cy.get(gitSyncLocators.gitBranchDelete).click(); }); cy.wait("@deleteBranch").should( diff --git a/app/client/cypress/support/queryCommands.js b/app/client/cypress/support/queryCommands.js index ea80ee421d..3105d9d103 100644 --- a/app/client/cypress/support/queryCommands.js +++ b/app/client/cypress/support/queryCommands.js @@ -3,6 +3,7 @@ require("cy-verify-downloads").addCustomCommand(); require("cypress-file-upload"); +const jsEditorLocators = require("../locators/JSEditor.json"); const datasourceEditor = require("../locators/DatasourcesEditor.json"); const datasourceFormData = require("../fixtures/datasources.json"); const commonlocators = require("../locators/commonlocators.json"); @@ -282,3 +283,12 @@ Cypress.Commands.add("NavigateToAction", (actionName) => { .should("be.visible") .click(); }); +Cypress.Commands.add("SelecJSFunctionAndRun", (functionName) => { + cy.xpath("//span[@name='expand-more']") + .first() + .click(); + cy.get(`[data-cy='t--dropdown-option-${functionName}']`).click(); + cy.get(jsEditorLocators.runButton) + .first() + .click(); +});