Browse Source

feat(playwrights): add DateTimeCell.ts

pull/4593/head
Wing-Kam Wong 2 years ago
parent
commit
164f0c9f8e
  1. 36
      tests/playwright/pages/Dashboard/common/Cell/DateTimeCell.ts
  2. 3
      tests/playwright/pages/Dashboard/common/Cell/index.ts

36
tests/playwright/pages/Dashboard/common/Cell/DateTimeCell.ts

@ -0,0 +1,36 @@
import { CellPageObject } from '.';
import BasePage from '../../../Base';
export class DateTimeCellPageObject extends BasePage {
readonly cell: CellPageObject;
constructor(cell: CellPageObject) {
super(cell.rootPage);
this.cell = cell;
}
get({ index, columnHeader }: { index?: number; columnHeader: string }) {
return this.cell.get({ index, columnHeader });
}
async open({ index, columnHeader }: { index: number; columnHeader: string }) {
await this.cell.dblclick({
index,
columnHeader,
});
}
async selectDateTime({
// date in format `YYYY-MM-DD`
// time in format 'HH:mm'
dateTime,
}: {
dateTime: string;
}) {
await this.rootPage.locator(`td[title="${dateTime}"]`).click();
}
async close() {
await this.rootPage.keyboard.press('Escape');
}
}

3
tests/playwright/pages/Dashboard/common/Cell/index.ts

@ -7,6 +7,7 @@ import { SharedFormPage } from '../../../SharedForm';
import { CheckboxCellPageObject } from './CheckboxCell';
import { RatingCellPageObject } from './RatingCell';
import { DateCellPageObject } from './DateCell';
import { DateTimeCellPageObject } from './DateTimeCell';
export class CellPageObject extends BasePage {
readonly parent: GridPage | SharedFormPage;
@ -15,6 +16,7 @@ export class CellPageObject extends BasePage {
readonly checkbox: CheckboxCellPageObject;
readonly rating: RatingCellPageObject;
readonly date: DateCellPageObject;
readonly dateTime: DateTimeCellPageObject;
constructor(parent: GridPage | SharedFormPage) {
super(parent.rootPage);
@ -24,6 +26,7 @@ export class CellPageObject extends BasePage {
this.checkbox = new CheckboxCellPageObject(this);
this.rating = new RatingCellPageObject(this);
this.date = new DateCellPageObject(this);
this.dateTime = new DateTimeCellPageObject(this);
}
get({ index, columnHeader }: { index?: number; columnHeader: string }): Locator {

Loading…
Cancel
Save