diff --git a/tests/sanity/tests/actions.spec.ts b/tests/sanity/tests/actions.spec.ts index d83595389d..45c63faaf7 100644 --- a/tests/sanity/tests/actions.spec.ts +++ b/tests/sanity/tests/actions.spec.ts @@ -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"]') diff --git a/tests/sanity/tests/files/cat.jpeg b/tests/sanity/tests/files/cat.jpeg new file mode 100644 index 0000000000..df681d18e1 Binary files /dev/null and b/tests/sanity/tests/files/cat.jpeg differ diff --git a/tests/sanity/tests/model/common-page.ts b/tests/sanity/tests/model/common-page.ts new file mode 100644 index 0000000000..e0493ffe43 --- /dev/null +++ b/tests/sanity/tests/model/common-page.ts @@ -0,0 +1,32 @@ +import { Page } from '@playwright/test' + +export class CommonPage { + async fillSelectPopup (page: Page, name: string): Promise { + 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 { + await page.locator('div.selectPopup div.header button').click() + } + + async selectFromDropdown (page: Page, point: string): Promise { + await page.locator('div.selectPopup span[class*="label"]', { hasText: point }).click() + } + + async createNewTalentPopup (page: Page, firstName: string, lastName: string): Promise { + 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 { + 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() + } +} diff --git a/tests/sanity/tests/model/recruiting/applications-details-page.ts b/tests/sanity/tests/model/recruiting/applications-details-page.ts new file mode 100644 index 0000000000..32f8e93cfc --- /dev/null +++ b/tests/sanity/tests/model/recruiting/applications-details-page.ts @@ -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 { + await this.inputCommentComment.fill(comment) + await this.buttonSendComment.click() + } + + async checkCommentExist (comment: string): Promise { + await expect(await this.textComment.filter({ hasText: comment })).toBeVisible() + } + + async addAttachments (filePath: string): Promise { + 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 { + await this.buttonCreateFirstReview.click() + await this.createNewReviewPopup(this.page, 'First Review', 'First review description') + } + + async changeDoneStatus (status: string): Promise { + await this.buttonChangeStatusDone.click() + await this.selectFromDropdown(this.page, status) + } +} diff --git a/tests/sanity/tests/model/recruiting/applications-page.ts b/tests/sanity/tests/model/recruiting/applications-page.ts new file mode 100644 index 0000000000..0fdc8d89d3 --- /dev/null +++ b/tests/sanity/tests/model/recruiting/applications-page.ts @@ -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 { + 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 { + 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 { + await this.buttonTalentSelector.click() + await this.fillSelectPopup(this.page, name) + } + + async selectVacancy (name: string): Promise { + await this.buttonSpaceSelector.click() + await this.fillSelectPopup(this.page, name) + } + + async selectRecruiter (name: string): Promise { + await this.buttonAssignedRecruiter.click() + await this.fillSelectPopup(this.page, name) + } + + async openApplicationByTalentName (talentName: TalentName): Promise { + 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 { + await expect( + await this.page + .locator('span.ap-label', { hasText: `${talentName.lastName} ${talentName.firstName}` }) + .locator('xpath=../../../../..') + .locator('td') + .nth(6) + ).toHaveText(done) + } +} diff --git a/tests/sanity/tests/model/recruiting/navigation-menu-page.ts b/tests/sanity/tests/model/recruiting/navigation-menu-page.ts new file mode 100644 index 0000000000..9d5921dd56 --- /dev/null +++ b/tests/sanity/tests/model/recruiting/navigation-menu-page.ts @@ -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' }) + } +} diff --git a/tests/sanity/tests/model/recruiting/types.ts b/tests/sanity/tests/model/recruiting/types.ts new file mode 100644 index 0000000000..818e2c1688 --- /dev/null +++ b/tests/sanity/tests/model/recruiting/types.ts @@ -0,0 +1,10 @@ +export interface NewApplication { + talentsName?: string + vacancy: string + recruiterName: string +} + +export interface TalentName { + firstName: string + lastName: string +} diff --git a/tests/sanity/tests/recruit.spec.ts b/tests/sanity/tests/recruit.spec.ts deleted file mode 100644 index b1a92fe83b..0000000000 --- a/tests/sanity/tests/recruit.spec.ts +++ /dev/null @@ -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}")`) - }) -}) diff --git a/tests/sanity/tests/recruiting/applications.spec.ts b/tests/sanity/tests/recruiting/applications.spec.ts new file mode 100644 index 0000000000..fc948a117e --- /dev/null +++ b/tests/sanity/tests/recruiting/applications.spec.ts @@ -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') + }) +}) diff --git a/tests/sanity/tests/recruiting/interview.spec.ts b/tests/sanity/tests/recruiting/interview.spec.ts new file mode 100644 index 0000000000..5ff5f78f0d --- /dev/null +++ b/tests/sanity/tests/recruiting/interview.spec.ts @@ -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-")') + }) +}) diff --git a/tests/sanity/tests/recruit.review.spec.ts b/tests/sanity/tests/recruiting/reviews.spec.ts similarity index 92% rename from tests/sanity/tests/recruit.review.spec.ts rename to tests/sanity/tests/recruiting/reviews.spec.ts index 3fae36926c..4ca2abbbac 100644 --- a/tests/sanity/tests/recruit.review.spec.ts +++ b/tests/sanity/tests/recruiting/reviews.spec.ts @@ -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() diff --git a/tests/sanity/tests/recruiting/skills.spec.ts b/tests/sanity/tests/recruiting/skills.spec.ts new file mode 100644 index 0000000000..20cb205808 --- /dev/null +++ b/tests/sanity/tests/recruiting/skills.spec.ts @@ -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}")`) + }) +}) diff --git a/tests/sanity/tests/recruiting/talents.spec.ts b/tests/sanity/tests/recruiting/talents.spec.ts new file mode 100644 index 0000000000..447dc03ab8 --- /dev/null +++ b/tests/sanity/tests/recruiting/talents.spec.ts @@ -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) + }) +}) diff --git a/tests/sanity/tests/recruiting/vacancies.spec.ts b/tests/sanity/tests/recruiting/vacancies.spec.ts new file mode 100644 index 0000000000..a7ad216985 --- /dev/null +++ b/tests/sanity/tests/recruiting/vacancies.spec.ts @@ -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) + // }) +})