Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Dec 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions tests/sanity/tests/model/recruiting/talents-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,36 @@ 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> {
const talentName: TalentName = {
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}` })
Expand All @@ -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)
}
}
17 changes: 17 additions & 0 deletions tests/sanity/tests/recruiting/talents.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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')
})
})