mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-10 19:57:43 +02:00
feat(tests): added delete application test (#3859)
Signed-off-by: Alex Velichko <nestor_007@mail.ru>
This commit is contained in:
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
@@ -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> {
|
||||
@@ -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()
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
@@ -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> {
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user