mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-22 21:50:34 +03:00
TESTS-18: feat(tests): added edit vacancy test (#3901)
Signed-off-by: Alex Velichko <nestor_007@mail.ru>
This commit is contained in:
parent
156741cf48
commit
b9a9c8c2ef
@ -16,7 +16,7 @@ export class CommonRecruitingPage extends CommonPage {
|
||||
constructor (page: Page) {
|
||||
super()
|
||||
this.page = page
|
||||
this.inputComment = page.locator('div.tiptap')
|
||||
this.inputComment = page.locator('div.text-input div.tiptap')
|
||||
this.buttonSendComment = page.locator('g#Send')
|
||||
this.textComment = page.locator('div.msgactivity-container p')
|
||||
this.inputAddAttachment = page.locator('div.antiSection #file')
|
||||
|
@ -5,11 +5,13 @@ export class NavigationMenuPage {
|
||||
readonly buttonApplications: Locator
|
||||
readonly buttonMyApplications: Locator
|
||||
readonly buttonTalents: Locator
|
||||
readonly buttonVacancies: Locator
|
||||
|
||||
constructor (page: Page) {
|
||||
this.page = page
|
||||
this.buttonApplications = page.locator('a[href$="candidates"]', { hasText: 'Applications' })
|
||||
this.buttonMyApplications = page.locator('a[href$="my-applications"]', { hasText: 'My applications' })
|
||||
this.buttonTalents = page.locator('a[href$="talents"]', { hasText: 'Talents' })
|
||||
this.buttonVacancies = page.locator('a[href$="vacancies"]', { hasText: 'Vacancies' })
|
||||
}
|
||||
}
|
||||
|
@ -7,14 +7,12 @@ export class TalentsPage extends CommonRecruitingPage {
|
||||
readonly page: Page
|
||||
readonly pageHeader: Locator
|
||||
readonly buttonCreateTalent: Locator
|
||||
readonly textTableFirstCell: 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.textTableFirstCell = page.locator('div[class$="firstCell"]')
|
||||
}
|
||||
|
||||
async createNewTalent (): Promise<TalentName> {
|
||||
|
@ -19,3 +19,9 @@ export interface MergeContacts {
|
||||
mergeSource: boolean
|
||||
source: string
|
||||
}
|
||||
|
||||
export interface NewVacancy {
|
||||
title: string
|
||||
description: string
|
||||
location?: string
|
||||
}
|
||||
|
49
tests/sanity/tests/model/recruiting/vacancies-page.ts
Normal file
49
tests/sanity/tests/model/recruiting/vacancies-page.ts
Normal file
@ -0,0 +1,49 @@
|
||||
import { expect, type Locator, type Page } from '@playwright/test'
|
||||
import { NewVacancy } from './types'
|
||||
import { CommonRecruitingPage } from './common-recruiting-page'
|
||||
|
||||
export class VacanciesPage extends CommonRecruitingPage {
|
||||
readonly page: Page
|
||||
readonly pageHeader: Locator
|
||||
readonly buttonCreateNewVacancy: Locator
|
||||
readonly textTableFirstCell: Locator
|
||||
readonly inputCreateVacancyTitle: Locator
|
||||
readonly inputCreateVacancyDescription: Locator
|
||||
readonly buttonCreateVacancyLocation: Locator
|
||||
readonly buttonCreateVacancy: Locator
|
||||
|
||||
constructor (page: Page) {
|
||||
super(page)
|
||||
this.page = page
|
||||
this.pageHeader = page.locator('span[class*="header"]', { hasText: 'Vacancies' })
|
||||
this.buttonCreateNewVacancy = page.locator('button > span', { hasText: 'Vacancy' })
|
||||
this.textTableFirstCell = page.locator('div[class$="firstCell"]')
|
||||
this.inputCreateVacancyTitle = page.locator('form[id="recruit:string:CreateVacancy"] input[type="text"]')
|
||||
this.inputCreateVacancyDescription = page.locator('form[id="recruit:string:CreateVacancy"] div.text-editor-view')
|
||||
this.buttonCreateVacancyLocation = page.locator('form[id="recruit:string:CreateVacancy"] button span', {
|
||||
hasText: 'Location'
|
||||
})
|
||||
this.buttonCreateVacancy = page.locator('form[id="recruit:string:CreateVacancy"] button[type="submit"]')
|
||||
}
|
||||
|
||||
async createNewVacancy ({ title, description, location }: NewVacancy): Promise<void> {
|
||||
await this.buttonCreateNewVacancy.click()
|
||||
|
||||
await this.inputCreateVacancyTitle.fill(title)
|
||||
await this.inputCreateVacancyDescription.fill(description)
|
||||
if (location != null) {
|
||||
await this.buttonCreateVacancyLocation.click()
|
||||
await this.fillToSelectPopup(this.page, location)
|
||||
}
|
||||
|
||||
await this.buttonCreateVacancy.click()
|
||||
}
|
||||
|
||||
async openVacancyByName (vacancyName: string): Promise<void> {
|
||||
await this.page.locator('tr', { hasText: vacancyName }).locator('div[class$="firstCell"]').click()
|
||||
}
|
||||
|
||||
async checkVacancyNotExist (vacancyName: string): Promise<void> {
|
||||
await expect(this.page.locator('tr', { hasText: vacancyName })).toHaveCount(0)
|
||||
}
|
||||
}
|
60
tests/sanity/tests/model/recruiting/vacancy-details-page.ts
Normal file
60
tests/sanity/tests/model/recruiting/vacancy-details-page.ts
Normal file
@ -0,0 +1,60 @@
|
||||
import { expect, type Locator, type Page } from '@playwright/test'
|
||||
import { CommonRecruitingPage } from './common-recruiting-page'
|
||||
import path from 'path'
|
||||
|
||||
export class VacancyDetailsPage extends CommonRecruitingPage {
|
||||
readonly page: Page
|
||||
readonly inputDescription: Locator
|
||||
readonly buttonInputDescription: Locator
|
||||
readonly buttonInputLocation: Locator
|
||||
readonly inputAttachFile: Locator
|
||||
readonly buttonInputCompany: Locator
|
||||
readonly buttonInputDueDate: Locator
|
||||
readonly buttonDatePopupToday: Locator
|
||||
readonly buttonDatePopupSave: Locator
|
||||
readonly inputComment: Locator
|
||||
|
||||
constructor (page: Page) {
|
||||
super(page)
|
||||
this.page = page
|
||||
this.inputDescription = page.locator('div[class*="full"] div.tiptap')
|
||||
this.buttonInputDescription = page.locator('button > span', { hasText: 'Description' })
|
||||
this.buttonInputLocation = page.locator('button > span', { hasText: 'Location' })
|
||||
this.inputAttachFile = page.locator('div[class*="full"] input[name="file"]')
|
||||
this.buttonInputCompany = page.locator('button > div', { hasText: 'Company' })
|
||||
this.buttonInputDueDate = page.locator('button > div', { hasText: 'Due date' })
|
||||
this.buttonDatePopupToday = page.locator('div.popup div.today')
|
||||
this.buttonDatePopupSave = page.locator('div.popup button[type="submit"]')
|
||||
this.inputComment = page.locator('div.text-input div.tiptap')
|
||||
}
|
||||
|
||||
async addComment (comment: string): Promise<void> {
|
||||
await this.inputComment.fill(comment)
|
||||
await this.buttonSendComment.click()
|
||||
}
|
||||
|
||||
async addAttachments (filePath: string): Promise<void> {
|
||||
await this.inputAttachFile.setInputFiles(path.join(__dirname, `../../files/${filePath}`))
|
||||
await expect(await this.textAttachmentName.filter({ hasText: filePath })).toBeVisible()
|
||||
}
|
||||
|
||||
async addDescription (description: string): Promise<void> {
|
||||
await this.buttonInputDescription.click()
|
||||
await this.fillToSelectPopup(this.page, description)
|
||||
}
|
||||
|
||||
async addLocation (location: string): Promise<void> {
|
||||
await this.buttonInputLocation.click()
|
||||
await this.fillToSelectPopup(this.page, location)
|
||||
}
|
||||
|
||||
async addCompany (company: string): Promise<void> {
|
||||
await this.buttonInputCompany.click()
|
||||
await this.selectMenuItem(this.page, company)
|
||||
}
|
||||
|
||||
async addDueDateToday (): Promise<void> {
|
||||
await this.buttonInputDueDate.click()
|
||||
await this.buttonDatePopupToday.click()
|
||||
}
|
||||
}
|
@ -1,5 +1,8 @@
|
||||
import { expect, test } from '@playwright/test'
|
||||
import { generateId, PlatformSetting, PlatformURI } from '../utils'
|
||||
import { NavigationMenuPage } from '../model/recruiting/navigation-menu-page'
|
||||
import { VacanciesPage } from '../model/recruiting/vacancies-page'
|
||||
import { VacancyDetailsPage } from '../model/recruiting/vacancy-details-page'
|
||||
|
||||
test.use({
|
||||
storageState: PlatformSetting
|
||||
@ -52,7 +55,7 @@ test.describe('recruit tests', () => {
|
||||
})
|
||||
|
||||
// test('application-search', async ({ page }) => {
|
||||
// TODO: Application search is brokeb, since indexer now index from child to parent.
|
||||
// TODO: Application search is broken, since indexer now index from child to parent.
|
||||
// await page.locator('[id="app-recruit\\:string\\:RecruitApplication"]').click()
|
||||
|
||||
// await page.locator('text=Vacancies').click()
|
||||
@ -73,4 +76,33 @@ test.describe('recruit tests', () => {
|
||||
// await expect(page.locator('text=M. Marina')).toBeVisible()
|
||||
// expect(await page.locator('.antiTable-body__row').count()).toBeGreaterThan(2)
|
||||
// })
|
||||
|
||||
test('Edit a Vacancy', async ({ page }) => {
|
||||
const vacancyName = 'Edit Vacancy ' + generateId(4)
|
||||
|
||||
const navigationMenuPage = new NavigationMenuPage(page)
|
||||
await navigationMenuPage.buttonVacancies.click()
|
||||
const vacanciesPage = new VacanciesPage(page)
|
||||
await vacanciesPage.createNewVacancy({
|
||||
title: vacancyName,
|
||||
description: 'Vacancy description from Edit a Vacancy test',
|
||||
location: 'Edit a Vacancy location'
|
||||
})
|
||||
|
||||
await vacanciesPage.openVacancyByName(vacancyName)
|
||||
|
||||
const vacancyDetailsPage = new VacancyDetailsPage(page)
|
||||
await vacancyDetailsPage.addComment('Test Vacancy Comment 12345')
|
||||
await vacancyDetailsPage.checkCommentExist('Test Vacancy Comment 12345')
|
||||
|
||||
await vacancyDetailsPage.inputDescription.fill('Edit a Vacancy description')
|
||||
await expect(vacancyDetailsPage.inputDescription).toHaveText('Edit a Vacancy description')
|
||||
|
||||
await vacancyDetailsPage.addAttachments('cat.jpeg')
|
||||
|
||||
await vacancyDetailsPage.addDescription('Vacancy Description left-side menu')
|
||||
await vacancyDetailsPage.addLocation('Edit Vacancy Location')
|
||||
await vacancyDetailsPage.addCompany('Apple')
|
||||
await vacancyDetailsPage.addDueDateToday()
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user