Skip to content

Commit

Permalink
TESTS-42: feat(tests): done Edit Sub-Issue test (#4191)
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Velichko <nestor_007@mail.ru>
  • Loading branch information
nestoragent authored Dec 14, 2023
1 parent 5d963eb commit 3b67b0e
Show file tree
Hide file tree
Showing 4 changed files with 115 additions and 35 deletions.
6 changes: 6 additions & 0 deletions tests/sanity/tests/model/tracker/issues-details-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export class IssuesDetailsPage extends CommonTrackerPage {
readonly buttonCloseIssue: Locator
readonly buttonMoreActions: Locator
readonly textParentTitle: Locator
readonly buttonAddSubIssue: Locator

constructor (page: Page) {
super(page)
Expand All @@ -38,6 +39,7 @@ export class IssuesDetailsPage extends CommonTrackerPage {
this.buttonCloseIssue = page.locator('div.popupPanel-title > button')
this.buttonMoreActions = page.locator('div.popupPanel-title div.flex-row-center > button:first-child')
this.textParentTitle = page.locator('span.issue-title')
this.buttonAddSubIssue = page.locator('#add-sub-issue')
}

async editIssue (data: Issue): Promise<void> {
Expand Down Expand Up @@ -109,4 +111,8 @@ export class IssuesDetailsPage extends CommonTrackerPage {
await this.buttonMoreActions.click()
await this.selectFromDropdown(this.page, action)
}

async waitDetailsOpened (issueTitle: string): Promise<void> {
await this.page.waitForSelector(`div[class*="main"] div:has-text("${issueTitle}")`)
}
}
6 changes: 4 additions & 2 deletions tests/sanity/tests/model/tracker/issues-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ export class IssuesPage extends CommonTrackerPage {

async createNewIssue (data: NewIssue): Promise<void> {
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.inputPopupCreateNewIssueDescription.fill(data.description)
if (data.status != null) {
Expand Down Expand Up @@ -124,8 +128,6 @@ export class IssuesPage extends CommonTrackerPage {
await this.buttonPopupCreateNewIssueParent.click()
await this.selectMenuItem(this.page, data.parentIssue, true)
}

await this.buttonCreateIssue.click()
}

async searchIssueByName (issueName: string): Promise<void> {
Expand Down
105 changes: 105 additions & 0 deletions tests/sanity/tests/tracker/subissues.spec.ts
Original file line number Diff line number Diff line change
@@ -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
})
})
})
33 changes: 0 additions & 33 deletions tests/sanity/tests/tracker/tracker.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@ import { IssuesPage } from '../model/tracker/issues-page'
import { PlatformSetting, fillSearch, generateId } from '../utils'
import {
DEFAULT_STATUSES,
DEFAULT_USER,
ViewletSelectors,
checkIssue,
checkIssueDraft,
createIssue,
fillIssueForm,
navigate,
openIssue,
toTime
Expand Down Expand Up @@ -310,34 +307,4 @@ test.describe('Tracker tests', () => {
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)
})
})

0 comments on commit 3b67b0e

Please sign in to comment.