TESTS-42: feat(tests): done Edit Sub-Issue test (#4191)

Signed-off-by: Alex Velichko <nestor_007@mail.ru>
This commit is contained in:
Alex Velichko 2023-12-14 19:36:50 +03:00 committed by GitHub
parent 5d963eb87a
commit 3b67b0e7e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 115 additions and 35 deletions

View File

@ -19,6 +19,7 @@ export class IssuesDetailsPage extends CommonTrackerPage {
readonly buttonCloseIssue: Locator readonly buttonCloseIssue: Locator
readonly buttonMoreActions: Locator readonly buttonMoreActions: Locator
readonly textParentTitle: Locator readonly textParentTitle: Locator
readonly buttonAddSubIssue: Locator
constructor (page: Page) { constructor (page: Page) {
super(page) super(page)
@ -38,6 +39,7 @@ export class IssuesDetailsPage extends CommonTrackerPage {
this.buttonCloseIssue = page.locator('div.popupPanel-title > button') this.buttonCloseIssue = page.locator('div.popupPanel-title > button')
this.buttonMoreActions = page.locator('div.popupPanel-title div.flex-row-center > button:first-child') this.buttonMoreActions = page.locator('div.popupPanel-title div.flex-row-center > button:first-child')
this.textParentTitle = page.locator('span.issue-title') this.textParentTitle = page.locator('span.issue-title')
this.buttonAddSubIssue = page.locator('#add-sub-issue')
} }
async editIssue (data: Issue): Promise<void> { async editIssue (data: Issue): Promise<void> {
@ -109,4 +111,8 @@ export class IssuesDetailsPage extends CommonTrackerPage {
await this.buttonMoreActions.click() await this.buttonMoreActions.click()
await this.selectFromDropdown(this.page, action) await this.selectFromDropdown(this.page, action)
} }
async waitDetailsOpened (issueTitle: string): Promise<void> {
await this.page.waitForSelector(`div[class*="main"] div:has-text("${issueTitle}")`)
}
} }

View File

@ -72,7 +72,11 @@ export class IssuesPage extends CommonTrackerPage {
async createNewIssue (data: NewIssue): Promise<void> { async createNewIssue (data: NewIssue): Promise<void> {
await this.buttonCreateNewIssue.click() await this.buttonCreateNewIssue.click()
await this.fillNewIssueForm(data)
await this.buttonCreateIssue.click()
}
async fillNewIssueForm (data: NewIssue): Promise<void> {
await this.inputPopupCreateNewIssueTitle.fill(data.title) await this.inputPopupCreateNewIssueTitle.fill(data.title)
await this.inputPopupCreateNewIssueDescription.fill(data.description) await this.inputPopupCreateNewIssueDescription.fill(data.description)
if (data.status != null) { if (data.status != null) {
@ -124,8 +128,6 @@ export class IssuesPage extends CommonTrackerPage {
await this.buttonPopupCreateNewIssueParent.click() await this.buttonPopupCreateNewIssueParent.click()
await this.selectMenuItem(this.page, data.parentIssue, true) await this.selectMenuItem(this.page, data.parentIssue, true)
} }
await this.buttonCreateIssue.click()
} }
async searchIssueByName (issueName: string): Promise<void> { async searchIssueByName (issueName: string): Promise<void> {

View File

@ -0,0 +1,105 @@
import { test } from '@playwright/test'
import { allure } from 'allure-playwright'
import { IssuesPage } from '../model/tracker/issues-page'
import { generateId, PlatformSetting, PlatformURI } from '../utils'
import {
checkIssue,
checkIssueDraft,
createIssue,
DEFAULT_STATUSES,
DEFAULT_USER,
fillIssueForm,
navigate
} from './tracker.utils'
import { Issue, NewIssue } from '../model/tracker/types'
import { LeftSideMenuPage } from '../model/left-side-menu-page'
import { IssuesDetailsPage } from '../model/tracker/issues-details-page'
test.use({
storageState: PlatformSetting
})
test.describe('Tracker sub-issues tests', () => {
test.beforeEach(async ({ page }) => {
await allure.parentSuite('Tracker tests')
await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished()
})
test('create sub-issue', async ({ page }) => {
await navigate(page)
const props = {
name: `issue-${generateId(5)}`,
description: 'description',
status: DEFAULT_STATUSES[1],
priority: 'Urgent',
assignee: DEFAULT_USER
}
await navigate(page)
await createIssue(page, props)
await page.click('text="Issues"')
const issuesPage = new IssuesPage(page)
await issuesPage.modelSelectorAll.click()
await issuesPage.searchIssueByName(props.name)
await issuesPage.openIssueByName(props.name)
await checkIssue(page, props)
props.name = `sub${props.name}`
await page.click('button:has-text("Add sub-issue")')
await fillIssueForm(page, props)
await page.keyboard.press('Escape')
await page.keyboard.press('Escape')
await page.locator('#new-issue').click()
await checkIssueDraft(page, props)
})
test('Edit a sub-issue', async ({ page }) => {
const newIssue: NewIssue = {
title: `Issue for the sub-issue-${generateId()}`,
description: 'Description Issue for the sub-issue'
}
const newSubIssue: NewIssue = {
title: `New Sub-Issue with parameter-${generateId()}`,
description: 'New Description Sub-Issue with parameter'
}
const editSubIssue: Issue = {
status: 'In Progress',
priority: 'Urgent',
assignee: 'Appleseed John',
createLabel: true,
labels: `EDIT-SUB-ISSUE-${generateId()}`,
component: 'No component',
estimation: '8',
milestone: 'No Milestone',
duedate: 'today',
filePath: 'cat.jpeg'
}
const leftSideMenuPage = new LeftSideMenuPage(page)
await leftSideMenuPage.buttonTracker.click()
const issuesPage = new IssuesPage(page)
await issuesPage.modelSelectorAll.click()
await issuesPage.createNewIssue(newIssue)
await issuesPage.searchIssueByName(newIssue.title)
await issuesPage.openIssueByName(newIssue.title)
const issuesDetailsPage = new IssuesDetailsPage(page)
await issuesDetailsPage.buttonAddSubIssue.click()
await issuesPage.fillNewIssueForm(newSubIssue)
await issuesPage.buttonCreateIssue.click()
await issuesPage.openIssueByName(newSubIssue.title)
await issuesDetailsPage.waitDetailsOpened(newSubIssue.title)
await issuesDetailsPage.editIssue(editSubIssue)
await issuesDetailsPage.checkIssue({
...newSubIssue,
...editSubIssue,
milestone: 'Milestone',
estimation: '1d',
parentIssue: newIssue.title
})
})
})

View File

@ -4,12 +4,9 @@ import { IssuesPage } from '../model/tracker/issues-page'
import { PlatformSetting, fillSearch, generateId } from '../utils' import { PlatformSetting, fillSearch, generateId } from '../utils'
import { import {
DEFAULT_STATUSES, DEFAULT_STATUSES,
DEFAULT_USER,
ViewletSelectors, ViewletSelectors,
checkIssue,
checkIssueDraft, checkIssueDraft,
createIssue, createIssue,
fillIssueForm,
navigate, navigate,
openIssue, openIssue,
toTime toTime
@ -310,34 +307,4 @@ test.describe('Tracker tests', () => {
dueDate: '24' dueDate: '24'
}) })
}) })
test('sub-issue-draft', async ({ page }) => {
await navigate(page)
const props = {
name: getIssueName(),
description: 'description',
status: DEFAULT_STATUSES[1],
priority: 'Urgent',
assignee: DEFAULT_USER
}
await navigate(page)
await createIssue(page, props)
await page.click('text="Issues"')
const issuesPage = new IssuesPage(page)
await issuesPage.modelSelectorAll.click()
await issuesPage.searchIssueByName(props.name)
await issuesPage.openIssueByName(props.name)
await checkIssue(page, props)
props.name = `sub${props.name}`
await page.click('button:has-text("Add sub-issue")')
await fillIssueForm(page, props)
await page.keyboard.press('Escape')
await page.keyboard.press('Escape')
await page.locator('#new-issue').click()
await checkIssueDraft(page, props)
})
}) })