feat(tests): TESTS-166 done Check Contact activity backlink test (#4585)

Signed-off-by: Alex Velichko <nestor_007@mail.ru>
This commit is contained in:
Alex Velichko 2024-02-09 06:13:43 +03:00 committed by GitHub
parent 18043e1c91
commit 48c83d8063
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 85 additions and 0 deletions

View File

@ -0,0 +1,22 @@
import { expect, type Locator, type Page } from '@playwright/test'
import { CommonPage } from '../common-page'
export class EmployeeDetailsPage extends CommonPage {
readonly page: Page
readonly pageHeader: Locator
readonly textActivity: Locator
readonly textActivityContent: Locator
constructor (page: Page) {
super()
this.page = page
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"]')
}
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()
}
}

View File

@ -0,0 +1,17 @@
import { type Locator, type Page } from '@playwright/test'
import { CommonPage } from '../common-page'
export class EmployeesPage extends CommonPage {
readonly page: Page
readonly pageHeader: Locator
constructor (page: Page) {
super()
this.page = page
this.pageHeader = page.locator('span[class$="title"]', { hasText: 'Employee' })
}
async openEmployeeByName (employeeName: string): Promise<void> {
await this.page.locator('tr a', { hasText: employeeName }).click()
}
}

View File

@ -0,0 +1,11 @@
import { type Locator, type Page } from '@playwright/test'
export class ContactsNavigationMenuPage {
readonly page: Page
readonly buttonEmployee: Locator
constructor (page: Page) {
this.page = page
this.buttonEmployee = page.locator('a[href$="employees"]', { hasText: 'Employee' })
}
}

View File

@ -5,6 +5,9 @@ import { IssuesPage } from '../model/tracker/issues-page'
import { IssuesDetailsPage } from '../model/tracker/issues-details-page'
import { NewIssue } from '../model/tracker/types'
import { allure } from 'allure-playwright'
import { ContactsNavigationMenuPage } from '../model/contacts/navigation-menu-page'
import { EmployeesPage } from '../model/contacts/employees-page'
import { EmployeeDetailsPage } from '../model/contacts/employee-details-page'
test.use({
storageState: PlatformSetting
@ -66,4 +69,36 @@ test.describe('Mentions issue tests', () => {
await issuesDetailsPage.checkCollaboratorsCount('2 members')
await issuesDetailsPage.checkCollaborators(['Appleseed John', 'Dirak Kainin'])
})
test('Check that the backlink shown in the Contact activity', async ({ page }) => {
const mentionName = 'Dirak Kainin'
const mentionIssue: 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(mentionIssue)
await issuesPage.searchIssueByName(mentionIssue.title)
await issuesPage.openIssueByName(mentionIssue.title)
const issuesDetailsPage = new IssuesDetailsPage(page)
await issuesDetailsPage.addMentions(mentionName)
await issuesDetailsPage.checkCommentExist(`@${mentionName}`)
await leftSideMenuPage.buttonContacts.click()
const contactsNavigationMenuPage = new ContactsNavigationMenuPage(page)
await contactsNavigationMenuPage.buttonEmployee.click()
const employeesPage = new EmployeesPage(page)
await employeesPage.openEmployeeByName(mentionName)
const employeeDetailsPage = new EmployeeDetailsPage(page)
await employeeDetailsPage.checkActivityExist(`mentioned ${mentionName} in`, `@${mentionName}`)
})
})