mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-22 21:50:34 +03:00
TESTS-44: feat(tests): the Set parent issue test (#4158)
Signed-off-by: Alex Velichko <nestor_007@mail.ru>
This commit is contained in:
parent
56b1c04b88
commit
7f7f494b80
@ -1,9 +1,10 @@
|
||||
import { Page, expect } from '@playwright/test'
|
||||
|
||||
export class CommonPage {
|
||||
async selectMenuItem (page: Page, name: string): Promise<void> {
|
||||
async selectMenuItem (page: Page, name: string, fullWordFilter: boolean = false): Promise<void> {
|
||||
if (name !== 'first') {
|
||||
await page.locator('div.selectPopup input').fill(name.split(' ')[0])
|
||||
const filterText = fullWordFilter ? name : name.split(' ')[0]
|
||||
await page.locator('div.selectPopup input').fill(filterText)
|
||||
}
|
||||
await page.locator('div.selectPopup div.list-item:first-child').click()
|
||||
}
|
||||
|
@ -15,6 +15,8 @@ export class IssuesDetailsPage extends CommonTrackerPage {
|
||||
readonly buttonMilestone: Locator
|
||||
readonly textEstimation: Locator
|
||||
readonly buttonEstimation: Locator
|
||||
readonly buttonMoreActions: Locator
|
||||
readonly textParentTitle: Locator
|
||||
|
||||
constructor (page: Page) {
|
||||
super(page)
|
||||
@ -30,6 +32,8 @@ export class IssuesDetailsPage extends CommonTrackerPage {
|
||||
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]')
|
||||
this.buttonMoreActions = page.locator('div.popupPanel-title div.flex-row-center > button:first-child')
|
||||
this.textParentTitle = page.locator('span.issue-title')
|
||||
}
|
||||
|
||||
async editIssue (data: Issue): Promise<void> {
|
||||
@ -92,5 +96,13 @@ export class IssuesDetailsPage extends CommonTrackerPage {
|
||||
if (data.estimation != null) {
|
||||
await expect(this.textEstimation).toHaveText(data.estimation)
|
||||
}
|
||||
if (data.parentIssue != null) {
|
||||
await expect(this.textParentTitle).toHaveText(data.parentIssue)
|
||||
}
|
||||
}
|
||||
|
||||
async moreActionOnIssue (action: string): Promise<void> {
|
||||
await this.buttonMoreActions.click()
|
||||
await this.selectFromDropdown(this.page, action)
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ export class IssuesPage extends CommonTrackerPage {
|
||||
readonly linkSidebarAll: Locator
|
||||
readonly linkSidebarMyIssue: Locator
|
||||
readonly buttonClearFilers: Locator
|
||||
readonly buttonPopupCreateNewIssueParent: Locator
|
||||
|
||||
constructor (page: Page) {
|
||||
super(page)
|
||||
@ -64,6 +65,7 @@ export class IssuesPage extends CommonTrackerPage {
|
||||
this.linkSidebarAll = page.locator('a[href$="all-issues"]')
|
||||
this.linkSidebarMyIssue = page.locator('a[href$="my-issues"]')
|
||||
this.buttonClearFilers = page.locator('div.search-start > div:first-child button')
|
||||
this.buttonPopupCreateNewIssueParent = page.locator('div#parentissue-editor button')
|
||||
}
|
||||
|
||||
async createNewIssue (data: NewIssue): Promise<void> {
|
||||
@ -116,6 +118,10 @@ export class IssuesPage extends CommonTrackerPage {
|
||||
await this.inputPopupCreateNewIssueFile.setInputFiles(path.join(__dirname, `../../files/${data.filePath}`))
|
||||
await expect(this.textPopupCreateNewIssueFile.filter({ hasText: data.filePath })).toBeVisible()
|
||||
}
|
||||
if (data.parentIssue != null) {
|
||||
await this.buttonPopupCreateNewIssueParent.click()
|
||||
await this.selectMenuItem(this.page, data.parentIssue, true)
|
||||
}
|
||||
|
||||
await this.buttonCreateIssue.click()
|
||||
}
|
||||
@ -149,6 +155,20 @@ export class IssuesPage extends CommonTrackerPage {
|
||||
}
|
||||
}
|
||||
|
||||
async checkParentIssue (issueName: string, parentName: string): Promise<void> {
|
||||
await expect(
|
||||
this.page
|
||||
.locator('a', { hasText: issueName })
|
||||
.locator('xpath=../..')
|
||||
.locator('div.root span.parent-label:first-child')
|
||||
).toHaveText(parentName)
|
||||
}
|
||||
|
||||
async doActionOnIssue (issueName: string, action: string): Promise<void> {
|
||||
await this.page.locator('a', { hasText: issueName }).click({ button: 'right' })
|
||||
await this.selectFromDropdown(this.page, action)
|
||||
}
|
||||
|
||||
async checkAllIssuesByPriority (priorityName: string): Promise<void> {
|
||||
for await (const locator of iterateLocator(this.page.locator('div.listGrid'))) {
|
||||
const href = await locator.locator('div.priority-container use').getAttribute('href')
|
||||
|
@ -3,14 +3,12 @@ import { CommonPage } from '../common-page'
|
||||
|
||||
export class TrackerNavigationMenuPage extends CommonPage {
|
||||
readonly page: Page
|
||||
readonly buttonIssues: Locator
|
||||
readonly buttonCreateProject: Locator
|
||||
readonly buttonProjectsParent: Locator
|
||||
|
||||
constructor (page: Page) {
|
||||
super()
|
||||
this.page = page
|
||||
this.buttonIssues = page.locator('a span', { hasText: 'Issues' })
|
||||
this.buttonCreateProject = page.locator('div#tree-projects').locator('xpath=..')
|
||||
this.buttonProjectsParent = page.locator('div.parent > span')
|
||||
}
|
||||
@ -37,7 +35,11 @@ export class TrackerNavigationMenuPage extends CommonPage {
|
||||
}
|
||||
|
||||
async openIssuesForProject (projectName: string): Promise<void> {
|
||||
await this.page.locator(`a[href$="issues"][href*="${projectName}"]`).click()
|
||||
await this.page
|
||||
.locator(`div[class*="antiNav-element"] a[href$="issues"][href*="${projectName}"]> div > span`, {
|
||||
hasText: 'Issues'
|
||||
})
|
||||
.click()
|
||||
}
|
||||
|
||||
async makeActionWithProject (projectName: string, action: string): Promise<void> {
|
||||
|
@ -14,6 +14,7 @@ export interface Issue {
|
||||
milestone?: string
|
||||
duedate?: string
|
||||
filePath?: string
|
||||
parentIssue?: string
|
||||
}
|
||||
|
||||
export interface NewProject {
|
||||
|
@ -5,6 +5,7 @@ import { IssuesPage } from '../model/tracker/issues-page'
|
||||
import { IssuesDetailsPage } from '../model/tracker/issues-details-page'
|
||||
import { Issue, NewIssue } from '../model/tracker/types'
|
||||
import { allure } from 'allure-playwright'
|
||||
import { TrackerNavigationMenuPage } from '../model/tracker/tracker-navigation-menu-page'
|
||||
|
||||
test.use({
|
||||
storageState: PlatformSetting
|
||||
@ -111,4 +112,85 @@ test.describe('Tracker issue tests', () => {
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
test('Set parent issue', async ({ page }) => {
|
||||
const parentIssue: NewIssue = {
|
||||
title: `PARENT ISSUE-${generateId()}`,
|
||||
description: 'Created issue to be parent issue'
|
||||
}
|
||||
|
||||
const leftSideMenuPage = new LeftSideMenuPage(page)
|
||||
await leftSideMenuPage.buttonTracker.click()
|
||||
|
||||
const issuesPage = new IssuesPage(page)
|
||||
await issuesPage.modelSelectorAll.click()
|
||||
await issuesPage.createNewIssue(parentIssue)
|
||||
|
||||
await test.step('Set parent issue during creation', async () => {
|
||||
const newIssue: NewIssue = {
|
||||
title: `Set parent issue during creation-${generateId()}`,
|
||||
description: 'Set parent issue during creation',
|
||||
parentIssue: parentIssue.title
|
||||
}
|
||||
|
||||
await issuesPage.modelSelectorAll.click()
|
||||
await issuesPage.createNewIssue(newIssue)
|
||||
await issuesPage.checkParentIssue(newIssue.title, parentIssue.title)
|
||||
|
||||
await issuesPage.openIssueByName(newIssue.title)
|
||||
const issuesDetailsPage = new IssuesDetailsPage(page)
|
||||
await issuesDetailsPage.checkIssue({
|
||||
...newIssue,
|
||||
parentIssue: parentIssue.title
|
||||
})
|
||||
|
||||
const trackerNavigationMenuPage = new TrackerNavigationMenuPage(page)
|
||||
await trackerNavigationMenuPage.openIssuesForProject('Default')
|
||||
})
|
||||
|
||||
await test.step('Set parent issue from issues page', async () => {
|
||||
const newIssue: NewIssue = {
|
||||
title: `Set parent issue from issues page-${generateId()}`,
|
||||
description: 'Set parent issue from issues page'
|
||||
}
|
||||
await issuesPage.modelSelectorAll.click()
|
||||
await issuesPage.createNewIssue(newIssue)
|
||||
await issuesPage.doActionOnIssue(newIssue.title, 'Set parent issue…')
|
||||
await issuesPage.selectMenuItem(page, parentIssue.title, true)
|
||||
await issuesPage.checkParentIssue(newIssue.title, parentIssue.title)
|
||||
|
||||
await issuesPage.openIssueByName(newIssue.title)
|
||||
const issuesDetailsPage = new IssuesDetailsPage(page)
|
||||
await issuesDetailsPage.checkIssue({
|
||||
...newIssue,
|
||||
parentIssue: parentIssue.title
|
||||
})
|
||||
|
||||
const trackerNavigationMenuPage = new TrackerNavigationMenuPage(page)
|
||||
await trackerNavigationMenuPage.openIssuesForProject('Default')
|
||||
})
|
||||
|
||||
await test.step('Set parent issue from issue details page', async () => {
|
||||
const newIssue: NewIssue = {
|
||||
title: `Set parent issue from issue details page-${generateId()}`,
|
||||
description: 'Set parent issue from issue details page'
|
||||
}
|
||||
await issuesPage.modelSelectorAll.click()
|
||||
await issuesPage.createNewIssue(newIssue)
|
||||
await issuesPage.openIssueByName(newIssue.title)
|
||||
|
||||
const issuesDetailsPage = new IssuesDetailsPage(page)
|
||||
|
||||
await issuesDetailsPage.moreActionOnIssue('Set parent issue…')
|
||||
await issuesPage.selectMenuItem(page, parentIssue.title, true)
|
||||
await issuesDetailsPage.checkIssue({
|
||||
...newIssue,
|
||||
parentIssue: parentIssue.title
|
||||
})
|
||||
|
||||
const trackerNavigationMenuPage = new TrackerNavigationMenuPage(page)
|
||||
await trackerNavigationMenuPage.openIssuesForProject('Default')
|
||||
await issuesPage.checkParentIssue(newIssue.title, parentIssue.title)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user