Skip to content

Commit

Permalink
test: fix datepicker tests (appsmithorg#37042)
Browse files Browse the repository at this point in the history
EE PR:appsmithorg/appsmith-ee#5438

Updated SetDate method as the older method was not working anymore

/ok-to-test tags="@tag.All"



<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/11512762742>
> Commit: 1e0ec01
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11512762742&attempt=2"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.All`
> Spec:
> <hr>Fri, 25 Oct 2024 08:22:21 UTC
<!-- end of auto-generated comment: Cypress test results  -->

---------

Co-authored-by: “NandanAnantharamu” <“nandan@thinkify.io”>
  • Loading branch information
NandanAnantharamu and “NandanAnantharamu” authored Oct 26, 2024
1 parent e38bcfb commit fcbb727
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe(

// ADS changes to date input property causes this test to fail
// skipping it temporarily.
it.skip("DatePicker-Date Name validation", function () {
it("DatePicker-Date Name validation", function () {
// changing the date to today
cy.get(formWidgetsPage.defaultDate).click();
cy.SetDateToToday();
Expand All @@ -36,10 +36,8 @@ describe(

/**
* setDate--> is a Command to select the date in the date picker
* @param1 --> its takes currentday+ <future day> eg: 1
* @param2 --> user date formate
*/
cy.setDate(1, "ddd MMM DD YYYY");
cy.setDate(1);
const nextDay = dayjs().add(1, "days").format("DD/MM/YYYY");
cy.log(nextDay);
cy.get(formWidgetsPage.datepickerWidget + " .bp3-input").should(
Expand Down
7 changes: 3 additions & 4 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -524,10 +524,9 @@ Cypress.Commands.add("getDate", (date, dateFormate) => {
return eDate;
});

Cypress.Commands.add("setDate", (date, dateFormate) => {
const expDate = dayjs().add(date, "days").format(dateFormate);
const sel = `.DayPicker-Day[aria-label=\"${expDate}\"]`;
cy.get(sel).click();
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("validateDisableWidget", (widgetCss, disableCss) => {
Expand Down

0 comments on commit fcbb727

Please sign in to comment.