Skip to content

Commit

Permalink
test: fixed datepicker skipped tests set 2
Browse files Browse the repository at this point in the history
  • Loading branch information
“NandanAnantharamu” committed Oct 29, 2024
1 parent d6305ba commit 98ad977
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
*/
Expand All @@ -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);
Expand All @@ -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");

/**
Expand All @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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
*/
Expand All @@ -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");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
3 changes: 2 additions & 1 deletion app/client/cypress/limited-tests.txt
Original file line number Diff line number Diff line change
@@ -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/**/**/*
Expand Down
3 changes: 2 additions & 1 deletion app/client/cypress/locators/FormWidgets.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
12 changes: 9 additions & 3 deletions app/client/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
2 changes: 1 addition & 1 deletion app/client/cypress/support/widgetCommands.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 98ad977

Please sign in to comment.