feat(recruiting): working on update recruit tests and adding Edit Application test (#3851)

Signed-off-by: Alex Velichko <nestor_007@mail.ru>
This commit is contained in:
Alex Velichko 2023-10-19 12:51:05 +03:00 committed by GitHub
parent 17f55283ce
commit 47a4acd8ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 513 additions and 211 deletions

View File

@ -38,6 +38,7 @@ test.describe('actions tests', () => {
await expect(page).toHaveURL(`${PlatformURI}/workbench/sanity-ws/recruit/vacancies`)
})
test('action-switch-applications', async ({ page }) => {
await page.click('[id="app-recruit\\:string\\:RecruitApplication"]')

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -0,0 +1,32 @@
import { Page } from '@playwright/test'
export class CommonPage {
async fillSelectPopup (page: Page, name: string): Promise<void> {
if (name !== 'first') {
await page.locator('div.selectPopup input').fill(name)
}
await page.locator('div.selectPopup div.list-item:first-child').click()
}
async pressCreateButtonSelectPopup (page: Page): Promise<void> {
await page.locator('div.selectPopup div.header button').click()
}
async selectFromDropdown (page: Page, point: string): Promise<void> {
await page.locator('div.selectPopup span[class*="label"]', { hasText: point }).click()
}
async createNewTalentPopup (page: Page, firstName: string, lastName: string): Promise<void> {
await page
.locator('div.popup form[id="recruit:string:CreateTalent"] input[placeholder="First name"]')
.fill(firstName)
await page.locator('div.popup form[id="recruit:string:CreateTalent"] input[placeholder="Last name"]').fill(lastName)
await page.locator('div.popup form[id="recruit:string:CreateTalent"] button[type="submit"]').click()
}
async createNewReviewPopup (page: Page, title: string, description: string): Promise<void> {
await page.locator('div.popup form[id="recruit:string:CreateReviewParams"] input[placeholder="Title"]').fill(title)
await page.locator('div.popup form[id="recruit:string:CreateReviewParams"] div.text-editor-view').fill(description)
await page.locator('div.popup form[id="recruit:string:CreateReviewParams"] button[type="submit"]').click()
}
}

View File

@ -0,0 +1,51 @@
import { expect, type Locator, type Page } from '@playwright/test'
import path from 'path'
import { CommonPage } from '../common-page'
export class ApplicationsDetailsPage extends CommonPage {
readonly page: Page
readonly inputCommentComment: Locator
readonly buttonSendComment: Locator
readonly textComment: Locator
readonly inputAddAttachment: Locator
readonly textAttachmentName: Locator
readonly buttonCreateFirstReview: Locator
readonly buttonChangeStatusDone: Locator
constructor (page: Page) {
super()
this.page = page
this.inputCommentComment = page.locator('div.tiptap')
this.buttonSendComment = page.locator('g#Send')
this.textComment = page.locator('div.msgactivity-container p')
this.inputAddAttachment = page.locator('div.antiSection #file')
this.textAttachmentName = page.locator('div.name a')
this.buttonCreateFirstReview = page.locator('span:has-text("Create review")')
this.buttonChangeStatusDone = page.locator('div[class*="aside-grid"] > div:nth-of-type(2) > button')
}
async addComment (comment: string): Promise<void> {
await this.inputCommentComment.fill(comment)
await this.buttonSendComment.click()
}
async checkCommentExist (comment: string): Promise<void> {
await expect(await this.textComment.filter({ hasText: comment })).toBeVisible()
}
async addAttachments (filePath: string): Promise<void> {
console.log(`__dirname: ${__dirname}`)
await this.inputAddAttachment.setInputFiles(path.join(__dirname, `../../files/${filePath}`))
await expect(await this.textAttachmentName.filter({ hasText: filePath })).toBeVisible()
}
async addFirstReview (): Promise<void> {
await this.buttonCreateFirstReview.click()
await this.createNewReviewPopup(this.page, 'First Review', 'First review description')
}
async changeDoneStatus (status: string): Promise<void> {
await this.buttonChangeStatusDone.click()
await this.selectFromDropdown(this.page, status)
}
}

View File

@ -0,0 +1,90 @@
import { expect, type Locator, type Page } from '@playwright/test'
import { NewApplication, TalentName } from './types'
import { CommonPage } from '../common-page'
import { generateId } from '../../utils'
export class ApplicationsPage extends CommonPage {
readonly page: Page
readonly pageHeader: Locator
readonly buttonCreateApplication: Locator
readonly buttonTalentSelector: Locator
readonly buttonSpaceSelector: Locator
readonly buttonAssignedRecruiter: Locator
readonly buttonCreateNewApplication: Locator
readonly buttonTabCreated: Locator
constructor (page: Page) {
super()
this.page = page
this.pageHeader = page.locator('span[class*="header"]', { hasText: 'Applications' })
this.buttonCreateApplication = page.locator('button > span', { hasText: 'Application' })
this.buttonTalentSelector = page.locator('div[id="vacancy.talant.selector"]')
this.buttonSpaceSelector = page.locator('div[id="space.selector"]')
this.buttonAssignedRecruiter = page.locator('button div.label', { hasText: 'Assigned recruiter' })
this.buttonCreateNewApplication = page.locator('form[id="recruit:string:CreateApplication"] button[type="submit"]')
this.buttonTabCreated = page.locator('div[data-id="tab-created"]')
}
async createNewApplication (data: NewApplication): Promise<void> {
await this.buttonCreateApplication.click()
await this.selectTalent(data.talentsName != null ? data.talentsName : 'first')
await this.selectVacancy(data.vacancy)
await this.selectRecruiter(data.recruiterName)
await this.buttonCreateNewApplication.click()
}
async createNewApplicationWithNewTalent (data: NewApplication): Promise<TalentName> {
const talentName: TalentName = {
firstName: `TestFirst-${generateId(4)}`,
lastName: `TestLast-${generateId(4)}`
}
await this.buttonCreateApplication.click()
await this.buttonTalentSelector.click()
await this.pressCreateButtonSelectPopup(this.page)
await this.createNewTalentPopup(this.page, talentName.firstName, talentName.lastName)
await this.selectVacancy(data.vacancy)
await this.selectRecruiter(data.recruiterName)
await this.buttonCreateNewApplication.click()
return talentName
}
async selectTalent (name: string): Promise<void> {
await this.buttonTalentSelector.click()
await this.fillSelectPopup(this.page, name)
}
async selectVacancy (name: string): Promise<void> {
await this.buttonSpaceSelector.click()
await this.fillSelectPopup(this.page, name)
}
async selectRecruiter (name: string): Promise<void> {
await this.buttonAssignedRecruiter.click()
await this.fillSelectPopup(this.page, name)
}
async openApplicationByTalentName (talentName: TalentName): Promise<void> {
await this.page
.locator('span.ap-label', { hasText: `${talentName.lastName} ${talentName.firstName}` })
.locator('xpath=../../../../..')
.locator('div[class*="firstCell"]')
.click()
}
async checkApplicationDoneStatus (talentName: TalentName, done: string): Promise<void> {
await expect(
await this.page
.locator('span.ap-label', { hasText: `${talentName.lastName} ${talentName.firstName}` })
.locator('xpath=../../../../..')
.locator('td')
.nth(6)
).toHaveText(done)
}
}

View File

@ -0,0 +1,13 @@
import { type Locator, type Page } from '@playwright/test'
export class NavigationMenuPage {
readonly page: Page
readonly buttonApplications: Locator
readonly buttonMyApplications: 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' })
}
}

View File

@ -0,0 +1,10 @@
export interface NewApplication {
talentsName?: string
vacancy: string
recruiterName: string
}
export interface TalentName {
firstName: string
lastName: string
}

View File

@ -1,209 +0,0 @@
import { expect, test } from '@playwright/test'
import { generateId, PlatformSetting, PlatformURI } from './utils'
test.use({
storageState: PlatformSetting
})
test.describe('recruit tests', () => {
test.beforeEach(async ({ page }) => {
// Create user and workspace
await (await page.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished()
})
test('create-candidate', async ({ page, context }) => {
await page.locator('[id="app-recruit\\:string\\:RecruitApplication"]').click()
await page.click('text=Talents')
await page.click('button:has-text("New Talent")')
const first = 'Elton-' + generateId(4)
const last = 'John-' + generateId(4)
const loc = 'Cupertino'
const email = `ej-${generateId(4)}@test.com`
const firstName = page.locator('[placeholder="First name"]')
await firstName.click()
await firstName.fill(first)
const lastName = page.locator('[placeholder="Last name"]')
await lastName.click()
await lastName.fill(last)
const title = page.locator('[placeholder="Title"]')
await title.click()
await title.fill('Super Candidate')
const location = page.locator('[placeholder="Location"]')
await location.click()
await location.fill(loc)
await page.locator('[id="presentation\\:string\\:AddSocialLinks"]').click()
await page.locator('.antiPopup').locator('text=Email').click()
const emailInput = page.locator('[placeholder="john\\.appleseed@apple\\.com"]')
await emailInput.fill(email)
await page.locator('#channel-ok.antiButton').click()
await page.locator('.antiCard button:has-text("Create")').click()
await page.waitForSelector('form.antiCard', { state: 'detached' })
await page.click(`text="${last} ${first}"`)
await expect(page.locator(`text=${first}`).first()).toBeVisible()
await expect(page.locator(`text=${last}`).first()).toBeVisible()
await expect(page.locator(`text=${loc}`).first()).toBeVisible()
const panel = page.locator('.popupPanel')
await panel.locator('[id="gmail\\:string\\:Email"]').scrollIntoViewIfNeeded()
await panel.locator('[id="gmail\\:string\\:Email"]').click()
expect(await page.locator('.cover-channel >> input').inputValue()).toEqual(email)
})
test('create-application', async ({ page }) => {
await page.locator('[id="app-recruit\\:string\\:RecruitApplication"]').click()
await page.waitForLoadState('load')
const vacancyId = 'My vacancy ' + generateId(4)
await page.locator('[id="app-recruit\\:string\\:RecruitApplication"]').click()
await page.locator('text=Vacancies').click()
await page.click('button:has-text("Vacancy")')
await page.fill('[placeholder="Software\\ Engineer"]', vacancyId)
await page.click('button:has-text("Create")')
await page.click(`tr > :has-text("${vacancyId}")`)
await page.click('text=Talents')
await page.click('text=Talents')
await page.click('text=P. Andrey')
// Click on Add button
// await page.click('.applications-container .flex-row-center .flex-center')
await page.click('button[id="appls.add"]')
await page.click('[id = "space.selector"]')
await page.fill('[placeholder="Search..."]', vacancyId)
await page.click(`button:has-text("${vacancyId}")`)
await page.waitForSelector('space.selector', { state: 'detached' })
await expect(
await page.locator('[id="recruit:string:CreateApplication"] button:has-text("HR Interview")')
).toBeVisible()
// We need to be sure state is proper one, no other way to do it.
await page.waitForTimeout(100)
await page.click('button:has-text("Create")')
await page.waitForSelector('form.antiCard', { state: 'detached' })
await page.click(`tr:has-text("${vacancyId}") >> text=APP-`)
await page.click('button:has-text("Assigned recruiter")')
await page.click('button:has-text("Chen Rosamund")')
})
test('create-vacancy', async ({ page }) => {
const vacancyId = 'My vacancy ' + generateId(4)
await page.locator('[id="app-recruit\\:string\\:RecruitApplication"]').click()
await page.locator('text=Vacancies').click()
await page.click('button:has-text("Vacancy")')
await page.fill('form [placeholder="Software\\ Engineer"]', vacancyId)
await page.click('form button:has-text("Create")')
await page.waitForSelector('form.antiCard', { state: 'detached' })
await page.click(`tr:has-text("${vacancyId}") > td:nth-child(3) >> .sm-tool-icon`)
// Create Applicatio n1
await page.click('button:has-text("Application")')
await page.click('form[id="recruit:string:CreateApplication"] [id="vacancy.talant.selector"]')
await page.click('button:has-text("P. Alex")')
await page.click('form[id="recruit:string:CreateApplication"] button:has-text("Create")')
await page.waitForSelector('form.antiCard', { state: 'detached' })
await expect(page.locator('text=APP-').first()).toBeVisible()
await expect(page.locator('text=P. Alex').first()).toBeVisible()
})
test('use-kanban', async ({ page }) => {
await page.locator('[id="app-recruit\\:string\\:RecruitApplication"]').click()
await page.locator('text=Vacancies').click()
await page.click('text=Software Engineer')
// await page.click('[name="tooltip-task:string:Kanban"]')
await page.click('.antiSection-header >> text=Applications')
await page.click('.tablist-container div:nth-child(2)')
await expect(page.locator('text=M. Marina').first()).toBeVisible()
await expect(page.locator('text=Multiseed John').first()).toBeVisible()
await expect(page.locator('text=P. Alex').first()).toBeVisible()
})
// test('application-search', async ({ page }) => {
// TODO: Application search is brokeb, since indexer now index from child to parent.
// await page.locator('[id="app-recruit\\:string\\:RecruitApplication"]').click()
// await page.locator('text=Vacancies').click()
// await page.click('text=Software Engineer')
// await expect(page.locator('text=M. Marina')).toBeVisible()
// expect(await page.locator('.antiTable-body__row').count()).toBeGreaterThan(2)
// const searchBox = page.locator('[placeholder="Search"]')
// await searchBox.fill('Frontend Engineer')
// await searchBox.press('Enter')
// await expect(page.locator('.antiTable-body__row')).toHaveCount(1)
// await searchBox.fill('')
// await searchBox.press('Enter')
// await expect(page.locator('text=M. Marina')).toBeVisible()
// expect(await page.locator('.antiTable-body__row').count()).toBeGreaterThan(2)
// })
test('create-interview', async ({ page }) => {
await page.locator('[id="app-recruit\\:string\\:RecruitApplication"]').click()
const interviewId = 'My interview ' + generateId(4)
await page.locator('[id="app-recruit\\:string\\:RecruitApplication"]').click()
await page.click('text=Reviews')
await page.click('button:has-text("Review")')
await page.click('[placeholder="Title"]')
await page.fill('[placeholder="Title"]', `Meet Peterson ${interviewId}`)
await page.click('[placeholder="Location"]')
await page.fill('[placeholder="Location"]', 'NSK')
await page.click('form button:has-text("Talent")')
await page.click('button:has-text("P. Andrey")')
await page.click('text=Create')
await page.waitForSelector('form.antiCard', { state: 'detached' })
await page.click('td:has-text("RVE-")')
})
test('test-create-skill', async ({ page }) => {
await page.click('[id="app-recruit\\:string\\:RecruitApplication"]')
await page.click('text=Skills')
await page.click('button:has-text("Skill")')
await page.click('[placeholder="Please\\ type\\ skill\\ title"]')
const skillId = 'custom-skill-' + generateId()
await page.fill('[placeholder="Please\\ type\\ skill\\ title"]', skillId)
await page.click('button:has-text("Other")')
await page.click('button:has-text("Design")')
await page.click('button:has-text("Create")')
await page.click(`text=${skillId}`)
await page.click('[placeholder="Please\\ type\\ description\\ here"]')
await page.fill('[placeholder="Please\\ type\\ description\\ here"]', 'description-' + skillId)
await page.click('button:has-text("Save")')
await page.click(`span:has-text("description-${skillId}")`)
})
})

View File

@ -0,0 +1,109 @@
import { expect, test } from '@playwright/test'
import { generateId, 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'
test.use({
storageState: PlatformSetting
})
test.describe('Application tests', () => {
test.beforeEach(async ({ page }) => {
// Create user and workspace
await (await page.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished()
})
test('create application', async ({ page }) => {
await page.locator('[id="app-recruit\\:string\\:RecruitApplication"]').click()
await page.waitForLoadState('load')
const vacancyId = 'My vacancy ' + generateId(4)
await page.locator('[id="app-recruit\\:string\\:RecruitApplication"]').click()
await page.locator('text=Vacancies').click()
await page.click('button:has-text("Vacancy")')
await page.fill('[placeholder="Software\\ Engineer"]', vacancyId)
await page.click('button:has-text("Create")')
await page.click(`tr > :has-text("${vacancyId}")`)
await page.click('text=Talents')
await page.click('text=Talents')
await page.click('text=P. Andrey')
// Click on Add button
// await page.click('.applications-container .flex-row-center .flex-center')
await page.click('button[id="appls.add"]')
await page.click('[id = "space.selector"]')
await page.fill('[placeholder="Search..."]', vacancyId)
await page.click(`button:has-text("${vacancyId}")`)
await page.waitForSelector('space.selector', { state: 'detached' })
await expect(
await page.locator('[id="recruit:string:CreateApplication"] button:has-text("HR Interview")')
).toBeVisible()
// We need to be sure state is proper one, no other way to do it.
await page.waitForTimeout(100)
await page.click('button:has-text("Create")')
await page.waitForSelector('form.antiCard', { state: 'detached' })
await page.click(`tr:has-text("${vacancyId}") >> text=APP-`)
await page.click('button:has-text("Assigned recruiter")')
await page.click('button:has-text("Chen Rosamund")')
})
test('Edit an Application', async ({ page }) => {
const navigationMenuPage = new NavigationMenuPage(page)
await navigationMenuPage.buttonApplications.click()
const applicationsPage = new ApplicationsPage(page)
const talentName = await applicationsPage.createNewApplicationWithNewTalent({
vacancy: 'first',
recruiterName: 'first'
})
await applicationsPage.openApplicationByTalentName(talentName)
const applicationsDetailsPage = new ApplicationsDetailsPage(page)
await applicationsDetailsPage.addComment('Test Comment 123')
await applicationsDetailsPage.checkCommentExist('Test Comment 123')
await applicationsDetailsPage.addAttachments('cat.jpeg')
await applicationsDetailsPage.addFirstReview()
})
test('Change Done status', async ({ page }) => {
const navigationMenuPage = new NavigationMenuPage(page)
await navigationMenuPage.buttonApplications.click()
let applicationsPage = new ApplicationsPage(page)
const talentName = await applicationsPage.createNewApplicationWithNewTalent({
vacancy: 'first',
recruiterName: 'first'
})
await applicationsPage.openApplicationByTalentName(talentName)
let applicationsDetailsPage = new ApplicationsDetailsPage(page)
await applicationsDetailsPage.changeDoneStatus('Lost')
await navigationMenuPage.buttonMyApplications.click()
applicationsPage = new ApplicationsPage(page)
await applicationsPage.buttonTabCreated.click()
await applicationsPage.checkApplicationDoneStatus(talentName, 'Lost')
await applicationsPage.openApplicationByTalentName(talentName)
applicationsDetailsPage = new ApplicationsDetailsPage(page)
await applicationsDetailsPage.changeDoneStatus('Won')
await navigationMenuPage.buttonMyApplications.click()
applicationsPage = new ApplicationsPage(page)
await applicationsPage.buttonTabCreated.click()
await applicationsPage.checkApplicationDoneStatus(talentName, 'Won')
})
})

View File

@ -0,0 +1,38 @@
import { test } from '@playwright/test'
import { generateId, PlatformSetting, PlatformURI } from '../utils'
test.use({
storageState: PlatformSetting
})
test.describe('interview tests', () => {
test.beforeEach(async ({ page }) => {
// Create user and workspace
await (await page.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished()
})
test.skip('create-interview', async ({ page }) => {
await page.locator('[id="app-recruit\\:string\\:RecruitApplication"]').click()
const interviewId = 'My interview ' + generateId(4)
await page.locator('[id="app-recruit\\:string\\:RecruitApplication"]').click()
await page.click('text=Reviews')
await page.click('button:has-text("Review")')
await page.click('[placeholder="Title"]')
await page.fill('[placeholder="Title"]', `Meet Peterson ${interviewId}`)
await page.click('[placeholder="Location"]')
await page.fill('[placeholder="Location"]', 'NSK')
await page.click('form button:has-text("Talent")')
await page.click('button:has-text("P. Andrey")')
await page.click('text=Create')
await page.waitForSelector('form.antiCard', { state: 'detached' })
await page.click('td:has-text("RVE-")')
})
})

View File

@ -1,11 +1,11 @@
import { test } from '@playwright/test'
import { generateId, PlatformSetting, PlatformURI } from './utils'
import { generateId, PlatformSetting, PlatformURI } from '../utils'
test.use({
storageState: PlatformSetting
})
test.describe('recruit review tests', () => {
test.describe('review tests', () => {
test.beforeEach(async ({ page }) => {
// Create user and workspace
await (await page.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished()

View File

@ -0,0 +1,30 @@
import { test } from '@playwright/test'
import { generateId, PlatformSetting, PlatformURI } from '../utils'
test.use({
storageState: PlatformSetting
})
test.describe('skill tests', () => {
test.beforeEach(async ({ page }) => {
// Create user and workspace
await (await page.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished()
})
test.skip('create skill', async ({ page }) => {
await page.click('[id="app-recruit\\:string\\:RecruitApplication"]')
await page.click('text=Skills')
await page.click('button:has-text("Skill")')
await page.click('[placeholder="Please\\ type\\ skill\\ title"]')
const skillId = 'custom-skill-' + generateId()
await page.fill('[placeholder="Please\\ type\\ skill\\ title"]', skillId)
await page.click('button:has-text("Other")')
await page.click('button:has-text("Design")')
await page.click('button:has-text("Create")')
await page.click(`text=${skillId}`)
await page.click('[placeholder="Please\\ type\\ description\\ here"]')
await page.fill('[placeholder="Please\\ type\\ description\\ here"]', 'description-' + skillId)
await page.click('button:has-text("Save")')
await page.click(`span:has-text("description-${skillId}")`)
})
})

View File

@ -0,0 +1,61 @@
import { expect, test } from '@playwright/test'
import { generateId, PlatformSetting, PlatformURI } from '../utils'
test.use({
storageState: PlatformSetting
})
test.describe('candidate tests', () => {
test.beforeEach(async ({ page }) => {
// Create user and workspace
await (await page.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished()
})
test('create-candidate', async ({ page, context }) => {
await page.locator('[id="app-recruit\\:string\\:RecruitApplication"]').click()
await page.click('text=Talents')
await page.click('button:has-text("New Talent")')
const first = 'Elton-' + generateId(4)
const last = 'John-' + generateId(4)
const loc = 'Cupertino'
const email = `ej-${generateId(4)}@test.com`
const firstName = page.locator('[placeholder="First name"]')
await firstName.click()
await firstName.fill(first)
const lastName = page.locator('[placeholder="Last name"]')
await lastName.click()
await lastName.fill(last)
const title = page.locator('[placeholder="Title"]')
await title.click()
await title.fill('Super Candidate')
const location = page.locator('[placeholder="Location"]')
await location.click()
await location.fill(loc)
await page.locator('[id="presentation\\:string\\:AddSocialLinks"]').click()
await page.locator('.antiPopup').locator('text=Email').click()
const emailInput = page.locator('[placeholder="john\\.appleseed@apple\\.com"]')
await emailInput.fill(email)
await page.locator('#channel-ok.antiButton').click()
await page.locator('.antiCard button:has-text("Create")').click()
await page.waitForSelector('form.antiCard', { state: 'detached' })
await page.click(`text="${last} ${first}"`)
await expect(page.locator(`text=${first}`).first()).toBeVisible()
await expect(page.locator(`text=${last}`).first()).toBeVisible()
await expect(page.locator(`text=${loc}`).first()).toBeVisible()
const panel = page.locator('.popupPanel')
await panel.locator('[id="gmail\\:string\\:Email"]').scrollIntoViewIfNeeded()
await panel.locator('[id="gmail\\:string\\:Email"]').click()
expect(await page.locator('.cover-channel >> input').inputValue()).toEqual(email)
})
})

View File

@ -0,0 +1,76 @@
import { expect, test } from '@playwright/test'
import { generateId, PlatformSetting, PlatformURI } from '../utils'
test.use({
storageState: PlatformSetting
})
test.describe('recruit tests', () => {
test.beforeEach(async ({ page }) => {
// Create user and workspace
await (await page.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished()
})
test('create-vacancy', async ({ page }) => {
const vacancyId = 'My vacancy ' + generateId(4)
await page.locator('[id="app-recruit\\:string\\:RecruitApplication"]').click()
await page.locator('text=Vacancies').click()
await page.click('button:has-text("Vacancy")')
await page.fill('form [placeholder="Software\\ Engineer"]', vacancyId)
await page.click('form button:has-text("Create")')
await page.waitForSelector('form.antiCard', { state: 'detached' })
await page.click(`tr:has-text("${vacancyId}") > td:nth-child(3) >> .sm-tool-icon`)
// Create Application1
await page.click('button:has-text("Application")')
await page.click('form[id="recruit:string:CreateApplication"] [id="vacancy.talant.selector"]')
await page.click('button:has-text("P. Alex")')
await page.click('form[id="recruit:string:CreateApplication"] button:has-text("Create")')
await page.waitForSelector('form.antiCard', { state: 'detached' })
await expect(page.locator('text=APP-').first()).toBeVisible()
await expect(page.locator('text=P. Alex').first()).toBeVisible()
})
test('use-kanban', async ({ page }) => {
await page.locator('[id="app-recruit\\:string\\:RecruitApplication"]').click()
await page.locator('text=Vacancies').click()
await page.click('text=Software Engineer')
// await page.click('[name="tooltip-task:string:Kanban"]')
await page.click('.antiSection-header >> text=Applications')
await page.click('.tablist-container div:nth-child(2)')
await expect(page.locator('text=M. Marina').first()).toBeVisible()
await expect(page.locator('text=Multiseed John').first()).toBeVisible()
await expect(page.locator('text=P. Alex').first()).toBeVisible()
})
// test('application-search', async ({ page }) => {
// TODO: Application search is brokeb, since indexer now index from child to parent.
// await page.locator('[id="app-recruit\\:string\\:RecruitApplication"]').click()
// await page.locator('text=Vacancies').click()
// await page.click('text=Software Engineer')
// await expect(page.locator('text=M. Marina')).toBeVisible()
// expect(await page.locator('.antiTable-body__row').count()).toBeGreaterThan(2)
// const searchBox = page.locator('[placeholder="Search"]')
// await searchBox.fill('Frontend Engineer')
// await searchBox.press('Enter')
// await expect(page.locator('.antiTable-body__row')).toHaveCount(1)
// await searchBox.fill('')
// await searchBox.press('Enter')
// await expect(page.locator('text=M. Marina')).toBeVisible()
// expect(await page.locator('.antiTable-body__row').count()).toBeGreaterThan(2)
// })
})