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:
Alex Velichko 2024-02-10 11:07:31 +03:00 committed by GitHub
parent ed5f00e842
commit 535184be0a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 54 additions and 1 deletions

View File

@ -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)
}
}

View File

@ -0,0 +1,4 @@
export interface Employee {
firstName: string
lastName: string
}

View File

@ -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()
}
}

View File

@ -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]
})
})
})