Corrected test in the Planner (#6260)

Signed-off-by: Alexander Platov <alexander.platov@hardcoreeng.com>
This commit is contained in:
Alexander Platov 2024-08-05 21:25:40 +03:00 committed by GitHub
parent 94b87cea8f
commit b96c2e9b89
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 6 deletions

View File

@ -81,7 +81,7 @@ export class PlanningPage extends CalendarPage {
readonly eventInSchedule = (title: string): Locator => readonly eventInSchedule = (title: string): Locator =>
this.schedule().locator('div.event-container', { hasText: title }) this.schedule().locator('div.event-container', { hasText: title })
async dragdropTomorrow (title: string, time: string): Promise<void> { async dragdropTomorrow (title: string, time: string, addHalf: boolean = false): Promise<void> {
await this.toDosContainer().getByRole('button', { name: title }).hover() await this.toDosContainer().getByRole('button', { name: title }).hover()
await expect(async () => { await expect(async () => {
@ -90,7 +90,7 @@ export class PlanningPage extends CalendarPage {
expect(boundingBox).toBeTruthy() expect(boundingBox).toBeTruthy()
if (boundingBox != null) { if (boundingBox != null) {
await this.page.mouse.move(boundingBox.x + 10, boundingBox.y + 10) await this.page.mouse.move(boundingBox.x + 10, boundingBox.y + 10)
await this.page.mouse.move(boundingBox.x + 10, boundingBox.y + 20) await this.page.mouse.move(boundingBox.x + 10, boundingBox.y + (addHalf ? 40 : 20))
await this.page.mouse.up() await this.page.mouse.up()
} }
}).toPass(retryOptions) }).toPass(retryOptions)

View File

@ -182,8 +182,8 @@ test.describe('Planning ToDo tests', () => {
let hour = new Date().getHours() let hour = new Date().getHours()
const ampm = hour < 13 ? 'am' : 'pm' const ampm = hour < 13 ? 'am' : 'pm'
hour = hour < 1 ? 1 : hour >= 11 && hour < 13 ? 11 : hour >= 22 ? 10 : hour > 12 ? hour - 12 : hour hour = hour < 1 ? 1 : hour >= 11 && hour < 13 ? 11 : hour >= 22 ? 10 : hour > 12 ? hour - 12 : hour
const timeV = `${hour}${ampm}` const time = `${hour}${ampm}`
const timeI = `${hour + 1}${ampm}` // const timeI = `${hour + 1}${ampm}`
const leftSideMenuPage: LeftSideMenuPage = new LeftSideMenuPage(page) const leftSideMenuPage: LeftSideMenuPage = new LeftSideMenuPage(page)
const loginPage: LoginPage = new LoginPage(page) const loginPage: LoginPage = new LoginPage(page)
@ -201,7 +201,7 @@ test.describe('Planning ToDo tests', () => {
await planningPage.selectInputToDo().fill(titleV) await planningPage.selectInputToDo().fill(titleV)
await planningPage.selectInputToDo().press('Enter') await planningPage.selectInputToDo().press('Enter')
await planningPage.dragdropTomorrow(titleV, timeV) await planningPage.dragdropTomorrow(titleV, time)
await planningPage.eventInSchedule(titleV).click() await planningPage.eventInSchedule(titleV).click()
await planningPage.buttonPopupCreateVisible().click() await planningPage.buttonPopupCreateVisible().click()
await planningPage.buttonPopupVisibleToEveryone().click() await planningPage.buttonPopupVisibleToEveryone().click()
@ -209,7 +209,7 @@ test.describe('Planning ToDo tests', () => {
await planningPage.selectInputToDo().fill(titleI) await planningPage.selectInputToDo().fill(titleI)
await planningPage.selectInputToDo().press('Enter') await planningPage.selectInputToDo().press('Enter')
await planningPage.dragdropTomorrow(titleI, timeI) await planningPage.dragdropTomorrow(titleI, time, true)
await planningPage.eventInSchedule(titleI).click() await planningPage.eventInSchedule(titleI).click()
await planningPage.buttonPopupCreateVisible().click() await planningPage.buttonPopupCreateVisible().click()
await planningPage.buttonPopupOnlyVisibleToYou().click() await planningPage.buttonPopupOnlyVisibleToYou().click()