mirror of https://github.com/nocodb/nocodb
DarkPhoenix2704
10 months ago
13 changed files with 275 additions and 24 deletions
@ -0,0 +1,26 @@ |
|||||||
|
import BasePage from '../../Base'; |
||||||
|
import { CalendarPage } from './index'; |
||||||
|
import { expect } from '@playwright/test'; |
||||||
|
|
||||||
|
export class CalendarDayDatePage extends BasePage { |
||||||
|
readonly parent: CalendarPage; |
||||||
|
|
||||||
|
constructor(parent: CalendarPage) { |
||||||
|
super(parent.rootPage); |
||||||
|
this.parent = parent; |
||||||
|
} |
||||||
|
|
||||||
|
get() { |
||||||
|
return this.rootPage.getByTestId('nc-calendar-day-view'); |
||||||
|
} |
||||||
|
|
||||||
|
async verifyRecord(data: { records: string[] }) { |
||||||
|
const records = await this.get().getByTestId('nc-calendar-day-record-card'); |
||||||
|
|
||||||
|
await expect(records).toHaveCount(data.records.length); |
||||||
|
|
||||||
|
for (let i = 0; i < data.records.length; i++) { |
||||||
|
await expect(records.nth(i)).toContainText(data.records[i]); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,45 @@ |
|||||||
|
import BasePage from '../../Base'; |
||||||
|
import { CalendarPage } from './index'; |
||||||
|
|
||||||
|
export class CalendarWeekDatePage extends BasePage { |
||||||
|
readonly parent: CalendarPage; |
||||||
|
|
||||||
|
constructor(parent: CalendarPage) { |
||||||
|
super(parent.rootPage); |
||||||
|
this.parent = parent; |
||||||
|
} |
||||||
|
|
||||||
|
get() { |
||||||
|
return this.rootPage.getByTestId('nc-calendar-week-view'); |
||||||
|
} |
||||||
|
|
||||||
|
getRecordContainer() { |
||||||
|
return this.get().getByTestId('nc-calendar-week-record-container'); |
||||||
|
} |
||||||
|
|
||||||
|
async dragAndDrop({ record, dayIndex }: { record: string; dayIndex: number }) { |
||||||
|
const recordContainer = this.getRecordContainer(); |
||||||
|
const recordCard = recordContainer.getByTestId(`nc-calendar-week-record-${record}`); |
||||||
|
const toDay = this.get().getByTestId('nc-calendar-week-day').nth(dayIndex); |
||||||
|
const cord = await toDay.boundingBox(); |
||||||
|
|
||||||
|
await recordCard.hover(); |
||||||
|
await this.rootPage.mouse.down(); |
||||||
|
await this.rootPage.waitForTimeout(500); |
||||||
|
|
||||||
|
await this.rootPage.mouse.move(cord.x + cord.width / 2, cord.y + cord.height / 2); |
||||||
|
await this.rootPage.mouse.up(); |
||||||
|
} |
||||||
|
|
||||||
|
async selectDay({ dayIndex }: { dayIndex: number }) { |
||||||
|
const day = this.get().getByTestId('nc-calendar-week-day').nth(dayIndex); |
||||||
|
|
||||||
|
await day.click({ |
||||||
|
force: true, |
||||||
|
position: { |
||||||
|
x: 0, |
||||||
|
y: 1, |
||||||
|
}, |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue