From 48c83d80630ac3700612255c5be13c8021a1032f Mon Sep 17 00:00:00 2001 From: Alex Velichko Date: Fri, 9 Feb 2024 06:13:43 +0300 Subject: [PATCH] feat(tests): TESTS-166 done Check Contact activity backlink test (#4585) Signed-off-by: Alex Velichko --- .../model/contacts/employee-details-page.ts | 22 ++++++++++++ .../tests/model/contacts/employees-page.ts | 17 +++++++++ .../model/contacts/navigation-menu-page.ts | 11 ++++++ tests/sanity/tests/tracker/mentions.spec.ts | 35 +++++++++++++++++++ 4 files changed, 85 insertions(+) create mode 100644 tests/sanity/tests/model/contacts/employee-details-page.ts create mode 100644 tests/sanity/tests/model/contacts/employees-page.ts create mode 100644 tests/sanity/tests/model/contacts/navigation-menu-page.ts diff --git a/tests/sanity/tests/model/contacts/employee-details-page.ts b/tests/sanity/tests/model/contacts/employee-details-page.ts new file mode 100644 index 0000000000..2f271d5f8a --- /dev/null +++ b/tests/sanity/tests/model/contacts/employee-details-page.ts @@ -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 { + await expect(this.textActivity.filter({ hasText: activityHeader }).first()).toBeVisible() + await expect(this.textActivityContent.filter({ hasText: activityContent }).first()).toBeVisible() + } +} diff --git a/tests/sanity/tests/model/contacts/employees-page.ts b/tests/sanity/tests/model/contacts/employees-page.ts new file mode 100644 index 0000000000..1637ad0fe8 --- /dev/null +++ b/tests/sanity/tests/model/contacts/employees-page.ts @@ -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 { + await this.page.locator('tr a', { hasText: employeeName }).click() + } +} diff --git a/tests/sanity/tests/model/contacts/navigation-menu-page.ts b/tests/sanity/tests/model/contacts/navigation-menu-page.ts new file mode 100644 index 0000000000..2a5775253a --- /dev/null +++ b/tests/sanity/tests/model/contacts/navigation-menu-page.ts @@ -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' }) + } +} diff --git a/tests/sanity/tests/tracker/mentions.spec.ts b/tests/sanity/tests/tracker/mentions.spec.ts index c80049e800..b053ef3e14 100644 --- a/tests/sanity/tests/tracker/mentions.spec.ts +++ b/tests/sanity/tests/tracker/mentions.spec.ts @@ -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}`) + }) })