From 98ad97753b0f8b9b08fae069103d0bb96f450bf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNandanAnantharamu=E2=80=9D?= <“nandan@thinkify.io”> Date: Tue, 29 Oct 2024 19:49:56 +0530 Subject: [PATCH 1/4] test: fixed datepicker skipped tests set 2 --- .../Binding/DatePicker_Text_spec.js | 23 ++++++++----------- .../Widgets/Datepicker/DatePicker2_spec.js | 2 +- app/client/cypress/limited-tests.txt | 3 ++- app/client/cypress/locators/FormWidgets.json | 3 ++- app/client/cypress/support/commands.js | 12 +++++++--- app/client/cypress/support/widgetCommands.js | 2 +- 6 files changed, 25 insertions(+), 20 deletions(-) diff --git a/app/client/cypress/e2e/Regression/ClientSide/Binding/DatePicker_Text_spec.js b/app/client/cypress/e2e/Regression/ClientSide/Binding/DatePicker_Text_spec.js index 037e637f8cd7..13f28fdad2bd 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Binding/DatePicker_Text_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/Binding/DatePicker_Text_spec.js @@ -14,7 +14,7 @@ describe( _.agHelper.AddDsl("uiBindDsl"); }); // Skipping tests due to issue - https://www.notion.so/appsmith/f353d8c6bd664f79ad858a42010cdfc8?v=f04cde23f6424aeb9d5a6e389cd172bd&p=0717892d43684c40bae4e2c87b8308cb&pm=s - it.skip("1. DatePicker-Text, Validate selectedDate functionality", function () { + it("1. DatePicker-Text, Validate selectedDate functionality", function () { /** * Bind DatePicker1 to Text for "selectedDate" */ @@ -25,9 +25,8 @@ describe( * Set the Calender for today's date in DatePicker1 */ cy.openPropertyPane("datepickerwidget"); - cy.get(formWidgetsPage.defaultDate).click(); - cy.ClearDateFooter(); - cy.SetDateToToday(); + cy.get(formWidgetsPage.datepickerWidget).first().click(); + cy.get(formWidgetsPage.datepickerFooter).contains("Today").click(); cy.getDate(1, "YYYY-MM-DD").then((date) => { cy.log("retured date" + date); @@ -43,15 +42,14 @@ describe( cy.get(publishPage.datepickerWidget + commonlocators.inputField) .eq(0) .click(); - cy.ClearDateFooter(); - cy.setDate(1, "ddd MMM DD YYYY"); + cy.setDate(1, "ddd MMM DD YYYY", "v1"); cy.get(commonlocators.labelTextStyle).should("contain", nextDay); }); cy.get(commonlocators.backToEditor).click(); }); - it.skip("2. DatePicker1-text: Change the date in DatePicker1 and Validate the same in text widget", function () { + it("2. DatePicker1-text: Change the date in DatePicker1 and Validate the same in text widget", function () { cy.openPropertyPane("textwidget"); /** @@ -75,9 +73,9 @@ describe( */ cy.openPropertyPane("datepickerwidget"); cy.get(formWidgetsPage.defaultDate).click(); - cy.ClearDateFooter(); - cy.setDate(1, "ddd MMM DD YYYY"); - // cy.get(commonlocators.onDateSelectedField).click(); + cy.get(formWidgetsPage.dayPickerToday).click(); + cy.get(formWidgetsPage.defaultDate).click(); + cy.setDate(1); /** *Validate the date in text widget @@ -89,7 +87,7 @@ describe( }); }); - it.skip("3. Validate the Date is not changed in DatePicker2", function () { + it("3. Validate the Date is not changed in DatePicker2", function () { cy.log("dateDp2:" + dateDp2); cy.get(formWidgetsPage.datepickerWidget + commonlocators.inputField) .eq(1) @@ -124,7 +122,7 @@ describe( _.deployMode.NavigateBacktoEditor(); }); - it.skip("5. Checks if on deselection of date triggers the onDateSelected action or not.", function () { + it("5. Checks if on deselection of date triggers the onDateSelected action or not.", function () { /** * bind datepicker to show a message "Hello" on date selected */ @@ -135,7 +133,6 @@ describe( * checking if on selecting the date triggers the message */ cy.get(formWidgetsPage.datepickerWidget).first().click(); - cy.ClearDateFooter(); cy.SetDateToToday(); cy.get(commonlocators.toastmsg).contains("hello"); diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Datepicker/DatePicker2_spec.js b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Datepicker/DatePicker2_spec.js index af2714ccb725..74292b291b10 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Datepicker/DatePicker2_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Datepicker/DatePicker2_spec.js @@ -22,7 +22,7 @@ describe( it("DatePicker-Date Name validation", function () { // changing the date to today cy.get(formWidgetsPage.defaultDate).click(); - cy.SetDateToToday(); + cy.get(formWidgetsPage.dayPickerToday).click(); //changing the Button Name cy.widgetText( diff --git a/app/client/cypress/limited-tests.txt b/app/client/cypress/limited-tests.txt index 31c0c0253fef..3fda832e8042 100644 --- a/app/client/cypress/limited-tests.txt +++ b/app/client/cypress/limited-tests.txt @@ -1,5 +1,6 @@ # To run only limited tests - give the spec names in below format: -cypress/e2e/Regression/ClientSide/Templates/Fork_Template_spec.js +cypress/e2e/Regression/ClientSide/Widgets/Datepicker/DatePicker2_spec.js +cypress/e2e/Regression/ClientSide/Binding/DatePicker_Text_spec.js # For running all specs - uncomment below: #cypress/e2e/**/**/* diff --git a/app/client/cypress/locators/FormWidgets.json b/app/client/cypress/locators/FormWidgets.json index db603de7b8c0..43462381c2da 100644 --- a/app/client/cypress/locators/FormWidgets.json +++ b/app/client/cypress/locators/FormWidgets.json @@ -78,5 +78,6 @@ "minDateTextArea" : ".t--property-control-mindate .CodeMirror textarea", "minDateInput" : ".t--property-control-mindate .ads-v2-input__input-section-input", "datePickerInput": ".t--widget-datepickerwidget2 .bp3-input", - "dayPickerNextButton": ".DayPicker-NavButton--next" + "dayPickerNextButton": ".DayPicker-NavButton--next", + "dayPickerToday": ".ads-v2-datepicker__calender-today" } diff --git a/app/client/cypress/support/commands.js b/app/client/cypress/support/commands.js index 19c28a5b3721..f9a2a09e5763 100644 --- a/app/client/cypress/support/commands.js +++ b/app/client/cypress/support/commands.js @@ -524,9 +524,15 @@ Cypress.Commands.add("getDate", (date, dateFormate) => { return eDate; }); -Cypress.Commands.add("setDate", (date) => { - const expDate = dayjs().add(date, "days").format("dddd, MMMM DD"); - cy.get(`.react-datepicker__day[aria-label^="Choose ${expDate}"]`).click(); +Cypress.Commands.add("setDate", (date, dateFormate, ver = "v2") => { + if (ver == "v2") { + const expDate = dayjs().add(date, "days").format("dddd, MMMM DD"); + cy.get(`.react-datepicker__day[aria-label^="Choose ${expDate}"]`).click(); + } else if (ver == "v1") { + const expDate = dayjs().add(date, "days").format(dateFormate); + const sel = `.DayPicker-Day[aria-label=\"${expDate}\"]`; + cy.get(sel).click(); + } }); Cypress.Commands.add("validateDisableWidget", (widgetCss, disableCss) => { diff --git a/app/client/cypress/support/widgetCommands.js b/app/client/cypress/support/widgetCommands.js index fd0772748f6f..4ff5489802e2 100644 --- a/app/client/cypress/support/widgetCommands.js +++ b/app/client/cypress/support/widgetCommands.js @@ -837,7 +837,7 @@ Cypress.Commands.add("selectWidgetForReset", (value) => { }); Cypress.Commands.add("SetDateToToday", () => { - cy.get(".react-datepicker .react-datepicker__day--today").click({ + cy.get(".DayPicker-Day--today").click({ force: true, }); agHelper.AssertAutoSave(); From f21e2846ecd469a323e14500683813ff04ddc862 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNandanAnantharamu=E2=80=9D?= <“nandan@thinkify.io”> Date: Wed, 30 Oct 2024 19:11:47 +0530 Subject: [PATCH 2/4] updated locators and flow --- .../Binding/DatePicker_Text_spec.js | 2 +- .../Datepicker/DatePicker_With_Switch_spec.js | 21 +- app/client/cypress/fixtures/uiBindnewDsl.json | 540 ++++++++++++++++++ app/client/cypress/limited-tests.txt | 1 + app/client/cypress/locators/Widgets.json | 4 +- 5 files changed, 553 insertions(+), 15 deletions(-) create mode 100644 app/client/cypress/fixtures/uiBindnewDsl.json diff --git a/app/client/cypress/e2e/Regression/ClientSide/Binding/DatePicker_Text_spec.js b/app/client/cypress/e2e/Regression/ClientSide/Binding/DatePicker_Text_spec.js index 13f28fdad2bd..6c29909e6340 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Binding/DatePicker_Text_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/Binding/DatePicker_Text_spec.js @@ -11,7 +11,7 @@ describe( let dateDp2; before(() => { - _.agHelper.AddDsl("uiBindDsl"); + _.agHelper.AddDsl("uiBindnewDsl"); }); // Skipping tests due to issue - https://www.notion.so/appsmith/f353d8c6bd664f79ad858a42010cdfc8?v=f04cde23f6424aeb9d5a6e389cd172bd&p=0717892d43684c40bae4e2c87b8308cb&pm=s it("1. DatePicker-Text, Validate selectedDate functionality", function () { diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Datepicker/DatePicker_With_Switch_spec.js b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Datepicker/DatePicker_With_Switch_spec.js index d48e5ce34c9e..ca19936ef522 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Datepicker/DatePicker_With_Switch_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Datepicker/DatePicker_With_Switch_spec.js @@ -28,11 +28,14 @@ describe( cy.closePropertyPane(); }); // Skipping tests due to issue - https://www.notion.so/appsmith/f353d8c6bd664f79ad858a42010cdfc8?v=f04cde23f6424aeb9d5a6e389cd172bd&p=0717892d43684c40bae4e2c87b8308cb&pm=s - it.skip("Date Widget with Reset widget being switch widget", function () { + it("Date Widget with Reset widget being switch widget", function () { EditorNavigation.SelectEntityByName("DatePicker1", EntityType.Widget); + cy.get(formWidgetsPage.datePickerInput).click(); + _.agHelper.GetNClick(widgetsPage.todayText) + cy.get(formWidgetsPage.defaultDate).click(); + _.agHelper.GetNClick('.ads-v2-datepicker__calender-today'); cy.get(formWidgetsPage.defaultDate).click(); - cy.SetDateToToday(); cy.setDate(1, "ddd MMM DD YYYY"); const nextDay = dayjs().format("DD/MM/YYYY"); cy.log(nextDay); @@ -51,18 +54,10 @@ describe( cy.get(widgetsPage.switchWidgetInactive).should("be.visible"); }); - it.skip("DatePicker-Date change and validate switch widget status", function () { + it("DatePicker-Date change and validate switch widget status", function () { cy.get(widgetsPage.datepickerInput).click({ force: true }); - cy.SetDateToToday(); - cy.get(widgetsPage.switchWidgetActive).should("be.visible"); - cy.get(".t--toast-action span") - .last() - .invoke("text") - .then((text) => { - const toasttext = text; - cy.log(toasttext); - expect(text.trim()).to.equal(toasttext.trim()); - }); + _.agHelper.GetNClick(widgetsPage.todayText) + _.agHelper.AssertClassExists('.bp3-switch', 't--switch-widget-active') }); }, ); diff --git a/app/client/cypress/fixtures/uiBindnewDsl.json b/app/client/cypress/fixtures/uiBindnewDsl.json new file mode 100644 index 000000000000..6d45729acce7 --- /dev/null +++ b/app/client/cypress/fixtures/uiBindnewDsl.json @@ -0,0 +1,540 @@ +{ + "dsl": { + "widgetName": "MainContainer", + "backgroundColor": "none", + "rightColumn": 4896, + "snapColumns": 64, + "detachFromLayout": true, + "widgetId": "0", + "topRow": 0, + "bottomRow": 600, + "containerStyle": "none", + "snapRows": 124, + "parentRowSpace": 1, + "type": "CANVAS_WIDGET", + "canExtend": true, + "version": 90, + "minHeight": 1292, + "parentColumnSpace": 1, + "dynamicBindingPathList": [], + "leftColumn": 0, + "children": [ + { + "boxShadow": "none", + "widgetName": "Container1", + "topRow": 0, + "bottomRow": 60, + "parentRowSpace": 38, + "type": "CONTAINER_WIDGET", + "parentColumnSpace": 75.25, + "dynamicBindingPathList": [], + "leftColumn": 0, + "children": [ + { + "labelTextSize": "0.875rem", + "boxShadow": "none", + "backgroundColor": "#FFFFFF", + "widgetName": "utncsu66ty", + "rightColumn": 2408, + "orientation": "VERTICAL", + "snapColumns": 16, + "detachFromLayout": true, + "widgetId": "acizsl94my", + "containerStyle": "none", + "topRow": 0, + "bottomRow": 380, + "parentRowSpace": 1, + "isVisible": true, + "type": "CANVAS_WIDGET", + "canExtend": false, + "version": 1, + "isLoading": false, + "parentColumnSpace": 1, + "leftColumn": 0, + "dynamicBindingPathList": [], + "borderRadius": "0px", + "children": [ + { + "boxShadow": "none", + "widgetName": "Text5", + "topRow": 28, + "bottomRow": 32, + "parentRowSpace": 38, + "type": "TEXT_WIDGET", + "parentColumnSpace": 62.484375, + "overflow": "NONE", + "fontFamily": "System Default", + "dynamicTriggerPathList": [], + "leftColumn": 16, + "dynamicBindingPathList": [ + { + "key": "text" + } + ], + "text": "{{DatePicker1.selectedDate}}", + "labelTextSize": "0.875rem", + "rightColumn": 32, + "textAlign": "LEFT", + "dynamicHeight": "FIXED", + "widgetId": "t7c7i4gv0f", + "isVisible": true, + "fontStyle": "BOLD", + "version": 1, + "textColor": "#231F20", + "parentId": "acizsl94my", + "isLoading": false, + "borderRadius": "0px", + "maxDynamicHeight": 9000, + "fontSize": "0.875rem", + "minDynamicHeight": 4 + }, + { + "needsErrorInfo": false, + "boxShadow": "none", + "mobileBottomRow": 12, + "widgetName": "DatePicker1", + "minDate": "1920-12-31T18:30:00.000Z", + "dateFormat": "YYYY-MM-DD HH:mm", + "topRow": 5, + "bottomRow": 12, + "shortcuts": false, + "parentRowSpace": 10, + "labelWidth": 5, + "type": "DATE_PICKER_WIDGET2", + "mobileRightColumn": 30, + "animateLoading": true, + "parentColumnSpace": 7.26171875, + "leftColumn": 10, + "dynamicBindingPathList": [ + { + "key": "accentColor" + }, + { + "key": "borderRadius" + } + ], + "labelPosition": "Top", + "isDisabled": false, + "key": "frcocd42ul", + "labelTextSize": "0.875rem", + "isRequired": false, + "defaultDate": "2024-10-24T07:39:07.659Z", + "rightColumn": 30, + "dynamicHeight": "FIXED", + "widgetId": "pwo88q4udx", + "accentColor": "{{appsmith.theme.colors.primaryColor}}", + "minWidth": 450, + "isVisible": true, + "datePickerType": "DATE_PICKER", + "label": "Label", + "version": 2, + "parentId": "acizsl94my", + "labelAlignment": "left", + "renderMode": "CANVAS", + "isLoading": false, + "mobileTopRow": 5, + "timePrecision": "minute", + "responsiveBehavior": "fill", + "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}", + "mobileLeftColumn": 10, + "maxDynamicHeight": 9000, + "firstDayOfWeek": 0, + "closeOnSelection": true, + "maxDate": "2121-12-31T18:29:00.000Z", + "minDynamicHeight": 4 + }, + { + "needsErrorInfo": false, + "boxShadow": "none", + "mobileBottomRow": 22, + "widgetName": "DatePicker2", + "minDate": "1920-12-31T18:30:00.000Z", + "dateFormat": "YYYY-MM-DD HH:mm", + "topRow": 14, + "bottomRow": 21, + "shortcuts": false, + "parentRowSpace": 10, + "labelWidth": 5, + "type": "DATE_PICKER_WIDGET2", + "mobileRightColumn": 29, + "animateLoading": true, + "parentColumnSpace": 7.26171875, + "leftColumn": 10, + "dynamicBindingPathList": [ + { + "key": "accentColor" + }, + { + "key": "borderRadius" + } + ], + "labelPosition": "Top", + "isDisabled": false, + "key": "frcocd42ul", + "labelTextSize": "0.875rem", + "isRequired": false, + "defaultDate": "2024-10-24T07:39:07.659Z", + "rightColumn": 30, + "dynamicHeight": "FIXED", + "widgetId": "gwcu42z6yn", + "accentColor": "{{appsmith.theme.colors.primaryColor}}", + "minWidth": 450, + "isVisible": true, + "datePickerType": "DATE_PICKER", + "label": "Label", + "version": 2, + "parentId": "acizsl94my", + "labelAlignment": "left", + "renderMode": "CANVAS", + "isLoading": false, + "mobileTopRow": 15, + "timePrecision": "minute", + "responsiveBehavior": "fill", + "borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}", + "mobileLeftColumn": 9, + "maxDynamicHeight": 9000, + "firstDayOfWeek": 0, + "closeOnSelection": true, + "maxDate": "2121-12-31T18:29:00.000Z", + "minDynamicHeight": 4 + } + ] + } + ], + "labelTextSize": "0.875rem", + "backgroundColor": "#FFFFFF", + "rightColumn": 56, + "orientation": "VERTICAL", + "snapColumns": 16, + "dynamicHeight": "FIXED", + "widgetId": "mp429a7dl3", + "containerStyle": "card", + "isVisible": true, + "version": 1, + "isLoading": false, + "borderRadius": "0px", + "maxDynamicHeight": 9000, + "minDynamicHeight": 4 + }, + { + "boxShadow": "none", + "widgetName": "Modal1", + "topRow": 0, + "bottomRow": 0, + "parentRowSpace": 1, + "type": "MODAL_WIDGET", + "shouldScrollContents": true, + "parentColumnSpace": 1, + "leftColumn": 0, + "dynamicBindingPathList": [], + "children": [ + { + "boxShadow": "none", + "widgetName": "Canvas1", + "topRow": 0, + "bottomRow": 240, + "parentRowSpace": 1, + "canExtend": true, + "type": "CANVAS_WIDGET", + "shouldScrollContents": false, + "minHeight": 0, + "parentColumnSpace": 1, + "leftColumn": 0, + "dynamicBindingPathList": [], + "children": [ + { + "labelTextSize": "0.875rem", + "isRequired": false, + "boxShadow": "none", + "widgetName": "Icon1", + "rightColumn": 64, + "onClick": "{{closeModal(Modal1.name)}}", + "iconName": "cross", + "buttonColor": "#2E3D49", + "widgetId": "t3sjfihdb1", + "topRow": 0, + "bottomRow": 4, + "isVisible": true, + "type": "ICON_BUTTON_WIDGET", + "version": 1, + "parentId": "cwamdbv44c", + "isLoading": false, + "leftColumn": 60, + "dynamicBindingPathList": [], + "borderRadius": "0px", + "buttonVariant": "TERTIARY", + "iconSize": 24 + }, + { + "boxShadow": "none", + "widgetName": "Text4", + "dynamicPropertyPathList": [ + { + "key": "fontSize" + } + ], + "topRow": 0, + "bottomRow": 4, + "type": "TEXT_WIDGET", + "overflow": "NONE", + "fontFamily": "System Default", + "leftColumn": 0, + "dynamicBindingPathList": [], + "text": "Modal Title", + "labelTextSize": "0.875rem", + "rightColumn": 60, + "dynamicHeight": "FIXED", + "widgetId": "x893ud3zjh", + "isVisible": true, + "fontStyle": "BOLD", + "version": 1, + "textColor": "#231F20", + "parentId": "cwamdbv44c", + "isLoading": false, + "borderRadius": "0px", + "maxDynamicHeight": 9000, + "fontSize": "1.5rem", + "minDynamicHeight": 4 + }, + { + "labelTextSize": "0.875rem", + "boxShadow": "none", + "widgetName": "Button2", + "rightColumn": 52, + "isDefaultClickDisabled": true, + "buttonColor": "#03B365", + "widgetId": "q9snwskqan", + "topRow": 16, + "bottomRow": 20, + "isVisible": true, + "type": "BUTTON_WIDGET", + "version": 1, + "recaptchaType": "V3", + "parentId": "cwamdbv44c", + "isLoading": false, + "leftColumn": 40, + "dynamicBindingPathList": [], + "borderRadius": "0px", + "buttonVariant": "PRIMARY", + "text": "Cancel", + "isDisabled": false + }, + { + "labelTextSize": "0.875rem", + "boxShadow": "none", + "widgetName": "Button3", + "rightColumn": 64, + "isDefaultClickDisabled": true, + "buttonColor": "#03B365", + "widgetId": "tufuj2kdpz", + "topRow": 16, + "bottomRow": 20, + "isVisible": true, + "type": "BUTTON_WIDGET", + "version": 1, + "recaptchaType": "V3", + "parentId": "cwamdbv44c", + "isLoading": false, + "leftColumn": 52, + "dynamicBindingPathList": [], + "borderRadius": "0px", + "buttonVariant": "PRIMARY", + "text": "Confirm", + "isDisabled": false + } + ], + "isDisabled": false, + "labelTextSize": "0.875rem", + "rightColumn": 0, + "detachFromLayout": true, + "widgetId": "cwamdbv44c", + "isVisible": true, + "version": 1, + "parentId": "bx9a2jg08o", + "blueprint": { + "view": [ + { + "type": "ICON_WIDGET", + "position": { + "left": 15, + "top": 0 + }, + "size": { + "rows": 1, + "cols": 1 + }, + "props": { + "iconName": "cross", + "iconSize": 24, + "color": "#040627" + } + }, + { + "type": "TEXT_WIDGET", + "position": { + "left": 0, + "top": 0 + }, + "size": { + "rows": 1, + "cols": 15 + }, + "props": { + "text": "Modal Title", + "textStyle": "HEADING" + } + }, + { + "type": "BUTTON_WIDGET", + "position": { + "left": 10, + "top": 4 + }, + "size": { + "rows": 1, + "cols": 3 + }, + "props": { + "text": "Cancel", + "buttonStyle": "SECONDARY_BUTTON" + } + }, + { + "type": "BUTTON_WIDGET", + "position": { + "left": 13, + "top": 4 + }, + "size": { + "rows": 1, + "cols": 3 + }, + "props": { + "text": "Confirm", + "buttonStyle": "PRIMARY_BUTTON" + } + } + ], + "operations": [ + { + "type": "MODIFY_PROPS" + } + ] + }, + "isLoading": false, + "borderRadius": "0px" + } + ], + "height": 240, + "labelTextSize": "0.875rem", + "rightColumn": 0, + "detachFromLayout": true, + "dynamicHeight": "FIXED", + "widgetId": "bx9a2jg08o", + "isVisible": false, + "canOutsideClickClose": true, + "canEscapeKeyClose": true, + "version": 2, + "parentId": "0", + "blueprint": { + "view": [ + { + "type": "CANVAS_WIDGET", + "position": { + "left": 0, + "top": 0 + }, + "props": { + "detachFromLayout": true, + "canExtend": true, + "isVisible": true, + "isDisabled": false, + "shouldScrollContents": false, + "children": [], + "blueprint": { + "view": [ + { + "type": "ICON_WIDGET", + "position": { + "left": 15, + "top": 0 + }, + "size": { + "rows": 1, + "cols": 1 + }, + "props": { + "iconName": "cross", + "iconSize": 24, + "color": "#040627" + } + }, + { + "type": "TEXT_WIDGET", + "position": { + "left": 0, + "top": 0 + }, + "size": { + "rows": 1, + "cols": 15 + }, + "props": { + "text": "Modal Title", + "textStyle": "HEADING" + } + }, + { + "type": "BUTTON_WIDGET", + "position": { + "left": 10, + "top": 4 + }, + "size": { + "rows": 1, + "cols": 3 + }, + "props": { + "text": "Cancel", + "buttonStyle": "SECONDARY_BUTTON" + } + }, + { + "type": "BUTTON_WIDGET", + "position": { + "left": 13, + "top": 4 + }, + "size": { + "rows": 1, + "cols": 3 + }, + "props": { + "text": "Confirm", + "buttonStyle": "PRIMARY_BUTTON" + } + } + ], + "operations": [ + { + "type": "MODIFY_PROPS" + } + ] + } + } + } + ] + }, + "isLoading": false, + "borderRadius": "0px", + "maxDynamicHeight": 9000, + "width": 456, + "minDynamicHeight": 4 + } + ] + }, + "layoutOnLoadActions": [], + "layoutOnLoadActionErrors": [], + "actionUpdates": [], + "messages": [] +} diff --git a/app/client/cypress/limited-tests.txt b/app/client/cypress/limited-tests.txt index 3fda832e8042..697156ea2edb 100644 --- a/app/client/cypress/limited-tests.txt +++ b/app/client/cypress/limited-tests.txt @@ -1,6 +1,7 @@ # To run only limited tests - give the spec names in below format: cypress/e2e/Regression/ClientSide/Widgets/Datepicker/DatePicker2_spec.js cypress/e2e/Regression/ClientSide/Binding/DatePicker_Text_spec.js +cypress/e2e/Regression/ClientSide/Widgets/Datepicker/DatePicker_With_Switch_spec.js # For running all specs - uncomment below: #cypress/e2e/**/**/* diff --git a/app/client/cypress/locators/Widgets.json b/app/client/cypress/locators/Widgets.json index 92b161d141b2..4dcb4ce330bf 100644 --- a/app/client/cypress/locators/Widgets.json +++ b/app/client/cypress/locators/Widgets.json @@ -234,5 +234,7 @@ "propertyPaneSaveButton": ".t--property-pane-section-collapse-savebutton", "firstEditInput":"[data-colindex=0][data-rowindex=0] .t--inlined-cell-editor input.bp3-input", "cellControlSwitch" : ".t--property-control-cellwrapping .ads-v2-switch", - "propertyControlLabel" : ".t--property-control-label" + "propertyControlLabel" : ".t--property-control-label", + "todayText": "span:contains('Today')", + "dayPickerToday": ".DayPicker-Day--today" } From 14be89943289e2b439d385a96cd8620eeaf2ba03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNandanAnantharamu=E2=80=9D?= <“nandan@thinkify.io”> Date: Sat, 2 Nov 2024 09:14:47 +0530 Subject: [PATCH 3/4] updated method --- .../e2e/Regression/ClientSide/Binding/DatePicker_Text_spec.js | 1 - app/client/cypress/support/commands.js | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/client/cypress/e2e/Regression/ClientSide/Binding/DatePicker_Text_spec.js b/app/client/cypress/e2e/Regression/ClientSide/Binding/DatePicker_Text_spec.js index 6c29909e6340..6f694f66dfb0 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Binding/DatePicker_Text_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/Binding/DatePicker_Text_spec.js @@ -76,7 +76,6 @@ describe( cy.get(formWidgetsPage.dayPickerToday).click(); cy.get(formWidgetsPage.defaultDate).click(); cy.setDate(1); - /** *Validate the date in text widget */ diff --git a/app/client/cypress/support/commands.js b/app/client/cypress/support/commands.js index f9a2a09e5763..84ba118ae234 100644 --- a/app/client/cypress/support/commands.js +++ b/app/client/cypress/support/commands.js @@ -526,8 +526,8 @@ Cypress.Commands.add("getDate", (date, dateFormate) => { Cypress.Commands.add("setDate", (date, dateFormate, ver = "v2") => { if (ver == "v2") { - const expDate = dayjs().add(date, "days").format("dddd, MMMM DD"); - cy.get(`.react-datepicker__day[aria-label^="Choose ${expDate}"]`).click(); + const expDate = dayjs().add(date, "days").format("dddd, MMMM D"); + cy.get(`.react-datepicker__day[aria-label^="Choose ${expDate}"]`).first().click(); } else if (ver == "v1") { const expDate = dayjs().add(date, "days").format(dateFormate); const sel = `.DayPicker-Day[aria-label=\"${expDate}\"]`; From f76f1243650bb009801b051179026ce5dba56fba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNandanAnantharamu=E2=80=9D?= <“nandan@thinkify.io”> Date: Sat, 2 Nov 2024 12:35:18 +0530 Subject: [PATCH 4/4] udpated tests --- .../e2e/Regression/ClientSide/Binding/DatePicker_Text_spec.js | 4 +++- app/client/cypress/support/widgetCommands.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/client/cypress/e2e/Regression/ClientSide/Binding/DatePicker_Text_spec.js b/app/client/cypress/e2e/Regression/ClientSide/Binding/DatePicker_Text_spec.js index 6f694f66dfb0..52c699902baf 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Binding/DatePicker_Text_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/Binding/DatePicker_Text_spec.js @@ -11,7 +11,7 @@ describe( let dateDp2; before(() => { - _.agHelper.AddDsl("uiBindnewDsl"); + _.agHelper.AddDsl("uiBindDsl"); }); // Skipping tests due to issue - https://www.notion.so/appsmith/f353d8c6bd664f79ad858a42010cdfc8?v=f04cde23f6424aeb9d5a6e389cd172bd&p=0717892d43684c40bae4e2c87b8308cb&pm=s it("1. DatePicker-Text, Validate selectedDate functionality", function () { @@ -42,6 +42,7 @@ describe( cy.get(publishPage.datepickerWidget + commonlocators.inputField) .eq(0) .click(); + cy.SetDateToToday(); cy.setDate(1, "ddd MMM DD YYYY", "v1"); cy.get(commonlocators.labelTextStyle).should("contain", nextDay); }); @@ -76,6 +77,7 @@ describe( cy.get(formWidgetsPage.dayPickerToday).click(); cy.get(formWidgetsPage.defaultDate).click(); cy.setDate(1); + /** *Validate the date in text widget */ diff --git a/app/client/cypress/support/widgetCommands.js b/app/client/cypress/support/widgetCommands.js index 4ff5489802e2..23d1d828f6a4 100644 --- a/app/client/cypress/support/widgetCommands.js +++ b/app/client/cypress/support/widgetCommands.js @@ -837,7 +837,7 @@ Cypress.Commands.add("selectWidgetForReset", (value) => { }); Cypress.Commands.add("SetDateToToday", () => { - cy.get(".DayPicker-Day--today").click({ + cy.get("button:contains('Today')").click({ force: true, }); agHelper.AssertAutoSave();