From a12c183c1200b8528d3138fc2c70fb97b838ade4 Mon Sep 17 00:00:00 2001 From: Tolulope Adetula <31691737+Tooluloope@users.noreply.github.com> Date: Tue, 29 Mar 2022 08:07:01 +0100 Subject: [PATCH 01/10] fix: default value consistency issues in select widget --- .../SelectWidget/widget/index.test.tsx | 68 +++++++++++++++++++ .../src/widgets/SelectWidget/widget/index.tsx | 11 +-- 2 files changed, 75 insertions(+), 4 deletions(-) diff --git a/app/client/src/widgets/SelectWidget/widget/index.test.tsx b/app/client/src/widgets/SelectWidget/widget/index.test.tsx index 9d697ce970..7c11839c64 100644 --- a/app/client/src/widgets/SelectWidget/widget/index.test.tsx +++ b/app/client/src/widgets/SelectWidget/widget/index.test.tsx @@ -13,6 +13,40 @@ describe("defaultOptionValueValidation - ", () => { messages: [""], }); }); + it("should get tested with number", () => { + const testValues = [ + [ + "{{1}}", + { + isValid: true, + parsed: 1, + messages: [""], + }, + ], + [ + "1", + { + isValid: true, + parsed: "1", + messages: [""], + }, + ], + [ + 1, + { + isValid: true, + parsed: 1, + messages: [""], + }, + ], + ]; + + testValues.forEach(([input, expected]) => { + expect( + defaultOptionValueValidation(input, {} as SelectWidgetProps, _), + ).toEqual(expected); + }); + }); it("should get tested with simple string", () => { const input = "green"; @@ -43,6 +77,40 @@ describe("defaultOptionValueValidation - ", () => { messages: [""], }); }); + it("should get tested with valid strings", () => { + const testValues = [ + [ + "undefined", + { + isValid: true, + parsed: "undefined", + messages: [""], + }, + ], + [ + "null", + { + isValid: true, + parsed: "null", + messages: [""], + }, + ], + [ + "true", + { + isValid: true, + parsed: "true", + messages: [""], + }, + ], + ]; + + testValues.forEach(([input, expected]) => { + expect( + defaultOptionValueValidation(input, {} as SelectWidgetProps, _), + ).toEqual(expected); + }); + }); it("should get tested with invalid values", () => { const testValues = [ diff --git a/app/client/src/widgets/SelectWidget/widget/index.tsx b/app/client/src/widgets/SelectWidget/widget/index.tsx index 1acb229f1a..581b08162a 100644 --- a/app/client/src/widgets/SelectWidget/widget/index.tsx +++ b/app/client/src/widgets/SelectWidget/widget/index.tsx @@ -11,12 +11,12 @@ import { import { EvaluationSubstitutionType } from "entities/DataTree/dataTreeFactory"; import { MinimumPopupRows, GRID_DENSITY_MIGRATION_V1 } from "widgets/constants"; import { AutocompleteDataType } from "utils/autocomplete/TernServer"; -import { findIndex, isArray, isNumber, isString } from "lodash"; +import { findIndex, isArray, isNumber, isString, LoDashStatic } from "lodash"; export function defaultOptionValueValidation( value: unknown, props: SelectWidgetProps, - _: any, + _: LoDashStatic, ): ValidationResponse { let isValid; let parsed; @@ -40,7 +40,10 @@ export function defaultOptionValueValidation( */ if (typeof value === "string") { try { - value = JSON.parse(value); + const parsedValue = JSON.parse(value); + if (_.isObject(parsedValue)) { + value = parsedValue; + } } catch (e) {} } @@ -53,7 +56,7 @@ export function defaultOptionValueValidation( } else { isValid = false; parsed = {}; - message = `value does not evaluate to type: string | { "label": "label1", "value": "value1" }`; + message = `value does not evaluate to type: string | number | { "label": "label1", "value": "value1" }`; } return { From e89c454ce5a9d6cfdb2aeb2815abee0a6474435c Mon Sep 17 00:00:00 2001 From: Tolulope Adetula <31691737+Tooluloope@users.noreply.github.com> Date: Tue, 29 Mar 2022 08:39:34 +0100 Subject: [PATCH 02/10] fix: add cypress tests --- .../DisplayWidgets/Dropdown_spec.js | 47 +++++++++++++++++-- .../SelectWidget/widget/index.test.tsx | 8 ---- 2 files changed, 44 insertions(+), 11 deletions(-) diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Dropdown_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Dropdown_spec.js index 1d550d9ca0..3d462ac092 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Dropdown_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Dropdown_spec.js @@ -8,9 +8,6 @@ describe("Dropdown Widget Functionality", function() { before(() => { cy.addDsl(dsl); }); - beforeEach(() => { - cy.wait(7000); - }); it("Add new dropdown widget", () => { cy.get(explorer.addWidget).click(); @@ -93,6 +90,50 @@ describe("Dropdown Widget Functionality", function() { cy.get(formWidgetsPage.dropdownDefaultButton).should("contain", "Blue"); }); + it("should check that special strings are parsed as string in default value", () => { + cy.openPropertyPane("selectwidget"); + cy.updateCodeInput( + ".t--property-control-options", + `[{ + "label": "Blue", + "value": "null" + }, + { + "label": "Green", + "value": 100 + }, + { + "label": "Red", + "value": "120" + }]`, + ); + cy.updateCodeInput(".t--property-control-defaultvalue", "null"); + cy.get(".t--property-control-defaultvalue .t--codemirror-has-error").should( + "not.exist", + ); + cy.get(formWidgetsPage.dropdownDefaultButton).should("contain", "Blue"); + + cy.openPropertyPane("selectwidget"); + cy.updateCodeInput(".t--property-control-defaultvalue", "120"); + cy.get(".t--property-control-defaultvalue .t--codemirror-has-error").should( + "not.exist", + ); + cy.get(formWidgetsPage.dropdownDefaultButton).should("contain", "Red"); + + cy.openPropertyPane("selectwidget"); + cy.updateCodeInput(".t--property-control-defaultvalue", "{{ 100 }}"); + cy.get(".t--property-control-defaultvalue .t--codemirror-has-error").should( + "not.exist", + ); + cy.get(formWidgetsPage.dropdownDefaultButton).should("contain", "Green"); + + cy.openPropertyPane("selectwidget"); + cy.updateCodeInput(".t--property-control-defaultvalue", "{{ null }}"); + cy.get(".t--property-control-defaultvalue .t--codemirror-has-error").should( + "exist", + ); + }); + it("Dropdown Functionality To Check disabled Widget", function() { cy.openPropertyPane("selectwidget"); // Disable the visible JS diff --git a/app/client/src/widgets/SelectWidget/widget/index.test.tsx b/app/client/src/widgets/SelectWidget/widget/index.test.tsx index 7c11839c64..5c6bd0ff9b 100644 --- a/app/client/src/widgets/SelectWidget/widget/index.test.tsx +++ b/app/client/src/widgets/SelectWidget/widget/index.test.tsx @@ -15,14 +15,6 @@ describe("defaultOptionValueValidation - ", () => { }); it("should get tested with number", () => { const testValues = [ - [ - "{{1}}", - { - isValid: true, - parsed: 1, - messages: [""], - }, - ], [ "1", { From 6aa2c36ea470f0b8b189f968ce5f34a60ee842fb Mon Sep 17 00:00:00 2001 From: Tolulope Adetula <31691737+Tooluloope@users.noreply.github.com> Date: Tue, 29 Mar 2022 08:55:19 +0100 Subject: [PATCH 03/10] fix: test failure --- .../src/widgets/SelectWidget/widget/index.test.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/client/src/widgets/SelectWidget/widget/index.test.tsx b/app/client/src/widgets/SelectWidget/widget/index.test.tsx index 5c6bd0ff9b..6bc3a069e4 100644 --- a/app/client/src/widgets/SelectWidget/widget/index.test.tsx +++ b/app/client/src/widgets/SelectWidget/widget/index.test.tsx @@ -112,7 +112,7 @@ describe("defaultOptionValueValidation - ", () => { isValid: false, parsed: {}, messages: [ - `value does not evaluate to type: string | { "label": "label1", "value": "value1" }`, + `value does not evaluate to type: string | number | { "label": "label1", "value": "value1" }`, ], }, ], @@ -122,7 +122,7 @@ describe("defaultOptionValueValidation - ", () => { isValid: false, parsed: {}, messages: [ - `value does not evaluate to type: string | { "label": "label1", "value": "value1" }`, + `value does not evaluate to type: string | number | { "label": "label1", "value": "value1" }`, ], }, ], @@ -132,7 +132,7 @@ describe("defaultOptionValueValidation - ", () => { isValid: false, parsed: {}, messages: [ - `value does not evaluate to type: string | { "label": "label1", "value": "value1" }`, + `value does not evaluate to type: string | number | { "label": "label1", "value": "value1" }`, ], }, ], @@ -142,7 +142,7 @@ describe("defaultOptionValueValidation - ", () => { isValid: false, parsed: {}, messages: [ - `value does not evaluate to type: string | { "label": "label1", "value": "value1" }`, + `value does not evaluate to type: string | number | { "label": "label1", "value": "value1" }`, ], }, ], @@ -154,7 +154,7 @@ describe("defaultOptionValueValidation - ", () => { isValid: false, parsed: {}, messages: [ - `value does not evaluate to type: string | { "label": "label1", "value": "value1" }`, + `value does not evaluate to type: string | number | { "label": "label1", "value": "value1" }`, ], }, ], From 797f1c0788ff28dbde72a6cc57c8a9b24416335a Mon Sep 17 00:00:00 2001 From: Nayan Date: Sun, 3 Apr 2022 10:07:59 +0600 Subject: [PATCH 05/10] chore: removed feature flag for app template (#12485) Removed feature flag for templates as we're planning to go live --- .../src/main/resources/features/init-flags.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/server/appsmith-server/src/main/resources/features/init-flags.yml b/app/server/appsmith-server/src/main/resources/features/init-flags.yml index 2f529bfac7..df1d9d0fc7 100644 --- a/app/server/appsmith-server/src/main/resources/features/init-flags.yml +++ b/app/server/appsmith-server/src/main/resources/features/init-flags.yml @@ -57,7 +57,7 @@ ff4j: enable: true description: Allow users to browse application templates and import them flipstrategy: - class: com.appsmith.server.featureflags.strategies.EmailBasedRolloutStrategy + class: org.ff4j.strategy.PonderationStrategy param: - - name: emailDomains - value: appsmith.com + - name: weight + value: 1 From 6e2606586511fc39d5a0ee5d00c1b5b1c44bbbcf Mon Sep 17 00:00:00 2001 From: rashmi rai Date: Sun, 3 Apr 2022 22:11:59 +0530 Subject: [PATCH 06/10] fix: fetchOptionsCondtionally (#12347) --- app/client/src/utils/FormControlRegistry.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/client/src/utils/FormControlRegistry.tsx b/app/client/src/utils/FormControlRegistry.tsx index 173a7d7b4d..d4fd124293 100644 --- a/app/client/src/utils/FormControlRegistry.tsx +++ b/app/client/src/utils/FormControlRegistry.tsx @@ -151,7 +151,7 @@ class FormControlRegistry { buildPropertyControl(controlProps: DropDownControlProps): JSX.Element { return ( Date: Sun, 3 Apr 2022 22:13:20 +0530 Subject: [PATCH 07/10] test: Cypress tests to include Deploy mode verifications + few flaky fixes (#12444) --- app/client/cypress.json | 5 +- .../cypress/fixtures/Select_table_dsl.json | 490 +++++++++--------- .../fixtures/onPageLoadActionsDsl.json | 302 +++++------ app/client/cypress/fixtures/paramsDsl.json | 2 +- .../Application/AForceMigration_Spec.ts | 6 +- .../ApiPaneTests/API_MultiPart_Spec.ts | 50 +- .../ClientSideTests/Auth/Analytics_spec.js | 18 +- .../BindButton_Text_WithRecaptcha_spec.js | 11 +- .../Binding/JSObjectToInput_Spec.ts | 49 +- .../Binding/JSObjectToListWidget_Spec.ts | 75 ++- .../Binding/LoadashBasic_Spec.ts | 5 +- .../Binding/MomentBasic_Spec.ts | 5 +- .../ClientSideTests/Binding/Promises_Spec.ts | 99 ++-- .../Binding/SelectWidget_Spec.ts | 79 +++ .../Binding/Select_Widget_Value_spec.js | 48 -- .../Binding/aTobAndbToaBasic_Spec.ts | 7 +- .../DisplayWidgets/ChartDataPoint_Spec.ts | 22 +- .../DisplayWidgets/DocumentViewer_Spec.ts | 6 +- .../DisplayWidgets/Migration_Spec.js | 30 +- .../Table_tabledata_schema_spec.js | 6 +- .../ClientSideTests/GenerateCRUD/S3_Spec.js | 2 +- .../Replay/Replay_Editor_spec.js | 1 + .../ApiPaneTests/API_Bugs_Spec.js | 12 +- .../Datasources/MySQLNoiseTest_spec.js | 6 +- .../Datasources/SMTPDatasource_spec.js | 4 +- ...tity_Explorer_Datasource_Structure_spec.js | 2 +- .../LayoutOnLoadActions/OnLoadActions_Spec.ts | 258 ++++----- .../Params/PassingParams_Spec.ts | 366 ++++--------- .../ServerSideTests/QueryPane/S3_spec.js | 6 +- .../cypress/locators/commonlocators.json | 2 +- .../cypress/support/Objects/CommonLocators.ts | 14 +- .../cypress/support/Objects/Registry.ts | 10 +- .../cypress/support/Pages/AggregateHelper.ts | 116 ++++- app/client/cypress/support/Pages/ApiPage.ts | 86 ++- .../cypress/support/Pages/DataSources.ts | 9 +- .../cypress/support/Pages/EntityExplorer.ts | 8 +- app/client/cypress/support/Pages/HomePage.ts | 4 +- app/client/cypress/support/Pages/JSEditor.ts | 12 +- app/client/cypress/support/Pages/Table.ts | 63 ++- app/client/cypress/support/commands.js | 33 +- app/client/cypress/support/index.js | 9 +- 41 files changed, 1169 insertions(+), 1169 deletions(-) create mode 100644 app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/SelectWidget_Spec.ts delete mode 100644 app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Select_Widget_Value_spec.js diff --git a/app/client/cypress.json b/app/client/cypress.json index 23ce69fcfe..c6e54daa60 100644 --- a/app/client/cypress.json +++ b/app/client/cypress.json @@ -1,8 +1,9 @@ { "baseUrl": "https://dev.appsmith.com/", - "defaultCommandTimeout": 20000, + "defaultCommandTimeout": 30000, "requestTimeout": 21000, - "pageLoadTimeout": 20000, + "responseTimeout": 30000, + "pageLoadTimeout": 40000, "video": true, "videoUploadOnPasses": false, "reporter": "mochawesome", diff --git a/app/client/cypress/fixtures/Select_table_dsl.json b/app/client/cypress/fixtures/Select_table_dsl.json index f4b6c51adb..bfea2d4184 100644 --- a/app/client/cypress/fixtures/Select_table_dsl.json +++ b/app/client/cypress/fixtures/Select_table_dsl.json @@ -1,254 +1,240 @@ { - "dsl": { - "widgetName": "MainContainer", - "backgroundColor": "none", - "rightColumn": 1160, - "snapColumns": 64, - "detachFromLayout": true, - "widgetId": "0", - "topRow": 0, - "bottomRow": 1180, - "containerStyle": "none", - "snapRows": 128, - "parentRowSpace": 1, - "type": "CANVAS_WIDGET", - "canExtend": true, - "version": 47, - "minHeight": 930, - "parentColumnSpace": 1, - "dynamicBindingPathList": [], - "leftColumn": 0, - "children": [ - { - "widgetName": "Table2", - "defaultPageSize": 0, - "columnOrder": [ - "step", - "task", - "status", - "action" - ], - "isVisibleDownload": true, - "displayName": "Table", - "iconSVG": "/static/media/icon.db8a9cbd.svg", - "topRow": 61, - "bottomRow": 89, - "isSortable": true, - "parentRowSpace": 10, - "type": "TABLE_WIDGET", - "defaultSelectedRow": "0", - "hideCard": false, - "animateLoading": true, - "parentColumnSpace": 17.265625, - "dynamicBindingPathList": [ - { - "key": "primaryColumns.step.computedValue" - }, - { - "key": "primaryColumns.task.computedValue" - }, - { - "key": "primaryColumns.status.computedValue" - }, - { - "key": "primaryColumns.action.computedValue" - } - ], - "leftColumn": 2, - "primaryColumns": { - "step": { - "index": 0, - "width": 150, - "id": "step", - "horizontalAlignment": "LEFT", - "verticalAlignment": "CENTER", - "columnType": "text", - "textSize": "PARAGRAPH", - "enableFilter": true, - "enableSort": true, - "isVisible": true, - "isCellVisible": true, - "isDerived": false, - "label": "step", - "computedValue": "{{Table2.sanitizedTableData.map((currentRow) => ( currentRow.step))}}", - "buttonColor": "#03B365", - "menuColor": "#03B365", - "labelColor": "#FFFFFF" - }, - "task": { - "index": 1, - "width": 150, - "id": "task", - "horizontalAlignment": "LEFT", - "verticalAlignment": "CENTER", - "columnType": "text", - "textSize": "PARAGRAPH", - "enableFilter": true, - "enableSort": true, - "isVisible": true, - "isCellVisible": true, - "isDerived": false, - "label": "task", - "computedValue": "{{Table2.sanitizedTableData.map((currentRow) => ( currentRow.task))}}", - "buttonColor": "#03B365", - "menuColor": "#03B365", - "labelColor": "#FFFFFF" - }, - "status": { - "index": 2, - "width": 150, - "id": "status", - "horizontalAlignment": "LEFT", - "verticalAlignment": "CENTER", - "columnType": "text", - "textSize": "PARAGRAPH", - "enableFilter": true, - "enableSort": true, - "isVisible": true, - "isCellVisible": true, - "isDerived": false, - "label": "status", - "computedValue": "{{Table2.sanitizedTableData.map((currentRow) => ( currentRow.status))}}", - "buttonColor": "#03B365", - "menuColor": "#03B365", - "labelColor": "#FFFFFF" - }, - "action": { - "index": 3, - "width": 150, - "id": "action", - "horizontalAlignment": "LEFT", - "verticalAlignment": "CENTER", - "columnType": "button", - "textSize": "PARAGRAPH", - "enableFilter": true, - "enableSort": true, - "isVisible": true, - "isCellVisible": true, - "isDisabled": false, - "isDerived": false, - "label": "action", - "onClick": "{{currentRow.step === '#1' ? showAlert('Done', 'success') : currentRow.step === '#2' ? navigateTo('https://docs.appsmith.com/core-concepts/connecting-to-data-sources/querying-a-database',undefined,'NEW_WINDOW') : navigateTo('https://docs.appsmith.com/core-concepts/displaying-data-read/display-data-tables',undefined,'NEW_WINDOW')}}", - "computedValue": "{{Table2.sanitizedTableData.map((currentRow) => ( currentRow.action))}}", - "buttonColor": "#03B365", - "menuColor": "#03B365", - "labelColor": "#FFFFFF" - } - }, - "delimiter": ",", - "key": "wk470tvqt8", - "derivedColumns": {}, - "rightColumn": 36, - "textSize": "PARAGRAPH", - "widgetId": "csw61cbjhr", - "isVisibleFilters": true, - "tableData": [ - { - "step": "#1", - "task": "Drop a table", - "status": "✅", - "action": "" - }, - { - "step": "#2", - "task": "Create a query fetch_users with the Mock DB", - "status": "--", - "action": "" - }, - { - "step": "#3", - "task": "Bind the query using => fetch_users.data", - "status": "--", - "action": "" - } - ], - "isVisible": true, - "label": "Data", - "searchKey": "", - "enableClientSideSearch": true, - "version": 3, - "totalRecordsCount": 0, - "parentId": "0", - "renderMode": "CANVAS", - "isLoading": false, - "horizontalAlignment": "LEFT", - "isVisibleSearch": true, - "isVisiblePagination": true, - "verticalAlignment": "CENTER", - "columnSizeMap": { - "task": 245, - "step": 62, - "status": 75 - } - }, - { - "widgetName": "Select1", - "isFilterable": false, - "displayName": "Select", - "iconSVG": "/static/media/icon.bd99caba.svg", - "labelText": "Label", - "topRow": 80, - "bottomRow": 86.9, - "parentRowSpace": 10, - "type": "SELECT_WIDGET", - "serverSideFiltering": false, - "hideCard": false, - "defaultOptionValue": "{\n \"label\": \"{{Table2.selectedRow.step}}\",\n \"value\": \"{{Table2.selectedRow.step}}\"\n }", - "selectionType": "SINGLE_SELECT", - "animateLoading": true, - "parentColumnSpace": 17.265625, - "dynamicTriggerPathList": [], - "leftColumn": 39, - "dynamicBindingPathList": [ - { - "key": "defaultOptionValue" - } - ], - "options": "[\n {\n \"label\": \"#1\",\n \"value\": \"#1\"\n },\n {\n \"label\": \"#2\",\n \"value\": \"#2\"\n }\n]", - "placeholderText": "Select option", - "isDisabled": false, - "key": "vzrxeimovl", - "isRequired": true, - "rightColumn": 59, - "widgetId": "ddz5gr36zl", - "isVisible": true, - "version": 1, - "parentId": "0", - "renderMode": "CANVAS", - "isLoading": false - }, - { - "widgetName": "Text1", - "displayName": "Text", - "iconSVG": "/static/media/icon.97c59b52.svg", - "topRow": 112, - "bottomRow": 116, - "parentRowSpace": 10, - "type": "TEXT_WIDGET", - "hideCard": false, - "animateLoading": true, - "parentColumnSpace": 17.265625, - "dynamicTriggerPathList": [], - "leftColumn": 5, - "dynamicBindingPathList": [ - { - "key": "text" - } - ], - "text": "{{Select1.selectedOptionValue}}", - "key": "5z14mymmyz", - "rightColumn": 21, - "textAlign": "LEFT", - "widgetId": "tvw5xfds57", - "isVisible": true, - "fontStyle": "BOLD", - "textColor": "#231F20", - "version": 1, - "parentId": "0", - "renderMode": "CANVAS", - "isLoading": false, - "fontSize": "PARAGRAPH" - } - ] - } + "dsl": { + "widgetName": "MainContainer", + "backgroundColor": "none", + "rightColumn": 453, + "snapColumns": 64, + "detachFromLayout": true, + "widgetId": "0", + "topRow": 0, + "bottomRow": 1320, + "containerStyle": "none", + "snapRows": 125, + "parentRowSpace": 1, + "type": "CANVAS_WIDGET", + "canExtend": true, + "version": 54, + "minHeight": 1292, + "parentColumnSpace": 1, + "dynamicBindingPathList": [ + + ], + "leftColumn": 0, + "children": [ + { + "widgetName": "Select1", + "isFilterable": true, + "displayName": "Select", + "iconSVG": "/static/media/icon.bd99caba.svg", + "labelText": "", + "topRow": 16, + "bottomRow": 20, + "parentRowSpace": 10, + "type": "SELECT_WIDGET", + "serverSideFiltering": false, + "hideCard": false, + "defaultOptionValue": "{\n \"label\": \"{{Table1.selectedRow.step}}\",\n \"value\": \"{{Table1.selectedRow.step}}\"\n }", + "animateLoading": true, + "parentColumnSpace": 21.203125, + "dynamicTriggerPathList": [ + + ], + "leftColumn": 39, + "dynamicBindingPathList": [ + { + "key": "defaultOptionValue" + } + ], + "options": "[\n {\n \"label\": \"#1\",\n \"value\": \"#1\"\n },\n {\n \"label\": \"#2\",\n \"value\": \"#2\"\n }\n]", + "placeholderText": "Select option", + "isDisabled": false, + "key": "2zzcijdy0f", + "isRequired": false, + "rightColumn": 59, + "widgetId": "uiu9bz9s1b", + "isVisible": true, + "version": 1, + "parentId": "0", + "renderMode": "CANVAS", + "isLoading": false + }, + { + "isVisible": true, + "animateLoading": true, + "defaultSelectedRow": "0", + "label": "Data", + "widgetName": "Table1", + "searchKey": "", + "textSize": "PARAGRAPH", + "horizontalAlignment": "LEFT", + "verticalAlignment": "CENTER", + "totalRecordsCount": 0, + "defaultPageSize": 0, + "dynamicBindingPathList": [ + { + "key": "primaryColumns.step.computedValue" + }, + { + "key": "primaryColumns.task.computedValue" + }, + { + "key": "primaryColumns.status.computedValue" + }, + { + "key": "primaryColumns.action.computedValue" + } + ], + "primaryColumns": { + "step": { + "index": 0, + "width": 150, + "id": "step", + "horizontalAlignment": "LEFT", + "verticalAlignment": "CENTER", + "columnType": "text", + "textSize": "PARAGRAPH", + "enableFilter": true, + "enableSort": true, + "isVisible": true, + "isDisabled": false, + "isCellVisible": true, + "isDerived": false, + "label": "step", + "computedValue": "{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.step))}}" + }, + "task": { + "index": 1, + "width": 150, + "id": "task", + "horizontalAlignment": "LEFT", + "verticalAlignment": "CENTER", + "columnType": "text", + "textSize": "PARAGRAPH", + "enableFilter": true, + "enableSort": true, + "isVisible": true, + "isDisabled": false, + "isCellVisible": true, + "isDerived": false, + "label": "task", + "computedValue": "{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.task))}}" + }, + "status": { + "index": 2, + "width": 150, + "id": "status", + "horizontalAlignment": "LEFT", + "verticalAlignment": "CENTER", + "columnType": "text", + "textSize": "PARAGRAPH", + "enableFilter": true, + "enableSort": true, + "isVisible": true, + "isDisabled": false, + "isCellVisible": true, + "isDerived": false, + "label": "status", + "computedValue": "{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.status))}}" + }, + "action": { + "index": 3, + "width": 150, + "id": "action", + "horizontalAlignment": "LEFT", + "verticalAlignment": "CENTER", + "columnType": "text", + "textSize": "PARAGRAPH", + "enableFilter": true, + "enableSort": true, + "isVisible": true, + "isDisabled": false, + "isCellVisible": true, + "isDerived": false, + "label": "action", + "computedValue": "{{Table1.sanitizedTableData.map((currentRow) => ( currentRow.action))}}" + } + }, + "derivedColumns": { + }, + "tableData": "[\n {\n \"step\": \"#1\",\n \"task\": \"Drop a table\",\n \"status\": \"✅\",\n \"action\": \"\"\n },\n {\n \"step\": \"#2\",\n \"task\": \"Create a query fetch_users with the Mock DB\",\n \"status\": \"--\",\n \"action\": \"\"\n },\n {\n \"step\": \"#3\",\n \"task\": \"Bind the query using => fetch_users.data\",\n \"status\": \"--\",\n \"action\": \"\"\n }\n]", + "columnSizeMap": { + "task": 245, + "step": 62, + "status": 75 + }, + "columnOrder": [ + "step", + "task", + "status", + "action" + ], + "enableClientSideSearch": true, + "isVisibleSearch": true, + "isVisibleFilters": true, + "isVisibleDownload": true, + "isVisiblePagination": true, + "isSortable": true, + "delimiter": ",", + "version": 3, + "type": "TABLE_WIDGET", + "hideCard": false, + "displayName": "Table", + "key": "t22odw8rfj", + "iconSVG": "/static/media/icon.db8a9cbd.svg", + "widgetId": "f427h0lu92", + "renderMode": "CANVAS", + "isLoading": false, + "parentColumnSpace": 16.703125, + "parentRowSpace": 10, + "leftColumn": 6, + "rightColumn": 34, + "topRow": 9, + "bottomRow": 37, + "parentId": "0", + "dynamicTriggerPathList": [ + + ], + "dynamicPropertyPathList": [ + + ] + }, + { + "isVisible": true, + "text": "{{Select1.selectedOptionValue}}", + "fontSize": "PARAGRAPH", + "fontStyle": "BOLD", + "textAlign": "LEFT", + "textColor": "#231F20", + "truncateButtonColor": "#FFC13D", + "widgetName": "Text1", + "shouldTruncate": false, + "overflow": "NONE", + "version": 1, + "animateLoading": true, + "type": "TEXT_WIDGET", + "hideCard": false, + "displayName": "Text", + "key": "cdb5qeydze", + "iconSVG": "/static/media/icon.97c59b52.svg", + "widgetId": "5qb4nik2gy", + "renderMode": "CANVAS", + "isLoading": false, + "parentColumnSpace": 16.703125, + "parentRowSpace": 10, + "leftColumn": 39, + "rightColumn": 59, + "topRow": 33, + "bottomRow": 37, + "parentId": "0", + "dynamicBindingPathList": [ + { + "key": "text" + } + ], + "dynamicTriggerPathList": [ + + ] + } + ] + } } \ No newline at end of file diff --git a/app/client/cypress/fixtures/onPageLoadActionsDsl.json b/app/client/cypress/fixtures/onPageLoadActionsDsl.json index ee4491dd98..8d3c4b68dd 100644 --- a/app/client/cypress/fixtures/onPageLoadActionsDsl.json +++ b/app/client/cypress/fixtures/onPageLoadActionsDsl.json @@ -1,166 +1,142 @@ { "dsl": { - "widgetName": "MainContainer", - "backgroundColor": "none", - "rightColumn": 1091, - "snapColumns": 64, - "detachFromLayout": true, - "widgetId": "0", - "topRow": 0, - "bottomRow": 1290, - "containerStyle": "none", - "snapRows": 125, - "parentRowSpace": 1, - "type": "CANVAS_WIDGET", - "canExtend": true, - "version": 47, - "minHeight": 1292, - "parentColumnSpace": 1, - "dynamicBindingPathList": [ - - ], - "leftColumn": 0, - "children": [ - { - "widgetName": "Image1", - "displayName": "Image", - "iconSVG": "/static/media/icon.52d8fb96.svg", - "topRow": 8, - "bottomRow": 38, - "parentRowSpace": 10, - "type": "IMAGE_WIDGET", - "hideCard": false, - "animateLoading": true, - "parentColumnSpace": 16.859375, - "dynamicTriggerPathList": [ - - ], - "imageShape": "RECTANGLE", - "leftColumn": 8, - "dynamicBindingPathList": [ - { - "key": "image" - } - ], - "defaultImage": "https://assets.appsmith.com/widgets/default.png", - "key": "nyx7m0wdr7", - "image": "{{RandomFlora.data}}", - "rightColumn": 54, - "objectFit": "contain", - "widgetId": "cj15t4i2xj", - "isVisible": true, - "version": 1, - "parentId": "0", - "renderMode": "CANVAS", - "isLoading": false, - "maxZoomLevel": 1, - "enableDownload": false, - "enableRotation": false - }, - { - "widgetName": "Text1", - "displayName": "Text", - "iconSVG": "/static/media/icon.97c59b52.svg", - "topRow": 59, - "bottomRow": 79, - "parentRowSpace": 10, - "type": "TEXT_WIDGET", - "hideCard": false, - "animateLoading": true, - "parentColumnSpace": 16.859375, - "dynamicTriggerPathList": [ - - ], - "leftColumn": 12, - "dynamicBindingPathList": [ - { - "key": "text" - } - ], - "text": "{{InspiringQuotes.data.quote.body}}\n--\n{{InspiringQuotes.data.quote.author}}\n", - "key": "jd7u8cfobk", - "rightColumn": 40, - "textAlign": "LEFT", - "widgetId": "89gapjd0ab", - "isVisible": true, - "fontStyle": "BOLD", - "textColor": "#231F20", - "version": 1, - "parentId": "0", - "renderMode": "CANVAS", - "isLoading": false, - "fontSize": "PARAGRAPH" - }, - { - "widgetName": "Text2", - "displayName": "Text", - "iconSVG": "/static/media/icon.97c59b52.svg", - "topRow": 39, - "bottomRow": 59, - "parentRowSpace": 10, - "type": "TEXT_WIDGET", - "hideCard": false, - "animateLoading": true, - "parentColumnSpace": 16.859375, - "dynamicTriggerPathList": [ - - ], - "leftColumn": 30, - "dynamicBindingPathList": [ - { - "key": "text" - } - ], - "text": "Hi, here is {{RandomUser.data.results[0].name.first}} & I'm {{RandomUser.data.results[0].dob.age}}'yo\nI live in {{RandomUser.data.results[0].location.country}}\nMy Suggestion : {{Suggestions.data.activity}}\n\nI'm {{Genderize.data.gender}}", - "key": "s2t8ibck1v", - "rightColumn": 54, - "textAlign": "LEFT", - "widgetId": "lmps8ycnp3", - "isVisible": true, - "fontStyle": "BOLD", - "textColor": "#231F20", - "version": 1, - "parentId": "0", - "renderMode": "CANVAS", - "isLoading": false, - "fontSize": "PARAGRAPH" - }, - { - "widgetName": "Image2", - "displayName": "Image", - "iconSVG": "/static/media/icon.52d8fb96.svg", - "topRow": 40, - "bottomRow": 59, - "parentRowSpace": 10, - "type": "IMAGE_WIDGET", - "hideCard": false, - "animateLoading": true, - "parentColumnSpace": 16.859375, - "dynamicTriggerPathList": [ - - ], - "imageShape": "RECTANGLE", - "leftColumn": 8, - "dynamicBindingPathList": [ - { - "key": "image" - } - ], - "defaultImage": "https://assets.appsmith.com/widgets/default.png", - "key": "agtoehwrk0", - "image": "{{RandomUser.data.results[0].picture.large}}", - "rightColumn": 27, - "objectFit": "contain", - "widgetId": "pe4eepcumg", - "isVisible": true, - "version": 1, - "parentId": "0", - "renderMode": "CANVAS", - "isLoading": false, - "maxZoomLevel": 1, - "enableDownload": false, - "enableRotation": false - } - ] - } + "widgetName": "MainContainer", + "backgroundColor": "none", + "rightColumn": 374, + "snapColumns": 64, + "detachFromLayout": true, + "widgetId": "0", + "topRow": 0, + "bottomRow": 1290, + "containerStyle": "none", + "snapRows": 125, + "parentRowSpace": 1, + "type": "CANVAS_WIDGET", + "canExtend": true, + "version": 54, + "minHeight": 1292, + "parentColumnSpace": 1, + "dynamicBindingPathList": [], + "leftColumn": 0, + "children": [ + { + "widgetName": "Image1", + "displayName": "Image", + "iconSVG": "/static/media/icon.52d8fb96.svg", + "topRow": 8, + "bottomRow": 38, + "parentRowSpace": 10, + "type": "IMAGE_WIDGET", + "hideCard": false, + "animateLoading": true, + "parentColumnSpace": 16.859375, + "dynamicTriggerPathList": [], + "imageShape": "RECTANGLE", + "leftColumn": 8, + "dynamicBindingPathList": [], + "defaultImage": "https://assets.appsmith.com/widgets/default.png", + "key": "nyx7m0wdr7", + "image": "", + "rightColumn": 54, + "objectFit": "contain", + "widgetId": "cj15t4i2xj", + "isVisible": true, + "version": 1, + "parentId": "0", + "renderMode": "CANVAS", + "isLoading": false, + "maxZoomLevel": 1, + "enableDownload": false, + "enableRotation": false + }, + { + "widgetName": "Text1", + "displayName": "Text", + "iconSVG": "/static/media/icon.97c59b52.svg", + "topRow": 59, + "bottomRow": 79, + "parentRowSpace": 10, + "type": "TEXT_WIDGET", + "hideCard": false, + "animateLoading": true, + "parentColumnSpace": 16.859375, + "dynamicTriggerPathList": [], + "overflow": "NONE", + "leftColumn": 12, + "dynamicBindingPathList": [], + "text": "", + "key": "jd7u8cfobk", + "rightColumn": 40, + "textAlign": "LEFT", + "widgetId": "89gapjd0ab", + "isVisible": true, + "fontStyle": "BOLD", + "textColor": "#231F20", + "version": 1, + "parentId": "0", + "renderMode": "CANVAS", + "isLoading": false, + "fontSize": "PARAGRAPH" + }, + { + "widgetName": "Text2", + "displayName": "Text", + "iconSVG": "/static/media/icon.97c59b52.svg", + "topRow": 39, + "bottomRow": 59, + "parentRowSpace": 10, + "type": "TEXT_WIDGET", + "hideCard": false, + "animateLoading": true, + "parentColumnSpace": 16.859375, + "dynamicTriggerPathList": [], + "overflow": "NONE", + "leftColumn": 30, + "dynamicBindingPathList": [], + "text": "", + "key": "s2t8ibck1v", + "rightColumn": 54, + "textAlign": "LEFT", + "widgetId": "lmps8ycnp3", + "isVisible": true, + "fontStyle": "BOLD", + "textColor": "#231F20", + "version": 1, + "parentId": "0", + "renderMode": "CANVAS", + "isLoading": false, + "fontSize": "PARAGRAPH" + }, + { + "widgetName": "Image2", + "displayName": "Image", + "iconSVG": "/static/media/icon.52d8fb96.svg", + "topRow": 40, + "bottomRow": 59, + "parentRowSpace": 10, + "type": "IMAGE_WIDGET", + "hideCard": false, + "animateLoading": true, + "parentColumnSpace": 16.859375, + "dynamicTriggerPathList": [], + "imageShape": "RECTANGLE", + "leftColumn": 8, + "dynamicBindingPathList": [], + "defaultImage": "https://assets.appsmith.com/widgets/default.png", + "key": "agtoehwrk0", + "image": "", + "rightColumn": 27, + "objectFit": "contain", + "widgetId": "pe4eepcumg", + "isVisible": true, + "version": 1, + "parentId": "0", + "renderMode": "CANVAS", + "isLoading": false, + "maxZoomLevel": 1, + "enableDownload": false, + "enableRotation": false + } + ] + } } \ No newline at end of file diff --git a/app/client/cypress/fixtures/paramsDsl.json b/app/client/cypress/fixtures/paramsDsl.json index 64da8332bd..9110d15322 100644 --- a/app/client/cypress/fixtures/paramsDsl.json +++ b/app/client/cypress/fixtures/paramsDsl.json @@ -168,7 +168,7 @@ "isFilterable": false, "displayName": "Select", "iconSVG": "/static/media/icon.bd99caba.svg", - "labelText": "Label", + "labelText": "Select an option to populate its records in Table!", "topRow": 5, "bottomRow": 12, "parentRowSpace": 10, diff --git a/app/client/cypress/integration/Smoke_TestSuite/Application/AForceMigration_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/Application/AForceMigration_Spec.ts index 113008cea3..32874f1b69 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/Application/AForceMigration_Spec.ts +++ b/app/client/cypress/integration/Smoke_TestSuite/Application/AForceMigration_Spec.ts @@ -26,8 +26,7 @@ describe("AForce - Community Issues page validations", function () { }); it("2. Validate table navigation with Server Side pagination enabled with Default selected row", () => { - ee.expandCollapseEntity("WIDGETS") - ee.SelectEntityByName("Table1") + ee.SelectEntityByName("Table1", 'WIDGETS') agHelper.AssertExistingToggleState("serversidepagination", 'checked') agHelper.EvaluateExistingPropertyFieldValue("Default Selected Row") @@ -71,8 +70,7 @@ describe("AForce - Community Issues page validations", function () { agHelper.NavigateBacktoEditor() table.WaitUntilTableLoad() - ee.expandCollapseEntity("WIDGETS") - ee.SelectEntityByName("Table1") + ee.SelectEntityByName("Table1", 'WIDGETS') agHelper.ToggleOnOrOff('serversidepagination', 'Off') agHelper.DeployApp() table.WaitUntilTableLoad() diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ApiPaneTests/API_MultiPart_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ApiPaneTests/API_MultiPart_Spec.ts index f60173df56..58524521ca 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ApiPaneTests/API_MultiPart_Spec.ts +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/ApiPaneTests/API_MultiPart_Spec.ts @@ -9,20 +9,20 @@ let agHelper = ObjectsRegistry.AggregateHelper, describe("Validate API request body panel", () => { it("1. Check whether input and type dropdown selector exist when multi-part is selected", () => { apiPage.CreateApi("FirstAPI", 'POST'); - apiPage.SelectAPITab('Body') + apiPage.SelectPaneTab('Body') apiPage.SelectSubTab('FORM_URLENCODED') - apiPage.CheckElementPresence(apiPage._bodyKey(0)) - apiPage.CheckElementPresence(apiPage._bodyValue(0)) + agHelper.AssertElementPresence(apiPage._bodyKey(0)) + agHelper.AssertElementPresence(apiPage._bodyValue(0)) apiPage.SelectSubTab('MULTIPART_FORM_DATA') - apiPage.CheckElementPresence(apiPage._bodyKey(0)) - apiPage.CheckElementPresence(apiPage._bodyTypeDropdown) - apiPage.CheckElementPresence(apiPage._bodyValue(0)) + agHelper.AssertElementPresence(apiPage._bodyKey(0)) + agHelper.AssertElementPresence(apiPage._bodyTypeDropdown) + agHelper.AssertElementPresence(apiPage._bodyValue(0)) agHelper.ActionContextMenuWithInPane('Delete') }); it("2. Checks whether No body error message is shown when None API body content type is selected", function () { apiPage.CreateApi("FirstAPI", 'GET'); - apiPage.SelectAPITab('Body') + apiPage.SelectPaneTab('Body') apiPage.SelectSubTab('NONE') cy.get(apiPage._noBodyMessageDiv).contains(apiPage._noBodyMessage); agHelper.ActionContextMenuWithInPane('Delete') @@ -34,7 +34,7 @@ describe("Validate API request body panel", () => { key: "content-type", value: "application/json", }); - apiPage.SelectAPITab('Body') + apiPage.SelectPaneTab('Body') apiPage.SelectSubTab('FORM_URLENCODED') apiPage.ValidateHeaderParams({ key: "content-type", @@ -49,7 +49,7 @@ describe("Validate API request body panel", () => { key: "content-type", value: "application/json", }); - apiPage.SelectAPITab('Body') + apiPage.SelectPaneTab('Body') apiPage.SelectSubTab('MULTIPART_FORM_DATA') apiPage.ValidateHeaderParams({ key: "content-type", @@ -60,7 +60,7 @@ describe("Validate API request body panel", () => { it("5. Checks whether content type 'FORM_URLENCODED' is preserved when user selects None API body content type", function () { apiPage.CreateApi("FirstAPI", 'POST'); - apiPage.SelectAPITab('Body') + apiPage.SelectPaneTab('Body') apiPage.SelectSubTab('FORM_URLENCODED') apiPage.SelectSubTab('NONE') apiPage.ValidateHeaderParams({ @@ -72,7 +72,7 @@ describe("Validate API request body panel", () => { it("6. Checks whether content type 'MULTIPART_FORM_DATA' is preserved when user selects None API body content type", function () { apiPage.CreateApi("FirstAPI", 'POST'); - apiPage.SelectAPITab('Body') + apiPage.SelectPaneTab('Body') apiPage.SelectSubTab('MULTIPART_FORM_DATA') apiPage.SelectSubTab('NONE') apiPage.ValidateHeaderParams({ @@ -82,7 +82,7 @@ describe("Validate API request body panel", () => { agHelper.ActionContextMenuWithInPane('Delete') }); - it("7. Checks MultiPart form data for a File Type upload", () => { + it("7. Checks MultiPart form data for a File Type upload + Bug 12476", () => { let imageNameToUpload = "ConcreteHouse.jpg"; cy.fixture('multiPartFormDataDsl').then((val: any) => { agHelper.AddDsl(val) @@ -100,13 +100,17 @@ describe("Validate API request body panel", () => { } }`, true, true, false); - ee.expandCollapseEntity("WIDGETS")//to expand widgets - ee.SelectEntityByName("FilePicker1"); + ee.SelectEntityByName("FilePicker1", 'WIDGETS'); jsEditor.EnterJSContext('onfilesselected', `{{JSObject1.upload()}}`, true, true); ee.SelectEntityByName("Image1"); jsEditor.EnterJSContext('image', '{{CloudinaryUploadApi.data.url}}') + ee.SelectEntityByName("CloudinaryUploadApi", 'QUERIES/JS'); + + apiPage.DisableOnPageLoadRun()//Bug 12476 + ee.SelectEntityByName("Page1"); + agHelper.DeployApp(locator._spanButton('Select Files')) agHelper.ClickButton('Select Files'); agHelper.UploadFile(imageNameToUpload) agHelper.ValidateToastMessage("Image uploaded to Cloudinary successfully") @@ -115,22 +119,24 @@ describe("Validate API request body panel", () => { .invoke('attr', 'src').then($src => { expect($src).not.eq("https://assets.appsmith.com/widgets/default.png") }) - apiPage.CheckElementPresence(locator._spanButton('Select Files'))//verifying if reset! - + agHelper.AssertElementPresence(locator._spanButton('Select Files'))//verifying if reset! + agHelper.NavigateBacktoEditor() }); it("8. Checks MultiPart form data for a Array Type upload results in API error", () => { let imageNameToUpload = "AAAFlowerVase.jpeg"; - ee.expandCollapseEntity("QUERIES/JS")//to expand widgets - ee.SelectEntityByName("CloudinaryUploadApi"); + ee.SelectEntityByName("CloudinaryUploadApi", 'QUERIES/JS'); apiPage.EnterBodyFormData('MULTIPART_FORM_DATA', 'file', '{{FilePicker1.files[0]}}', 'Array', true) - ee.SelectEntityByName("FilePicker1"); + ee.SelectEntityByName("FilePicker1", 'WIDGETS'); + agHelper.ClickButton('Select Files'); + agHelper.UploadFile(imageNameToUpload, false) + agHelper.AssertDebugError("Execution failed with status 400 BAD_REQUEST", '{"error":{"message":"Unsupported source URL: {\\"type\\":\\"image/jpeg\\"') + + agHelper.DeployApp(locator._spanButton('Select Files')) agHelper.ClickButton('Select Files'); agHelper.UploadFile(imageNameToUpload, false) agHelper.ValidateToastMessage("CloudinaryUploadApi failed to execute") - apiPage.CheckElementPresence(locator._spanButton('Select Files'))//verifying if reset! - agHelper.AssertDebugError("Execution failed with status 400 BAD_REQUEST", '{"error":{"message":"Unsupported source URL: {\\"type\\":\\"image/jpeg\\"') - + agHelper.AssertElementPresence(locator._spanButton('Select Files'))//verifying if reset in case of failure! }); }); \ No newline at end of file diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Auth/Analytics_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Auth/Analytics_spec.js index 72980b8359..f7331bbaa7 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Auth/Analytics_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Auth/Analytics_spec.js @@ -6,12 +6,14 @@ describe("Checks for analytics initialization", function() { it("Should check analytics is not initialised when enableTelemtry is false", function() { cy.visit("/applications"); cy.reload(); - cy.wait(6000); - cy.wait("@getUser").should( - "have.nested.property", - "response.body.data.enableTelemetry", - false, - ); + cy.wait(3000); + cy.wait("@getMe") + .wait("@getMe") + .should( + "have.nested.property", + "response.body.data.enableTelemetry", + false, + ); cy.window().then((window) => { expect(window.analytics).to.be.equal(undefined); }); @@ -35,7 +37,7 @@ describe("Checks for analytics initialization", function() { cy.visit("/applications"); cy.reload(); cy.wait(3000); - cy.wait("@getUser"); + cy.wait("@getMe"); cy.window().then((window) => { expect(window.smartlook).to.be.equal(undefined); }); @@ -59,7 +61,7 @@ describe("Checks for analytics initialization", function() { cy.visit("/applications"); cy.reload(); cy.wait(3000); - cy.wait("@getUser"); + cy.wait("@getMe"); cy.window().then((window) => { expect(window.Sentry).to.be.equal(undefined); }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/BindButton_Text_WithRecaptcha_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/BindButton_Text_WithRecaptcha_spec.js index ae9b194ad3..e83bf12b7f 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/BindButton_Text_WithRecaptcha_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/BindButton_Text_WithRecaptcha_spec.js @@ -1,9 +1,4 @@ -const commonlocators = require("../../../../locators/commonlocators.json"); -const formWidgetsPage = require("../../../../locators/FormWidgets.json"); const dsl = require("../../../../fixtures/buttonRecaptchaDsl.json"); -const pages = require("../../../../locators/Pages.json"); -const widgetsPage = require("../../../../locators/Widgets.json"); -const publish = require("../../../../locators/publishWidgetspage.json"); const testdata = require("../../../../fixtures/testdata.json"); describe("Binding the Button widget with Text widget using Recpatcha v3", function() { @@ -11,7 +6,7 @@ describe("Binding the Button widget with Text widget using Recpatcha v3", functi cy.addDsl(dsl); }); - it("Validate the Button binding with Text Widget with Recaptcha Token", function() { + it("1. Validate the Button binding with Text Widget with Recaptcha token with empty key", function() { cy.get("button") .contains("Submit") .should("be.visible") @@ -69,7 +64,7 @@ describe("Binding the Button widget with Text widget using Recpatcha v3", functi }) }); */ - it("Validate the Button binding with Text Widget with Recaptcha Token with v2Key", function() { + it("2. Validate the Button binding with Text Widget with Recaptcha Token with v2Key", function() { cy.get("button") .contains("Submit") .should("be.visible") @@ -106,7 +101,7 @@ describe("Binding the Button widget with Text widget using Recpatcha v3", functi }); }); - it("Validate the Button binding with Text Widget with Recaptcha Token with v3Key", function() { + it("3. Validate the Button binding with Text Widget with Recaptcha Token with v3Key", function() { cy.get("button") .contains("Submit") .should("be.visible") diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/JSObjectToInput_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/JSObjectToInput_Spec.ts index 4ba32c21ad..d96978988d 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/JSObjectToInput_Spec.ts +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/JSObjectToInput_Spec.ts @@ -1,9 +1,9 @@ import { ObjectsRegistry } from "../../../../support/Objects/Registry" let agHelper = ObjectsRegistry.AggregateHelper, - ee = ObjectsRegistry.EntityExplorer, - jsEditor = ObjectsRegistry.JSEditor, - locator = ObjectsRegistry.CommonLocators; + ee = ObjectsRegistry.EntityExplorer, + jsEditor = ObjectsRegistry.JSEditor, + locator = ObjectsRegistry.CommonLocators; describe("Validate Create Api and Bind to Table widget via JSObject", () => { before(() => { @@ -12,15 +12,24 @@ describe("Validate Create Api and Bind to Table widget via JSObject", () => { }); }); + let jsOjbNameReceived: any; + it("1. Bind Input widget with JSObject", function () { jsEditor.CreateJSObject('return "Success";', false); ee.expandCollapseEntity("WIDGETS")//to expand widgets ee.expandCollapseEntity("Form1") ee.SelectEntityByName("Input2") + cy.get(locator._inputWidget).last().invoke("attr", "value").should("equal", 'Hello');//Before mapping JSObject value of input cy.get("@jsObjName").then((jsObjName) => { + jsOjbNameReceived = jsObjName; jsEditor.EnterJSContext("defaulttext", "{{" + jsObjName + ".myFun1()}}") }); - cy.get(locator._inputWidget).last().invoke("attr", "value").should("equal", 'Success'); + cy.get(locator._inputWidget).last().invoke("attr", "value").should("equal", 'Success');//After mapping JSObject value of input + agHelper.DeployApp(locator._inputWidgetInDeployed) + cy.get(locator._inputWidgetInDeployed).first().should('have.value', 'Hello') + cy.get(locator._inputWidgetInDeployed).last().should('have.value', 'Success') + agHelper.NavigateBacktoEditor() + // cy.get(locator._inputWidget) // .last() // .within(() => { @@ -30,19 +39,25 @@ describe("Validate Create Api and Bind to Table widget via JSObject", () => { // }); }); - it.skip("2. Bug 10284, 11529 - Verify timeout issue with running JS Objects", function () { - jsEditor.CreateJSObject('return "Success";', true); - ee.expandCollapseEntity("Form1") - ee.SelectEntityByName("Input2") - cy.get("@jsObjName").then((jsObjName) => { - jsEditor.EnterJSContext("defaulttext", "{{" + jsObjName + ".myFun1()}}") - }); - cy.wait("@updateLayout").should( - "have.nested.property", - "response.body.responseMeta.status", - 200, - ); - cy.get(locator._inputWidget).last().invoke("attr", "value").should("equal", 'Success'); + it.skip("2. Bug 10284, 11529 - Verify autosave while editing JSObj & reference changes when JSObj is mapped", function () { + ee.SelectEntityByName(jsOjbNameReceived as string, 'QUERIES/JS') + jsEditor.EditJSObj("myFun1", "newName") + + //jsEditor.CreateJSObject('return "Success";', true); + // ee.expandCollapseEntity("Form1") + // ee.SelectEntityByName("Input2") + // cy.get("@jsObjName").then((jsObjName) => { + // jsEditor.EnterJSContext("defaulttext", "{{" + jsObjName + ".myFun1()}}") + // }); + // // cy.wait("@updateLayout").should( + // // "have.nested.property", + // // "response.body.responseMeta.status", + // // 200, + // // ); + // cy.get(locator._inputWidget).last().invoke("attr", "value").should("equal", 'Success'); + // agHelper.DeployApp(locator._inputWidgetInDeployed) + // cy.get(locator._inputWidgetInDeployed).first().should('have.value', 'Hello') + // cy.get(locator._inputWidgetInDeployed).last().should('have.value', 'Success') }); }); \ No newline at end of file diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/JSObjectToListWidget_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/JSObjectToListWidget_Spec.ts index ca5351ea34..b66ef10a32 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/JSObjectToListWidget_Spec.ts +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/JSObjectToListWidget_Spec.ts @@ -5,10 +5,11 @@ let agHelper = ObjectsRegistry.AggregateHelper, ee = ObjectsRegistry.EntityExplorer, jsEditor = ObjectsRegistry.JSEditor, locator = ObjectsRegistry.CommonLocators, - apiPage = ObjectsRegistry.ApiPage; + apiPage = ObjectsRegistry.ApiPage, + table = ObjectsRegistry.Table; -describe("Validate Create Api and Bind to Table widget via JSObject", () => { +describe("Validate JSObj binding to Table widget", () => { before(() => { cy.fixture('listwidgetdsl').then((val: any) => { agHelper.AddDsl(val) @@ -35,47 +36,67 @@ describe("Validate Create Api and Bind to Table widget via JSObject", () => { }) }); - it("2. Validate the Api data is updated on List widget", function () { - ee.expandCollapseEntity("WIDGETS")//to expand widgets - ee.SelectEntityByName("List1"); + it("2. Validate the Api data is updated on List widget + Bug 12438", function () { + ee.SelectEntityByName("List1", 'WIDGETS'); jsEditor.EnterJSContext("items", "{{" + jsName as string + ".myFun1()}}") cy.get(locator._textWidget).should("have.length", 8); - cy.get(locator._textWidget) - .first() - .invoke("text") - .then((text) => { - expect(text).to.equal((valueToTest as string).trimEnd()); - }); - agHelper.DeployApp(); - agHelper.WaitUntilEleAppear(locator._textWidgetInDeployed) - cy.get(locator._textWidgetInDeployed).should("have.length", 8); + agHelper.DeployApp(locator._textWidgetInDeployed); + agHelper.AssertElementLength(locator._textWidgetInDeployed, 8) cy.get(locator._textWidgetInDeployed) .first() .invoke("text") .then((text) => { expect(text).to.equal((valueToTest as string).trimEnd()); }); + + table.AssertPageNumber_List(1) + table.NavigateToNextPage_List() + table.AssertPageNumber_List(2) + agHelper.AssertElementLength(locator._textWidgetInDeployed, 8) + table.NavigateToNextPage_List() + table.AssertPageNumber_List(3, true) + agHelper.AssertElementLength(locator._textWidgetInDeployed, 4) + table.NavigateToPreviousPage_List() + table.AssertPageNumber_List(2) + agHelper.AssertElementLength(locator._textWidgetInDeployed, 8) + table.NavigateToPreviousPage_List() + table.AssertPageNumber_List(1) + agHelper.AssertElementLength(locator._textWidgetInDeployed, 8) + agHelper.NavigateBacktoEditor() }); - it("3. Validate the List widget ", function () { - agHelper.NavigateBacktoEditor() - ee.expandCollapseEntity("WIDGETS")//to expand widgets - ee.SelectEntityByName("List1"); + it("3. Validate the List widget + Bug 12438 ", function () { + ee.SelectEntityByName("List1", 'WIDGETS'); jsEditor.EnterJSContext("itemspacing\\(px\\)", "50") cy.get(locator._textWidget).should("have.length", 6); - cy.get(locator._textWidget) - .first() - .invoke("text") - .then((text) => { - expect(text).to.equal((valueToTest as string).trimEnd()); - }); - agHelper.DeployApp(); - cy.get(locator._textWidgetInDeployed).should("have.length", 6); + agHelper.DeployApp(locator._textWidgetInDeployed); + agHelper.AssertElementLength(locator._textWidgetInDeployed, 6) cy.get(locator._textWidgetInDeployed).first() .invoke("text") .then((text) => { expect(text).to.equal((valueToTest as string).trimEnd()); }); - agHelper.NavigateBacktoEditor() + + table.AssertPageNumber_List(1) + agHelper.AssertElementLength(locator._textWidgetInDeployed, 6) + table.NavigateToNextPage_List() + table.AssertPageNumber_List(2) + agHelper.AssertElementLength(locator._textWidgetInDeployed, 6) + table.NavigateToNextPage_List() + table.AssertPageNumber_List(3) + agHelper.AssertElementLength(locator._textWidgetInDeployed, 6) + table.NavigateToNextPage_List() + table.AssertPageNumber_List(4, true) + agHelper.AssertElementLength(locator._textWidgetInDeployed, 2) + table.NavigateToPreviousPage_List() + table.AssertPageNumber_List(3) + agHelper.AssertElementLength(locator._textWidgetInDeployed, 6) + table.NavigateToPreviousPage_List() + table.AssertPageNumber_List(2) + agHelper.AssertElementLength(locator._textWidgetInDeployed, 6) + table.NavigateToPreviousPage_List() + table.AssertPageNumber_List(1) + agHelper.AssertElementLength(locator._textWidgetInDeployed, 6) + //agHelper.NavigateBacktoEditor() }); }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/LoadashBasic_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/LoadashBasic_Spec.ts index 9c6483ccf0..7ec2ede787 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/LoadashBasic_Spec.ts +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/LoadashBasic_Spec.ts @@ -19,8 +19,7 @@ describe("Loadash basic test with input Widget", () => { }); it("1. Input widget test with default value for atob method", () => { - ee.expandCollapseEntity("WIDGETS") - ee.SelectEntityByName("Input1") + ee.SelectEntityByName("Input1", 'WIDGETS') jsEditor.EnterJSContext("defaulttext", dataSet.defaultInputBinding + "}}"); agHelper.ValidateNetworkStatus('@updateLayout') }); @@ -32,7 +31,7 @@ describe("Loadash basic test with input Widget", () => { }); it("3. Publish and validate the data displayed in input widgets value for aToB and bToa", function () { - agHelper.DeployApp() + agHelper.DeployApp(locator._inputWidgetInDeployed) cy.get(locator._inputWidgetInDeployed).first().invoke("attr", "value") .should("contain", "7") cy.get(locator._inputWidgetInDeployed).last().invoke("attr", "value") diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/MomentBasic_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/MomentBasic_Spec.ts index 55e064dd5a..3060dec0ed 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/MomentBasic_Spec.ts +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/MomentBasic_Spec.ts @@ -19,8 +19,7 @@ describe("Validate basic binding of Input widget to Input widget", () => { }); it("1. Input widget test with default value from another Input widget", () => { - ee.expandCollapseEntity("WIDGETS") - ee.SelectEntityByName("Input1") + ee.SelectEntityByName("Input1", 'WIDGETS') jsEditor.EnterJSContext("defaulttext", dataSet.defaultInputBinding + "}}"); agHelper.ValidateNetworkStatus('@updateLayout') }); @@ -33,7 +32,7 @@ describe("Validate basic binding of Input widget to Input widget", () => { it("3. Publish widget and validate the data displayed in input widgets", function () { var currentTime = new Date(); - agHelper.DeployApp() + agHelper.DeployApp(locator._inputWidgetInDeployed) cy.get(locator._inputWidgetInDeployed).first() .should("contain.value", currentTime.getFullYear()); cy.get(locator._inputWidgetInDeployed).last() diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Promises_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Promises_Spec.ts index d10a93455c..1aa9ede7f6 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Promises_Spec.ts +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Promises_Spec.ts @@ -1,32 +1,31 @@ import { ObjectsRegistry } from "../../../../support/Objects/Registry" let agHelper = ObjectsRegistry.AggregateHelper, - ee = ObjectsRegistry.EntityExplorer, - jsEditor = ObjectsRegistry.JSEditor, - locator = ObjectsRegistry.CommonLocators, - apiPage = ObjectsRegistry.ApiPage; + ee = ObjectsRegistry.EntityExplorer, + jsEditor = ObjectsRegistry.JSEditor, + locator = ObjectsRegistry.CommonLocators, + apiPage = ObjectsRegistry.ApiPage; describe("Validate basic operations on Entity explorer JSEditor structure", () => { it("1. Verify storeValue via .then via direct Promises", () => { let date = new Date().toDateString(); cy.fixture('promisesBtnDsl').then((val: any) => { - agHelper.AddDsl(val) + agHelper.AddDsl(val, locator._spanButton('Submit')) }); - ee.expandCollapseEntity("WIDGETS")//to expand widgets - ee.SelectEntityByName("Button1"); + ee.SelectEntityByName("Button1", 'WIDGETS'); jsEditor.EnterJSContext('onclick', "{{storeValue('date', Date()).then(() => showAlert(appsmith.store.date))}}", true, true); + agHelper.DeployApp() agHelper.ClickButton('Submit') - cy.log("Date is:" + date) agHelper.ValidateToastMessage(date) + agHelper.NavigateBacktoEditor() }); it("2. Verify resolve & chaining via direct Promises", () => { cy.fixture("promisesBtnDsl").then((val: any) => { - agHelper.AddDsl(val); + agHelper.AddDsl(val, locator._spanButton('Submit')); }); - ee.expandCollapseEntity("WIDGETS"); - ee.SelectEntityByName("Button1"); + ee.SelectEntityByName("Button1", 'WIDGETS'); jsEditor.EnterJSContext( "onclick", `{{ @@ -38,13 +37,15 @@ describe("Validate basic operations on Entity explorer JSEditor structure", () = showAlert(res, 'success') }).catch(err => { showAlert(err, 'error') }); }}`, true, true); + agHelper.DeployApp() agHelper.ClickButton('Submit') agHelper.ValidateToastMessage('We are on planet Earth') + agHelper.NavigateBacktoEditor() }); it("3. Verify Async Await in direct Promises", () => { cy.fixture("promisesBtnDsl").then((val: any) => { - agHelper.AddDsl(val); + agHelper.AddDsl(val, locator._spanButton('Submit')); }); apiPage.CreateAndFillApi("https://randomuser.me/api/", "RandomUser"); apiPage.CreateAndFillApi( @@ -55,8 +56,7 @@ describe("Validate basic operations on Entity explorer JSEditor structure", () = key: "name", value: "{{this.params.country}}", }); // verifies Bug 10055 - ee.expandCollapseEntity("WIDGETS"); - ee.SelectEntityByName("Button1"); + ee.SelectEntityByName("Button1", 'WIDGETS'); jsEditor.EnterJSContext( "onclick", `{{(async function(){ @@ -69,6 +69,7 @@ describe("Validate basic operations on Entity explorer JSEditor structure", () = true, true, ); + agHelper.DeployApp() agHelper.ClickButton("Submit"); cy.get(locator._toastMsg).should("have.length", 2); cy.get(locator._toastMsg) @@ -77,18 +78,18 @@ describe("Validate basic operations on Entity explorer JSEditor structure", () = cy.get(locator._toastMsg) .last() .contains(/male|female|null/g); + agHelper.NavigateBacktoEditor() }); it("4. Verify .then & .catch via direct Promises", () => { cy.fixture("promisesBtnImgDsl").then((val: any) => { - agHelper.AddDsl(val); + agHelper.AddDsl(val, locator._spanButton('Submit')); }); apiPage.CreateAndFillApi( "https://source.unsplash.com/collection/8439505", "Christmas", ); - ee.expandCollapseEntity("WIDGETS"); //to expand widgets - ee.SelectEntityByName("Button1"); + ee.SelectEntityByName("Button1", 'WIDGETS'); jsEditor.EnterJSContext( "onclick", `{{ @@ -103,55 +104,55 @@ describe("Validate basic operations on Entity explorer JSEditor structure", () = ); ee.SelectEntityByName("Image1"); jsEditor.EnterJSContext("image", `{{Christmas.data}}`, true); - agHelper.WaitUntilEleDisappear( - locator._toastMsg, - "will be executed automatically on page load", - ); + agHelper.ValidateToastMessage('will be executed automatically on page load') + agHelper.DeployApp() agHelper.ClickButton("Submit"); cy.get(locator._toastMsg) .should("have.length", 1) .contains(/You have a beautiful picture|Oops!/g); + agHelper.NavigateBacktoEditor() }); it("5. Verify .then & .catch via JS Objects in Promises", () => { cy.fixture("promisesBtnDsl").then((val: any) => { - agHelper.AddDsl(val); + agHelper.AddDsl(val, locator._spanButton('Submit')); }); apiPage.CreateAndFillApi("https://favqs.com/api/qotd", "InspiringQuotes"); jsEditor.CreateJSObject(`const user = 'You'; return InspiringQuotes.run().then((res) => { showAlert("Today's quote for " + user + " is " + JSON.stringify(res.quote.body), 'success') }).catch(() => showAlert("Unable to fetch quote for " + user, 'warning'))`); - ee.expandCollapseEntity("WIDGETS"); //to expand widgets - ee.SelectEntityByName("Button1"); + ee.SelectEntityByName("Button1", 'WIDGETS'); cy.get("@jsObjName").then((jsObjName) => { jsEditor.EnterJSContext('onclick', "{{" + jsObjName + ".myFun1()}}", true, true); }) + agHelper.DeployApp() agHelper.ClickButton("Submit"); agHelper.ValidateToastMessage("Today's quote for You") + agHelper.NavigateBacktoEditor() }); it("6. Verify Promise.race via direct Promises", () => { cy.fixture('promisesBtnDsl').then((val: any) => { - agHelper.AddDsl(val) + agHelper.AddDsl(val, locator._spanButton('Submit')) }); apiPage.CreateAndFillApi("https://api.agify.io?name={{this.params.person}}", "Agify") apiPage.ValidateQueryParams({ key: "name", value: "{{this.params.person}}" }); // verifies Bug 10055 - ee.expandCollapseEntity("WIDGETS") - ee.SelectEntityByName("Button1"); + ee.SelectEntityByName("Button1", 'WIDGETS'); jsEditor.EnterJSContext('onclick', `{{ Promise.race([Agify.run({ person: 'Melinda' }), Agify.run({ person: 'Trump' })]).then((res) => { showAlert('Winner is ' + JSON.stringify(res.name), 'success') }) }} `, true, true); + agHelper.DeployApp() agHelper.ClickButton('Submit') cy.get(locator._toastMsg).should("have.length", 1).contains(/Melinda|Trump/g) + agHelper.NavigateBacktoEditor() }) it("7. Verify maintaining context via direct Promises", () => { cy.fixture("promisesBtnListDsl").then((val: any) => { - agHelper.AddDsl(val); + agHelper.AddDsl(val, locator._spanButton('Submit')); }); apiPage.CreateAndFillApi( "https://api.jikan.moe/v3/search/anime?q={{this.params.name}}", "GetAnime", ); - ee.expandCollapseEntity("WIDGETS"); //to expand widgets - ee.SelectEntityByName("List1"); + ee.SelectEntityByName("List1", 'WIDGETS'); jsEditor.EnterJSContext( "items", `[{ @@ -171,10 +172,7 @@ return InspiringQuotes.run().then((res) => { showAlert("Today's quote for " + us }]`, true, ); - agHelper.WaitUntilEleDisappear( - locator._toastMsg, - "will be executed automatically on page load", - ); + agHelper.ValidateToastMessage('will be executed automatically on page load')//Validating 'Run API on Page Load' is set once api response is mapped ee.SelectEntityByName("Button1"); jsEditor.EnterJSContext( "onclick", @@ -188,19 +186,20 @@ return InspiringQuotes.run().then((res) => { showAlert("Today's quote for " + us true, true, ); + agHelper.DeployApp() agHelper.ClickButton("Submit"); agHelper.WaitUntilEleAppear(locator._toastMsg) cy.get(locator._toastMsg) //.should("have.length", 1)//covered in WaitUntilEleAppear() .should("have.text", "Showing results for : fruits basket : the final"); + agHelper.NavigateBacktoEditor() }); it("8: Verify Promise.all via direct Promises", () => { cy.fixture('promisesBtnDsl').then((val: any) => { - agHelper.AddDsl(val) + agHelper.AddDsl(val, locator._spanButton('Submit')) }); - ee.expandCollapseEntity("WIDGETS")//to expand widgets - ee.SelectEntityByName("Button1"); + ee.SelectEntityByName("Button1", 'WIDGETS'); jsEditor.EnterJSContext('onclick', `{{ (function () { let agifyy = []; @@ -212,14 +211,16 @@ return InspiringQuotes.run().then((res) => { showAlert("Today's quote for " + us .then((responses) => showAlert(responses.map((res) => res.name).join(','))) })() }} `, true, true); + agHelper.DeployApp() agHelper.ClickButton('Submit') agHelper.ValidateToastMessage("cat,dog,camel,rabbit,rat") + agHelper.NavigateBacktoEditor() }); it("9. Bug 10150: Verify Promise.all via JSObjects", () => { let date = new Date().toDateString(); cy.fixture('promisesBtnDsl').then((val: any) => { - agHelper.AddDsl(val) + agHelper.AddDsl(val, locator._spanButton('Submit')) }); jsEditor.CreateJSObject(`let allFuncs = [Genderize.run({ country: 'India' }), RandomUser.run(), @@ -232,24 +233,24 @@ showAlert("Running all api's", "warning"); return Promise.all(allFuncs).then(() => showAlert("Wonderful! all apis executed", "success")).catch(() => showAlert("Please check your api's again", "error")); `) - ee.expandCollapseEntity("WIDGETS") - - ee.SelectEntityByName("Button1"); + ee.SelectEntityByName("Button1", 'WIDGETS'); cy.get("@jsObjName").then((jsObjName) => { jsEditor.EnterJSContext('onclick', "{{storeValue('date', Date()).then(() => { showAlert(appsmith.store.date, 'success'); return " + jsObjName + ".myFun1()})}}", true, true); }); + agHelper.DeployApp() agHelper.ClickButton('Submit') - agHelper.WaitUntilEleAppear(locator._toastMsg) + //agHelper.WaitUntilEleAppear(locator._toastMsg) cy.get(locator._toastMsg).should("have.length", 3) cy.get(locator._toastMsg).eq(0).should('contain.text', date) cy.get(locator._toastMsg).eq(1).contains("Running all api's") agHelper.WaitUntilEleAppear(locator._toastMsg) cy.get(locator._toastMsg).last().contains(/Wonderful|Please check/g) + agHelper.NavigateBacktoEditor() }); it("10. Verify Promises.any via direct JSObjects", () => { cy.fixture('promisesBtnDsl').then((val: any) => { - agHelper.AddDsl(val) + agHelper.AddDsl(val, locator._spanButton('Submit')) }); jsEditor.CreateJSObject(`export default { func2: async () => { @@ -267,31 +268,31 @@ showAlert("Wonderful! all apis executed", "success")).catch(() => showAlert("Ple return Promise.any([this.func2(), this.func3(), this.func1()]).then((value) => showAlert("Resolved promise is:" + value)) } }`, true, true) - ee.expandCollapseEntity('WIDGETS') - ee.SelectEntityByName("Button1"); + ee.SelectEntityByName("Button1", 'WIDGETS'); cy.get("@jsObjName").then((jsObjName) => { jsEditor.EnterJSContext('onclick', "{{" + jsObjName + ".runAny()}}", true, true); }); + agHelper.DeployApp() agHelper.ClickButton('Submit') cy.get(locator._toastMsg) .should("have.length", 4) cy.get(locator._toastMsg).eq(0).contains('Promises reject from func2') cy.get(locator._toastMsg).last().contains('Resolved promise is:func3') + agHelper.NavigateBacktoEditor() }); it("11. Bug : 11110 - Verify resetWidget via .then direct Promises", () => { cy.fixture("promisesBtnDsl").then((dsl: any) => { - agHelper.AddDsl(dsl); + agHelper.AddDsl(dsl, locator._spanButton('Submit')); }); - ee.expandCollapseEntity("WIDGETS"); //to expand widgets - ee.SelectEntityByName("Button1"); + ee.SelectEntityByName("Button1", 'WIDGETS'); jsEditor.EnterJSContext( "onclick", "{{resetWidget('Input1').then(() => showAlert(Input1.text))}}", true, true, ); - agHelper.DeployApp(); + agHelper.DeployApp(locator._inputWidgetInDeployed); cy.get(locator._inputWidgetInDeployed).type("Update value"); agHelper.ClickButton("Submit"); agHelper.ValidateToastMessage("Test") diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/SelectWidget_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/SelectWidget_Spec.ts new file mode 100644 index 0000000000..c21d7ef054 --- /dev/null +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/SelectWidget_Spec.ts @@ -0,0 +1,79 @@ +import { ObjectsRegistry } from "../../../../support/Objects/Registry" + +let agHelper = ObjectsRegistry.AggregateHelper, + table = ObjectsRegistry.Table; + +describe("Validate basic binding of Input widget to Input widget", () => { + + before(() => { + cy.fixture('Select_table_dsl').then((val: any) => { + agHelper.AddDsl(val) + }); + }); + + it("1. Validation of default displayed in Select widget based on row selected", function () { + agHelper.DeployApp() + + //Verify Default selected row is selected by default + table.ReadTableRowColumnData(0, 0).then($cellData => { + agHelper.ReadSelectedDropDownValue().then($selectedValue => { + expect($cellData).to.eq($selectedValue) + }) + }) + + //Verify able to select dropdown before any table selection + agHelper.SelectDropDown("#2") + agHelper.ReadSelectedDropDownValue().then($selectedValue => { + expect($selectedValue).to.eq('#2') + }) + + //Change to an non existing option - by table selecion + table.SelectTableRow(2) + agHelper.ReadSelectedDropDownValue().then($selectedValue => { + expect($selectedValue).to.eq('#3') + }) + + //Change select value now - if below is #2 - it will fail + agHelper.SelectDropDown("#1") + agHelper.ReadSelectedDropDownValue().then($selectedValue => { + expect($selectedValue).to.eq('#1') + }) + + agHelper.SelectDropDown("#2") + agHelper.ReadSelectedDropDownValue().then($selectedValue => { + expect($selectedValue).to.eq('#2') + }) + + agHelper.SelectDropDown("#1") + agHelper.ReadSelectedDropDownValue().then($selectedValue => { + expect($selectedValue).to.eq('#1') + }) + }); + + //Till bug fixed + it.skip("2. Validation of default displayed in Select widget based on row selected + Bug 12531", function () { + table.SelectTableRow(1) + agHelper.ReadSelectedDropDownValue().then($selectedValue => { + expect($selectedValue).to.eq('#2') + }) + + //Change select value now - failing here! + agHelper.SelectDropDown("#1") + agHelper.ReadSelectedDropDownValue().then($selectedValue => { + expect($selectedValue).to.eq('#1') + }) + + table.SelectTableRow(2)//Deselecting here! + agHelper.ReadSelectedDropDownValue().then($selectedValue => { + expect($selectedValue).to.eq('Select option') + }) + }); + + it("3. Verify Selecting the already selected row deselects it", () => { + table.SelectTableRow(0) + table.SelectTableRow(0) + agHelper.ReadSelectedDropDownValue().then($selectedValue => { + expect($selectedValue).to.eq('Select option') + }) + }) +}); \ No newline at end of file diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Select_Widget_Value_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Select_Widget_Value_spec.js deleted file mode 100644 index 1f35f37c1d..0000000000 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Select_Widget_Value_spec.js +++ /dev/null @@ -1,48 +0,0 @@ -const dsl = require("../../../../fixtures/Select_table_dsl.json"); -const widgetsPage = require("../../../../locators/Widgets.json"); -const commonlocators = require("../../../../locators/commonlocators.json"); -const formWidgetsPage = require("../../../../locators/FormWidgets.json"); -const widgetLocators = require("../../../../locators/Widgets.json"); - -describe("Binding the multiple widgets and validating default data", function() { - before(() => { - cy.addDsl(dsl); - }); - - it("1. Validation of default displayed in select widget based on row selected", function() { - cy.isSelectRow(0); - cy.readTabledataPublish("0", "0").then((tabData) => { - const tabValue = tabData; - //expect(tabValue).to.be.equal("#1"); - cy.log("the value is" + tabValue); - cy.get(widgetsPage.defaultSingleSelectValue) - .first() - .invoke("text") - .then((text) => { - const someText = text; - expect(someText) - .to.equal(tabValue) - .to.equal("#1"); - }); - }); - }); - it("2. Validation of data displayed in select widget based on row selected", function() { - cy.isSelectRow(2); - cy.CheckAndUnfoldEntityItem("WIDGETS"); - cy.wait(2500); - cy.get(widgetsPage.defaultSingleSelectValue) - .first() - .invoke("text") - .then((text) => { - const someText = text; - expect(someText).to.equal("#3"); - }); - cy.get(formWidgetsPage.selectWidget) - .find(widgetLocators.dropdownSingleSelect) - .click({ force: true }); - cy.get(commonlocators.singleSelectWidgetMenuItem) - .contains("#1") - .click({ force: true }); - cy.get(commonlocators.TextInside).contains("#1"); - }); -}); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/aTobAndbToaBasic_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/aTobAndbToaBasic_Spec.ts index b1d9e86486..b4ef01886b 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/aTobAndbToaBasic_Spec.ts +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/aTobAndbToaBasic_Spec.ts @@ -19,20 +19,21 @@ describe("Validate basic binding of Input widget to Input widget", () => { }); it("1. Input widget test with default value for atob method", () => { - ee.expandCollapseEntity("WIDGETS") - ee.SelectEntityByName("Input1") + ee.SelectEntityByName("Input1", 'WIDGETS') jsEditor.EnterJSContext("defaulttext", dataSet.atobInput + "}}"); agHelper.ValidateNetworkStatus('@updateLayout') + cy.get(locator._inputWidget).first().invoke("attr", "value").should("equal", 'A');//Before mapping JSObject value of input }); it("2. Input widget test with default value for btoa method", function () { ee.SelectEntityByName("Input2") jsEditor.EnterJSContext("defaulttext", dataSet.btoaInput + "}}"); agHelper.ValidateNetworkStatus('@updateLayout') + cy.get(locator._inputWidget).last().invoke("attr", "value").should("equal", 'QQ==');//Before mapping JSObject value of input }); it("3. Publish and validate the data displayed in input widgets value for aToB and bToa", function () { - agHelper.DeployApp() + agHelper.DeployApp(locator._inputWidgetInDeployed) cy.get(locator._inputWidgetInDeployed).first().invoke("attr", "value") .should("contain", "A") cy.get(locator._inputWidgetInDeployed).last().invoke("attr", "value") diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/ChartDataPoint_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/ChartDataPoint_Spec.ts index 0598455a93..d30f6c43de 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/ChartDataPoint_Spec.ts +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/ChartDataPoint_Spec.ts @@ -18,29 +18,23 @@ describe("Input widget test with default value from chart datapoint", () => { }); }); - it("1. Input widget test with default value from another Input widget", () => { - ee.expandCollapseEntity("WIDGETS") - ee.SelectEntityByName("Input1") + it("1. Chart widget - Input widget test with default value from another Input widget", () => { + ee.SelectEntityByName("Input1", 'WIDGETS') jsEditor.EnterJSContext("defaulttext", dataSet.bindChartData + "}}"); agHelper.ValidateNetworkStatus('@updateLayout') - }); - - it("2. Chart with datapoint feature validation", function () { ee.SelectEntityByName("Chart1") agHelper.SelectPropertiesDropDown("ondatapointclick", "Show message") agHelper.EnterActionValue("Message", dataSet.bindingDataPoint) + ee.SelectEntityByName("Input2") + jsEditor.EnterJSContext("defaulttext", dataSet.bindingSeriesTitle + "}}"); + agHelper.DeployApp() + agHelper.Sleep(1500)//waiting for chart to load! agHelper.XpathNClick("(//*[local-name()='rect'])[13]") - cy.get(locator._inputWidget).first().invoke('val').then($value => { + cy.get(locator._inputWidgetInDeployed).first().invoke('val').then($value => { let inputVal = ($value as string).replace(/\s/g, "") //cy.get(locator._toastMsg).invoke('text').then(toastTxt => expect(toastTxt.trim()).to.eq(inputVal)) cy.get(locator._toastMsg).should('have.text', inputVal) }) - }) - - it("3. Chart with seriesTitle feature validation", function () { - ee.SelectEntityByName("Input2") - jsEditor.EnterJSContext("defaulttext", dataSet.bindingSeriesTitle + "}}"); - cy.get(locator._inputWidget).last().should("have.value", dsl.dsl.children[0].chartData[0].seriesName); + cy.get(locator._inputWidgetInDeployed).last().should("have.value", dsl.dsl.children[0].chartData[0].seriesName); }); - }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/DocumentViewer_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/DocumentViewer_Spec.ts index de5c2ee9e5..c1cc33c6bf 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/DocumentViewer_Spec.ts +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/DocumentViewer_Spec.ts @@ -11,8 +11,7 @@ describe("DocumentViewer Widget Functionality", () => { it("2. Modify visibility & Publish app & verify", () => { ee.NavigateToSwitcher('explorer') - ee.expandCollapseEntity("WIDGETS"); //to expand widgets - ee.SelectEntityByName("DocumentViewer1"); + ee.SelectEntityByName("DocumentViewer1", 'WIDGETS'); agHelper.ToggleOnOrOff("visible", 'Off'); agHelper.DeployApp(); cy.get(locator._widgetInDeployed("documentviewerwidget")).should( @@ -22,8 +21,7 @@ describe("DocumentViewer Widget Functionality", () => { }); it("3. Change visibility & Publish app & verify again", () => { - ee.expandCollapseEntity("WIDGETS"); //to expand widgets - ee.SelectEntityByName("DocumentViewer1"); + ee.SelectEntityByName("DocumentViewer1", 'WIDGETS'); agHelper.ToggleOnOrOff("visible", 'On'); agHelper.DeployApp(); cy.get(locator._widgetInDeployed("documentviewerwidget")).should("exist"); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Migration_Spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Migration_Spec.js index bbda807719..5f3164d295 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Migration_Spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Migration_Spec.js @@ -164,9 +164,7 @@ describe("Migration Validate", function() { cy.waitUntil( () => cy - .xpath("//div[contains(@class, ' t--widget-textwidget')][2]", { - timeout: 50000, - }) + .xpath("//div[contains(@class, ' t--widget-textwidget')][2]") .eq(0) .contains("State:", { timeout: 30000 }) .should("exist"), @@ -217,14 +215,11 @@ describe("Migration Validate", function() { // cy.wait(4000); // cy.get("div.tableWrap").should("be.visible"); //wait for page load! - cy.waitUntil( - () => cy.get("div.tableWrap", { timeout: 50000 }).should("be.visible"), - { - errorMsg: "Page is not loaded evn after 10 secs", - timeout: 30000, - interval: 2000, - }, - ).then(() => cy.wait(1000)); //wait for page load! + cy.waitUntil(() => cy.get("div.tableWrap").should("be.visible"), { + errorMsg: "Page is not loaded evn after 10 secs", + timeout: 30000, + interval: 2000, + }).then(() => cy.wait(1000)); //wait for page load! cy.isSelectRow(2); //as aft refresh row selection is also gone cy.getTableDataSelector("2", "18").then((selector) => { @@ -398,14 +393,11 @@ describe("Migration Validate", function() { //cy.wait(4000); //cy.get("div.tableWrap").should("be.visible"); - cy.waitUntil( - () => cy.get("div.tableWrap", { timeout: 50000 }).should("be.visible"), - { - errorMsg: "Page is not loaded evn after 10 secs", - timeout: 30000, - interval: 2000, - }, - ).then(() => cy.wait(1000)); //wait for page load! + cy.waitUntil(() => cy.get("div.tableWrap").should("be.visible"), { + errorMsg: "Page is not loaded evn after 10 secs", + timeout: 30000, + interval: 2000, + }).then(() => cy.wait(1000)); //wait for page load! //Manu Btn validation: - 1st menu item cy.isSelectRow(4); //as aft refresh row selection is also gone diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Table_tabledata_schema_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Table_tabledata_schema_spec.js index 8ab65522e1..b8296dc6c5 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Table_tabledata_schema_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Table_tabledata_schema_spec.js @@ -25,7 +25,7 @@ describe("Table Widget", function() { cy.PublishtheApp(); cy.wait(30000); cy.getTableDataSelector("0", "0").then((element) => { - cy.get(element, { timeout: 10000 }).should("be.visible"); + cy.get(element).should("be.visible"); }); cy.readTabledataPublish("0", "0").then((value) => { expect(value).to.be.equal("joe"); @@ -35,7 +35,7 @@ describe("Table Widget", function() { .click(); cy.wait(1000); cy.getTableDataSelector("0", "0").then((element) => { - cy.get(element, { timeout: 10000 }).should("be.visible"); + cy.get(element).should("be.visible"); }); cy.readTabledataPublish("0", "0").then((value) => { expect(value).to.be.equal("john"); @@ -45,7 +45,7 @@ describe("Table Widget", function() { .click(); cy.wait(1000); cy.getTableDataSelector("0", "0").then((element) => { - cy.get(element, { timeout: 10000 }).should("be.visible"); + cy.get(element).should("be.visible"); }); cy.readTabledataPublish("0", "0").then((value) => { expect(value).to.be.equal("joe"); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/GenerateCRUD/S3_Spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/GenerateCRUD/S3_Spec.js index 77b485bbb5..eed7dce475 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/GenerateCRUD/S3_Spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/GenerateCRUD/S3_Spec.js @@ -217,7 +217,7 @@ describe("Generate New CRUD Page Inside from entity explorer", function() { //Post Execute call not happening.. hence commenting it for this case //cy.wait("@post_Execute").should("have.nested.property", "response.body.responseMeta.status", 200,); - cy.wait("@postExecute", { timeout: 8000 }).then(({ response }) => { + cy.wait("@postExecute").then(({ response }) => { expect(response.body.data.isExecutionSuccess).to.eq(true); }); cy.get("span:contains('GOT IT')").click(); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Replay/Replay_Editor_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Replay/Replay_Editor_spec.js index e0099ecbca..0d22effe89 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Replay/Replay_Editor_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Replay/Replay_Editor_spec.js @@ -62,6 +62,7 @@ describe("Undo/Redo functionality", function() { cy.get("body").click(0, 0); cy.get("body").type(`{${modifierKey}}z`); cy.get("body").type(`{${modifierKey}}z`); + cy.wait(1000); cy.get(apiwidget.headers).should("have.class", "react-tabs__tab--selected"); cy.get("body").type(`{${modifierKey}}z`); cy.get(`${apiwidget.resourceUrl} .CodeMirror-placeholder`).should( diff --git a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/ApiPaneTests/API_Bugs_Spec.js b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/ApiPaneTests/API_Bugs_Spec.js index 454ad9504a..755dd87b3b 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/ApiPaneTests/API_Bugs_Spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/ApiPaneTests/API_Bugs_Spec.js @@ -54,7 +54,7 @@ describe("Rest Bugs tests", function() { .invoke("attr", "src") .then(($src) => { expect($src).not.eq("https://assets.appsmith.com/widgets/default.png"); - expect($src).contains("cat"); + //expect($src).contains("cat"); }); // cy.wait("@postExecute").then(({ response }) => { @@ -62,7 +62,7 @@ describe("Rest Bugs tests", function() { // expect(response.body.data.body[0].url.length).to.be.above(0); //Cat image // }); - // cy.wait("@postExecute", { timeout: 8000 }).then(({ response }) => { + // cy.wait("@postExecute").then(({ response }) => { // expect(response.body.data.isExecutionSuccess).to.eq(true); // expect(response.body.data.body.message.length).to.be.above(0); //Dog Image // }); @@ -74,10 +74,10 @@ describe("Rest Bugs tests", function() { .invoke("attr", "src") .then(($src) => { expect($src).not.eq("https://assets.appsmith.com/widgets/default.png"); - expect($src).contains("dog"); + //expect($src).contains("dog"); }); - // cy.wait("@postExecute", { timeout: 8000 }).then(({ response }) => { + // cy.wait("@postExecute").then(({ response }) => { // expect(response.body.data.isExecutionSuccess).to.eq(true); // expect(response.body.data.body.length).to.be.above(0); //Number fact // }); @@ -87,7 +87,7 @@ describe("Rest Bugs tests", function() { .invoke("text") .then(($txt) => expect($txt).to.have.length.greaterThan(25)); - // cy.wait("@postExecute", { timeout: 8000 }).then(({ response }) => { + // cy.wait("@postExecute").then(({ response }) => { // //cy.log("Response is :"+ JSON.stringify(response.body)) // expect(response.body.data.isExecutionSuccess).to.eq(true); // expect(response.body.data.request.url.length).to.be.above(0); //Cocktail @@ -101,7 +101,7 @@ describe("Rest Bugs tests", function() { .invoke("attr", "src") .then(($src) => { expect($src).not.eq("https://assets.appsmith.com/widgets/default.png"); - expect($src).contains("cocktail"); + //expect($src).contains("cocktail"); }); //Spread to check later! diff --git a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/Datasources/MySQLNoiseTest_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/Datasources/MySQLNoiseTest_spec.js index 30a9bae220..3421c9e947 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/Datasources/MySQLNoiseTest_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/Datasources/MySQLNoiseTest_spec.js @@ -55,13 +55,13 @@ describe("MySQL noise test", function() { cy.get(commonlocators.toastmsg).contains( "UncaughtPromiseRejection: NoiseTestQuery failed to execute", ); - cy.wait("@postExecute", { timeout: 8000 }).then(({ response }) => { + cy.wait("@postExecute").then(({ response }) => { expect(response.body.data.statusCode).to.eq("200 OK"); }); - cy.wait("@postExecute", { timeout: 8000 }).then(({ response }) => { + cy.wait("@postExecute").then(({ response }) => { expect(response.body.data.statusCode).to.eq("200 OK"); }); - cy.wait("@postExecute", { timeout: 8000 }).then(({ response }) => { + cy.wait("@postExecute").then(({ response }) => { expect(response.body.data.statusCode).to.eq("5004"); expect(response.body.data.title).to.eq( "Datasource configuration is invalid", diff --git a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/Datasources/SMTPDatasource_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/Datasources/SMTPDatasource_spec.js index b7903d781b..5d2328de23 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/Datasources/SMTPDatasource_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/Datasources/SMTPDatasource_spec.js @@ -62,7 +62,7 @@ describe("SMTP datasource test cases using ted", function() { cy.get("span.bp3-button-text:contains('Run query')") .closest("div") .click(); - cy.wait("@postExecute", { timeout: 8000 }).then(({ response }) => { + cy.wait("@postExecute").then(({ response }) => { expect(response.body.data.statusCode).to.eq("5005"); expect(response.body.data.body).to.contain( "Couldn't find a valid recipient address. Please check your action configuration", @@ -78,7 +78,7 @@ describe("SMTP datasource test cases using ted", function() { cy.get("span.bp3-button-text:contains('Run query')") .closest("div") .click(); - cy.wait("@postExecute", { timeout: 8000 }).then(({ response }) => { + cy.wait("@postExecute").then(({ response }) => { expect(response.body.data.statusCode).to.eq("5005"); expect(response.body.data.body).to.contain( "Couldn't find a valid sender address. Please check your action configuration", diff --git a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/ExplorerTests/Entity_Explorer_Datasource_Structure_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/ExplorerTests/Entity_Explorer_Datasource_Structure_spec.js index 867be76269..48a99c8b36 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/ExplorerTests/Entity_Explorer_Datasource_Structure_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/ExplorerTests/Entity_Explorer_Datasource_Structure_spec.js @@ -94,7 +94,7 @@ describe("Entity explorer datasource structure", function() { .replace(/[^a-z]+/g, ""); cy.typeValueNValidate(`CREATE TABLE public.${tableName} ( ID int );`); cy.onlyQueryRun(); - cy.wait("@postExecute", { timeout: 8000 }).then(({ response }) => { + cy.wait("@postExecute").then(({ response }) => { expect(response.body.data.request.requestParams.Query.value).to.contain( tableName, ); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/LayoutOnLoadActions/OnLoadActions_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/LayoutOnLoadActions/OnLoadActions_Spec.ts index 994196b2af..e7a8171912 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/LayoutOnLoadActions/OnLoadActions_Spec.ts +++ b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/LayoutOnLoadActions/OnLoadActions_Spec.ts @@ -2,18 +2,20 @@ import { ObjectsRegistry } from "../../../../support/Objects/Registry" let dsl: any; let agHelper = ObjectsRegistry.AggregateHelper, - homePage = ObjectsRegistry.HomePage, - ee = ObjectsRegistry.EntityExplorer, - apiPage = ObjectsRegistry.ApiPage; + homePage = ObjectsRegistry.HomePage, + ee = ObjectsRegistry.EntityExplorer, + apiPage = ObjectsRegistry.ApiPage, + jsEditor = ObjectsRegistry.JSEditor, + locator = ObjectsRegistry.CommonLocators; -describe("Layout OnLoad Actions tests", function() { +describe("Layout OnLoad Actions tests", function () { before(() => { cy.fixture("onPageLoadActionsDsl").then((val: any) => { dsl = val; }); }); - it("1. Bug 8595: OnPageLoad execution - when No api to run on Pageload", function() { + it("1. Bug 8595: OnPageLoad execution - when No api to run on Pageload", function () { agHelper.AddDsl(dsl); ee.SelectEntityByName("WIDGETS"); ee.SelectEntityByName("Page1"); @@ -29,98 +31,130 @@ describe("Layout OnLoad Actions tests", function() { }); }); - it("2. Bug 8595: OnPageLoad execution - when Query Parmas added via Params tab", function() { - agHelper.AddDsl(dsl); + it("2. Bug 8595: OnPageLoad execution - when Query Parmas added via Params tab", function () { + agHelper.AddDsl(dsl, locator._imageWidget); apiPage.CreateAndFillApi( "https://source.unsplash.com/collection/1599413", "RandomFlora", ); - apiPage.RunAPI(); + //apiPage.RunAPI(); apiPage.CreateAndFillApi("https://randomuser.me/api/", "RandomUser"); - apiPage.RunAPI(); + //apiPage.RunAPI(); apiPage.CreateAndFillApi("https://favqs.com/api/qotd", "InspiringQuotes"); - apiPage.EnterHeader("dependency", "{{RandomUser.data}}"); - apiPage.RunAPI(); + apiPage.EnterHeader("dependency", "{{RandomUser.data}}");//via Params tab + //apiPage.RunAPI(); apiPage.CreateAndFillApi( "https://www.boredapi.com/api/activity", "Suggestions", ); apiPage.EnterHeader("dependency", "{{InspiringQuotes.data}}"); - apiPage.RunAPI(); + //apiPage.RunAPI(); apiPage.CreateAndFillApi("https://api.genderize.io", "Genderize"); - apiPage.EnterParams("name", "{{RandomUser.data.results[0].name.first}}"); - apiPage.RunAPI(); + apiPage.EnterParams("name", "{{RandomUser.data.results[0].name.first}}");//via Params tab + //apiPage.RunAPI(); + + //Adding dependency in right order matters! ee.SelectEntityByName("WIDGETS"); - ee.SelectEntityByName("Page1"); + ee.SelectEntityByName("Image1"); + jsEditor.EnterJSContext("image", `{{RandomFlora.data}}`, true); - cy.url().then((url) => { - const pageid = url.split("/")[4]?.split("-").pop(); - cy.log(pageid + "page id"); - cy.request("GET", "api/v1/pages/" + pageid).then((response) => { - const respBody = JSON.stringify(response.body); + ee.SelectEntityByName("Image2"); + jsEditor.EnterJSContext("image", `{{RandomUser.data.results[0].picture.large}}`, true); - const _randomFlora = JSON.parse(respBody).data.layouts[0] - .layoutOnLoadActions[0]; - const _randomUser = JSON.parse(respBody).data.layouts[0] - .layoutOnLoadActions[1]; - const _genderize = JSON.parse(respBody).data.layouts[0] - .layoutOnLoadActions[2]; - const _suggestions = JSON.parse(respBody).data.layouts[0] - .layoutOnLoadActions[3]; - // cy.log("_randomFlora is: " + JSON.stringify(_randomFlora)) - // cy.log("_randomUser is: " + JSON.stringify(_randomUser)) - // cy.log("_genderize is: " + JSON.stringify(_genderize)) - // cy.log("_suggestions is: " + JSON.stringify(_suggestions)) + ee.SelectEntityByName("Text1"); + jsEditor.EnterJSContext("text", `{{InspiringQuotes.data.quote.body}}\n--\n{{InspiringQuotes.data.quote.author}}\n`, true); - expect(JSON.parse(JSON.stringify(_randomFlora))[0]["name"]).to.eq( - "RandomFlora", - ); - expect(JSON.parse(JSON.stringify(_randomUser))[0]["name"]).to.eq( - "RandomUser", - ); - expect(JSON.parse(JSON.stringify(_genderize))[0]["name"]).to.be.oneOf([ - "Genderize", - "InspiringQuotes", - ]); - expect(JSON.parse(JSON.stringify(_genderize))[1]["name"]).to.be.oneOf([ - "Genderize", - "InspiringQuotes", - ]); - expect(JSON.parse(JSON.stringify(_suggestions))[0]["name"]).to.eq( - "Suggestions", - ); - }); - }); + ee.SelectEntityByName("Text2"); + jsEditor.EnterJSContext("text", `Hi, here is {{RandomUser.data.results[0].name.first}} & I'm {{RandomUser.data.results[0].dob.age}}'yo\nI live in {{RandomUser.data.results[0].location.country}}\nMy Suggestion : {{Suggestions.data.activity}}\n\nI'm {{Genderize.data.gender}}`, true); + + // cy.url().then((url) => { + // const pageid = url.split("/")[4]?.split("-").pop(); + // cy.log(pageid + "page id"); + // cy.request("GET", "api/v1/pages/" + pageid).then((response) => { + // const respBody = JSON.stringify(response.body); + + // const _randomFlora = JSON.parse(respBody).data.layouts[0] + // .layoutOnLoadActions[0]; + // const _randomUser = JSON.parse(respBody).data.layouts[0] + // .layoutOnLoadActions[1]; + // const _genderize = JSON.parse(respBody).data.layouts[0] + // .layoutOnLoadActions[2]; + // const _suggestions = JSON.parse(respBody).data.layouts[0] + // .layoutOnLoadActions[3]; + // // cy.log("_randomFlora is: " + JSON.stringify(_randomFlora)) + // // cy.log("_randomUser is: " + JSON.stringify(_randomUser)) + // // cy.log("_genderize is: " + JSON.stringify(_genderize)) + // // cy.log("_suggestions is: " + JSON.stringify(_suggestions)) + + // expect(JSON.parse(JSON.stringify(_randomFlora))[0]["name"]).to.eq( + // "RandomFlora", + // ); + // expect(JSON.parse(JSON.stringify(_randomUser))[0]["name"]).to.eq( + // "RandomUser", + // ); + // expect(JSON.parse(JSON.stringify(_genderize))[0]["name"]).to.be.oneOf([ + // "Genderize", + // "InspiringQuotes", + // ]); + // expect(JSON.parse(JSON.stringify(_genderize))[1]["name"]).to.be.oneOf([ + // "Genderize", + // "InspiringQuotes", + // ]); + // expect(JSON.parse(JSON.stringify(_suggestions))[0]["name"]).to.eq( + // "Suggestions", + // ); + // }); + // }); + + agHelper.DeployApp() + agHelper.Sleep()//waiting for error toast - incase it wants to appear! + agHelper.AssertElementAbsence(locator._toastMsg) + agHelper.Sleep(5000)//for all api's to ccomplete call! + cy.wait("@viewPage").then(($response) => { + const respBody = JSON.stringify($response.response?.body); + + const _randomFlora = JSON.parse(respBody).data.layouts[0] + .layoutOnLoadActions[0]; + const _randomUser = JSON.parse(respBody).data.layouts[0] + .layoutOnLoadActions[1]; + const _genderize = JSON.parse(respBody).data.layouts[0] + .layoutOnLoadActions[2]; + const _suggestions = JSON.parse(respBody).data.layouts[0] + .layoutOnLoadActions[3]; + // cy.log("_randomFlora is: " + JSON.stringify(_randomFlora)) + // cy.log("_randomUser is: " + JSON.stringify(_randomUser)) + // cy.log("_genderize is: " + JSON.stringify(_genderize)) + // cy.log("_suggestions is: " + JSON.stringify(_suggestions)) + + expect(JSON.parse(JSON.stringify(_randomFlora))[0]["name"]).to.eq( + "RandomFlora", + ); + expect(JSON.parse(JSON.stringify(_randomUser))[0]["name"]).to.eq( + "RandomUser", + ); + expect(JSON.parse(JSON.stringify(_genderize))[0]["name"]).to.be.oneOf([ + "Genderize", + "InspiringQuotes", + ]); + expect(JSON.parse(JSON.stringify(_genderize))[1]["name"]).to.be.oneOf([ + "Genderize", + "InspiringQuotes", + ]); + expect(JSON.parse(JSON.stringify(_suggestions))[0]["name"]).to.eq( + "Suggestions", + ); + }) + + agHelper.NavigateBacktoEditor() }); - it("3. Bug 10049, 10055: Dependency not executed in expected order in layoutOnLoadActions when dependency added via URL", function() { - homePage.NavigateToHome(); - homePage.CreateNewApplication(); - agHelper.AddDsl(dsl); - - apiPage.CreateAndFillApi( - "https://source.unsplash.com/collection/1599413", - "RandomFlora", - ); - apiPage.RunAPI(); - - apiPage.CreateAndFillApi("https://randomuser.me/api/", "RandomUser"); - apiPage.RunAPI(); - - apiPage.CreateAndFillApi("https://favqs.com/api/qotd", "InspiringQuotes"); - apiPage.EnterHeader("dependency", "{{RandomUser.data}}"); - apiPage.RunAPI(); - - apiPage.CreateAndFillApi( - "https://www.boredapi.com/api/activity", - "Suggestions", - ); - apiPage.EnterHeader("dependency", "{{InspiringQuotes.data}}"); - apiPage.RunAPI(); + it("3. Bug 10049, 10055: Dependency not executed in expected order in layoutOnLoadActions when dependency added via URL", function () { + ee.SelectEntityByName('Genderize', 'QUERIES/JS') + ee.ActionContextMenuByEntityName('Genderize', 'Delete', 'Are you sure?') apiPage.CreateAndFillApi( "https://api.genderize.io?name={{RandomUser.data.results[0].name.first}}", @@ -130,47 +164,39 @@ describe("Layout OnLoad Actions tests", function() { key: "name", value: "{{RandomUser.data.results[0].name.first}}", }); // verifies Bug 10055 - apiPage.RunAPI(); - ee.SelectEntityByName("WIDGETS"); - ee.SelectEntityByName("Page1"); + + agHelper.DeployApp() + agHelper.Sleep()//waiting for error toast - incase it wants to appear! + agHelper.AssertElementAbsence(locator._toastMsg) + agHelper.Sleep(5000)//for all api's to ccomplete call! + cy.wait("@viewPage").then(($response) => { + const respBody = JSON.stringify($response.response?.body); + const _randomFlora = JSON.parse(respBody).data.layouts[0] + .layoutOnLoadActions[0]; + const _randomUser = JSON.parse(respBody).data.layouts[0] + .layoutOnLoadActions[1]; + const _genderize = JSON.parse(respBody).data.layouts[0] + .layoutOnLoadActions[2]; + const _suggestions = JSON.parse(respBody).data.layouts[0] + .layoutOnLoadActions[3]; - cy.url().then((url) => { - const pageid = url.split("/")[4]?.split("-").pop(); - cy.log(pageid + "page id"); - cy.request("GET", "api/v1/pages/" + pageid).then((response) => { - const respBody = JSON.stringify(response.body); - - const _randomFlora = JSON.parse(respBody).data.layouts[0] - .layoutOnLoadActions[0]; - const _randomUser = JSON.parse(respBody).data.layouts[0] - .layoutOnLoadActions[1]; - const _genderize = JSON.parse(respBody).data.layouts[0] - .layoutOnLoadActions[2]; - const _suggestions = JSON.parse(respBody).data.layouts[0] - .layoutOnLoadActions[3]; - // cy.log("_randomFlora is: " + JSON.stringify(_randomFlora)) - // cy.log("_randomUser is: " + JSON.stringify(_randomUser)) - // cy.log("_genderize is: " + JSON.stringify(_genderize)) - // cy.log("_suggestions is: " + JSON.stringify(_suggestions)) - - expect(JSON.parse(JSON.stringify(_randomFlora))[0]["name"]).to.eq( - "RandomFlora", - ); - expect(JSON.parse(JSON.stringify(_randomUser))[0]["name"]).to.eq( - "RandomUser", - ); - expect(JSON.parse(JSON.stringify(_genderize))[0]["name"]).to.be.oneOf([ - "Genderize", - "InspiringQuotes", - ]); - expect(JSON.parse(JSON.stringify(_genderize))[1]["name"]).to.be.oneOf([ - "Genderize", - "InspiringQuotes", - ]); - expect(JSON.parse(JSON.stringify(_suggestions))[0]["name"]).to.eq( - "Suggestions", - ); - }); - }); + expect(JSON.parse(JSON.stringify(_randomFlora))[0]["name"]).to.eq( + "RandomFlora", + ); + expect(JSON.parse(JSON.stringify(_randomUser))[0]["name"]).to.eq( + "RandomUser", + ); + expect(JSON.parse(JSON.stringify(_genderize))[0]["name"]).to.be.oneOf([ + "Genderize", + "InspiringQuotes", + ]); + expect(JSON.parse(JSON.stringify(_genderize))[1]["name"]).to.be.oneOf([ + "Genderize", + "InspiringQuotes", + ]); + expect(JSON.parse(JSON.stringify(_suggestions))[0]["name"]).to.eq( + "Suggestions", + ); + }) }); }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/Params/PassingParams_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/Params/PassingParams_Spec.ts index ab2ef1c76e..62bf2127e5 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/Params/PassingParams_Spec.ts +++ b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/Params/PassingParams_Spec.ts @@ -1,12 +1,13 @@ import { ObjectsRegistry } from "../../../../support/Objects/Registry" -let guid: any; +let guid: any, jsName: any; let agHelper = ObjectsRegistry.AggregateHelper, dataSources = ObjectsRegistry.DataSources, jsEditor = ObjectsRegistry.JSEditor, locator = ObjectsRegistry.CommonLocators, ee = ObjectsRegistry.EntityExplorer, - table = ObjectsRegistry.Table; + table = ObjectsRegistry.Table, + apiPage = ObjectsRegistry.ApiPage; describe("[Bug] - 10784 - Passing params from JS to SQL query should not break", () => { before(() => { @@ -27,17 +28,17 @@ describe("[Bug] - 10784 - Passing params from JS to SQL query should not break", cy.log("ds name is :" + guid); dataSources.NavigateToActiveDSQueryPane(guid); agHelper.GetNClick(dataSources._templateMenu); - agHelper.RenameWithInPane("Params1"); + agHelper.RenameWithInPane("ParamsTest"); agHelper.EnterValue( "SELECT * FROM public.users where id = {{this?.params?.condition || '1=1'}} order by id", ); jsEditor.CreateJSObject( - 'Params1.run(() => {},() => {},{"condition": selRecordFilter.selectedOptionValue})', + 'ParamsTest.run(() => {},() => {},{"condition": selRecordFilter.selectedOptionValue})', true, false, false ); }); - ee.expandCollapseEntity("WIDGETS"); - ee.SelectEntityByName("Button1"); + ee.SelectEntityByName("Button1", 'WIDGETS'); cy.get("@jsObjName").then((jsObjName) => { + jsName = jsObjName; jsEditor.EnterJSContext( "onclick", "{{" + jsObjName + ".myFun1()}}", @@ -46,368 +47,185 @@ describe("[Bug] - 10784 - Passing params from JS to SQL query should not break", ); }); ee.SelectEntityByName("Table1"); - jsEditor.EnterJSContext("tabledata", "{{Params1.data}}"); + jsEditor.EnterJSContext("tabledata", "{{ParamsTest.data}}"); - agHelper.ClickButton("Submit"); - agHelper.ValidateNetworkExecutionSuccess("@postExecute"); - table.ReadTableRowColumnData(0, 0).then((cellData) => { - expect(cellData).to.be.equal("8"); - }); + ee.SelectEntityByName("ParamsTest", 'QUERIES/JS'); + apiPage.DisableOnPageLoadRun()//Bug 12476 - agHelper.SelectDropDown("selectwidget", "7"); - agHelper.Sleep(2000); + agHelper.DeployApp(locator._spanButton('Submit')) + agHelper.SelectDropDown("7"); agHelper.ClickButton("Submit"); - agHelper.Sleep(2000); agHelper.ValidateNetworkExecutionSuccess("@postExecute"); table.ReadTableRowColumnData(0, 0).then((cellData) => { expect(cellData).to.be.equal("7"); }); + + agHelper.NavigateBacktoEditor() }); it("2. With Optional chaining : {{ (function() { return this?.params?.condition })() }}", function () { - dataSources.NavigateToActiveDSQueryPane(guid); - agHelper.GetNClick(dataSources._templateMenu); - agHelper.RenameWithInPane("Params2"); + ee.SelectEntityByName("ParamsTest", 'QUERIES/JS'); agHelper.EnterValue( "SELECT * FROM public.users where id = {{(function() { return this?.params?.condition })() || '1=1'}} order by id", ); - jsEditor.CreateJSObject( - 'Params2.run(() => {},() => {},{"condition": selRecordFilter.selectedOptionValue})', - ); - - ee.SelectEntityByName("Button1"); - cy.get("@jsObjName").then((jsObjName) => { - jsEditor.EnterJSContext( - "onclick", - "{{" + jsObjName + ".myFun1()}}", - true, - true, - ); - }); - ee.SelectEntityByName("Table1"); - jsEditor.EnterJSContext("tabledata", "{{Params2.data}}"); - + agHelper.DeployApp(locator._spanButton('Submit')) + agHelper.SelectDropDown("9"); agHelper.ClickButton("Submit"); agHelper.ValidateNetworkExecutionSuccess("@postExecute"); - table.ReadTableRowColumnData(0, 0).then((cellData) => { - expect(cellData).to.be.equal("7"); - }); - - agHelper.SelectDropDown("selectwidget", "9"); - agHelper.Sleep(2000); - agHelper.ClickButton("Submit"); - agHelper.Sleep(2000); - agHelper.ValidateNetworkExecutionSuccess("@postExecute"); table.ReadTableRowColumnData(0, 0).then((cellData) => { expect(cellData).to.be.equal("9"); }); + agHelper.NavigateBacktoEditor() }); it("3. With Optional chaining : {{ (() => { return this?.params?.condition })() }}", function () { - dataSources.NavigateToActiveDSQueryPane(guid); - agHelper.GetNClick(dataSources._templateMenu); - agHelper.RenameWithInPane("Params3"); + ee.SelectEntityByName("ParamsTest", 'QUERIES/JS'); agHelper.EnterValue( "SELECT * FROM public.users where id = {{(() => { return this?.params?.condition })() || '1=1'}} order by id", ); - jsEditor.CreateJSObject( - 'Params3.run(() => {},() => {},{"condition": selRecordFilter.selectedOptionValue})', - ); - - ee.SelectEntityByName("Button1"); - cy.get("@jsObjName").then((jsObjName) => { - jsEditor.EnterJSContext( - "onclick", - "{{" + jsObjName + ".myFun1()}}", - true, - true, - ); - }); - ee.SelectEntityByName("Table1"); - jsEditor.EnterJSContext("tabledata", "{{Params3.data}}"); - + agHelper.DeployApp(locator._spanButton('Submit')) + agHelper.SelectDropDown("7"); agHelper.ClickButton("Submit"); agHelper.ValidateNetworkExecutionSuccess("@postExecute"); table.ReadTableRowColumnData(0, 0).then((cellData) => { - expect(cellData).to.be.equal("9"); - }); - - agHelper.SelectDropDown("selectwidget", "8"); - agHelper.Sleep(2000); - agHelper.ClickButton("Submit"); - agHelper.Sleep(2000); - agHelper.ValidateNetworkExecutionSuccess("@postExecute"); - table.ReadTableRowColumnData(0, 0).then((cellData) => { - expect(cellData).to.be.equal("8"); + expect(cellData).to.be.equal("7"); }); + agHelper.NavigateBacktoEditor() }); it("4. With Optional chaining : {{ this?.params.condition }}", function () { - dataSources.NavigateToActiveDSQueryPane(guid); - agHelper.GetNClick(dataSources._templateMenu); - agHelper.RenameWithInPane("Params4"); + ee.SelectEntityByName("ParamsTest", 'QUERIES/JS'); agHelper.EnterValue( "SELECT * FROM public.users where id = {{this?.params.condition || '1=1'}} order by id", ); - jsEditor.CreateJSObject( - 'Params4.run(() => {},() => {},{"condition": selRecordFilter.selectedOptionValue})', - ); - - ee.SelectEntityByName("Button1"); - cy.get("@jsObjName").then((jsObjName) => { - jsEditor.EnterJSContext( - "onclick", - "{{" + jsObjName + ".myFun1()}}", - true, - true, - ); - }); - ee.SelectEntityByName("Table1"); - jsEditor.EnterJSContext("tabledata", "{{Params4.data}}"); - + agHelper.DeployApp(locator._spanButton('Submit')) + agHelper.SelectDropDown("9"); agHelper.ClickButton("Submit"); agHelper.ValidateNetworkExecutionSuccess("@postExecute"); table.ReadTableRowColumnData(0, 0).then((cellData) => { - expect(cellData).to.be.equal("8"); - }); - - agHelper.SelectDropDown("selectwidget", "7"); - agHelper.Sleep(2000); - agHelper.ClickButton("Submit"); - agHelper.Sleep(2000); - agHelper.ValidateNetworkExecutionSuccess("@postExecute"); - table.ReadTableRowColumnData(0, 0).then((cellData) => { - expect(cellData).to.be.equal("7"); + expect(cellData).to.be.equal("9"); }); + agHelper.NavigateBacktoEditor() }); it("5. With Optional chaining : {{ (function() { return this?.params.condition })() }}", function () { - dataSources.NavigateToActiveDSQueryPane(guid); - agHelper.GetNClick(dataSources._templateMenu); - agHelper.RenameWithInPane("Params5"); + ee.SelectEntityByName("ParamsTest", 'QUERIES/JS'); agHelper.EnterValue( "SELECT * FROM public.users where id = {{(function() { return this?.params.condition })() || '1=1'}} order by id", ); - jsEditor.CreateJSObject( - 'Params5.run(() => {},() => {},{"condition": selRecordFilter.selectedOptionValue})', - ); - - ee.SelectEntityByName("Button1"); - cy.get("@jsObjName").then((jsObjName) => { - jsEditor.EnterJSContext( - "onclick", - "{{" + jsObjName + ".myFun1()}}", - true, - true, - ); - }); - ee.SelectEntityByName("Table1"); - jsEditor.EnterJSContext("tabledata", "{{Params5.data}}"); - + agHelper.DeployApp(locator._spanButton('Submit')) + agHelper.SelectDropDown("7"); agHelper.ClickButton("Submit"); agHelper.ValidateNetworkExecutionSuccess("@postExecute"); table.ReadTableRowColumnData(0, 0).then((cellData) => { expect(cellData).to.be.equal("7"); }); - - agHelper.SelectDropDown("selectwidget", "9"); - agHelper.Sleep(2000); - agHelper.ClickButton("Submit"); - agHelper.Sleep(2000); - agHelper.ValidateNetworkExecutionSuccess("@postExecute"); - table.ReadTableRowColumnData(0, 0).then((cellData) => { - expect(cellData).to.be.equal("9"); - }); + agHelper.NavigateBacktoEditor() }); it("6. With Optional chaining : {{ (() => { return this?.params.condition })() }}", function () { - dataSources.NavigateToActiveDSQueryPane(guid); - agHelper.GetNClick(dataSources._templateMenu); - agHelper.RenameWithInPane("Params6"); + ee.SelectEntityByName("ParamsTest", 'QUERIES/JS'); agHelper.EnterValue( "SELECT * FROM public.users where id = {{(() => { return this?.params.condition })() || '1=1'}} order by id", ); - jsEditor.CreateJSObject( - 'Params6.run(() => {},() => {},{"condition": selRecordFilter.selectedOptionValue})', - ); - - ee.SelectEntityByName("Button1"); - cy.get("@jsObjName").then((jsObjName) => { - jsEditor.EnterJSContext( - "onclick", - "{{" + jsObjName + ".myFun1()}}", - true, - true, - ); - }); - ee.SelectEntityByName("Table1"); - jsEditor.EnterJSContext("tabledata", "{{Params6.data}}"); - + agHelper.DeployApp(locator._spanButton('Submit')) + agHelper.SelectDropDown("9"); agHelper.ClickButton("Submit"); agHelper.ValidateNetworkExecutionSuccess("@postExecute"); table.ReadTableRowColumnData(0, 0).then((cellData) => { expect(cellData).to.be.equal("9"); }); - - agHelper.SelectDropDown("selectwidget", "8"); - agHelper.Sleep(2000); - agHelper.ClickButton("Submit"); - agHelper.Sleep(2000); - agHelper.ValidateNetworkExecutionSuccess("@postExecute"); - table.ReadTableRowColumnData(0, 0).then((cellData) => { - expect(cellData).to.be.equal("8"); - }); + agHelper.NavigateBacktoEditor() }); it("7. With No Optional chaining : {{ this.params.condition }}", function () { - dataSources.NavigateToActiveDSQueryPane(guid); - agHelper.GetNClick(dataSources._templateMenu); - agHelper.RenameWithInPane("Params7"); + ee.SelectEntityByName("ParamsTest", 'QUERIES/JS'); agHelper.EnterValue( "SELECT * FROM public.users where id = {{this.params.condition || '1=1'}} order by id", ); - jsEditor.CreateJSObject( - 'Params7.run(() => {},() => {},{"condition": selRecordFilter.selectedOptionValue})', - ); - - ee.SelectEntityByName("Button1"); - cy.get("@jsObjName").then((jsObjName) => { - jsEditor.EnterJSContext( - "onclick", - "{{" + jsObjName + ".myFun1()}}", - true, - true, - ); - }); - ee.SelectEntityByName("Table1"); - jsEditor.EnterJSContext("tabledata", "{{Params7.data}}"); - + agHelper.DeployApp(locator._spanButton('Submit')) + agHelper.SelectDropDown("7"); agHelper.ClickButton("Submit"); agHelper.ValidateNetworkExecutionSuccess("@postExecute"); - table.ReadTableRowColumnData(0, 0).then((cellData) => { - expect(cellData).to.be.equal("8"); - }); - - agHelper.SelectDropDown("selectwidget", "7"); - agHelper.Sleep(2000); - agHelper.ClickButton("Submit"); - agHelper.Sleep(2000); - agHelper.ValidateNetworkExecutionSuccess("@postExecute"); table.ReadTableRowColumnData(0, 0).then((cellData) => { expect(cellData).to.be.equal("7"); }); + agHelper.NavigateBacktoEditor() }); it("8. With No Optional chaining : {{ (function() { return this.params.condition })() }}", function () { - dataSources.NavigateToActiveDSQueryPane(guid); - agHelper.GetNClick(dataSources._templateMenu); - agHelper.RenameWithInPane("Params8"); + ee.SelectEntityByName("ParamsTest", 'QUERIES/JS'); agHelper.EnterValue( "SELECT * FROM public.users where id = {{(function() { return this.params.condition })() || '1=1'}} order by id", ); - jsEditor.CreateJSObject( - 'Params8.run(() => {},() => {},{"condition": selRecordFilter.selectedOptionValue})', - ); - - ee.SelectEntityByName("Button1"); - cy.get("@jsObjName").then((jsObjName) => { - jsEditor.EnterJSContext( - "onclick", - "{{" + jsObjName + ".myFun1()}}", - true, - true, - ); - }); - ee.SelectEntityByName("Table1"); - jsEditor.EnterJSContext("tabledata", "{{Params8.data}}"); - + agHelper.DeployApp(locator._spanButton('Submit')) + agHelper.SelectDropDown("8"); agHelper.ClickButton("Submit"); agHelper.ValidateNetworkExecutionSuccess("@postExecute"); - table.ReadTableRowColumnData(0, 0).then((cellData) => { - expect(cellData).to.be.equal("7"); - }); - - agHelper.SelectDropDown("selectwidget", "9"); - agHelper.Sleep(2000); - agHelper.ClickButton("Submit"); - agHelper.Sleep(2000); - agHelper.ValidateNetworkExecutionSuccess("@postExecute"); - table.ReadTableRowColumnData(0, 0).then((cellData) => { - expect(cellData).to.be.equal("9"); - }); - }); - - it("9. With No Optional chaining : {{ (() => { return this.params.condition })() }}", function () { - dataSources.NavigateToActiveDSQueryPane(guid); - agHelper.GetNClick(dataSources._templateMenu); - agHelper.RenameWithInPane("Params9"); - agHelper.EnterValue( - "SELECT * FROM public.users where id = {{(() => { return this.params.condition })() || '1=1'}} order by id", - ); - jsEditor.CreateJSObject( - 'Params9.run(() => {},() => {},{"condition": selRecordFilter.selectedOptionValue})', - ); - - ee.SelectEntityByName("Button1"); - cy.get("@jsObjName").then((jsObjName) => { - jsEditor.EnterJSContext( - "onclick", - "{{" + jsObjName + ".myFun1()}}", - true, - true, - ); - }); - ee.SelectEntityByName("Table1"); - jsEditor.EnterJSContext("tabledata", "{{Params9.data}}"); - - agHelper.ClickButton("Submit"); - agHelper.ValidateNetworkExecutionSuccess("@postExecute"); - table.ReadTableRowColumnData(0, 0).then((cellData) => { - expect(cellData).to.be.equal("9"); - }); - - agHelper.SelectDropDown("selectwidget", "8"); - agHelper.Sleep(2000); - agHelper.ClickButton("Submit"); - agHelper.Sleep(2000); - agHelper.ValidateNetworkExecutionSuccess("@postExecute"); table.ReadTableRowColumnData(0, 0).then((cellData) => { expect(cellData).to.be.equal("8"); }); + agHelper.NavigateBacktoEditor() }); - it("10. With Optional chaining : {{ this?.params?.condition }} && no optional paramter passed", function () { - dataSources.NavigateToActiveDSQueryPane(guid); - agHelper.GetNClick(dataSources._templateMenu); - agHelper.RenameWithInPane("Params10"); + it("9. With No Optional chaining : {{ (() => { return this.params.condition })() }}", function () { + ee.SelectEntityByName("ParamsTest", 'QUERIES/JS'); + agHelper.EnterValue( + "SELECT * FROM public.users where id = {{(() => { return this.params.condition })() || '1=1'}} order by id", + ); + agHelper.DeployApp(locator._spanButton('Submit')) + agHelper.SelectDropDown("9"); + agHelper.ClickButton("Submit"); + agHelper.ValidateNetworkExecutionSuccess("@postExecute"); + table.ReadTableRowColumnData(0, 0).then((cellData) => { + expect(cellData).to.be.equal("9"); + }); + agHelper.NavigateBacktoEditor() + }); + + it("10. With Optional chaining : {{ this.params.condition }} && direct paramter passed", function () { + ee.SelectEntityByName("ParamsTest", 'QUERIES/JS'); agHelper.EnterValue( "SELECT * FROM public.users where id = {{(() => { return this.params.condition })() || '7'}} order by id", ); - jsEditor.CreateJSObject( - 'Params10.run(() => {},() => {},{"condition": selRecordFilter.selectedOptionValue})', - ); - ee.SelectEntityByName("Button1"); - cy.get("@jsObjName").then((jsObjName) => { - jsEditor.EnterJSContext( - "onclick", - "{{" + jsObjName + ".myFun1()}}", - true, - true, - ); - }); - ee.SelectEntityByName("Table1"); - jsEditor.EnterJSContext("tabledata", "{{Params10.data}}"); - - //When No selected option passed - cy.xpath(locator._selectWidgetDropdown("selectwidget")).within(() => + agHelper.DeployApp(locator._spanButton('Submit')) + //Verifh when No selected option passed + cy.xpath(locator._selectWidgetDropdownInDeployed("selectwidget")).within(() => cy.get(locator._crossBtn).click(), ); agHelper.ClickButton("Submit"); - agHelper.Sleep(2000); agHelper.ValidateNetworkExecutionSuccess("@postExecute"); table.ReadTableRowColumnData(0, 0).then((cellData) => { expect(cellData).to.be.equal("7"); }); + agHelper.NavigateBacktoEditor() + + }); + + it("11. With Optional chaining : {{ this.params.condition }} && no optional paramter passed", function () { + ee.SelectEntityByName("ParamsTest", 'QUERIES/JS'); + agHelper.EnterValue( + "SELECT * FROM public.users where id = {{(() => { return this.params.condition })()}} order by id", + ); + agHelper.DeployApp(locator._spanButton('Submit')) + agHelper.ClickButton("Submit"); + agHelper.ValidateNetworkExecutionSuccess("@postExecute"); + table.ReadTableRowColumnData(0, 0).then((cellData) => { + expect(cellData).to.be.equal("8"); + }); + agHelper.NavigateBacktoEditor() + }); + + it("12. Delete all entities - Query, JSObjects, Datasource + Bug 12532", () => { + ee.expandCollapseEntity('QUERIES/JS') + ee.ActionContextMenuByEntityName('ParamsTest', 'Delete', 'Are you sure?') + agHelper.ValidateNetworkStatus("@deleteAction", 200) + ee.ActionContextMenuByEntityName(jsName as string, 'Delete', 'Are you sure?') + agHelper.ValidateNetworkStatus("@deleteJSCollection", 200) + // //Bug 12532 + // ee.expandCollapseEntity('DATASOURCES') + // ee.ActionContextMenuByEntityName(guid, 'Delete', 'Are you sure?') + // agHelper.ValidateNetworkStatus("@deleteAction", 200) }); }); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/QueryPane/S3_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/QueryPane/S3_spec.js index 45f925f5ab..390c9d2947 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/QueryPane/S3_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/QueryPane/S3_spec.js @@ -428,9 +428,7 @@ describe("Validate CRUD queries for Amazon S3 along with UI flow verifications", cy.wait("@postExecute").then(({ response }) => { expect(response.body.data.isExecutionSuccess).to.eq(true); }); - cy.get("span:contains('CRUDNewPageFile')", { timeout: 10000 }).should( - "not.exist", - ); //verify Deletion of file is success from UI also + cy.get("span:contains('CRUDNewPageFile')").should("not.exist"); //verify Deletion of file is success from UI also }); it("6. Validate Deletion of the Newly Created Page", () => { @@ -543,7 +541,6 @@ describe("Validate CRUD queries for Amazon S3 along with UI flow verifications", "//div[@data-cy='overlay-comments-wrapper']//span[text()='" + fixturePath + "']", - { timeout: 10000 }, ).should("not.exist"); //verify Deletion of file is success from UI also //Upload: 2 - Bug verification 9201 @@ -609,7 +606,6 @@ describe("Validate CRUD queries for Amazon S3 along with UI flow verifications", "//div[@data-cy='overlay-comments-wrapper']//span[text()='" + fixturePath + "']", - { timeout: 10000 }, ).should("not.exist"); //verify Deletion of file is success from UI also //Deleting the page: diff --git a/app/client/cypress/locators/commonlocators.json b/app/client/cypress/locators/commonlocators.json index fe6166b562..eb842845c9 100644 --- a/app/client/cypress/locators/commonlocators.json +++ b/app/client/cypress/locators/commonlocators.json @@ -65,7 +65,7 @@ "toastMsg": ".Toastify__toast.Toastify__toast--default span", "callApi": ".t--property-control-onpagechange .t--open-dropdown-Select-Action", "singleSelectMenuItem": ".bp3-menu-item.single-select div", - "singleSelectWidgetMenuItem": ".menu-item-link div", + "singleSelectWidgetMenuItem": ".menu-item-link", "singleSelectActiveMenuItem": ".menu-item-active div", "multiSelectMenuItem": "rc-select-item.rc-select-item-option div", "selectMenuItem": ".bp3-menu li>a>div", diff --git a/app/client/cypress/support/Objects/CommonLocators.ts b/app/client/cypress/support/Objects/CommonLocators.ts index 17b69d12e4..a8403dd780 100644 --- a/app/client/cypress/support/Objects/CommonLocators.ts +++ b/app/client/cypress/support/Objects/CommonLocators.ts @@ -15,8 +15,11 @@ export class CommonLocators { _textWidget = ".t--draggable-textwidget span" _inputWidget = ".t--draggable-inputwidgetv2 input" _publishButton = ".t--application-publish-btn" - _textWidgetInDeployed = ".t--widget-textwidget span" - _inputWidgetInDeployed = ".t--widget-inputwidgetv2 input" + _widgetInCanvas = (widgetType: string) => `.t--draggable-${widgetType}` + _widgetInDeployed = (widgetType: string) => `.t--widget-${widgetType}` + _textWidgetInDeployed = this._widgetInDeployed("textwidget") + " span" + _inputWidgetInDeployed = this._widgetInDeployed("inputwidgetv2") + " input" + _imageWidget = ".t--draggable-imagewidget" _backToEditor = ".t--back-to-editor" _newPage = ".pages .t--entity-add-btn" _toastMsg = ".t--toast-action" @@ -26,7 +29,6 @@ export class CommonLocators { _openWidget = ".widgets .t--entity-add-btn" _dropHere = "#comment-overlay-wrapper-0" _activeTab = "span:contains('Active')" - _createQuery = ".t--create-query" _crossBtn = "span.cancel-icon" _createNew = ".t--entity-add-btn.group.files" _uploadFiles = "div.uppy-Dashboard-AddFiles input" @@ -46,15 +48,15 @@ export class CommonLocators { _selectPropDropdown = (ddName: string) => "//div[contains(@class, 't--property-control-" + ddName + "')]//button[contains(@class, 't--open-dropdown-Select-Action')]" _dropDownValue = (ddOption: string) => ".single-select:contains('" + ddOption + "')" _selectOptionValue = (ddOption: string) => ".menu-item-link:contains('" + ddOption + "')" + _selectedDropdownValue = "//button[contains(@class, 'select-button')]/span[@class='bp3-button-text']" _actionTextArea = (actionName: string) => "//label[text()='" + actionName + "']/following-sibling::div//div[contains(@class, 'CodeMirror')]//textarea" _existingDefaultTextInput = ".t--property-control-defaulttext .CodeMirror-code" _widgetPageIcon = (widgetType: string) => `.t--widget-card-draggable-${widgetType}` - _widgetInCanvas = (widgetType: string) => `.t--draggable-${widgetType}` - _widgetInDeployed = (widgetType: string) => `.t--widget-${widgetType}` _propertyToggle = (controlToToggle: string) => ".t--property-control-" + controlToToggle + " input[type='checkbox']" _propertyToggleValue = (controlToToggle: string) => "//div[contains(@class, 't--property-control-" + controlToToggle + "')]//input[@type='checkbox']/parent::label" _openNavigationTab = (tabToOpen: string) => `#switcher--${tabToOpen}` - _selectWidgetDropdown = (widgetType: string) => "//div[contains(@class, 't--draggable-" + widgetType + "')]//button" + _selectWidgetDropdown = (widgetType: string) => `//div[contains(@class, 't--draggable-${widgetType}')]//button` + _selectWidgetDropdownInDeployed = (widgetType: string) => `//div[contains(@class, 't--widget-${widgetType}')]//button` _inputFieldByName = (fieldName: string) => "//p[text()='" + fieldName + "']/parent::label/following-sibling::div" _existingFieldValueByName = (fieldName: string) => "//label[text()='" + fieldName + "']/ancestor::div//div[contains(@class,'CodeMirror-code')]" _evaluatedCurrentValue = "div:last-of-type .t--CodeEditor-evaluatedValue > div:last-of-type pre" diff --git a/app/client/cypress/support/Objects/Registry.ts b/app/client/cypress/support/Objects/Registry.ts index 6096886218..4dbf9df67b 100644 --- a/app/client/cypress/support/Objects/Registry.ts +++ b/app/client/cypress/support/Objects/Registry.ts @@ -72,4 +72,12 @@ export class ObjectsRegistry { } return ObjectsRegistry.table__; } -} \ No newline at end of file +} + +export const initLocalstorageRegistry = () => { + cy.window().then((window) => { + window.localStorage.setItem("ShowCommentsButtonToolTip", ""); + window.localStorage.setItem("updateDismissed", "true"); + }); + localStorage.setItem("inDeployedMode", "false"); +}; \ No newline at end of file diff --git a/app/client/cypress/support/Pages/AggregateHelper.ts b/app/client/cypress/support/Pages/AggregateHelper.ts index a54f597ca7..db124fec15 100644 --- a/app/client/cypress/support/Pages/AggregateHelper.ts +++ b/app/client/cypress/support/Pages/AggregateHelper.ts @@ -4,7 +4,7 @@ import { ObjectsRegistry } from '../Objects/Registry'; export class AggregateHelper { private locator = ObjectsRegistry.CommonLocators; - public AddDsl(dsl: string) { + public AddDsl(dsl: string, elementToCheckPresenceaftDslLoad: string | "" = "") { let currentURL; let pageid: string; let layoutId; @@ -27,7 +27,10 @@ export class AggregateHelper { }); }); }); - this.Sleep(5000)//settling time for dsl + + if (elementToCheckPresenceaftDslLoad) + this.WaitUntilEleAppear(elementToCheckPresenceaftDslLoad) + this.Sleep(500)//settling time for dsl cy.get(this.locator._loading).should("not.exist");//Checks the spinner is gone & dsl loaded! } @@ -50,7 +53,7 @@ export class AggregateHelper { public AssertAutoSave() { // wait for save query to trigger & n/w call to finish occuring - cy.get(this.locator._saveStatusSuccess, { timeout: 40000 }).should("exist"); + cy.get(this.locator._saveStatusSuccess, { timeout: 30000 }).should("exist");//adding timeout since waiting more time is not worth it! } public ValidateCodeEditorContent(selector: string, contentToValidate: any) { @@ -60,7 +63,7 @@ export class AggregateHelper { } //refering PublishtheApp from command.js - public DeployApp() { + public DeployApp(eleToCheckInDeployPage: string = this.locator._backToEditor) { cy.intercept("POST", "/api/v1/applications/publish/*").as("publishApp"); // Wait before publish this.Sleep(2000) @@ -75,6 +78,9 @@ export class AggregateHelper { cy.log("Pagename: " + localStorage.getItem("PageName")); cy.wait("@publishApp").its("request.url").should("not.contain", "edit") //cy.wait('@publishApp').wait('@publishApp') //waitng for 2 calls to complete + + this.WaitUntilEleAppear(eleToCheckInDeployPage) + localStorage.setItem("inDeployedMode", "true"); } public AddNewPage() { @@ -114,22 +120,35 @@ export class AggregateHelper { }); } - public WaitUntilEleDisappear(selector: string, msgToCheckforDisappearance: string) { - cy.waitUntil(() => cy.get(selector).contains(msgToCheckforDisappearance).should("have.length", 0), + public WaitUntilEleDisappear(selector: string, msgToCheckforDisappearance: string | "") { + cy.waitUntil(() => selector.includes("//") ? cy.xpath(selector) : cy.get(selector), { errorMsg: msgToCheckforDisappearance + " did not disappear", timeout: 5000, interval: 1000 - }).then(() => this.Sleep()) + }).then($ele => { + cy.wrap($ele).contains(msgToCheckforDisappearance).should("have.length", 0) + this.Sleep() + }) } public WaitUntilEleAppear(selector: string) { - cy.waitUntil(() => cy.get(selector, { timeout: 50000 }).should("have.length.greaterThan", 0), + // cy.waitUntil(() => cy.get(selector, { timeout: 50000 }).should("have.length.greaterThan", 0), + // { + // errorMsg: "Element did not appear", + // timeout: 5000, + // interval: 1000 + // }).then(() => this.Sleep(500)) + + cy.waitUntil(() => selector.includes("//") ? cy.xpath(selector) : cy.get(selector), { errorMsg: "Element did not appear", timeout: 5000, interval: 1000 - }).then(() => this.Sleep(500)) + }).then($ele => { + cy.wrap($ele).eq(0).should("be.visible") + this.Sleep() + }) } public ValidateNetworkExecutionSuccess(aliasName: string, expectedRes = true) { @@ -164,13 +183,26 @@ export class AggregateHelper { cy.get(this.locator._dropDownValue(ddOption)).click() } - public SelectDropDown(endp: string, ddOption: string,) { - cy.xpath(this.locator._selectWidgetDropdown(endp)) - .first() - .scrollIntoView() - .click() + public SelectDropDown(ddOption: string, endp: string = "selectwidget") { + let mode = localStorage.getItem("inDeployedMode"); + if (mode == "false") { + cy.xpath(this.locator._selectWidgetDropdown(endp)) + .first() + .scrollIntoView() + .click() + } + else { + cy.xpath(this.locator._selectWidgetDropdownInDeployed(endp)) + .first() + .scrollIntoView() + .click() + } cy.get(this.locator._selectOptionValue(ddOption)).click({ force: true }) - this.Sleep(2000) + this.Sleep()//for selected value to reflect! + } + + public ReadSelectedDropDownValue() { + return cy.xpath(this.locator._selectedDropdownValue).first().invoke("text") } public EnterActionValue(actionName: string, value: string, paste = true) { @@ -241,8 +273,9 @@ export class AggregateHelper { } public NavigateBacktoEditor() { - cy.get(this.locator._backToEditor).click({ force: true }); + cy.get(this.locator._backToEditor).click(); this.Sleep(2000) + localStorage.setItem("inDeployedMode", "false"); } public GenerateUUID() { @@ -278,14 +311,14 @@ export class AggregateHelper { this.VerifyEvaluatedValue(valueToType); } - public EnterValue(valueToType: string, fieldName = "") { + public EnterValue(valueToEnter: string, fieldName = "") { if (fieldName) { cy.xpath(this.locator._inputFieldByName(fieldName)).then(($field: any) => { - this.UpdateCodeInput($field, valueToType); + this.UpdateCodeInput($field, valueToEnter); }); } else { cy.get(this.locator._codeEditorTarget).then(($field: any) => { - this.UpdateCodeInput($field, valueToType); + this.UpdateCodeInput($field, valueToEnter); }); } } @@ -336,7 +369,7 @@ export class AggregateHelper { } public UploadFile(fixtureName: string, execStat = true) { - cy.get(this.locator._uploadFiles).attachFile(fixtureName).wait(1000); + cy.get(this.locator._uploadFiles).attachFile(fixtureName).wait(2000); cy.get(this.locator._uploadBtn).click().wait(3000); this.ValidateNetworkExecutionSuccess("@postExecute", execStat); } @@ -360,4 +393,47 @@ export class AggregateHelper { }); } + + public AssertElementAbsence(selector: string) { + if (selector.startsWith("//")) + cy.xpath(selector).should('not.exist') + else + cy.get(selector).should('not.exist') + } + + public AssertElementPresence(selector: string) { + if (selector.startsWith("//")) + cy.xpath(selector).should('be.visible') + else + cy.get(selector).should('be.visible') + } + + public AssertElementLength(selector: string, length: number) { + if (selector.startsWith("//")) + cy.xpath(selector).should("have.length", length) + else + cy.get(selector).should("have.length", length); + } + + //Not used: + // private xPathToCss(xpath: string) { + // return xpath + // .replace(/\[(\d+?)\]/g, function (s, m1) { return '[' + (m1 - 1) + ']'; }) + // .replace(/\/{2}/g, '') + // .replace(/\/+/g, ' > ') + // .replace(/@/g, '') + // .replace(/\[(\d+)\]/g, ':eq($1)') + // .replace(/^\s+/, ''); + // } + + // Cypress.Commands.add("byXpath", (xpath) => { + // const iterator = document.evaluate(xpath, document, null, XPathResult.UNORDERED_NODE_ITERATOR_TYPE, null) + // const items = []; + // let item = iterator.iterateNext(); + // while (item) { + // items.push(item); + // item = iterator.iterateNext(); + // } + // return items; + // }, { timeout: 5000 }); } \ No newline at end of file diff --git a/app/client/cypress/support/Pages/ApiPage.ts b/app/client/cypress/support/Pages/ApiPage.ts index 2a7081fa5a..01212f49b5 100644 --- a/app/client/cypress/support/Pages/ApiPage.ts +++ b/app/client/cypress/support/Pages/ApiPage.ts @@ -25,6 +25,7 @@ export class ApiPage { _noBodyMessage = "This request does not have a body" _imageSrc = "//img/parent::div" private _trashDelete = "span[name='delete']" + private _onPageLoad = "input[name='executeOnLoad'][type='checkbox']" CreateApi(apiName: string = "", apiVerb: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' = 'GET',) { @@ -54,72 +55,50 @@ export class ApiPage { this.CreateApi(apiname, apiVerb) this.EnterURL(url) this.agHelper.AssertAutoSave() - this.agHelper.Sleep(2000);// Added because api name edit takes some time to reflect in api sidebar after the call passes. + //this.agHelper.Sleep(2000);// Added because api name edit takes some time to reflect in api sidebar after the call passes. cy.get(this._apiRunBtn).should("not.be.disabled"); this.SetAPITimeout(queryTimeout) } EnterURL(url: string) { - cy.get(this._resourceUrl) - .first() - .click({ force: true }) - .type(url, { parseSpecialCharSequences: false }); + this.agHelper.UpdateCodeInput(this._resourceUrl, url) this.agHelper.AssertAutoSave() } EnterHeader(hKey: string, hValue: string) { - this.SelectAPITab('Headers'); - cy.get(this._headerKey(0)) - .first() - .click({ force: true }) - .type(hKey, { parseSpecialCharSequences: false }) - .type("{esc}"); - cy.get(this._headerValue(0)) - .first() - .click({ force: true }) - .type(hValue, { parseSpecialCharSequences: false }) - .type("{esc}"); + this.SelectPaneTab('Headers'); + this.agHelper.UpdateCodeInput(this._headerKey(0), hKey) + cy.get('body').type("{esc}"); + this.agHelper.UpdateCodeInput(this._headerValue(0), hValue) + cy.get('body').type("{esc}"); this.agHelper.AssertAutoSave() } EnterParams(pKey: string, pValue: string) { - this.SelectAPITab('Params') - cy.get(this._paramKey(0)) - .first() - .click({ force: true }) - .type(pKey, { parseSpecialCharSequences: false }) - .type("{esc}"); - cy.get(this._paramValue(0)) - .first() - .click({ force: true }) - .type(pValue, { parseSpecialCharSequences: false }) - .type("{esc}"); + this.SelectPaneTab('Params') + this.agHelper.UpdateCodeInput(this._paramKey(0), pKey) + cy.get('body').type("{esc}"); + this.agHelper.UpdateCodeInput(this._paramValue(0), pValue) + cy.get('body').type("{esc}"); this.agHelper.AssertAutoSave() } EnterBodyFormData(subTab: 'FORM_URLENCODED' | 'MULTIPART_FORM_DATA', bKey: string, bValue: string, type = "", toTrash = false) { - this.SelectAPITab('Body') + this.SelectPaneTab('Body') this.SelectSubTab(subTab) - if (toTrash) - { + if (toTrash) { cy.get(this._trashDelete).click() cy.xpath(this._visibleTextSpan('Add more')).click() } - cy.get(this._bodyKey(0)) - .first() - .click({ force: true }) - .type(bKey, { parseSpecialCharSequences: false }) - .type("{esc}"); + this.agHelper.UpdateCodeInput(this._bodyKey(0), bKey) + cy.get('body').type("{esc}"); + if (type) { cy.xpath(this._bodyTypeDropdown).eq(0).click() cy.xpath(this._visibleTextDiv(type)).click() } - cy.get(this._bodyValue(0)) - .first() - .click({ force: true }) - .type(bValue, { parseSpecialCharSequences: false }) - .type("{esc}"); - + this.agHelper.UpdateCodeInput(this._bodyValue(0), bValue) + cy.get('body').type("{esc}"); this.agHelper.AssertAutoSave() } @@ -129,14 +108,22 @@ export class ApiPage { } SetAPITimeout(timeout: number) { - this.SelectAPITab('Settings'); + this.SelectPaneTab('Settings'); cy.xpath(this._queryTimeout) .clear() .type(timeout.toString()); - this.SelectAPITab('Headers'); + this.agHelper.AssertAutoSave() + this.SelectPaneTab('Headers'); } - SelectAPITab(tabName: 'Headers' | 'Params' | 'Body' | 'Pagination' | 'Authentication' | 'Settings') { + DisableOnPageLoadRun() { + this.SelectPaneTab('Settings'); + cy.get(this._onPageLoad).uncheck({ + force: true, + }); + } + + SelectPaneTab(tabName: 'Headers' | 'Params' | 'Body' | 'Pagination' | 'Authentication' | 'Settings') { cy.xpath(this._visibleTextSpan(tabName)).should('be.visible').eq(0).click(); } @@ -144,21 +131,14 @@ export class ApiPage { cy.get(this._bodySubTab(subTabName)).eq(0).should('be.visible').click(); } - public CheckElementPresence(selector: string) { - if (selector.startsWith("//")) - cy.xpath(selector).should('be.visible') - else - cy.get(selector).should('be.visible') - } - ValidateQueryParams(param: { key: string; value: string; }) { - this.SelectAPITab('Params') + this.SelectPaneTab('Params') this.agHelper.ValidateCodeEditorContent(this._paramKey(0), param.key) this.agHelper.ValidateCodeEditorContent(this._paramValue(0), param.value) } ValidateHeaderParams(header: { key: string; value: string; }) { - this.SelectAPITab('Headers') + this.SelectPaneTab('Headers') this.agHelper.ValidateCodeEditorContent(this._headerKey(0), header.key) this.agHelper.ValidateCodeEditorContent(this._headerValue(0), header.value) } diff --git a/app/client/cypress/support/Pages/DataSources.ts b/app/client/cypress/support/Pages/DataSources.ts index 66d8fc4432..64efe142fe 100644 --- a/app/client/cypress/support/Pages/DataSources.ts +++ b/app/client/cypress/support/Pages/DataSources.ts @@ -4,6 +4,7 @@ export class DataSources { private agHelper = ObjectsRegistry.AggregateHelper private locator = ObjectsRegistry.CommonLocators; + private ee = ObjectsRegistry.EntityExplorer; private _dsCreateNewTab = "[data-cy=t--tab-CREATE_NEW]" private _addNewDataSource = ".datasources .t--entity-add-btn" @@ -18,6 +19,7 @@ export class DataSources { private _saveDs = ".t--save-datasource" private _datasourceCard = ".t--datasource" _templateMenu = ".t--template-menu" + private _createQuery = ".t--create-query" _visibleTextSpan = (spanText: string) => "//span[contains(text(),'" + spanText + "')]" _dropdownTitle = (ddTitle: string) => "//p[contains(text(),'" + ddTitle + "')]/parent::label/following-sibling::div/div/div" _reconnectModal = "div.reconnect-datasource-modal" @@ -81,11 +83,16 @@ export class DataSources { .should("be.visible") .closest(this._datasourceCard) .within(() => { - cy.get(this.locator._createQuery).click({ force: true }); + cy.get(this._createQuery).click({ force: true }); }) this.agHelper.Sleep(2000); //for the CreateQuery page to load } + public NavigateToActiveDSviaEntityExplorer(datasourceName: string) { + this.ee.SelectEntityByName(datasourceName, 'DATASOURCES') + cy.get(this._createQuery).click({ force: true }); + } + public ValidateNSelectDropdown(ddTitle: string, currentValue = "", newValue = "") { let toChange = false; diff --git a/app/client/cypress/support/Pages/EntityExplorer.ts b/app/client/cypress/support/Pages/EntityExplorer.ts index ca9614967e..513caccc11 100644 --- a/app/client/cypress/support/Pages/EntityExplorer.ts +++ b/app/client/cypress/support/Pages/EntityExplorer.ts @@ -5,8 +5,10 @@ export class EntityExplorer { public agHelper = ObjectsRegistry.AggregateHelper public locator = ObjectsRegistry.CommonLocators; - public SelectEntityByName(entityNameinLeftSidebar: string) { - cy.xpath(this.locator._entityNameInExplorer(entityNameinLeftSidebar), { timeout: 30000 }) + public SelectEntityByName(entityNameinLeftSidebar: string, section: 'WIDGETS' | 'QUERIES/JS' | 'DATASOURCES' | '' = '') { + if (section) + this.expandCollapseEntity(section)//to expand respective section + cy.xpath(this.locator._entityNameInExplorer(entityNameinLeftSidebar)) .last() .click({ multiple: true }) this.agHelper.Sleep() @@ -32,7 +34,7 @@ export class EntityExplorer { else if (!expand && arrow == 'arrow-down') cy.xpath(this.locator._expandCollapseArrow(entityName)).trigger('click', { multiple: true }).wait(1000); else - this.agHelper.Sleep() + this.agHelper.Sleep(500) }) } diff --git a/app/client/cypress/support/Pages/HomePage.ts b/app/client/cypress/support/Pages/HomePage.ts index f2090afa05..7c4e3bb23e 100644 --- a/app/client/cypress/support/Pages/HomePage.ts +++ b/app/client/cypress/support/Pages/HomePage.ts @@ -175,9 +175,9 @@ export class HomePage { cy.wait("@postLogout"); cy.visit("/user/login"); cy.get(this._username).should("be.visible").type(uname) - cy.get(this._password).type(pswd); + cy.get(this._password).type(pswd, {log: false}); cy.get(this._submitBtn).click(); - cy.wait("@getUser"); + cy.wait("@getMe"); this.agHelper.Sleep(3000) if (role != 'App Viewer') cy.get(this._homePageAppCreateBtn).should("be.visible").should("be.enabled"); diff --git a/app/client/cypress/support/Pages/JSEditor.ts b/app/client/cypress/support/Pages/JSEditor.ts index a174c4eb04..97716ed679 100644 --- a/app/client/cypress/support/Pages/JSEditor.ts +++ b/app/client/cypress/support/Pages/JSEditor.ts @@ -20,7 +20,8 @@ export class JSEditor { cy.get(this._newJSobj).click({ force: true }); //cy.waitUntil(() => cy.get(this.locator._toastMsg).should('not.be.visible')) // fails sometimes - this.agHelper.WaitUntilEleDisappear(this.locator._toastMsg, 'created successfully') + //this.agHelper.WaitUntilEleDisappear(this.locator._toastMsg, 'created successfully') + this.agHelper.Sleep() } public CreateJSObject(JSCode: string, paste = true, completeReplace = false, toRun = true) { @@ -67,7 +68,7 @@ export class JSEditor { }); this.agHelper.AssertAutoSave()//Ample wait due to open bug # 10284 - this.agHelper.Sleep(5000)//Ample wait due to open bug # 10284 + //this.agHelper.Sleep(5000)//Ample wait due to open bug # 10284 if (toRun) { //clicking 1 times & waits for 3 second for result to be populated! @@ -83,6 +84,13 @@ export class JSEditor { this.GetJSObjectName() } + //Not working - To improve! + public EditJSObj(existingTxt: string, newTxt: string) { + cy.get(this.locator._codeEditorTarget).contains(existingTxt).dblclick()//.type("{backspace}").type(newTxt) + cy.get('body').type("{backspace}").type(newTxt) + this.agHelper.AssertAutoSave()//Ample wait due to open bug # 10284 + } + public EnterJSContext(endp: string, value: string, paste = true, toToggleOnJS = false) { if (toToggleOnJS) { cy.get(this.locator._jsToggle(endp)) diff --git a/app/client/cypress/support/Pages/Table.ts b/app/client/cypress/support/Pages/Table.ts index ecb8a2f37e..24ab8fd620 100644 --- a/app/client/cypress/support/Pages/Table.ts +++ b/app/client/cypress/support/Pages/Table.ts @@ -11,9 +11,13 @@ export class Table { private _previousPage = ".t--widget-tablewidget .t--table-widget-prev-page" private _pageNumber = ".t--widget-tablewidget .page-item" private _pageNumberServerSideOff = ".t--widget-tablewidget .t--table-widget-page-input input" - _tableRowColumn = (rowNum: number, colNum: number) => `.t--widget-tablewidget .tbody .td[data-rowindex=${rowNum}][data-colindex=${colNum}] div div` + _tableRow = (rowNum: number, colNum: number) => `.t--widget-tablewidget .tbody .td[data-rowindex=${rowNum}][data-colindex=${colNum}]` + _tableRowColumnData = (rowNum: number, colNum: number) => this._tableRow(rowNum, colNum) + ` div div` _tableEmptyColumnData = `.t--widget-tablewidget .tbody .td` //selected-row _tableSelectedRow = this._tableWrap + "//div[contains(@class, 'tbody')]//div[contains(@class, 'selected-row')]/div" + _liNextPage = "li[title='Next Page']" + _liPreviousPage = "li[title='Previous Page']" + _liCurrentSelectedPage = "//div[@type='LIST_WIDGET']//ul[contains(@class, 'rc-pagination')]/li[contains(@class, 'rc-pagination-item-active')]/a" public WaitUntilTableLoad() { @@ -28,21 +32,28 @@ export class Table { // expect(cellData).not.empty; // }); - cy.waitUntil(() => this.ReadTableRowColumnData(0, 0).then(cellData => expect(cellData).not.empty), + cy.waitUntil(() => this.ReadTableRowColumnData(0, 0), { errorMsg: "Table is not populated", timeout: 10000, interval: 2000 - }).then(() => this.agHelper.Sleep(500)) + }).then(cellData => { + expect(cellData).not.empty + this.agHelper.Sleep(500) + }) } public WaitForTableEmpty() { - cy.waitUntil(() => cy.get(this._tableEmptyColumnData).children().should("have.length", 0), + cy.waitUntil(() => cy.get(this._tableEmptyColumnData), { errorMsg: "Table is populated when not expected", timeout: 10000, interval: 2000 - }).then(() => this.agHelper.Sleep(500)) + }).then($children => { + cy.wrap($children).children().should('have.length', 0) //or below + //expect($children).to.have.lengthOf(0) + this.agHelper.Sleep(500) + }) } public AssertTableHeaderOrder(expectedOrder: string) { @@ -52,7 +63,8 @@ export class Table { } public ReadTableRowColumnData(rowNum: number, colNum: number) { - return cy.get(this._tableRowColumn(rowNum, colNum), { timeout: 80000 }).invoke("text"); + this.agHelper.Sleep(2000)//Settling time for table! + return cy.get(this._tableRowColumnData(rowNum, colNum)).invoke("text"); } public AssertHiddenColumns(columnNames: string[]) { @@ -103,4 +115,43 @@ export class Table { }); } + public SelectTableRow(rowIndex: number) { + cy.get(this._tableRow(rowIndex, 0)).first().click({ force: true }); + this.agHelper.Sleep()//for select to reflect + } + + //List methods - keeping it for now! + public NavigateToNextPage_List() { + let curPageNo: number; + cy.xpath(this._liCurrentSelectedPage).invoke('text').then($currentPageNo => + curPageNo = Number($currentPageNo)) + cy.get(this._liNextPage).click() + cy.scrollTo('top', { easing: 'linear' }) + cy.xpath(this._liCurrentSelectedPage).invoke('text').then($newPageNo => + expect(Number($newPageNo)).to.eq(curPageNo + 1)) + } + + public NavigateToPreviousPage_List() { + let curPageNo: number; + cy.xpath(this._liCurrentSelectedPage).invoke('text').then($currentPageNo => + curPageNo = Number($currentPageNo)) + cy.get(this._liPreviousPage).click() + cy.scrollTo('top', { easing: 'linear' }) + cy.xpath(this._liCurrentSelectedPage).invoke('text').then($newPageNo => + expect(Number($newPageNo)).to.eq(curPageNo - 1)) + } + + public AssertPageNumber_List(pageNo: number, checkNoNextPage = false) { + cy.xpath(this._liCurrentSelectedPage).invoke('text').then($currentPageNo => + expect(Number($currentPageNo)).to.eq(pageNo)) + + if (pageNo == 1) + cy.get(this._liPreviousPage).should("have.attr", "aria-disabled", 'true') + + if (checkNoNextPage) + cy.get(this._liNextPage).should("have.attr", "aria-disabled", 'true') + else + cy.get(this._liNextPage).should("have.attr", "aria-disabled", 'false') + + } } \ No newline at end of file diff --git a/app/client/cypress/support/commands.js b/app/client/cypress/support/commands.js index 753535b5ac..1c9d4af8b2 100644 --- a/app/client/cypress/support/commands.js +++ b/app/client/cypress/support/commands.js @@ -384,6 +384,12 @@ Cypress.Commands.add("CreateAppInFirstListedOrg", (appname) => { 200, ); + cy.waitUntil(() => cy.get(generatePage.buildFromScratchActionCard), { + errorMsg: "Build app from scratch not visible even aft 80 secs", + timeout: 20000, + interval: 1000, + }).then(($ele) => cy.wrap($ele).should("be.visible")); + cy.get(generatePage.buildFromScratchActionCard).click(); /* The server created app always has an old dsl so the layout will migrate @@ -481,7 +487,7 @@ Cypress.Commands.add("LogintoApp", (uname, pword) => { cy.get(loginPage.username).type(uname); cy.get(loginPage.password).type(pword, { log: false }); cy.get(loginPage.submitBtn).click(); - cy.wait("@getUser"); + cy.wait("@getMe"); cy.wait(3000); cy.get(".t--applications-container .createnew").should("be.visible"); cy.get(".t--applications-container .createnew").should("be.enabled"); @@ -506,7 +512,7 @@ Cypress.Commands.add("Signup", (uname, pword) => { cy.get(signupPage.dropdownOption).click(); cy.get(signupPage.roleUsecaseSubmit).click(); - cy.wait("@getUser"); + cy.wait("@getMe"); cy.wait(3000); initLocalstorage(); }); @@ -526,7 +532,7 @@ Cypress.Commands.add("LoginFromAPI", (uname, pword) => { }, }).then((response) => { expect(response.status).equal(302); - cy.log(response.body); + //cy.log(response.body); }); }); @@ -1330,16 +1336,16 @@ Cypress.Commands.add("createModal", (ModalName) => { }); Cypress.Commands.add("selectOnClickOption", (option) => { - cy.get(".bp3-popover-content", { timeout: 10000 }).should("be.visible"); - cy.get("ul.bp3-menu div.bp3-fill", { timeout: 10000 }) + cy.get(".bp3-popover-content").should("be.visible"); + cy.get("ul.bp3-menu div.bp3-fill") .should("be.visible") .contains(option) .click({ force: true }); }); Cypress.Commands.add("selectWidgetOnClickOption", (option) => { - cy.get(".bp3-popover-content", { timeout: 10000 }).should("be.visible"); - cy.get(commonlocators.selectWidgetVirtualList, { timeout: 10000 }) + cy.get(".bp3-popover-content").should("be.visible"); + cy.get(commonlocators.selectWidgetVirtualList) .should("be.visible") .contains(option) .click({ force: true }); @@ -2679,10 +2685,12 @@ Cypress.Commands.add( const selector = `.t--widget-card-draggable-${widgetType}`; cy.wait(800); cy.get(selector) + .scrollIntoView() .trigger("dragstart", { force: true }) .trigger("mousemove", x, y, { force: true }); const selector2 = `.t--draggable-${destinationWidget}`; cy.get(selector2) + .scrollIntoView() .trigger("mousemove", x, y, { eventConstructor: "MouseEvent" }) .trigger("mousemove", x, y, { eventConstructor: "MouseEvent" }) .trigger("mouseup", x, y, { eventConstructor: "MouseEvent" }); @@ -2900,6 +2908,7 @@ Cypress.Commands.add("isSelectRow", (index) => { cy.get('.tbody .td[data-rowindex="' + index + '"][data-colindex="' + 0 + '"]') .first() .click({ force: true }); + cy.wait(1000); //for selection to show! }); Cypress.Commands.add("getDate", (date, dateFormate) => { @@ -2934,11 +2943,11 @@ Cypress.Commands.add("validateDisableWidget", (widgetCss, disableCss) => { }); Cypress.Commands.add("validateToolbarVisible", (widgetCss, toolbarCss) => { - cy.get(widgetCss + toolbarCss, { timeout: 10000 }).should("exist"); + cy.get(widgetCss + toolbarCss).should("exist"); }); Cypress.Commands.add("validateToolbarHidden", (widgetCss, toolbarCss) => { - cy.get(widgetCss + toolbarCss, { timeout: 10000 }).should("not.exist"); + cy.get(widgetCss + toolbarCss).should("not.exist"); }); Cypress.Commands.add("validateEnableWidget", (widgetCss, disableCss) => { @@ -2989,9 +2998,7 @@ Cypress.Commands.add("startServerAndRoutes", () => { "getTemplateCollections", ); cy.route("PUT", "/api/v1/pages/*").as("updatePage"); - cy.route("DELETE", "/api/v1/actions/*").as("deleteAPI"); cy.route("DELETE", "/api/v1/applications/*").as("deleteApp"); - cy.route("DELETE", "/api/v1/actions/*").as("deleteAction"); cy.route("DELETE", "/api/v1/pages/*").as("deletePage"); cy.route("POST", "/api/v1/datasources").as("createDatasource"); cy.route("DELETE", "/api/v1/datasources/*").as("deleteDatasource"); @@ -3040,7 +3047,7 @@ Cypress.Commands.add("startServerAndRoutes", () => { cy.route("GET", "/api/v1/organizations/roles?organizationId=*").as( "getRoles", ); - cy.route("GET", "/api/v1/users/me").as("getUser"); + cy.route("GET", "/api/v1/users/me").as("getMe"); cy.route("POST", "/api/v1/pages").as("createPage"); cy.route("POST", "/api/v1/pages/clone/*").as("clonePage"); cy.route("POST", "/api/v1/applications/clone/*").as("cloneApp"); @@ -3271,7 +3278,7 @@ Cypress.Commands.add( "validateWidgetExists", { prevSubject: true }, (selector) => { - cy.get(selector, { timeout: 5000 }).should("exist"); + cy.get(selector).should("exist"); }, ); diff --git a/app/client/cypress/support/index.js b/app/client/cypress/support/index.js index beac3774c5..a45c718b64 100644 --- a/app/client/cypress/support/index.js +++ b/app/client/cypress/support/index.js @@ -25,6 +25,7 @@ let applicationId; // Import commands.js using ES2015 syntax: import "./commands"; import { initLocalstorage } from "./commands"; +import { initLocalstorageRegistry } from "./Objects/Registry"; import * as MESSAGES from "../../../client/src/ce/constants/messages.ts"; Cypress.on("uncaught:exception", (err, runnable) => { @@ -42,14 +43,15 @@ Cypress.env("MESSAGES", MESSAGES); before(function() { //console.warn = () => {}; initLocalstorage(); + initLocalstorageRegistry(); cy.startServerAndRoutes(); // Clear indexedDB cy.window().then((window) => { window.indexedDB.deleteDatabase("Appsmith"); }); - cy.visit("/setup/welcome"); - cy.wait("@getUser"); + cy.wait("@getMe"); + cy.wait(2000); cy.url().then((url) => { if (url.indexOf("setup/welcome") > -1) { cy.createSuperUser(); @@ -75,7 +77,7 @@ before(function() { const password = Cypress.env("PASSWORD"); cy.LoginFromAPI(username, password); cy.visit("/applications"); - cy.wait("@getUser"); + cy.wait("@getMe"); cy.wait(3000); cy.get(".t--applications-container .createnew").should("be.visible"); cy.get(".t--applications-container .createnew").should("be.enabled"); @@ -91,6 +93,7 @@ before(function() { beforeEach(function() { initLocalstorage(); + initLocalstorageRegistry(); Cypress.Cookies.preserveOnce("SESSION", "remember_token"); cy.startServerAndRoutes(); //-- Delete local storage data of entity explorer From ead200859c78cfa7d720bd5fdbbef6d1825bbc17 Mon Sep 17 00:00:00 2001 From: Aswath K Date: Sun, 3 Apr 2022 22:14:30 +0530 Subject: [PATCH 08/10] feat: Make property title not focusable with keyboard (#12489) --- app/client/src/pages/Editor/PropertyPane/PropertyHelpLabel.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/app/client/src/pages/Editor/PropertyPane/PropertyHelpLabel.tsx b/app/client/src/pages/Editor/PropertyPane/PropertyHelpLabel.tsx index c5412f02f3..287979caf7 100644 --- a/app/client/src/pages/Editor/PropertyPane/PropertyHelpLabel.tsx +++ b/app/client/src/pages/Editor/PropertyPane/PropertyHelpLabel.tsx @@ -31,6 +31,7 @@ function PropertyHelpLabel(props: Props) { } disabled={!toolTipDefined} hoverOpenDelay={200} + openOnTargetFocus={false} position={Position.TOP} >
Date: Mon, 4 Apr 2022 10:25:00 +0530 Subject: [PATCH 09/10] feat: update list segment header (#12530) * fix: update ListSegmentHeader * chore: add tests for change --- .../components/ads/ListSegmentHeader.test.tsx | 22 +++++++++++++++++++ .../src/components/ads/ListSegmentHeader.tsx | 16 ++++++++++---- 2 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 app/client/src/components/ads/ListSegmentHeader.test.tsx diff --git a/app/client/src/components/ads/ListSegmentHeader.test.tsx b/app/client/src/components/ads/ListSegmentHeader.test.tsx new file mode 100644 index 0000000000..b2ae5812a1 --- /dev/null +++ b/app/client/src/components/ads/ListSegmentHeader.test.tsx @@ -0,0 +1,22 @@ +import SegmentHeader from "./ListSegmentHeader"; +import { render, screen } from "test/testUtils"; +import React from "react"; + +describe("ListSegmentHeader", () => { + it("renders properly with hr element", async () => { + render(); + const header = await screen.queryByTestId("t--styled-segment-header"); + expect(header).not.toBe(null); + const hr = await screen.queryByTestId("t--styled-segment-header-hr"); + expect(hr).not.toBe(null); + expect(header?.innerHTML.includes("uh title")).toBeTruthy(); + }); + it("renders properly without hr element", async () => { + render(); + const header = await screen.queryByTestId("t--styled-segment-header"); + expect(header).not.toBe(null); + const hr = await screen.queryByTestId("t--styled-segment-header-hr"); + expect(hr).toBe(null); + expect(header?.innerHTML.includes("tvo title")).toBeTruthy(); + }); +}); diff --git a/app/client/src/components/ads/ListSegmentHeader.tsx b/app/client/src/components/ads/ListSegmentHeader.tsx index 1ded10ea67..3742f81587 100644 --- a/app/client/src/components/ads/ListSegmentHeader.tsx +++ b/app/client/src/components/ads/ListSegmentHeader.tsx @@ -20,14 +20,22 @@ const StyledHr = styled.div` margin-left: ${(props) => props.theme.spaces[3]}px; `; -export default function SegmentHeader(props: { +export type SegmentHeaderProps = { title: string; style?: CSSProperties; -}) { + hideStyledHr?: boolean; +}; + +export default function SegmentHeader(props: SegmentHeaderProps) { return ( - + {props.title} - + {!props.hideStyledHr && ( + + )} ); } From 50a8e1441c062f0815ac197a7a8b592ee6ba718a Mon Sep 17 00:00:00 2001 From: f0c1s Date: Mon, 4 Apr 2022 10:25:19 +0530 Subject: [PATCH 10/10] fix: show errors from git status (#12440) * fix: show errors from git status * fix: review comments --- app/client/src/ce/constants/messages.test.ts | 73 ++++++++++++++++---- app/client/src/ce/constants/messages.ts | 10 ++- app/client/src/sagas/GitSyncSagas.ts | 62 +++++++++-------- 3 files changed, 104 insertions(+), 41 deletions(-) diff --git a/app/client/src/ce/constants/messages.test.ts b/app/client/src/ce/constants/messages.test.ts index 0e41c0f60e..f7780e4fb2 100644 --- a/app/client/src/ce/constants/messages.test.ts +++ b/app/client/src/ce/constants/messages.test.ts @@ -24,6 +24,8 @@ import { DISCONNECT_EXISTING_REPOSITORIES, DISCONNECT_EXISTING_REPOSITORIES_INFO, DISCONNECT_GIT, + ERROR_GIT_AUTH_FAIL, + ERROR_GIT_INVALID_REMOTE, ERROR_WHILE_PULLING_CHANGES, ERROR_WIDGET_COPY_NOT_ALLOWED, FETCH_GIT_STATUS, @@ -73,14 +75,23 @@ describe("messages", () => { describe("git-sync messages", () => { const expectedMessages = [ { key: "COMMIT_CHANGES", value: "Commit changes" }, - { key: "COMMIT_TO", value: "Commit to" }, + { + key: "COMMIT_TO", + value: "Commit to", + }, { key: "COMMIT_AND_PUSH", value: "Commit & push" }, - { key: "PULL_CHANGES", value: "PULL CHANGES" }, + { + key: "PULL_CHANGES", + value: "PULL CHANGES", + }, { key: "DEPLOY_KEY_TITLE", value: "Deployed Key" }, { key: "REGENERATE_SSH_KEY", value: "Regenerate SSH Key" }, { key: "SSH_KEY", value: "SSH Key" }, - { key: "COPY_SSH_KEY", value: "Copy SSH Key" }, + { + key: "COPY_SSH_KEY", + value: "Copy SSH Key", + }, { key: "REGENERATE_KEY_CONFIRM_MESSAGE", value: @@ -96,11 +107,20 @@ describe("git-sync messages", () => { value: "COMMITTING AND PUSHING CHANGES...", }, { key: "IS_MERGING", value: "MERGING CHANGES..." }, - { key: "MERGE_CHANGES", value: "Merge changes" }, + { + key: "MERGE_CHANGES", + value: "Merge changes", + }, { key: "SELECT_BRANCH_TO_MERGE", value: "Select branch to merge" }, - { key: "CONNECT_GIT", value: "Connect Git" }, + { + key: "CONNECT_GIT", + value: "Connect Git", + }, { key: "CONNECT_GIT_BETA", value: "Connect Git (Beta)" }, - { key: "RETRY", value: "RETRY" }, + { + key: "RETRY", + value: "RETRY", + }, { key: "CREATE_NEW_BRANCH", value: "CREATE NEW BRANCH" }, { key: "ERROR_WHILE_PULLING_CHANGES", @@ -125,9 +145,15 @@ describe("git-sync messages", () => { value: "Please enter valid SSH URL of your repository", }, { key: "GENERATE_KEY", value: "Generate Key" }, - { key: "UPDATE_CONFIG", value: "UPDATE CONFIG" }, + { + key: "UPDATE_CONFIG", + value: "UPDATE CONFIG", + }, { key: "CONNECT_BTN_LABEL", value: "CONNECT" }, - { key: "FETCH_GIT_STATUS", value: "fetching status..." }, + { + key: "FETCH_GIT_STATUS", + value: "fetching status...", + }, { key: "FETCH_MERGE_STATUS", value: "Checking mergeability..." }, { key: "NO_MERGE_CONFLICT", @@ -167,7 +193,10 @@ describe("git-sync messages", () => { "To make space for newer repositories you can remove existing repositories.", }, { key: "CONTACT_SUPPORT", value: "Contact Support" }, - { key: "REPOSITORY_LIMIT_REACHED", value: "Repository Limit Reached" }, + { + key: "REPOSITORY_LIMIT_REACHED", + value: "Repository Limit Reached", + }, { key: "REPOSITORY_LIMIT_REACHED_INFO", value: @@ -187,16 +216,25 @@ describe("git-sync messages", () => { value: "Disconnect might cause the application to break.", }, { key: "DISCONNECT_GIT", value: "Revoke access" }, - { key: "DISCONNECT", value: "DISCONNECT" }, + { + key: "DISCONNECT", + value: "DISCONNECT", + }, { key: "GIT_DISCONNECTION_SUBMENU", value: "Git Connection > Disconnect" }, - { key: "USE_DEFAULT_CONFIGURATION", value: "Use default configuration" }, + { + key: "USE_DEFAULT_CONFIGURATION", + value: "Use default configuration", + }, { key: "GIT_COMMIT_MESSAGE_PLACEHOLDER", value: "Your commit message here", }, { key: "GIT_CONNECTION", value: "Git Connection" }, { key: "DEPLOY", value: "Deploy" }, - { key: "MERGE", value: "Merge" }, + { + key: "MERGE", + value: "Merge", + }, { key: "GIT_SETTINGS", value: "Git Settings" }, { key: "CONNECT_TO_GIT", value: "Connect to git repository" }, { @@ -209,6 +247,15 @@ describe("git-sync messages", () => { value: `Create an empty git repository and paste the remote URL here.`, }, { key: "REMOTE_URL_VIA", value: "Remote URL via" }, + { + key: "ERROR_GIT_AUTH_FAIL", + value: + "Please make sure that regenerated SSH key is added and has write access to the repo.", + }, + { + key: "ERROR_GIT_INVALID_REMOTE", + value: "Remote repo doesn't exist or is unreachable.", + }, ]; const functions = [ CANNOT_MERGE_DUE_TO_UNCOMMITTED_CHANGES, @@ -270,6 +317,8 @@ describe("git-sync messages", () => { SUBMIT, UPDATE_CONFIG, USE_DEFAULT_CONFIGURATION, + ERROR_GIT_AUTH_FAIL, + ERROR_GIT_INVALID_REMOTE, ]; functions.forEach((fn: () => string) => { it(`${fn.name} returns expected value`, () => { diff --git a/app/client/src/ce/constants/messages.ts b/app/client/src/ce/constants/messages.ts index 83e6e0a5d1..ffa207d4c7 100644 --- a/app/client/src/ce/constants/messages.ts +++ b/app/client/src/ce/constants/messages.ts @@ -522,8 +522,7 @@ export const BULK_WIDGET_ADDED = (widgetName: string) => export const UNSUPPORTED_PLUGIN_DIALOG_TITLE = () => `Couldn't auto generate a page from this datasource.`; -export const UNSUPPORTED_PLUGIN_DIALOG_SUBTITLE = () => - `You can continue building your app with it using our drag & Drop +export const UNSUPPORTED_PLUGIN_DIALOG_SUBTITLE = () => `You can continue building your app with it using our drag & Drop builder`; export const UNSUPPORTED_PLUGIN_DIALOG_MAIN_HEADING = () => `Heads up`; @@ -736,6 +735,13 @@ export const CONNECTING_TO_REPO_DISABLED = () => export const DURING_ONBOARDING_TOUR = () => "during the onboarding tour"; export const MERGED_SUCCESSFULLY = () => "Merged successfully"; +// GIT ERRORS begin +export const ERROR_GIT_AUTH_FAIL = () => + "Please make sure that regenerated SSH key is added and has write access to the repo."; +export const ERROR_GIT_INVALID_REMOTE = () => + "Remote repo doesn't exist or is unreachable."; +// GIT ERRORS end + // JS Snippets export const SNIPPET_DESCRIPTION = () => `Search and insert code snippets to perform complex actions quickly.`; diff --git a/app/client/src/sagas/GitSyncSagas.ts b/app/client/src/sagas/GitSyncSagas.ts index 6a46d0eda5..c6f7292aab 100644 --- a/app/client/src/sagas/GitSyncSagas.ts +++ b/app/client/src/sagas/GitSyncSagas.ts @@ -5,9 +5,12 @@ import { ReduxActionTypes, ReduxActionWithCallbacks, } from "constants/ReduxActionConstants"; -import { all, put, select, takeLatest, call } from "redux-saga/effects"; +import { all, call, put, select, takeLatest } from "redux-saga/effects"; -import GitSyncAPI from "api/GitSyncAPI"; +import GitSyncAPI, { + MergeBranchPayload, + MergeStatusPayload, +} from "api/GitSyncAPI"; import { getCurrentApplicationId, getCurrentPageId, @@ -17,33 +20,35 @@ import { commitToRepoSuccess, fetchBranchesInit, fetchBranchesSuccess, - fetchGlobalGitConfigSuccess, - fetchLocalGitConfigSuccess, - updateLocalGitConfigSuccess, - fetchLocalGitConfigInit, - switchGitBranchInit, - gitPullSuccess, - fetchMergeStatusSuccess, - fetchMergeStatusFailure, fetchGitStatusInit, - setIsGitSyncModalOpen, - setIsGitErrorPopupVisible, - setIsDisconnectGitModalOpen, - setShowRepoLimitErrorModal, + fetchGitStatusSuccess, fetchGlobalGitConfigInit, - generateSSHKeyPairSuccess, - getSSHKeyPairSuccess, - getSSHKeyPairError, + fetchGlobalGitConfigSuccess, + fetchLocalGitConfigInit, + fetchLocalGitConfigSuccess, + fetchMergeStatusFailure, + fetchMergeStatusSuccess, GenerateSSHKeyPairReduxAction, + generateSSHKeyPairSuccess, + getSSHKeyPairError, GetSSHKeyPairReduxAction, + getSSHKeyPairSuccess, + gitPullSuccess, importAppViaGitSuccess, + setIsDisconnectGitModalOpen, + setIsGitErrorPopupVisible, + setIsGitSyncModalOpen, + setShowRepoLimitErrorModal, + switchGitBranchInit, + updateLocalGitConfigSuccess, } from "actions/gitSyncActions"; import { showReconnectDatasourceModal } from "actions/applicationActions"; import { - connectToGitSuccess, ConnectToGitReduxAction, + connectToGitSuccess, + mergeBranchSuccess, } from "../actions/gitSyncActions"; import { ApiResponse } from "api/ApiResponses"; import { GitConfig, GitSyncModalTab } from "entities/GitSync"; @@ -52,29 +57,24 @@ import { Variant } from "components/ads/common"; import { getCurrentAppGitMetaData, getCurrentApplication, + getOrganizationIdForImport, } from "selectors/applicationSelectors"; -import { fetchGitStatusSuccess } from "actions/gitSyncActions"; import { createMessage, + ERROR_GIT_AUTH_FAIL, + ERROR_GIT_INVALID_REMOTE, GIT_USER_UPDATED_SUCCESSFULLY, } from "@appsmith/constants/messages"; import { GitApplicationMetadata } from "../api/ApplicationApi"; import history from "utils/history"; import { addBranchParam, GIT_BRANCH_QUERY_KEY } from "constants/routes"; -import { MergeBranchPayload, MergeStatusPayload } from "api/GitSyncAPI"; - -import { - mergeBranchSuccess, - // mergeBranchFailure, -} from "../actions/gitSyncActions"; import { getCurrentGitBranch, getDisconnectingGitApplication, } from "selectors/gitSyncSelectors"; import { initEditor } from "actions/initActions"; import { fetchPage } from "actions/pageActions"; -import { getOrganizationIdForImport } from "selectors/applicationSelectors"; import { getLogToSentryFromResponse } from "utils/helpers"; import { getCurrentOrg } from "selectors/organizationSelectors"; import { Org } from "constants/orgConstants"; @@ -432,10 +432,18 @@ function* fetchGitStatusSaga() { yield put(fetchGitStatusSuccess(response?.data)); } } catch (error) { + const payload = { error, show: true }; + if (error?.message?.includes("Auth fail")) { + payload.error = new Error(createMessage(ERROR_GIT_AUTH_FAIL)); + } else if (error?.message?.includes("Invalid remote: origin")) { + payload.error = new Error(createMessage(ERROR_GIT_INVALID_REMOTE)); + } + yield put({ type: ReduxActionErrorTypes.FETCH_GIT_STATUS_ERROR, - payload: { error, show: false }, + payload, }); + // non api error if (!response || response?.responseMeta?.success) { throw error;