feat(tests): TESTS-54 done Edit a Milestone test (#4175)

Signed-off-by: Alex Velichko <nestor_007@mail.ru>
This commit is contained in:
Alex Velichko 2023-12-12 09:16:21 +03:00 committed by GitHub
parent 166606640a
commit c804d88b3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
67 changed files with 96 additions and 5 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -41,8 +41,8 @@ test.describe('actions tests', () => {
await page.click('div.actionsHeader input.actionsInput')
await page.fill('div.actionsHeader input.actionsInput', 'go to ')
expect(await page.locator('div.selectPopup :text("Go To Vacancies")').count()).toBe(1)
await page.click('div.selectPopup :text("Go To Vacancies")', { delay: 100 })
expect(await page.locator('div.selectPopup div.list-item :text("Go To Vacancies")').count()).toBe(1)
await page.click('div.selectPopup div.list-item :text("Go To Vacancies")', { delay: 100 })
await expect(page).toHaveURL(`${PlatformURI}/workbench/sanity-ws/recruit/vacancies`)
})

View File

@ -4,11 +4,19 @@ import { CalendarPage } from '../calendar-page'
export class CommonTrackerPage extends CalendarPage {
readonly page: Page
readonly buttonFilter: Locator
readonly inputComment: Locator
readonly buttonSendComment: Locator
readonly textComment: Locator
readonly textActivity: Locator
constructor (page: Page) {
super(page)
this.page = page
this.buttonFilter = page.locator('div.search-start > div:first-child button')
this.inputComment = page.locator('div.text-input div.tiptap')
this.buttonSendComment = page.locator('g#Send')
this.textComment = page.locator('div.showMore-content p')
this.textActivity = page.locator('div.header')
}
async selectFilter (filter: string, filterSecondLevel?: string): Promise<void> {
@ -58,4 +66,17 @@ export class CommonTrackerPage extends CalendarPage {
await this.page.locator('div.date-popup-container button[type="submit"]').click({ delay: 100 })
}
async addComment (comment: string): Promise<void> {
await this.inputComment.fill(comment)
await this.buttonSendComment.click()
}
async checkCommentExist (comment: string): Promise<void> {
await expect(this.textComment.filter({ hasText: comment })).toBeVisible()
}
async checkActivityExist (activity: string): Promise<void> {
await expect(this.textActivity.filter({ hasText: activity })).toBeVisible()
}
}

View File

@ -1,13 +1,53 @@
import { type Locator, type Page } from '@playwright/test'
import { expect, type Locator, type Page } from '@playwright/test'
import { CommonTrackerPage } from './common-tracker-page'
import { NewMilestone } from './types'
export class MilestonesDetailsPage extends CommonTrackerPage {
readonly page: Page
readonly inputTitle: Locator
readonly buttonStatus: Locator
readonly buttonTargetDate: Locator
readonly inputMilestoneName: Locator
readonly inputDescription: Locator
constructor (page: Page) {
super(page)
this.page = page
this.inputTitle = page.locator('div.popupPanel-body input[type="text"]')
this.buttonStatus = page.locator('//span[text()="Status"]/following-sibling::div[1]/button')
this.buttonTargetDate = page.locator('//span[text()="Target date"]/following-sibling::div[1]/button')
this.inputMilestoneName = page.locator('input[placeholder="Milestone name"]')
this.inputDescription = page.locator('div.inputMsg div.tiptap')
}
async checkIssue (data: NewMilestone): Promise<void> {
await expect(this.inputTitle).toHaveValue(data.name)
if (data.description != null) {
await expect(this.inputDescription).toHaveText(data.description)
}
if (data.status != null) {
await expect(this.buttonStatus).toHaveText(data.status)
}
}
async editIssue (data: NewMilestone): Promise<void> {
if (data.name != null) {
await this.inputTitle.fill(data.name)
}
if (data.description != null) {
await this.inputDescription.fill(data.description)
}
if (data.status != null) {
await this.buttonStatus.click()
await this.selectFromDropdown(this.page, data.status)
}
if (data.targetDate != null) {
await this.buttonTargetDate.click()
await this.fillDatePopup(data.targetDate.day, data.targetDate.month, data.targetDate.year)
}
if (data.targetDateInDays != null) {
await this.buttonTargetDate.click()
await this.fillDatePopupInDays(data.targetDateInDays)
}
}
}

View File

@ -1,4 +1,4 @@
import { expect, test } from '@playwright/test'
import { test } from '@playwright/test'
import { generateId, PlatformSetting, PlatformURI } from '../utils'
import { allure } from 'allure-playwright'
import { LeftSideMenuPage } from '../model/left-side-menu-page'
@ -36,6 +36,36 @@ test.describe('Tracker milestone tests', () => {
await milestonesPage.openMilestoneByName(newMilestone.name)
const milestonesDetailsPage = new MilestonesDetailsPage(page)
await expect(milestonesDetailsPage.inputTitle).toHaveValue(newMilestone.name)
await milestonesDetailsPage.checkIssue(newMilestone)
})
test('Edit a Milestone', async ({ page }) => {
const commentText: 'Edit Milestone comment' = 'Edit Milestone comment'
const editMilestone: NewMilestone = {
name: 'Edit Milestone',
description: 'Edit Milestone Description',
status: 'Completed',
targetDateInDays: 'in 30 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.openMilestoneByName(editMilestone.name)
const milestonesDetailsPage = new MilestonesDetailsPage(page)
await milestonesDetailsPage.editIssue(editMilestone)
await milestonesDetailsPage.checkIssue(editMilestone)
await milestonesDetailsPage.addComment(commentText)
await milestonesDetailsPage.checkCommentExist(commentText)
await milestonesDetailsPage.checkActivityExist('created milestone')
await milestonesDetailsPage.checkActivityExist('changed target date in')
await milestonesDetailsPage.checkActivityExist('changed status in')
await milestonesDetailsPage.checkActivityExist('changed description in')
})
})