Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix:Unpredictable movements of the dates in the date picker included #34314

Closed
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
22aa6e0
fix:Unpredictable movements of the dates in the date picker included …
May 31, 2024
65e5724
fix:changes suggested by coderabbitai
May 31, 2024
e59373a
fix:make selecting date to pick current date
Jun 3, 2024
cee996e
fix:make suggestions from coderabbitai
Jun 3, 2024
bc72469
fix:changes made as coderabbitai suggestions
Jun 7, 2024
1b2d400
fix:change in cypress
Jun 18, 2024
0af9aef
fix:change in cypress function declaration
Jun 18, 2024
b776289
Merge remote-tracking branch 'contributor-fork/Issue-25081-fix/Unpred…
somangshu Jun 18, 2024
cff44ed
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
rahulbarwal Sep 6, 2024
11ad485
Updates selector string
rahulbarwal Sep 6, 2024
fbc38e5
fix: Fix test case to use helper APIs
rahulbarwal Sep 6, 2024
bc8b2f6
Renamed spec
rahulbarwal Sep 6, 2024
3842691
Updates spec file
rahulbarwal Sep 6, 2024
73bbacc
fix: Fix test case for DateColumn_ISOFormat_AddNewRow_EditRow_spec
rahulbarwal Sep 6, 2024
f3644c6
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
rahulbarwal Sep 16, 2024
41f07dc
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
rahulbarwal Sep 17, 2024
86b8ff6
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
rahulbarwal Sep 19, 2024
5d0cd85
removes unncessary enw lines.
rahulbarwal Sep 19, 2024
2d9bfe7
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
rahulbarwal Sep 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import {
entityExplorer,
draggableWidgets,
propPane,
agHelper,
table,
locators,
} from "../../../../../support/Objects/ObjectsCore";

const tableData = `[
{
"step": "#1",
"task": "Drop a table",
"Date": "2021-05-25 12:00"
},
{
"step": "#2",
"task": "Create a query fetch_users with the Mock DB",
"Date": "2021-05-27 14:30"
},
{
"step": "#3",
"task": "Bind the query using => fetch_users.data",
"Date": "2021-05-29 16:45"
}
]`;

describe(
"Table Widget V2 - Add New Row and Edit Date Column",
{ tags: ["@tag.Widget", "@tag.Table"] },
() => {
before(() => {
entityExplorer.DragDropWidgetNVerify(draggableWidgets.TABLE);
propPane.EnterJSContext("Table data", tableData);
});

it("1. Verify Date column is visible and editable", () => {
propPane.TogglePropertyState("Allow adding a row", "On");
// enabling the editable option for the three columns
table.EditColumn("Date", "v2");
propPane.TogglePropertyState("Editable", "On");
propPane.SelectPropertiesDropDown("Date format", "YYYY-MM-DD");

table.AddNewRow();
agHelper
.GetText(`${table._tableRow1Child3} ${locators._inputField}`)
.then(($textData) => expect($textData).to.eq(""));
const datepickerLocator = `${table._tableRow1Child3} ${locators._inputField}`;
agHelper.GetNClick(datepickerLocator, 0, true);
agHelper
.GetElement(`.bp3-datepicker-day-wrapper`)
.contains("11")
.click({ force: true });

// add a text widget to check the values
cy.dragAndDropToCanvas("textwidget", { x: 300, y: 600 });
propPane.UpdatePropertyFieldValue("Text", `{{Table1.newRow.Date}}`);
agHelper.GetText(locators._textWidget, "text").then(($text: any) => {
expect($text).to.eq(getYYYYMMDDForThisMonth("11"));
});

// check the same date in europe timezone(Issue: https://github.com/appsmithorg/appsmith/issues/25081)
agHelper.GetNClick(locators._textWidget);
propPane.UpdatePropertyFieldValue(
"Text",
`{{moment(Table1.newRow.date).tz("Europe/Amsterdam").format("YYYY-MM-DD")}}`,
);

agHelper.GetText(locators._textWidget, "text").then(($text: any) => {
expect($text).to.eq(getYYYYMMDDForThisMonth("11"));
});
});
},
);

const getYYYYMMDDForThisMonth = (date: string): string => {
const now = new Date();
return `${now.getFullYear()}-${(now.getMonth() + 1).toString().padStart(2, "0")}-${date}`;
};
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,9 @@ export const DateCell = (props: DateComponentProps) => {
}, [value, props.outputFormat]);

const onDateSelected = (date: string) => {
const formattedDate: string = date ? moment(date).format(inputFormat) : "";
if (isNewRow) {
updateNewRowValues(alias, date, date);
updateNewRowValues(alias, date, formattedDate);
rahulbarwal marked this conversation as resolved.
Show resolved Hide resolved
return;
}

Expand All @@ -232,7 +233,6 @@ export const DateCell = (props: DateComponentProps) => {
setShowRequiredError(false);
setHasFocus(false);

const formattedDate = date ? moment(date).format(inputFormat) : "";
onDateSave(rowIndex, alias, formattedDate, onDateSelectedString);
};

Expand Down
Loading