mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-22 21:50:34 +03:00
TESTS-192: feat(tests): done Add comment with image attachment test (#4687)
Signed-off-by: Alex Velichko <alex@hardcoreeng.com>
This commit is contained in:
parent
4341f0161a
commit
9e77c2d3e4
@ -1,6 +1,7 @@
|
||||
import { expect, Locator, Page } from '@playwright/test'
|
||||
import { CalendarPage } from '../calendar-page'
|
||||
import { DateDivided } from './types'
|
||||
import path from 'path'
|
||||
|
||||
export class CommonTrackerPage extends CalendarPage {
|
||||
readonly page: Page
|
||||
@ -16,6 +17,8 @@ export class CommonTrackerPage extends CalendarPage {
|
||||
readonly buttonMoreActions: Locator
|
||||
readonly textActivityContent: Locator
|
||||
readonly linkInActivity: Locator
|
||||
readonly inputCommentFile: Locator
|
||||
readonly commentImg: Locator
|
||||
|
||||
constructor (page: Page) {
|
||||
super(page)
|
||||
@ -34,6 +37,8 @@ export class CommonTrackerPage extends CalendarPage {
|
||||
this.buttonMoreActions = page.locator('div.popupPanel-title div.flex-row-center > button:first-child')
|
||||
this.textActivityContent = page.locator('div.activityMessage div.content div.content')
|
||||
this.linkInActivity = page.locator('div[id="activity:string:Activity"] a')
|
||||
this.inputCommentFile = page.locator('input#file')
|
||||
this.commentImg = page.locator('div.activityMessage div.content img')
|
||||
}
|
||||
|
||||
async selectFilter (filter: string, filterSecondLevel?: string): Promise<void> {
|
||||
@ -168,4 +173,17 @@ export class CommonTrackerPage extends CalendarPage {
|
||||
async openLinkFromActivitiesByText (linkText: string): Promise<void> {
|
||||
await this.linkInActivity.filter({ hasText: linkText }).click()
|
||||
}
|
||||
|
||||
async addCommentWithImage (comment: string, fileName: string): Promise<void> {
|
||||
await this.inputComment.fill(comment)
|
||||
await this.inputCommentFile.setInputFiles(path.join(__dirname, `../../files/${fileName}`))
|
||||
await expect(this.page.locator('div[slot="header"] div.item div.name', { hasText: fileName })).toBeVisible()
|
||||
await this.buttonSendComment.click()
|
||||
}
|
||||
|
||||
async checkCommentWithImageExist (commentHeader: string, fileName: string): Promise<void> {
|
||||
await this.checkActivityExist(commentHeader)
|
||||
const srcset = await this.commentImg.getAttribute('srcset')
|
||||
expect(srcset).toContain(fileName)
|
||||
}
|
||||
}
|
||||
|
@ -339,4 +339,25 @@ test.describe('Tracker issue tests', () => {
|
||||
await issuesDetailsPage.openShowMoreLink('changed description')
|
||||
await issuesDetailsPage.checkComparingTextAdded(additionalDescription)
|
||||
})
|
||||
|
||||
test('Add comment with image attachment', async ({ page }) => {
|
||||
const commentImageIssue: NewIssue = {
|
||||
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)
|
||||
|
||||
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')
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user