diff --git a/tests/sanity/tests/model/common-page.ts b/tests/sanity/tests/model/common-page.ts index 507996c24f..c001256554 100644 --- a/tests/sanity/tests/model/common-page.ts +++ b/tests/sanity/tests/model/common-page.ts @@ -91,4 +91,8 @@ export class CommonPage { async checkInfoSectionNotExist (page: Page): Promise { await expect(page.locator('div.INFO span')).not.toBeAttached() } + + async selectMention (page: Page, mentionName: string): Promise { + await page.locator('form.mentionPoup div.list-item span.name', { hasText: mentionName }).click() + } } diff --git a/tests/sanity/tests/model/tracker/common-tracker-page.ts b/tests/sanity/tests/model/tracker/common-tracker-page.ts index 5343f007f4..1c51d9da2f 100644 --- a/tests/sanity/tests/model/tracker/common-tracker-page.ts +++ b/tests/sanity/tests/model/tracker/common-tracker-page.ts @@ -14,6 +14,7 @@ export class CommonTrackerPage extends CalendarPage { readonly buttonKeepOriginalMoveIssuesModal: Locator readonly inputKeepOriginalMoveIssuesModal: Locator readonly buttonMoreActions: Locator + readonly textActivityContent: Locator constructor (page: Page) { super(page) @@ -30,6 +31,7 @@ export class CommonTrackerPage extends CalendarPage { this.buttonKeepOriginalMoveIssuesModal = page.locator('form[id="tracker:string:MoveIssues"] span.toggle-switch') 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') } async selectFilter (filter: string, filterSecondLevel?: string): Promise { @@ -150,4 +152,14 @@ export class CommonTrackerPage extends CalendarPage { await this.buttonMoveIssuesModal.click({ delay: 1000 }) } + + async addMentions (mention: string): Promise { + await this.inputComment.fill('@') + await this.selectMention(this.page, mention) + await this.buttonSendComment.click() + } + + async checkActivityContentExist (activityContent: string): Promise { + await expect(this.textActivityContent.filter({ hasText: activityContent })).toBeVisible() + } } diff --git a/tests/sanity/tests/model/tracker/issues-details-page.ts b/tests/sanity/tests/model/tracker/issues-details-page.ts index 426f5e1142..95b1345af3 100644 --- a/tests/sanity/tests/model/tracker/issues-details-page.ts +++ b/tests/sanity/tests/model/tracker/issues-details-page.ts @@ -20,6 +20,7 @@ export class IssuesDetailsPage extends CommonTrackerPage { readonly textParentTitle: Locator readonly buttonAddSubIssue: Locator readonly textRelated: Locator + readonly buttonCollaborators: Locator constructor (page: Page) { super(page) @@ -40,6 +41,7 @@ export class IssuesDetailsPage extends CommonTrackerPage { this.textParentTitle = page.locator('span.issue-title') this.buttonAddSubIssue = page.locator('#add-sub-issue') this.textRelated = page.locator('//span[text()="Related"]/following-sibling::div[1]/div//span') + this.buttonCollaborators = page.locator('//span[text()="Collaborators"]/following-sibling::div[1]/button') } async editIssue (data: Issue): Promise { @@ -126,4 +128,23 @@ export class IssuesDetailsPage extends CommonTrackerPage { async checkIssueContainsAttachment (fileName: string): Promise { await this.page.locator('div.attachment-grid div.name', { hasText: fileName }).click() } + + async checkCollaborators (names: Array): Promise { + await this.buttonCollaborators.click() + for (const name of names) { + await expect( + this.page + .locator('//div[contains(@class, "popup")]//span[@class="label"]//div[contains(@class, "text-left")]', { + hasText: name + }) + .locator('xpath=../../../../..') + .locator('div.check div') + ).toBeVisible() + } + await this.inputTitle.click({ force: true }) + } + + async checkCollaboratorsCount (count: string): Promise { + await expect(this.buttonCollaborators).toHaveText(count) + } } diff --git a/tests/sanity/tests/recruiting/vacancies.spec.ts b/tests/sanity/tests/recruiting/vacancies.spec.ts index abd7e28214..ea82c958c4 100644 --- a/tests/sanity/tests/recruiting/vacancies.spec.ts +++ b/tests/sanity/tests/recruiting/vacancies.spec.ts @@ -167,7 +167,7 @@ test.describe('Vacancy tests', () => { const vacancyDetailsPage = new VacancyDetailsPage(page) await vacancyDetailsPage.moreActionOn('Archive') await vacancyDetailsPage.pressYesForPopup(page) - // await vacancyDetailsPage.checkActivityExist('changed archived in') + await vacancyDetailsPage.checkActivityExist('changed archived in') await navigationMenuPage.buttonVacancies.click() await vacanciesPage.checkVacancyNotExist( diff --git a/tests/sanity/tests/tracker/issues.spec.ts b/tests/sanity/tests/tracker/issues.spec.ts index 3762bdcab5..c5f9bc61b0 100644 --- a/tests/sanity/tests/tracker/issues.spec.ts +++ b/tests/sanity/tests/tracker/issues.spec.ts @@ -229,8 +229,8 @@ test.describe('Tracker issue tests', () => { await issuesDetailsPage.checkIssue({ ...moveIssue }) - // await issuesDetailsPage.checkActivityExist('changed project in') - // await issuesDetailsPage.checkActivityExist('changed number in') + await issuesDetailsPage.checkActivityExist('changed project in') + await issuesDetailsPage.checkActivityExist('changed number in') }) test('Comment stored after reload the page', async ({ page }) => { diff --git a/tests/sanity/tests/tracker/mentions.spec.ts b/tests/sanity/tests/tracker/mentions.spec.ts new file mode 100644 index 0000000000..c80049e800 --- /dev/null +++ b/tests/sanity/tests/tracker/mentions.spec.ts @@ -0,0 +1,69 @@ +import { test } from '@playwright/test' +import { generateId, PlatformSetting, PlatformURI } from '../utils' +import { LeftSideMenuPage } from '../model/left-side-menu-page' +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' + +test.use({ + storageState: PlatformSetting +}) + +test.describe('Mentions issue tests', () => { + test.beforeEach(async ({ page }) => { + await allure.parentSuite('Tracker tests') + await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished() + }) + + test('If user mentioned in the issue than he should be added as Collaborators', async ({ page }) => { + const mentionIssue: NewIssue = { + title: `Issue user mentioned as Collaborators-${generateId()}`, + description: 'Issue user mentioned as Collaborators 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('Dirak Kainin') + await issuesDetailsPage.checkCommentExist('@Dirak Kainin') + + await issuesDetailsPage.checkCollaborators(['Appleseed John']) + // TODO bug with adding in collaborators + // await issuesDetailsPage.checkCollaborators(['Appleseed John', 'Dirak Kainin']) + }) + + test('When Change assigner user should be added as Collaborators', async ({ page }) => { + const mentionIssue: NewIssue = { + title: `When Change assigner user should be added as Collaborators-${generateId()}`, + description: 'When Change assigner user should be added as Collaborators 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.editIssue({ assignee: 'Dirak Kainin' }) + await issuesDetailsPage.checkIssue({ + ...mentionIssue, + assignee: 'Dirak Kainin' + }) + await issuesDetailsPage.checkActivityExist('changed assignee') + await issuesDetailsPage.checkActivityContentExist('Assignee set to Dirak Kainin') + await issuesDetailsPage.checkCollaboratorsCount('2 members') + await issuesDetailsPage.checkCollaborators(['Appleseed John', 'Dirak Kainin']) + }) +})