Skip to content
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
4 changes: 4 additions & 0 deletions tests/sanity/tests/model/common-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,8 @@ export class CommonPage {
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()
}

async pressYesDeletePopup (page: Page): Promise<void> {
await page.locator('form[id="view:string:DeleteObject"] button.accented').click()
}
}
19 changes: 18 additions & 1 deletion tests/sanity/tests/model/recruiting/applications-details-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ export class ApplicationsDetailsPage extends CommonPage {
readonly textAttachmentName: Locator
readonly buttonCreateFirstReview: Locator
readonly buttonChangeStatusDone: Locator
readonly textApplicationId: Locator
readonly buttonMoreActions: Locator
readonly buttonDelete: Locator

constructor (page: Page) {
super()
Expand All @@ -22,6 +25,9 @@ export class ApplicationsDetailsPage extends CommonPage {
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')
this.textApplicationId = page.locator('div.popupPanel-title div.title-wrapper > span')
this.buttonMoreActions = page.locator('div.popupPanel-title div.buttons-group > button:nth-of-type(2)')
this.buttonDelete = page.locator('button[class*="menuItem"] span', { hasText: 'Delete' })
}

async addComment (comment: string): Promise<void> {
Expand All @@ -34,7 +40,6 @@ export class ApplicationsDetailsPage extends CommonPage {
}

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()
}
Expand All @@ -48,4 +53,16 @@ export class ApplicationsDetailsPage extends CommonPage {
await this.buttonChangeStatusDone.click()
await this.selectFromDropdown(this.page, status)
}

async getApplicationId (): Promise<string> {
const applicationId = await this.textApplicationId.textContent()
expect(applicationId !== null).toBeTruthy()
return applicationId != null ? applicationId : ''
}

async deleteApplication (): Promise<void> {
await this.buttonMoreActions.click()
await this.buttonDelete.click()
await this.pressYesDeletePopup(this.page)
}
}
6 changes: 6 additions & 0 deletions tests/sanity/tests/model/recruiting/applications-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export class ApplicationsPage extends CommonPage {
readonly buttonAssignedRecruiter: Locator
readonly buttonCreateNewApplication: Locator
readonly buttonTabCreated: Locator
readonly textTableFirstCell: Locator

constructor (page: Page) {
super()
Expand All @@ -23,6 +24,7 @@ export class ApplicationsPage extends CommonPage {
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"]')
this.textTableFirstCell = page.locator('div[class$="firstCell"]')
}

async createNewApplication (data: NewApplication): Promise<void> {
Expand Down Expand Up @@ -87,4 +89,8 @@ export class ApplicationsPage extends CommonPage {
.nth(6)
).toHaveText(done)
}

async checkApplicationNotExist (applicationId: string): Promise<void> {
await expect(await this.textTableFirstCell.filter({ hasText: applicationId })).toHaveCount(0)
}
}
22 changes: 22 additions & 0 deletions tests/sanity/tests/recruiting/applications.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ test.describe('Application tests', () => {
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)

Expand Down Expand Up @@ -106,4 +107,25 @@ test.describe('Application tests', () => {
await applicationsPage.buttonTabCreated.click()
await applicationsPage.checkApplicationDoneStatus(talentName, 'Won')
})

test('Delete 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)
const applicationId = await applicationsDetailsPage.getApplicationId()

await applicationsDetailsPage.deleteApplication()
expect(page.url()).toContain(applicationId)

await navigationMenuPage.buttonApplications.click()
await applicationsPage.checkApplicationNotExist(applicationId)
})
})