mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-22 21:50:34 +03:00
TESTS-53 feat(test): done Create a Milestone test (#4169)
Signed-off-by: Alex Velichko <nestor_007@mail.ru>
This commit is contained in:
parent
c6853c123f
commit
119d65653a
@ -1,13 +1,34 @@
|
||||
import { Locator, Page } from '@playwright/test'
|
||||
import { expect, Locator, Page } from '@playwright/test'
|
||||
import { CommonPage } from './common-page'
|
||||
|
||||
export class CalendarPage extends CommonPage {
|
||||
readonly page: Page
|
||||
readonly buttonDatePopupToday: Locator
|
||||
readonly inputTargetDateDay: Locator
|
||||
readonly inputTargetDateMonth: Locator
|
||||
readonly inputTargetDateYear: Locator
|
||||
readonly buttonTargetDateSave: Locator
|
||||
|
||||
constructor (page: Page) {
|
||||
super()
|
||||
this.page = page
|
||||
this.buttonDatePopupToday = page.locator('div.popup div.today:not(.wrongMonth)')
|
||||
this.inputTargetDateDay = page.locator('div.date-popup-container div.datetime-input span.digit:nth-child(1)')
|
||||
this.inputTargetDateMonth = page.locator('div.date-popup-container div.datetime-input span.digit:nth-child(3)')
|
||||
this.inputTargetDateYear = page.locator('div.date-popup-container div.datetime-input span.digit:nth-child(5)')
|
||||
this.buttonTargetDateSave = page.locator('div.date-popup-container div.footer button')
|
||||
}
|
||||
|
||||
async fillDatePopup (day: string, month: string, year: string): Promise<void> {
|
||||
await expect(this.inputTargetDateDay).toBeVisible()
|
||||
await this.inputTargetDateDay.fill(day)
|
||||
await this.inputTargetDateMonth.fill(month)
|
||||
await this.inputTargetDateDay.fill(year)
|
||||
await this.buttonTargetDateSave.click()
|
||||
}
|
||||
|
||||
async fillDatePopupInDays (inDays: string): Promise<void> {
|
||||
await expect(this.inputTargetDateDay).toBeVisible()
|
||||
await this.page.locator('div.popup div.shift-container div.btn span', { hasText: inDays }).click()
|
||||
}
|
||||
}
|
||||
|
13
tests/sanity/tests/model/tracker/milestones-details-page.ts
Normal file
13
tests/sanity/tests/model/tracker/milestones-details-page.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import { type Locator, type Page } from '@playwright/test'
|
||||
import { CommonTrackerPage } from './common-tracker-page'
|
||||
|
||||
export class MilestonesDetailsPage extends CommonTrackerPage {
|
||||
readonly page: Page
|
||||
readonly inputTitle: Locator
|
||||
|
||||
constructor (page: Page) {
|
||||
super(page)
|
||||
this.page = page
|
||||
this.inputTitle = page.locator('div.popupPanel-body input[type="text"]')
|
||||
}
|
||||
}
|
62
tests/sanity/tests/model/tracker/milestones-page.ts
Normal file
62
tests/sanity/tests/model/tracker/milestones-page.ts
Normal file
@ -0,0 +1,62 @@
|
||||
import { type Locator, type Page } from '@playwright/test'
|
||||
import { NewMilestone } from './types'
|
||||
import { CommonTrackerPage } from './common-tracker-page'
|
||||
|
||||
export class MilestonesPage extends CommonTrackerPage {
|
||||
readonly page: Page
|
||||
readonly modelSelectorAll: Locator
|
||||
readonly modelSelectorPlanned: Locator
|
||||
readonly modelSelectorActive: Locator
|
||||
readonly buttonCreateNewMilestone: Locator
|
||||
readonly inputNewMilestoneName: Locator
|
||||
readonly inputNewMilestoneDescription: Locator
|
||||
readonly buttonNewMilestoneSetStatus: Locator
|
||||
readonly buttonNewMilestoneTargetDate: Locator
|
||||
readonly buttonNewMilestoneCreate: Locator
|
||||
|
||||
constructor (page: Page) {
|
||||
super(page)
|
||||
this.page = page
|
||||
this.modelSelectorAll = page.locator('div[data-id="tab-all"]')
|
||||
this.modelSelectorPlanned = page.locator('div[data-id="tab-planned"]')
|
||||
this.modelSelectorActive = page.locator('div[data-id="tab-active"]')
|
||||
this.buttonCreateNewMilestone = page.locator('div.ac-header-full button[type="submit"]')
|
||||
this.inputNewMilestoneName = page.locator(
|
||||
'form[id="tracker:string:NewMilestone"] input[placeholder="Milestone name"]'
|
||||
)
|
||||
this.inputNewMilestoneDescription = page.locator('form[id="tracker:string:NewMilestone"] div.tiptap')
|
||||
this.buttonNewMilestoneSetStatus = page.locator(
|
||||
'form[id="tracker:string:NewMilestone"] div.antiCard-pool button[type="button"]'
|
||||
)
|
||||
this.buttonNewMilestoneTargetDate = page.locator(
|
||||
'form[id="tracker:string:NewMilestone"] div.antiCard-pool button.datetime-button'
|
||||
)
|
||||
this.buttonNewMilestoneCreate = page.locator('form[id="tracker:string:NewMilestone"] button[type="submit"]')
|
||||
}
|
||||
|
||||
async createNewMilestone (data: NewMilestone): Promise<void> {
|
||||
await this.buttonCreateNewMilestone.click()
|
||||
|
||||
await this.inputNewMilestoneName.fill(data.name)
|
||||
if (data.description != null) {
|
||||
await this.inputNewMilestoneDescription.fill(data.description)
|
||||
}
|
||||
if (data.status != null) {
|
||||
await this.buttonNewMilestoneSetStatus.click()
|
||||
await this.selectFromDropdown(this.page, data.status)
|
||||
}
|
||||
if (data.targetDate != null) {
|
||||
await this.buttonNewMilestoneTargetDate.click()
|
||||
await this.fillDatePopup(data.targetDate.day, data.targetDate.month, data.targetDate.year)
|
||||
}
|
||||
if (data.targetDateInDays != null) {
|
||||
await this.buttonNewMilestoneTargetDate.click()
|
||||
await this.fillDatePopupInDays(data.targetDateInDays)
|
||||
}
|
||||
await this.buttonNewMilestoneCreate.click()
|
||||
}
|
||||
|
||||
async openMilestoneByName (milestoneName: string): Promise<void> {
|
||||
await this.page.locator('div.listGrid a', { hasText: milestoneName }).click()
|
||||
}
|
||||
}
|
@ -47,8 +47,8 @@ export class NewProjectPage extends CommonTrackerPage {
|
||||
if (data.description != null) {
|
||||
await this.inputDescription.fill(data.description)
|
||||
}
|
||||
if (data.icon != null) {
|
||||
await this.inputDescription.fill(data.icon)
|
||||
if (data.iconNumber != null) {
|
||||
await this.inputDescription.fill(data.iconNumber + '')
|
||||
}
|
||||
if (data.private != null && data.private) {
|
||||
await this.buttonMakePrivate.click()
|
||||
|
@ -51,4 +51,12 @@ export class TrackerNavigationMenuPage extends CommonPage {
|
||||
.click()
|
||||
await this.selectFromDropdown(this.page, action)
|
||||
}
|
||||
|
||||
async openMilestonesForProject (projectName: string): Promise<void> {
|
||||
await this.page
|
||||
.locator('div[class*="antiNav-element"] a[href$="milestones"][href*="Default"]> div > span', {
|
||||
hasText: 'Milestones'
|
||||
})
|
||||
.click()
|
||||
}
|
||||
}
|
||||
|
@ -27,3 +27,15 @@ export interface NewProject {
|
||||
iconNumber?: number
|
||||
type?: string
|
||||
}
|
||||
|
||||
export interface NewMilestone {
|
||||
name: string
|
||||
description?: string
|
||||
status?: string
|
||||
targetDate?: {
|
||||
day: string
|
||||
month: string
|
||||
year: string
|
||||
}
|
||||
targetDateInDays?: string
|
||||
}
|
||||
|
41
tests/sanity/tests/tracker/milestone.spec.ts
Normal file
41
tests/sanity/tests/tracker/milestone.spec.ts
Normal file
@ -0,0 +1,41 @@
|
||||
import { expect, test } from '@playwright/test'
|
||||
import { generateId, PlatformSetting, PlatformURI } from '../utils'
|
||||
import { allure } from 'allure-playwright'
|
||||
import { LeftSideMenuPage } from '../model/left-side-menu-page'
|
||||
import { TrackerNavigationMenuPage } from '../model/tracker/tracker-navigation-menu-page'
|
||||
import { MilestonesPage } from '../model/tracker/milestones-page'
|
||||
import { NewMilestone } from '../model/tracker/types'
|
||||
import { MilestonesDetailsPage } from '../model/tracker/milestones-details-page'
|
||||
|
||||
test.use({
|
||||
storageState: PlatformSetting
|
||||
})
|
||||
|
||||
test.describe('Tracker milestone tests', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await allure.parentSuite('Tracker tests')
|
||||
await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished()
|
||||
})
|
||||
|
||||
test('Create a Milestone', async ({ page }) => {
|
||||
const newMilestone: NewMilestone = {
|
||||
name: `Created Milestone-${generateId()}`,
|
||||
description: 'Create a Milestone',
|
||||
status: 'In progress',
|
||||
targetDateInDays: 'in 3 days'
|
||||
}
|
||||
|
||||
const leftSideMenuPage = new LeftSideMenuPage(page)
|
||||
await leftSideMenuPage.buttonTracker.click()
|
||||
|
||||
const trackerNavigationMenuPage = new TrackerNavigationMenuPage(page)
|
||||
await trackerNavigationMenuPage.openMilestonesForProject('Default')
|
||||
|
||||
const milestonesPage = new MilestonesPage(page)
|
||||
await milestonesPage.createNewMilestone(newMilestone)
|
||||
await milestonesPage.openMilestoneByName(newMilestone.name)
|
||||
|
||||
const milestonesDetailsPage = new MilestonesDetailsPage(page)
|
||||
await expect(milestonesDetailsPage.inputTitle).toHaveValue(newMilestone.name)
|
||||
})
|
||||
})
|
Loading…
Reference in New Issue
Block a user