TESTS-164: feat(tests): done mentioned in the issue test (#4575)

Signed-off-by: Alex Velichko <nestor_007@mail.ru>
This commit is contained in:
Alex Velichko 2024-02-08 10:19:10 +03:00 committed by GitHub
parent 8838320fbb
commit 60da5e28e3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 109 additions and 3 deletions

View File

@ -91,4 +91,8 @@ export class CommonPage {
async checkInfoSectionNotExist (page: Page): Promise<void> {
await expect(page.locator('div.INFO span')).not.toBeAttached()
}
async selectMention (page: Page, mentionName: string): Promise<void> {
await page.locator('form.mentionPoup div.list-item span.name', { hasText: mentionName }).click()
}
}

View File

@ -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<void> {
@ -150,4 +152,14 @@ export class CommonTrackerPage extends CalendarPage {
await this.buttonMoveIssuesModal.click({ delay: 1000 })
}
async addMentions (mention: string): Promise<void> {
await this.inputComment.fill('@')
await this.selectMention(this.page, mention)
await this.buttonSendComment.click()
}
async checkActivityContentExist (activityContent: string): Promise<void> {
await expect(this.textActivityContent.filter({ hasText: activityContent })).toBeVisible()
}
}

View File

@ -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<void> {
@ -126,4 +128,23 @@ export class IssuesDetailsPage extends CommonTrackerPage {
async checkIssueContainsAttachment (fileName: string): Promise<void> {
await this.page.locator('div.attachment-grid div.name', { hasText: fileName }).click()
}
async checkCollaborators (names: Array<string>): Promise<void> {
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<void> {
await expect(this.buttonCollaborators).toHaveText(count)
}
}

View File

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

View File

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

View File

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