mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-22 16:27:22 +00:00
feat(tests): TESTS-39 done edit issue test (#3918)
Signed-off-by: Alex Velichko <nestor_007@mail.ru>
This commit is contained in:
parent
5dede58e83
commit
f4a5c6de1b
13
tests/sanity/tests/model/calendar-page.ts
Normal file
13
tests/sanity/tests/model/calendar-page.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import { Locator, Page } from '@playwright/test'
|
||||
import { CommonPage } from './common-page'
|
||||
|
||||
export class CalendarPage extends CommonPage {
|
||||
readonly page: Page
|
||||
readonly buttonDatePopupToday: Locator
|
||||
|
||||
constructor (page: Page) {
|
||||
super()
|
||||
this.page = page
|
||||
this.buttonDatePopupToday = page.locator('div.popup div.today:not(.wrongMonth)')
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@ export class CommonPage {
|
||||
if (name !== 'first') {
|
||||
await page.locator('div.selectPopup input').fill(name.split(' ')[0])
|
||||
}
|
||||
await page.locator('div.selectPopup div.list-item:first-child').click()
|
||||
await page.locator('div.selectPopup div.list-item:first-child').click({ delay: 500 })
|
||||
}
|
||||
|
||||
async pressCreateButtonSelectPopup (page: Page): Promise<void> {
|
||||
@ -50,6 +50,6 @@ export class CommonPage {
|
||||
if (name !== 'first') {
|
||||
await page.locator('div.selectPopup input').fill(name.split(' ')[0])
|
||||
}
|
||||
await page.locator('div.selectPopup div.list-item').click()
|
||||
await page.locator('div.selectPopup div.list-item').click({ delay: 500 })
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { expect, Locator, Page } from '@playwright/test'
|
||||
import { CommonPage } from '../common-page'
|
||||
import path from 'path'
|
||||
import { CalendarPage } from '../calendar-page'
|
||||
|
||||
export class CommonRecruitingPage extends CommonPage {
|
||||
export class CommonRecruitingPage extends CalendarPage {
|
||||
readonly page: Page
|
||||
readonly inputComment: Locator
|
||||
readonly buttonSendComment: Locator
|
||||
@ -14,7 +14,7 @@ export class CommonRecruitingPage extends CommonPage {
|
||||
readonly buttonDelete: Locator
|
||||
|
||||
constructor (page: Page) {
|
||||
super()
|
||||
super(page)
|
||||
this.page = page
|
||||
this.inputComment = page.locator('div.text-input div.tiptap')
|
||||
this.buttonSendComment = page.locator('g#Send')
|
||||
|
@ -10,7 +10,6 @@ export class VacancyDetailsPage extends CommonRecruitingPage {
|
||||
readonly inputAttachFile: Locator
|
||||
readonly buttonInputCompany: Locator
|
||||
readonly buttonInputDueDate: Locator
|
||||
readonly buttonDatePopupToday: Locator
|
||||
readonly buttonDatePopupSave: Locator
|
||||
readonly inputComment: Locator
|
||||
|
||||
@ -23,7 +22,6 @@ export class VacancyDetailsPage extends CommonRecruitingPage {
|
||||
this.inputAttachFile = page.locator('div[class*="full"] input[name="file"]')
|
||||
this.buttonInputCompany = page.locator('button > div', { hasText: 'Company' })
|
||||
this.buttonInputDueDate = page.locator('button > div', { hasText: 'Due date' })
|
||||
this.buttonDatePopupToday = page.locator('div.popup div.today:not(.wrongMonth)')
|
||||
this.buttonDatePopupSave = page.locator('div.popup button[type="submit"]')
|
||||
this.inputComment = page.locator('div.text-input div.tiptap')
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { Page } from '@playwright/test'
|
||||
import { CommonPage } from '../common-page'
|
||||
import { CalendarPage } from '../calendar-page'
|
||||
|
||||
export class CommonTrackerPage extends CommonPage {
|
||||
export class CommonTrackerPage extends CalendarPage {
|
||||
readonly page: Page
|
||||
|
||||
constructor (page: Page) {
|
||||
super()
|
||||
super(page)
|
||||
this.page = page
|
||||
}
|
||||
}
|
||||
|
@ -1,53 +1,93 @@
|
||||
import { expect, type Locator, type Page } from '@playwright/test'
|
||||
import { CommonTrackerPage } from './common-tracker-page'
|
||||
import { NewIssue } from './types'
|
||||
import { Issue, NewIssue } from './types'
|
||||
|
||||
export class IssuesDetailsPage extends CommonTrackerPage {
|
||||
readonly page: Page
|
||||
readonly inputTitle: Locator
|
||||
readonly inputDescription: Locator
|
||||
readonly textStatus: Locator
|
||||
readonly textPriority: Locator
|
||||
readonly textAssignee: Locator
|
||||
readonly buttonStatus: Locator
|
||||
readonly buttonPriority: Locator
|
||||
readonly buttonAssignee: Locator
|
||||
readonly textLabels: Locator
|
||||
readonly textComponent: Locator
|
||||
readonly textMilestone: Locator
|
||||
readonly buttonAddLabel: Locator
|
||||
readonly buttonComponent: Locator
|
||||
readonly buttonMilestone: Locator
|
||||
readonly textEstimation: Locator
|
||||
readonly buttonEstimation: Locator
|
||||
|
||||
constructor (page: Page) {
|
||||
super(page)
|
||||
this.page = page
|
||||
this.inputTitle = page.locator('div.popupPanel-body input[type="text"]')
|
||||
this.inputDescription = page.locator('div.popupPanel-body div.textInput p')
|
||||
this.textStatus = page.locator('//span[text()="Status"]/../button[1]//span')
|
||||
this.textPriority = page.locator('//span[text()="Status"]/../button[2]//span')
|
||||
this.textAssignee = page.locator('(//span[text()="Assignee"]/../div/button)[2]')
|
||||
this.buttonStatus = page.locator('//span[text()="Status"]/../button[1]//span')
|
||||
this.buttonPriority = page.locator('//span[text()="Priority"]/../button[2]//span')
|
||||
this.buttonAssignee = page.locator('(//span[text()="Assignee"]/../div/button)[2]')
|
||||
this.textLabels = page.locator('div.step-container div.listitems-container')
|
||||
this.textComponent = page.locator('(//span[text()="Component"]/../div/div/button)[2]')
|
||||
this.textMilestone = page.locator('(//span[text()="Milestone"]/../div/div/button)[3]')
|
||||
this.buttonAddLabel = page.locator('button.tag-button')
|
||||
this.buttonComponent = page.locator('(//span[text()="Component"]/../div/div/button)[2]')
|
||||
this.buttonMilestone = page.locator('(//span[text()="Milestone"]/../div/div/button)[3]')
|
||||
this.textEstimation = page.locator('(//span[text()="Estimation"]/../div/button)[4]')
|
||||
this.buttonEstimation = page.locator('(//span[text()="Estimation"]/../div/button)[3]')
|
||||
}
|
||||
|
||||
async checkIssueDescription (data: NewIssue): Promise<void> {
|
||||
async editIssue (data: Issue): Promise<void> {
|
||||
if (data.status != null) {
|
||||
await this.buttonStatus.click()
|
||||
await this.selectFromDropdown(this.page, data.status)
|
||||
}
|
||||
if (data.priority != null) {
|
||||
await this.buttonPriority.click()
|
||||
await this.selectMenuItem(this.page, data.priority)
|
||||
}
|
||||
if (data.assignee != null) {
|
||||
await this.buttonAssignee.click()
|
||||
await this.selectAssignee(this.page, data.assignee)
|
||||
}
|
||||
if (data.labels != null && data.createLabel != null) {
|
||||
if (data.createLabel) {
|
||||
await this.buttonAddLabel.click()
|
||||
await this.pressCreateButtonSelectPopup(this.page)
|
||||
await this.addNewTagPopup(this.page, data.labels, 'Tag from editIssue')
|
||||
}
|
||||
await this.checkFromDropdown(this.page, data.labels)
|
||||
await this.inputTitle.click({ force: true })
|
||||
}
|
||||
if (data.component != null) {
|
||||
await this.buttonComponent.click()
|
||||
await this.selectMenuItem(this.page, data.component)
|
||||
}
|
||||
if (data.milestone != null) {
|
||||
await this.buttonMilestone.click()
|
||||
await this.selectMenuItem(this.page, data.milestone)
|
||||
}
|
||||
if (data.estimation != null) {
|
||||
await this.buttonEstimation.click()
|
||||
await this.fillToSelectPopup(this.page, data.estimation)
|
||||
}
|
||||
}
|
||||
|
||||
async checkIssue (data: NewIssue): Promise<void> {
|
||||
await expect(this.inputTitle).toHaveValue(data.title)
|
||||
await expect(this.inputDescription).toHaveText(data.description)
|
||||
if (data.status != null) {
|
||||
await expect(this.textStatus).toHaveText(data.status)
|
||||
await expect(this.buttonStatus).toHaveText(data.status)
|
||||
}
|
||||
if (data.priority != null) {
|
||||
await expect(this.textPriority).toHaveText(data.priority)
|
||||
await expect(this.buttonPriority).toHaveText(data.priority)
|
||||
}
|
||||
if (data.assignee != null) {
|
||||
await expect(this.textAssignee).toHaveText(data.assignee)
|
||||
await expect(this.buttonAssignee).toHaveText(data.assignee)
|
||||
}
|
||||
if (data.labels != null) {
|
||||
await expect(this.textLabels).toHaveText(data.labels)
|
||||
}
|
||||
if (data.component != null) {
|
||||
await expect(this.textComponent).toHaveText(data.component)
|
||||
await expect(this.buttonComponent).toHaveText(data.component)
|
||||
}
|
||||
if (data.milestone != null) {
|
||||
await expect(this.textMilestone).toHaveText(data.milestone)
|
||||
await expect(this.buttonMilestone).toHaveText(data.milestone)
|
||||
}
|
||||
if (data.estimation != null) {
|
||||
await expect(this.textEstimation).toHaveText(data.estimation)
|
||||
|
@ -17,7 +17,6 @@ export class IssuesPage extends CommonTrackerPage {
|
||||
readonly buttonPopupCreateNewIssueEstimation: Locator
|
||||
readonly buttonPopupCreateNewIssueMilestone: Locator
|
||||
readonly buttonPopupCreateNewIssueDuedate: Locator
|
||||
readonly buttonDatePopupToday: Locator
|
||||
readonly inputPopupCreateNewIssueFile: Locator
|
||||
readonly textPopupCreateNewIssueFile: Locator
|
||||
readonly buttonCreateIssue: Locator
|
||||
@ -50,7 +49,6 @@ export class IssuesPage extends CommonTrackerPage {
|
||||
'form[id="tracker:string:NewIssue"] div#milestone-editor button'
|
||||
)
|
||||
this.buttonPopupCreateNewIssueDuedate = page.locator('form[id="tracker:string:NewIssue"] div#duedate-editor button')
|
||||
this.buttonDatePopupToday = page.locator('div.popup div.today:not(.wrongMonth)')
|
||||
this.inputPopupCreateNewIssueFile = page.locator('form[id="tracker:string:NewIssue"] input[type="file"]')
|
||||
this.textPopupCreateNewIssueFile = page.locator('div[class*="attachments"] > div[class*="attachment"]')
|
||||
this.buttonCreateIssue = page.locator('button > span', { hasText: 'Create issue' })
|
||||
|
@ -1,6 +1,9 @@
|
||||
export interface NewIssue {
|
||||
export interface NewIssue extends Issue {
|
||||
title: string
|
||||
description: string
|
||||
}
|
||||
|
||||
export interface Issue {
|
||||
status?: string
|
||||
priority?: string
|
||||
assignee?: string
|
||||
|
@ -3,7 +3,7 @@ import { generateId, PlatformSetting, PlatformURI } from '../utils'
|
||||
import { LeftSideMenuPage } from '../model/left-side-menu-page'
|
||||
import { IssuesPage } from '../model/tracker/issues-page'
|
||||
import { IssuesDetailsPage } from '../model/tracker/issues-details-page'
|
||||
import { NewIssue } from '../model/tracker/types'
|
||||
import { Issue, NewIssue } from '../model/tracker/types'
|
||||
|
||||
test.use({
|
||||
storageState: PlatformSetting
|
||||
@ -39,10 +39,45 @@ test.describe('tracker issue tests', () => {
|
||||
await issuesPage.openIssueByName(newIssue.title)
|
||||
|
||||
const issuesDetailsPage = new IssuesDetailsPage(page)
|
||||
await issuesDetailsPage.checkIssueDescription({
|
||||
await issuesDetailsPage.checkIssue({
|
||||
...newIssue,
|
||||
milestone: 'Milestone',
|
||||
estimation: '2h'
|
||||
})
|
||||
})
|
||||
|
||||
test('Edit an issue', async ({ page }) => {
|
||||
const newIssue: NewIssue = {
|
||||
title: `Issue with all parameters and attachments-${generateId()}`,
|
||||
description: 'Created issue with all parameters and attachments description'
|
||||
}
|
||||
|
||||
const editIssue: Issue = {
|
||||
status: 'Done',
|
||||
priority: 'High',
|
||||
createLabel: true,
|
||||
labels: `EDIT-ISSUE-${generateId()}`,
|
||||
component: 'No component',
|
||||
estimation: '8',
|
||||
milestone: 'Milestone',
|
||||
duedate: 'today'
|
||||
}
|
||||
|
||||
const leftSideMenuPage = new LeftSideMenuPage(page)
|
||||
await leftSideMenuPage.buttonTracker.click()
|
||||
|
||||
const issuesPage = new IssuesPage(page)
|
||||
await issuesPage.createNewIssue(newIssue)
|
||||
await issuesPage.searchIssueByName(newIssue.title)
|
||||
await issuesPage.openIssueByName(newIssue.title)
|
||||
|
||||
const issuesDetailsPage = new IssuesDetailsPage(page)
|
||||
await issuesDetailsPage.editIssue(editIssue)
|
||||
|
||||
await issuesDetailsPage.checkIssue({
|
||||
...newIssue,
|
||||
...editIssue,
|
||||
estimation: '1d'
|
||||
})
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user