feat(tests): TESTS-21 done Match to vacancy test (#4268)

This commit is contained in:
Alex Velichko 2023-12-26 08:25:14 +03:00 committed by GitHub
parent 2a345280eb
commit 0cddfeedb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 2 deletions

View File

@ -7,12 +7,20 @@ export class TalentsPage extends CommonRecruitingPage {
readonly page: Page
readonly pageHeader: Locator
readonly buttonCreateTalent: Locator
readonly textVacancyMatchingTalent: Locator
readonly textVacancyMatchingScore: Locator
constructor (page: Page) {
super(page)
this.page = page
this.pageHeader = page.locator('span[class*="header"]', { hasText: 'Talents' })
this.buttonCreateTalent = page.locator('div[class*="ac-header"] button > span', { hasText: 'Talent' })
this.textVacancyMatchingTalent = page.locator(
'form[id="recruit:string:VacancyMatching"] table > tbody > tr > td:nth-child(1) span[class*="label"]'
)
this.textVacancyMatchingScore = page.locator(
'form[id="recruit:string:VacancyMatching"] table > tbody > tr > td:nth-child(2)'
)
}
async createNewTalent (): Promise<TalentName> {
@ -20,11 +28,15 @@ export class TalentsPage extends CommonRecruitingPage {
firstName: `TestFirst-${generateId(4)}`,
lastName: `TestLast-${generateId(4)}`
}
await this.buttonCreateTalent.click()
await this.createNewTalentPopup(this.page, talentName.firstName, talentName.lastName)
await this.createNewTalentWithName(talentName.firstName, talentName.lastName)
return talentName
}
async createNewTalentWithName (firstName: string, lastName: string): Promise<void> {
await this.buttonCreateTalent.click()
await this.createNewTalentPopup(this.page, firstName, lastName)
}
async openTalentByTalentName (talentName: TalentName): Promise<void> {
await this.page
.locator('tr', { hasText: `${talentName.lastName} ${talentName.firstName}` })
@ -35,4 +47,16 @@ export class TalentsPage extends CommonRecruitingPage {
async checkTalentNotExist (talentName: TalentName): Promise<void> {
await expect(this.page.locator('tr', { hasText: `${talentName.lastName} ${talentName.firstName}` })).toHaveCount(0)
}
async rightClickAction (talentName: TalentName, action: string): Promise<void> {
await this.page
.locator('tr', { hasText: `${talentName.lastName} ${talentName.firstName}` })
.click({ button: 'right' })
await this.selectFromDropdown(this.page, action)
}
async checkMatchVacancy (talentName: string, score: string): Promise<void> {
await expect(this.textVacancyMatchingTalent).toContainText(talentName, { ignoreCase: true })
await expect(this.textVacancyMatchingScore).toContainText(score)
}
}

View File

@ -4,6 +4,7 @@ import { NavigationMenuPage } from '../model/recruiting/navigation-menu-page'
import { TalentsPage } from '../model/recruiting/talents-page'
import { TalentDetailsPage } from '../model/recruiting/talent-details-page'
import { allure } from 'allure-playwright'
import { TalentName } from '../model/recruiting/types'
test.use({
storageState: PlatformSetting
@ -162,4 +163,20 @@ test.describe('candidate/talents tests', () => {
await expect(talentDetailsPage.page.locator('button > span', { hasText: titleTalent2 })).toBeVisible()
await expect(talentDetailsPage.page.locator('button > span', { hasText: sourceTalent2 })).toBeVisible()
})
test('Match to vacancy', async ({ page, context }) => {
const talentName: TalentName = {
firstName: 'Software',
lastName: `Engineer-${generateId(4)}`
}
const navigationMenuPage = new NavigationMenuPage(page)
await navigationMenuPage.buttonTalents.click()
const talentsPage = new TalentsPage(page)
await talentsPage.createNewTalentWithName(talentName.firstName, talentName.lastName)
await talentsPage.rightClickAction(talentName, 'Match to vacancy')
await talentsPage.checkMatchVacancy(`${talentName.lastName} ${talentName.firstName}`, '0.5')
})
})