mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-28 20:45:00 +02:00
TESTS-57: feat(tests): done Edit a Template test (#4079)
Signed-off-by: Alex Velichko <nestor_007@mail.ru>
This commit is contained in:
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 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.
@@ -1,6 +1,6 @@
|
||||
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 TemplateDetailsPage extends CommonTrackerPage {
|
||||
readonly page: Page
|
||||
@@ -11,7 +11,10 @@ export class TemplateDetailsPage extends CommonTrackerPage {
|
||||
readonly buttonAddLabel: Locator
|
||||
readonly textLabels: Locator
|
||||
readonly buttonComponent: Locator
|
||||
readonly textEstimation: Locator
|
||||
readonly buttonEstimation: Locator
|
||||
readonly buttonDueDate: Locator
|
||||
readonly buttonSaveDueDate: Locator
|
||||
readonly textComment: Locator
|
||||
|
||||
constructor (page: Page) {
|
||||
super(page)
|
||||
@@ -23,7 +26,10 @@ export class TemplateDetailsPage extends CommonTrackerPage {
|
||||
this.textLabels = page.locator('div.menu-group span')
|
||||
this.buttonAddLabel = page.locator('//span[text()="Labels"]/../button[2]//span')
|
||||
this.buttonComponent = page.locator('//span[text()="Component"]/../div/div/button')
|
||||
this.textEstimation = page.locator('(//span[text()="Estimation"]/../div/button)[3]')
|
||||
this.buttonEstimation = page.locator('(//span[text()="Estimation"]/../div/button)[3]')
|
||||
this.buttonDueDate = page.locator('(//span[text()="Due date"]/../div/button)[2]')
|
||||
this.buttonSaveDueDate = page.locator('div.footer > button')
|
||||
this.textComment = page.locator('div.labels-row')
|
||||
}
|
||||
|
||||
async checkTemplate (data: NewIssue): Promise<void> {
|
||||
@@ -43,7 +49,48 @@ export class TemplateDetailsPage extends CommonTrackerPage {
|
||||
await expect(this.buttonComponent).toHaveText(data.component)
|
||||
}
|
||||
if (data.estimation != null) {
|
||||
await expect(this.textEstimation).toHaveText(data.estimation)
|
||||
await expect(this.buttonEstimation).toHaveText(data.estimation)
|
||||
}
|
||||
}
|
||||
|
||||
async editTemplate (data: Issue): Promise<void> {
|
||||
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 edit template')
|
||||
}
|
||||
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.estimation != null) {
|
||||
await this.buttonEstimation.click()
|
||||
await this.fillToSelectPopup(this.page, data.estimation)
|
||||
}
|
||||
if (data.duedate != null) {
|
||||
if (data.duedate === 'today') {
|
||||
await this.buttonDueDate.click()
|
||||
await this.buttonDatePopupToday.click()
|
||||
} else {
|
||||
await this.buttonDueDate.click()
|
||||
await this.buttonSaveDueDate.click()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async checkCommentExist (comment: string): Promise<void> {
|
||||
await expect(this.textComment.filter({ hasText: comment })).toBeVisible()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { test } from '@playwright/test'
|
||||
import { generateId, PlatformSetting, PlatformURI } from '../utils'
|
||||
import { LeftSideMenuPage } from '../model/left-side-menu-page'
|
||||
import { NewIssue } from '../model/tracker/types'
|
||||
import { Issue, NewIssue } from '../model/tracker/types'
|
||||
import { allure } from 'allure-playwright'
|
||||
import { TrackerNavigationMenuPage } from '../model/tracker/tracker-navigation-menu-page'
|
||||
import { TemplatePage } from '../model/tracker/templates-page'
|
||||
@@ -46,4 +46,45 @@ test.describe('Tracker template tests', () => {
|
||||
estimation: '2h'
|
||||
})
|
||||
})
|
||||
|
||||
test('Edit a Template', async ({ page }) => {
|
||||
const newTemplate: NewIssue = {
|
||||
title: 'Template for edit',
|
||||
description: 'Created template for edit'
|
||||
}
|
||||
|
||||
const editTemplate: Issue = {
|
||||
priority: 'High',
|
||||
assignee: 'Dirak Kainin',
|
||||
createLabel: true,
|
||||
labels: `EDIT-TEMPLATE-${generateId()}`,
|
||||
component: 'No component',
|
||||
estimation: '8',
|
||||
duedate: 'today'
|
||||
}
|
||||
|
||||
const leftSideMenuPage = new LeftSideMenuPage(page)
|
||||
await leftSideMenuPage.buttonTracker.click()
|
||||
|
||||
const trackerNavigationMenuPage = new TrackerNavigationMenuPage(page)
|
||||
await trackerNavigationMenuPage.buttonTemplates.click()
|
||||
|
||||
const templatePage = new TemplatePage(page)
|
||||
await templatePage.openTemplate(newTemplate.title)
|
||||
|
||||
const templateDetailsPage = new TemplateDetailsPage(page)
|
||||
await templateDetailsPage.editTemplate(editTemplate)
|
||||
|
||||
await templateDetailsPage.checkTemplate({
|
||||
...newTemplate,
|
||||
...editTemplate,
|
||||
estimation: '1d'
|
||||
})
|
||||
|
||||
await templateDetailsPage.checkCommentExist('Appleseed John created template')
|
||||
await templateDetailsPage.checkCommentExist('Appleseed John changed priority to High')
|
||||
await templateDetailsPage.checkCommentExist('Appleseed John changed assignee to Dirak Kainin')
|
||||
await templateDetailsPage.checkCommentExist('Appleseed John changed estimation to 1d')
|
||||
await templateDetailsPage.checkCommentExist('Appleseed John changed due date')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user