Browse Source

wip(playwright): DateTime tests

pull/4593/head
Wing-Kam Wong 2 years ago
parent
commit
a5331b9cec
  1. 65
      tests/playwright/tests/columnDateTime.spec.ts

65
tests/playwright/tests/columnDateTime.spec.ts

@ -11,14 +11,50 @@ const dateTimeData = [
date: '2022-12-12',
hour: '10',
minute: '20',
output: '2022-12-12 10:20',
},
{
dateFormat: 'YYYY-MM-DD',
timeFormat: 'HH:mm:ss',
date: '2022-12-12',
hour: '20',
minute: '30',
second: '40',
output: '2022-12-12 20:30:40',
},
{
dateFormat: 'YYYY/MM/DD',
timeFormat: 'HH:mm',
date: '2022/12/12',
hour: '10',
minute: '20',
second: '30',
output: '2022/12/12 10:20',
},
{
dateFormat: 'YYYY/MM/DD',
timeFormat: 'HH:mm:ss',
date: '2022/12/12',
hour: '5',
minute: '30',
second: '40',
output: '2022/12/12 05:30:40',
},
{
dateFormat: 'DD-MM-YYYY',
timeFormat: 'HH:mm',
date: '25-11-2022',
hour: '3',
minute: '20',
output: '12-12-2022 03:20',
},
{
dateFormat: 'DD-MM-YYYY',
timeFormat: 'HH:mm:ss',
date: '25-11-2022',
hour: '2',
minute: '30',
second: '40',
output: '25-11-2022 02:30:40',
},
];
@ -41,29 +77,34 @@ test.describe('DateTime Column', () => {
timeFormat: dateTimeData[0].timeFormat,
});
for (let i = 0; i < dateTimeData.length; i++) {
// Edit DateTime column
await dashboard.grid.column.openEdit({
title: 'NC_DATETIME_0',
type: 'DateTime',
dateFormat: dateTimeData[i].dateFormat,
timeFormat: dateTimeData[i].timeFormat,
});
await dashboard.grid.cell.dateTime.open({
index: 0,
columnHeader: 'NC_DATETIME_0',
});
await dashboard.grid.cell.dateTime.selectDate({
date: dateTimeData[0],
date: dateTimeData[i].date,
});
await dashboard.grid.cell.dateTime.selectTime({
hour: dateTimeData[0].hour,
minute: dateTimeData[0].minute,
hour: dateTimeData[i].hour,
minute: dateTimeData[i].minute,
});
await dashboard.grid.cell.dateTime.close();
for (let i = 0; i < dateTimeData.length; i++) {
// Edit DateTime column
await dashboard.grid.column.openEdit({
title: 'NC_DATETIME_0',
type: 'DateTime',
dateFormat: dateTimeData[i].dateFormat,
timeFormat: dateTimeData[i].timeFormat,
await dashboard.grid.cell.verify({
index: 0,
columnHeader: 'NC_DATETIME_0',
value: dateTimeData[i].output,
});
// TODO: ...
}
});
});

Loading…
Cancel
Save