mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-14 04:08:19 +00:00
TESTS-167: feat(tests): done Check that the issue backlink test (#4596)
* TESTS-167: feat(tests): done Check that the issue backlink test --------- Signed-off-by: Alex Velichko <alex@hardcoreeng.com>
This commit is contained in:
parent
ed5f00e842
commit
535184be0a
@ -1,11 +1,14 @@
|
||||
import { expect, type Locator, type Page } from '@playwright/test'
|
||||
import { CommonPage } from '../common-page'
|
||||
import { Employee } from './types'
|
||||
|
||||
export class EmployeeDetailsPage extends CommonPage {
|
||||
readonly page: Page
|
||||
readonly pageHeader: Locator
|
||||
readonly textActivity: Locator
|
||||
readonly textActivityContent: Locator
|
||||
readonly textEmployeeFirstName: Locator
|
||||
readonly textEmployeeLastName: Locator
|
||||
|
||||
constructor (page: Page) {
|
||||
super()
|
||||
@ -13,10 +16,17 @@ export class EmployeeDetailsPage extends CommonPage {
|
||||
this.pageHeader = page.locator('span[class$="title"]', { hasText: 'Employee' })
|
||||
this.textActivity = page.locator('div.header')
|
||||
this.textActivityContent = page.locator('div.activityMessage div.content div[class*="content"]')
|
||||
this.textEmployeeFirstName = page.locator('input[placeholder="First name"]')
|
||||
this.textEmployeeLastName = page.locator('input[placeholder="Last name"]')
|
||||
}
|
||||
|
||||
async checkActivityExist (activityHeader: string, activityContent: string): Promise<void> {
|
||||
await expect(this.textActivity.filter({ hasText: activityHeader }).first()).toBeVisible()
|
||||
await expect(this.textActivityContent.filter({ hasText: activityContent }).first()).toBeVisible()
|
||||
}
|
||||
|
||||
async checkEmployee (employee: Employee): Promise<void> {
|
||||
await expect(this.textEmployeeFirstName).toHaveValue(employee.firstName)
|
||||
await expect(this.textEmployeeLastName).toHaveValue(employee.lastName)
|
||||
}
|
||||
}
|
||||
|
4
tests/sanity/tests/model/contacts/types.ts
Normal file
4
tests/sanity/tests/model/contacts/types.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export interface Employee {
|
||||
firstName: string
|
||||
lastName: string
|
||||
}
|
@ -15,6 +15,7 @@ export class CommonTrackerPage extends CalendarPage {
|
||||
readonly inputKeepOriginalMoveIssuesModal: Locator
|
||||
readonly buttonMoreActions: Locator
|
||||
readonly textActivityContent: Locator
|
||||
readonly linkInActivity: Locator
|
||||
|
||||
constructor (page: Page) {
|
||||
super(page)
|
||||
@ -32,6 +33,7 @@ export class CommonTrackerPage extends CalendarPage {
|
||||
this.inputKeepOriginalMoveIssuesModal = page.locator('form[id="tracker:string:MoveIssues"] input[type="checkbox"]')
|
||||
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')
|
||||
}
|
||||
|
||||
async selectFilter (filter: string, filterSecondLevel?: string): Promise<void> {
|
||||
@ -154,7 +156,7 @@ export class CommonTrackerPage extends CalendarPage {
|
||||
}
|
||||
|
||||
async addMentions (mention: string): Promise<void> {
|
||||
await this.inputComment.fill('@')
|
||||
await this.inputComment.fill(`@${mention}`)
|
||||
await this.selectMention(this.page, mention)
|
||||
await this.buttonSendComment.click()
|
||||
}
|
||||
@ -162,4 +164,8 @@ export class CommonTrackerPage extends CalendarPage {
|
||||
async checkActivityContentExist (activityContent: string): Promise<void> {
|
||||
await expect(this.textActivityContent.filter({ hasText: activityContent })).toBeVisible()
|
||||
}
|
||||
|
||||
async openLinkFromActivitiesByText (linkText: string): Promise<void> {
|
||||
await this.linkInActivity.filter({ hasText: linkText }).click()
|
||||
}
|
||||
}
|
||||
|
@ -101,4 +101,37 @@ test.describe('Mentions issue tests', () => {
|
||||
const employeeDetailsPage = new EmployeeDetailsPage(page)
|
||||
await employeeDetailsPage.checkActivityExist(`mentioned ${mentionName} in`, `@${mentionName}`)
|
||||
})
|
||||
|
||||
test('Check that the backlink shown in the Issue activity', async ({ page }) => {
|
||||
const mentionName = 'Dirak Kainin'
|
||||
const backlinkIssue: NewIssue = {
|
||||
title: `Check that the backlink shown in the Contact activity-${generateId()}`,
|
||||
description: 'Check that the backlink shown in the Contact activity description'
|
||||
}
|
||||
|
||||
const leftSideMenuPage = new LeftSideMenuPage(page)
|
||||
await leftSideMenuPage.buttonTracker.click()
|
||||
|
||||
const issuesPage = new IssuesPage(page)
|
||||
await issuesPage.modelSelectorAll.click()
|
||||
await issuesPage.createNewIssue(backlinkIssue)
|
||||
await issuesPage.searchIssueByName(backlinkIssue.title)
|
||||
await issuesPage.openIssueByName(backlinkIssue.title)
|
||||
|
||||
const issuesDetailsPage = new IssuesDetailsPage(page)
|
||||
await issuesDetailsPage.checkActivityExist('created issue')
|
||||
await issuesDetailsPage.checkActivityContentExist(`New issue: ${backlinkIssue.title}`)
|
||||
await issuesDetailsPage.openLinkFromActivitiesByText(backlinkIssue.title)
|
||||
await issuesDetailsPage.checkIssue(backlinkIssue)
|
||||
|
||||
await issuesDetailsPage.addMentions(mentionName)
|
||||
await issuesDetailsPage.checkCommentExist(`@${mentionName}`)
|
||||
await issuesDetailsPage.openLinkFromActivitiesByText(mentionName)
|
||||
|
||||
const employeeDetailsPage = new EmployeeDetailsPage(page)
|
||||
await employeeDetailsPage.checkEmployee({
|
||||
firstName: mentionName.split(' ')[1],
|
||||
lastName: mentionName.split(' ')[0]
|
||||
})
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user