Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed tests/sanity-ws/000001/_migrations-1701980652141-0.snp.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed tests/sanity-ws/000001/comment-1701980652141-0.snp.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed tests/sanity-ws/000001/contact-1701980652141-0.snp.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed tests/sanity-ws/000001/tracker-1701980652141-0.snp.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed tests/sanity-ws/000001/tx-1701980652141-0.snp.gz
Binary file not shown.
Binary file added tests/sanity-ws/000001/tx-1702322310672-0.snp.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified tests/sanity-ws/backup.json.gz
Binary file not shown.
4 changes: 2 additions & 2 deletions tests/sanity/tests/actions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
})
Expand Down
21 changes: 21 additions & 0 deletions tests/sanity/tests/model/tracker/common-tracker-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down Expand Up @@ -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()
}
}
42 changes: 41 additions & 1 deletion tests/sanity/tests/model/tracker/milestones-details-page.ts
Original file line number Diff line number Diff line change
@@ -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)
}
}
}
34 changes: 32 additions & 2 deletions tests/sanity/tests/tracker/milestone.spec.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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')
})
})