diff --git a/tests/sanity/tests/model/recruiting/talents-page.ts b/tests/sanity/tests/model/recruiting/talents-page.ts index 5929a0c80f..fe913af8c3 100644 --- a/tests/sanity/tests/model/recruiting/talents-page.ts +++ b/tests/sanity/tests/model/recruiting/talents-page.ts @@ -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 { @@ -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 { + await this.buttonCreateTalent.click() + await this.createNewTalentPopup(this.page, firstName, lastName) + } + async openTalentByTalentName (talentName: TalentName): Promise { await this.page .locator('tr', { hasText: `${talentName.lastName} ${talentName.firstName}` }) @@ -35,4 +47,16 @@ export class TalentsPage extends CommonRecruitingPage { async checkTalentNotExist (talentName: TalentName): Promise { await expect(this.page.locator('tr', { hasText: `${talentName.lastName} ${talentName.firstName}` })).toHaveCount(0) } + + async rightClickAction (talentName: TalentName, action: string): Promise { + 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 { + await expect(this.textVacancyMatchingTalent).toContainText(talentName, { ignoreCase: true }) + await expect(this.textVacancyMatchingScore).toContainText(score) + } } diff --git a/tests/sanity/tests/recruiting/talents.spec.ts b/tests/sanity/tests/recruiting/talents.spec.ts index 8cb164c78f..05df969e0c 100644 --- a/tests/sanity/tests/recruiting/talents.spec.ts +++ b/tests/sanity/tests/recruiting/talents.spec.ts @@ -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') + }) })