mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-22 21:50:34 +03:00
TESTS-212: feat(tests): done Add comment by popup test (#4817)
Signed-off-by: Alex Velichko <alex@hardcoreeng.com>
This commit is contained in:
parent
ae6059c040
commit
1df662e2a0
@ -146,7 +146,7 @@ export class CommonTrackerPage extends CalendarPage {
|
||||
}
|
||||
|
||||
async checkActivityExist (activity: string): Promise<void> {
|
||||
await expect(this.textActivity.filter({ hasText: activity })).toBeVisible()
|
||||
await expect(this.textActivity.filter({ hasText: activity }).first()).toBeVisible()
|
||||
}
|
||||
|
||||
async fillMoveIssuesModal (newProjectName: string, keepOriginalAttributes: boolean = false): Promise<void> {
|
||||
|
30
tests/sanity/tests/model/tracker/issue-comment-popup.ts
Normal file
30
tests/sanity/tests/model/tracker/issue-comment-popup.ts
Normal file
@ -0,0 +1,30 @@
|
||||
import { IssuesPage } from './issues-page'
|
||||
import { type Locator, type Page, expect } from '@playwright/test'
|
||||
import path from 'path'
|
||||
|
||||
export class IssueCommentPopup extends IssuesPage {
|
||||
readonly page: Page
|
||||
readonly inputCommentText: Locator
|
||||
readonly inputAttachFile: Locator
|
||||
readonly textAttachFileName: Locator
|
||||
readonly buttonSendComment: Locator
|
||||
|
||||
constructor (page: Page) {
|
||||
super(page)
|
||||
this.page = page
|
||||
this.inputCommentText = page.locator('div[class*="commentPopup"] div.tiptap')
|
||||
this.inputAttachFile = page.locator('div[class*="commentPopup"] input#file')
|
||||
this.textAttachFileName = page.locator('div[class*="commentPopup"] div[class*="attachment"] div.name')
|
||||
this.buttonSendComment = page.locator('div[class*="commentPopup"] div.buttons-panel > button[type="button"]')
|
||||
}
|
||||
|
||||
async addCommentInPopup (commentText: string, attachmentFileName?: string): Promise<void> {
|
||||
await this.inputCommentText.fill(commentText)
|
||||
if (attachmentFileName != null) {
|
||||
await this.inputAttachFile.setInputFiles(path.join(__dirname, `../../files/${attachmentFileName}`))
|
||||
await expect(this.textAttachFileName).toHaveText(attachmentFileName)
|
||||
}
|
||||
|
||||
await this.buttonSendComment.click()
|
||||
}
|
||||
}
|
@ -250,4 +250,23 @@ export class IssuesPage extends CommonTrackerPage {
|
||||
await this.page.locator('div.row span', { hasText: issueName }).locator('xpath=..').locator('a > button').click()
|
||||
await expect(this.textPopupAddAttachmentsFile.filter({ hasText: filePath })).toBeVisible()
|
||||
}
|
||||
|
||||
async checkCommentsCount (issueName: string, count: string): Promise<void> {
|
||||
await expect(
|
||||
this.page
|
||||
.locator('div.row span', { hasText: issueName })
|
||||
.locator('xpath=..')
|
||||
.locator('button > div[slot="content"]')
|
||||
.first()
|
||||
).toHaveText(count)
|
||||
}
|
||||
|
||||
async openCommentPopupForIssueByName (issueName: string): Promise<void> {
|
||||
await this.page
|
||||
.locator('div.row span', { hasText: issueName })
|
||||
.locator('xpath=..')
|
||||
.locator('button')
|
||||
.first()
|
||||
.click()
|
||||
}
|
||||
}
|
||||
|
@ -63,5 +63,6 @@ test.describe('Attachments tests', () => {
|
||||
const issuesDetailsPage = new IssuesDetailsPage(page)
|
||||
await issuesDetailsPage.checkIssueContainsAttachment('cat.jpeg')
|
||||
await issuesDetailsPage.checkIssueContainsAttachment('cat3.jpeg')
|
||||
await issuesDetailsPage.checkActivityExist('uploaded an attachment')
|
||||
})
|
||||
})
|
||||
|
@ -12,3 +12,15 @@ export async function prepareNewIssueStep (page: Page, issue: NewIssue): Promise
|
||||
return await issuesPage.getIssueId(issue.title)
|
||||
})
|
||||
}
|
||||
|
||||
export async function prepareNewIssueWithOpenStep (page: Page, issue: NewIssue): Promise<string> {
|
||||
return await test.step('Prepare document', async () => {
|
||||
const issuesPage = new IssuesPage(page)
|
||||
await issuesPage.modelSelectorAll.click()
|
||||
|
||||
await issuesPage.createNewIssue(issue)
|
||||
await issuesPage.searchIssueByName(issue.title)
|
||||
await issuesPage.openIssueByName(issue.title)
|
||||
return await issuesPage.getIssueId(issue.title)
|
||||
})
|
||||
}
|
||||
|
@ -5,6 +5,8 @@ import { IssuesPage } from '../model/tracker/issues-page'
|
||||
import { IssuesDetailsPage } from '../model/tracker/issues-details-page'
|
||||
import { Issue, NewIssue } from '../model/tracker/types'
|
||||
import { TrackerNavigationMenuPage } from '../model/tracker/tracker-navigation-menu-page'
|
||||
import { prepareNewIssueWithOpenStep } from './common-steps'
|
||||
import { IssueCommentPopup } from '../model/tracker/issue-comment-popup'
|
||||
|
||||
test.use({
|
||||
storageState: PlatformSetting
|
||||
@ -13,6 +15,9 @@ test.use({
|
||||
test.describe('Tracker issue tests', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished()
|
||||
|
||||
const leftSideMenuPage = new LeftSideMenuPage(page)
|
||||
await leftSideMenuPage.buttonTracker.click()
|
||||
})
|
||||
|
||||
test('Create an issue with all parameters and attachments', async ({ page }) => {
|
||||
@ -31,15 +36,7 @@ test.describe('Tracker issue tests', () => {
|
||||
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)
|
||||
|
||||
await prepareNewIssueWithOpenStep(page, newIssue)
|
||||
const issuesDetailsPage = new IssuesDetailsPage(page)
|
||||
await issuesDetailsPage.checkIssue({
|
||||
...newIssue,
|
||||
@ -53,7 +50,6 @@ test.describe('Tracker issue tests', () => {
|
||||
title: `Issue with all parameters and attachments-${generateId()}`,
|
||||
description: 'Created issue with all parameters and attachments description'
|
||||
}
|
||||
|
||||
const editIssue: Issue = {
|
||||
status: 'Done',
|
||||
priority: 'High',
|
||||
@ -64,15 +60,7 @@ test.describe('Tracker issue tests', () => {
|
||||
milestone: 'Milestone',
|
||||
duedate: 'today'
|
||||
}
|
||||
|
||||
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)
|
||||
await prepareNewIssueWithOpenStep(page, newIssue)
|
||||
|
||||
const issuesDetailsPage = new IssuesDetailsPage(page)
|
||||
await issuesDetailsPage.editIssue(editIssue)
|
||||
@ -117,9 +105,6 @@ test.describe('Tracker issue tests', () => {
|
||||
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)
|
||||
@ -204,25 +189,15 @@ test.describe('Tracker issue tests', () => {
|
||||
title: `Issue to another project-${generateId()}`,
|
||||
description: 'Issue to move to another project'
|
||||
}
|
||||
|
||||
const leftSideMenuPage = new LeftSideMenuPage(page)
|
||||
await leftSideMenuPage.buttonTracker.click()
|
||||
|
||||
const trackerNavigationMenuPage = new TrackerNavigationMenuPage(page)
|
||||
await trackerNavigationMenuPage.openIssuesForProject('Default')
|
||||
|
||||
const issuesPage = new IssuesPage(page)
|
||||
await issuesPage.modelSelectorAll.click()
|
||||
await issuesPage.createNewIssue(moveIssue)
|
||||
await issuesPage.searchIssueByName(moveIssue.title)
|
||||
await issuesPage.openIssueByName(moveIssue.title)
|
||||
|
||||
await prepareNewIssueWithOpenStep(page, moveIssue)
|
||||
const issuesDetailsPage = new IssuesDetailsPage(page)
|
||||
await issuesDetailsPage.moreActionOnIssue('Move to project')
|
||||
await issuesDetailsPage.fillMoveIssuesModal(secondProjectName, true)
|
||||
|
||||
const trackerNavigationMenuPage = new TrackerNavigationMenuPage(page)
|
||||
await trackerNavigationMenuPage.openIssuesForProject(secondProjectName)
|
||||
|
||||
const issuesPage = new IssuesPage(page)
|
||||
await issuesPage.openIssueByName(moveIssue.title)
|
||||
await issuesDetailsPage.checkIssue({
|
||||
...moveIssue
|
||||
@ -238,18 +213,7 @@ test.describe('Tracker issue tests', () => {
|
||||
title: `Issue for stored comment-${generateId()}`,
|
||||
description: 'Issue for comment stored after reload the page'
|
||||
}
|
||||
|
||||
const leftSideMenuPage = new LeftSideMenuPage(page)
|
||||
await leftSideMenuPage.buttonTracker.click()
|
||||
|
||||
const trackerNavigationMenuPage = new TrackerNavigationMenuPage(page)
|
||||
await trackerNavigationMenuPage.openIssuesForProject('Default')
|
||||
|
||||
const issuesPage = new IssuesPage(page)
|
||||
await issuesPage.modelSelectorAll.click()
|
||||
await issuesPage.createNewIssue(commentIssue)
|
||||
await issuesPage.searchIssueByName(commentIssue.title)
|
||||
await issuesPage.openIssueByName(commentIssue.title)
|
||||
await prepareNewIssueWithOpenStep(page, commentIssue)
|
||||
|
||||
const issuesDetailsPage = new IssuesDetailsPage(page)
|
||||
await issuesDetailsPage.waitDetailsOpened(commentIssue.title)
|
||||
@ -271,13 +235,6 @@ test.describe('Tracker issue tests', () => {
|
||||
component: 'Default component',
|
||||
milestone: 'Edit Milestone'
|
||||
}
|
||||
|
||||
const leftSideMenuPage = new LeftSideMenuPage(page)
|
||||
await leftSideMenuPage.buttonTracker.click()
|
||||
|
||||
const trackerNavigationMenuPage = new TrackerNavigationMenuPage(page)
|
||||
await trackerNavigationMenuPage.openIssuesForProject('Default')
|
||||
|
||||
const issuesPage = new IssuesPage(page)
|
||||
await issuesPage.modelSelectorAll.click()
|
||||
await issuesPage.buttonCreateNewIssue.click()
|
||||
@ -298,10 +255,6 @@ test.describe('Tracker issue tests', () => {
|
||||
title: 'Issue for deletion',
|
||||
description: 'Description Issue for deletion'
|
||||
}
|
||||
|
||||
const leftSideMenuPage = new LeftSideMenuPage(page)
|
||||
await leftSideMenuPage.buttonTracker.click()
|
||||
|
||||
const issuesPage = new IssuesPage(page)
|
||||
await issuesPage.modelSelectorAll.click()
|
||||
await issuesPage.searchIssueByName(deleteIssue.title)
|
||||
@ -322,15 +275,7 @@ test.describe('Tracker issue tests', () => {
|
||||
title: `Check the changed description activity-${generateId()}`,
|
||||
description: 'Check the changed description activity description'
|
||||
}
|
||||
|
||||
const leftSideMenuPage = new LeftSideMenuPage(page)
|
||||
await leftSideMenuPage.buttonTracker.click()
|
||||
|
||||
const issuesPage = new IssuesPage(page)
|
||||
await issuesPage.modelSelectorAll.click()
|
||||
await issuesPage.createNewIssue(changedDescriptionIssue)
|
||||
await issuesPage.searchIssueByName(changedDescriptionIssue.title)
|
||||
await issuesPage.openIssueByName(changedDescriptionIssue.title)
|
||||
await prepareNewIssueWithOpenStep(page, changedDescriptionIssue)
|
||||
|
||||
const issuesDetailsPage = new IssuesDetailsPage(page)
|
||||
await issuesDetailsPage.waitDetailsOpened(changedDescriptionIssue.title)
|
||||
@ -345,19 +290,42 @@ test.describe('Tracker issue tests', () => {
|
||||
title: `Add comment with image attachment-${generateId()}`,
|
||||
description: 'Add comment with image attachment'
|
||||
}
|
||||
|
||||
const leftSideMenuPage = new LeftSideMenuPage(page)
|
||||
await leftSideMenuPage.buttonTracker.click()
|
||||
|
||||
const issuesPage = new IssuesPage(page)
|
||||
await issuesPage.modelSelectorAll.click()
|
||||
await issuesPage.createNewIssue(commentImageIssue)
|
||||
await issuesPage.searchIssueByName(commentImageIssue.title)
|
||||
await issuesPage.openIssueByName(commentImageIssue.title)
|
||||
await prepareNewIssueWithOpenStep(page, commentImageIssue)
|
||||
|
||||
const issuesDetailsPage = new IssuesDetailsPage(page)
|
||||
await issuesDetailsPage.waitDetailsOpened(commentImageIssue.title)
|
||||
await issuesDetailsPage.addCommentWithImage('Added comment with atttachment', 'cat3.jpeg')
|
||||
await issuesDetailsPage.checkCommentWithImageExist('left a comment', 'cat3.jpeg')
|
||||
})
|
||||
|
||||
test('Add comment by popup', async ({ page }) => {
|
||||
const commentInside = `Comment for the inside issue-${generateId()}`
|
||||
const commentPopup = `Comment for the popup-${generateId()}`
|
||||
const commentIssue: NewIssue = {
|
||||
title: `Issue for add comment by popup-${generateId()}`,
|
||||
description: 'Issue for add comment by popup'
|
||||
}
|
||||
await prepareNewIssueWithOpenStep(page, commentIssue)
|
||||
|
||||
const issuesDetailsPage = new IssuesDetailsPage(page)
|
||||
await issuesDetailsPage.waitDetailsOpened(commentIssue.title)
|
||||
await issuesDetailsPage.addComment(commentInside)
|
||||
await issuesDetailsPage.checkCommentExist(commentInside)
|
||||
|
||||
const trackerNavigationMenuPage = new TrackerNavigationMenuPage(page)
|
||||
await trackerNavigationMenuPage.openIssuesForProject('Default')
|
||||
|
||||
const issuesPage = new IssuesPage(page)
|
||||
await issuesPage.checkCommentsCount(commentIssue.title, '1')
|
||||
await issuesPage.openCommentPopupForIssueByName(commentIssue.title)
|
||||
|
||||
const issueCommentPopup = new IssueCommentPopup(page)
|
||||
await issueCommentPopup.addCommentInPopup(commentPopup, 'cat2.jpeg')
|
||||
await issueCommentPopup.checkCommentWithImageExist('left a comment', 'cat2.jpeg')
|
||||
await issueCommentPopup.checkCommentExist(commentPopup)
|
||||
|
||||
await issuesPage.modelSelectorAll.click()
|
||||
|
||||
await issuesPage.checkCommentsCount(commentIssue.title, '2')
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user