Browse Source

test: hardwire time on first cell

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/5896/head
Raju Udava 2 years ago
parent
commit
7aceae951e
  1. 32
      tests/playwright/pages/Dashboard/common/Cell/TimeCell.ts
  2. 41
      tests/playwright/setup/xcdb-records.ts
  3. 3
      tests/playwright/tests/db/verticalFillHandle.spec.ts

32
tests/playwright/pages/Dashboard/common/Cell/TimeCell.ts

@ -20,4 +20,36 @@ export class TimeCellPageObject extends BasePage {
await cell.locator(`input[title="${value}"]`).waitFor({ state: 'visible' });
await expect(cell.locator(`[title="${value}"]`)).toBeVisible();
}
async selectTime({
// hour: 0 - 23
// minute: 0 - 59
// second: 0 - 59
hour,
minute,
}: {
hour: number;
minute: number;
}) {
const timePanel = await this.rootPage.locator('.ant-picker-time-panel-column');
await timePanel.nth(0).locator('.ant-picker-time-panel-cell').nth(hour).click();
await timePanel.nth(1).locator('.ant-picker-time-panel-cell').nth(minute).click();
if (hour < 12) {
await timePanel.nth(2).locator('.ant-picker-time-panel-cell').nth(0).click();
} else {
await timePanel.nth(2).locator('.ant-picker-time-panel-cell').nth(1).click();
}
}
async save() {
await this.rootPage.locator('button:has-text("Ok"):visible').click();
}
async set({ index, columnHeader, value }: { index: number; columnHeader: string; value: string }) {
const [hour, minute, _second] = value.split(':');
await this.get({ index, columnHeader }).click();
await this.get({ index, columnHeader }).click();
await this.selectTime({ hour: +hour, minute: +minute });
await this.save();
}
}

41
tests/playwright/setup/xcdb-records.ts

@ -48,34 +48,19 @@ const rowMixedValue = (column: ColumnType, index: number, db?: string) => {
const numbers = [33, null, 456, 333, 267, 34, 8754, 3234, 44, 33, null];
const decimals = [33.3, 456.34, 333.3, null, 267.5674, 34.0, 8754.0, 3234.547, 44.2647, 33.98, null];
const duration = [60, 120, 180, 3600, 3660, 3720, null, 3780, 60, 120, null];
const time =
db === 'mysql'
? [
`02:02:00`,
`20:20:20`,
`04:04:00`,
`02:02:00`,
`20:20:20`,
`18:18:18`,
null,
`02:02:00`,
`20:20:20`,
`18:18:18`,
null,
]
: [
`1999-01-01 02:02:00${timezoneOffset}`,
`1999-01-01 20:20:20${timezoneOffset}`,
`1999-01-01 04:04:00${timezoneOffset}`,
`1999-01-01 02:02:00${timezoneOffset}`,
`1999-01-01 20:20:20${timezoneOffset}`,
`1999-01-01 18:18:18${timezoneOffset}`,
null,
`1999-01-01 02:02:00${timezoneOffset}`,
`1999-01-01 20:20:20${timezoneOffset}`,
`1999-01-01 18:18:18${timezoneOffset}`,
null,
];
const time = [
`1999-01-01 02:02:00${timezoneOffset}`,
`1999-01-01 20:20:20${timezoneOffset}`,
`1999-01-01 04:04:00${timezoneOffset}`,
`1999-01-01 02:02:00${timezoneOffset}`,
`1999-01-01 20:20:20${timezoneOffset}`,
`1999-01-01 18:18:18${timezoneOffset}`,
null,
`1999-01-01 02:02:00${timezoneOffset}`,
`1999-01-01 20:20:20${timezoneOffset}`,
`1999-01-01 18:18:18${timezoneOffset}`,
null,
];
const rating = [0, 1, 2, 3, null, 0, 4, 5, 0, 1, null];
const years = [2023, null, 1956, 2023, 1967, 2024, 1954, 1924, 2044, 1923, null];

3
tests/playwright/tests/db/verticalFillHandle.spec.ts

@ -89,6 +89,9 @@ test.describe('Fill Handle', () => {
{ title: 'Time', value: '02:02', type: 'time' },
];
// kludge: insert time from browser until mysql issue with timezone is fixed
await dashboard.grid.cell.time.set({ index: 0, columnHeader: 'Time', value: '02:02' });
// set rating for first record
await dashboard.grid.cell.rating.select({ index: 0, columnHeader: 'Rating', rating: 2 });

Loading…
Cancel
Save