mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-23 03:22:19 +03:00
TESTS-88: feat(tests): done Add comment from several users test (#4054)
Signed-off-by: Alex Velichko <nestor_007@mail.ru>
This commit is contained in:
parent
79054bc121
commit
704503ef12
95
tests/sanity/tests/collaborative/applications.spec.ts
Normal file
95
tests/sanity/tests/collaborative/applications.spec.ts
Normal file
@ -0,0 +1,95 @@
|
||||
import { test } from '@playwright/test'
|
||||
import { getSecondPage, PlatformSetting, PlatformURI } from '../utils'
|
||||
import { NavigationMenuPage } from '../model/recruiting/navigation-menu-page'
|
||||
import { ApplicationsPage } from '../model/recruiting/applications-page'
|
||||
import { ApplicationsDetailsPage } from '../model/recruiting/applications-details-page'
|
||||
import { allure } from 'allure-playwright'
|
||||
import { TalentName } from '../model/recruiting/types'
|
||||
import { LeftSideMenuPage } from '../model/left-side-menu-page'
|
||||
import { NotificationPage } from '../model/notification-page'
|
||||
|
||||
test.use({
|
||||
storageState: PlatformSetting
|
||||
})
|
||||
|
||||
test.describe('Collaborative tests for Application', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await allure.parentSuite('Collaborative tests')
|
||||
await (await page.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished()
|
||||
})
|
||||
|
||||
test('Add comment from several users', async ({ page, browser }) => {
|
||||
const vacancyName = 'Software Engineer'
|
||||
let talentName: TalentName
|
||||
// open second page
|
||||
const userSecondPage = await getSecondPage(browser)
|
||||
|
||||
await test.step('User1. Add collaborators and comment from user1', async () => {
|
||||
const navigationMenuPage = new NavigationMenuPage(page)
|
||||
await navigationMenuPage.buttonApplications.click()
|
||||
|
||||
const applicationsPage = new ApplicationsPage(page)
|
||||
talentName = await applicationsPage.createNewApplicationWithNewTalent({
|
||||
vacancy: vacancyName,
|
||||
recruiterName: 'first'
|
||||
})
|
||||
await applicationsPage.selectType(vacancyName)
|
||||
await applicationsPage.openApplicationByTalentName(talentName)
|
||||
|
||||
const applicationsDetailsPage = new ApplicationsDetailsPage(page)
|
||||
await applicationsDetailsPage.addCollaborators('Dirak Kainin')
|
||||
await applicationsDetailsPage.addComment('Test Comment from user1')
|
||||
await applicationsDetailsPage.checkCommentExist('Test Comment from user1')
|
||||
})
|
||||
|
||||
await test.step('User2. Check notification and add comment from user2', async () => {
|
||||
await (await userSecondPage.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished()
|
||||
|
||||
const leftSideMenuPageSecond = new LeftSideMenuPage(userSecondPage)
|
||||
await leftSideMenuPageSecond.checkExistNewNotification(userSecondPage)
|
||||
await leftSideMenuPageSecond.buttonNotification.click()
|
||||
|
||||
const notificationPageSecond = new NotificationPage(userSecondPage)
|
||||
await notificationPageSecond.checkNotificationCollaborators(
|
||||
`${talentName.lastName} ${talentName.firstName}`,
|
||||
'You have been added to collaborators'
|
||||
)
|
||||
|
||||
await (await userSecondPage.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished()
|
||||
const navigationMenuPageSecond = new NavigationMenuPage(userSecondPage)
|
||||
await navigationMenuPageSecond.buttonApplications.click()
|
||||
|
||||
const applicationsPageSecond = new ApplicationsPage(userSecondPage)
|
||||
await applicationsPageSecond.selectType(vacancyName)
|
||||
await applicationsPageSecond.openApplicationByTalentName(talentName)
|
||||
|
||||
const applicationsDetailsPageSecond = new ApplicationsDetailsPage(userSecondPage)
|
||||
await applicationsDetailsPageSecond.checkCommentExist('Test Comment from user1')
|
||||
await applicationsDetailsPageSecond.addComment('Test Comment from user2')
|
||||
await applicationsDetailsPageSecond.checkCommentExist('Test Comment from user2')
|
||||
})
|
||||
|
||||
await test.step('User1. Check notification and check comment from user1', async () => {
|
||||
const leftSideMenuPage = new LeftSideMenuPage(page)
|
||||
await leftSideMenuPage.checkExistNewNotification(page)
|
||||
await leftSideMenuPage.buttonNotification.click()
|
||||
|
||||
const notificationPage = new NotificationPage(page)
|
||||
await notificationPage.checkNotificationCollaborators(
|
||||
`${talentName.lastName} ${talentName.firstName}`,
|
||||
'left a comment'
|
||||
)
|
||||
|
||||
await (await page.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished()
|
||||
const navigationMenuPage = new NavigationMenuPage(page)
|
||||
await navigationMenuPage.buttonApplications.click()
|
||||
|
||||
const applicationsPage = new ApplicationsPage(page)
|
||||
await applicationsPage.selectType(vacancyName)
|
||||
await applicationsPage.openApplicationByTalentName(talentName)
|
||||
|
||||
const applicationsDetailsPage = new ApplicationsDetailsPage(page)
|
||||
await applicationsDetailsPage.checkCommentExist('Test Comment from user2')
|
||||
})
|
||||
})
|
||||
})
|
@ -135,7 +135,7 @@ test.describe('Collaborative test for issue', () => {
|
||||
await leftSideMenuPageSecond.buttonNotification.click()
|
||||
|
||||
const notificationPageSecond = new NotificationPage(userSecondPage)
|
||||
await notificationPageSecond.checkNotification(issue.title, newAssignee)
|
||||
await notificationPageSecond.checkNotificationIssue(issue.title, newAssignee)
|
||||
|
||||
await leftSideMenuPageSecond.buttonTracker.click()
|
||||
})
|
||||
|
@ -7,8 +7,13 @@ export class NotificationPage {
|
||||
this.page = page
|
||||
}
|
||||
|
||||
async checkNotification (name: string, assignee: string): Promise<void> {
|
||||
async checkNotificationIssue (name: string, assignee: string): Promise<void> {
|
||||
const notification = this.page.locator('div[class*="inbox-activity"] span', { hasText: name })
|
||||
await expect(notification.locator('xpath=../../..').locator('a span.ap-label')).toHaveText(assignee)
|
||||
}
|
||||
|
||||
async checkNotificationCollaborators (name: string, text: string): Promise<void> {
|
||||
const notification = this.page.locator('div[class*="inbox-activity"] span', { hasText: name })
|
||||
await expect(notification.locator('xpath=../../..').locator('div[class*="title"]')).toHaveText(text)
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ export class ApplicationsDetailsPage extends CommonRecruitingPage {
|
||||
readonly page: Page
|
||||
readonly textApplicationId: Locator
|
||||
readonly buttonState: Locator
|
||||
readonly buttonSelectCollaborators: Locator
|
||||
|
||||
constructor (page: Page) {
|
||||
super(page)
|
||||
@ -14,6 +15,7 @@ export class ApplicationsDetailsPage extends CommonRecruitingPage {
|
||||
.locator('div[class*="collapsed-container"]')
|
||||
.nth(0)
|
||||
.locator('div[class*="aside-grid"] > div:nth-of-type(1) > button')
|
||||
this.buttonSelectCollaborators = page.locator('xpath=//span[text()="Collaborators"]/..//button')
|
||||
}
|
||||
|
||||
async getApplicationId (): Promise<string> {
|
||||
@ -27,4 +29,18 @@ export class ApplicationsDetailsPage extends CommonRecruitingPage {
|
||||
await this.selectFromDropdown(this.page, status)
|
||||
await expect(this.buttonState).toContainText(status)
|
||||
}
|
||||
|
||||
async addCollaborators (name: string): Promise<void> {
|
||||
await this.buttonSelectCollaborators.click()
|
||||
if (name === 'all') {
|
||||
const checks = this.page.locator('div.popup button.menu-item')
|
||||
const count = await checks.count()
|
||||
for (let i = 0; i < count; i++) {
|
||||
await checks.nth(i).click()
|
||||
}
|
||||
} else {
|
||||
await this.page.locator('div.popup button.menu-item div.label', { hasText: name }).click()
|
||||
}
|
||||
await this.buttonSelectCollaborators.press('Escape')
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user