feat(tests): TESTS-10 added the Delete the Talent test (#3883)

Signed-off-by: Alex Velichko <nestor_007@mail.ru>
This commit is contained in:
Alex Velichko 2023-10-25 10:03:25 +03:00 committed by GitHub
parent 56dcbeb0cd
commit 10d5993d02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 11 deletions

View File

@ -29,12 +29,6 @@ export class ApplicationsDetailsPage extends CommonRecruitingPage {
return applicationId != null ? applicationId : '' return applicationId != null ? applicationId : ''
} }
async deleteApplication (): Promise<void> {
await this.buttonMoreActions.click()
await this.buttonDelete.click()
await this.pressYesDeletePopup(this.page)
}
async changeState (status: string): Promise<void> { async changeState (status: string): Promise<void> {
await this.buttonState.click() await this.buttonState.click()
await this.selectFromDropdown(this.page, status) await this.selectFromDropdown(this.page, status)

View File

@ -81,7 +81,7 @@ export class ApplicationsPage extends CommonRecruitingPage {
async checkApplicationDoneStatus (talentName: TalentName, done: string): Promise<void> { async checkApplicationDoneStatus (talentName: TalentName, done: string): Promise<void> {
await expect( await expect(
await this.page this.page
.locator('tr', { hasText: `${talentName.lastName} ${talentName.firstName}` }) .locator('tr', { hasText: `${talentName.lastName} ${talentName.firstName}` })
.locator('td') .locator('td')
.nth(6) .nth(6)
@ -90,7 +90,7 @@ export class ApplicationsPage extends CommonRecruitingPage {
async checkApplicationState (talentName: TalentName, done: string): Promise<void> { async checkApplicationState (talentName: TalentName, done: string): Promise<void> {
await expect( await expect(
await this.page this.page
.locator('tr', { hasText: `${talentName.lastName} ${talentName.firstName}` }) .locator('tr', { hasText: `${talentName.lastName} ${talentName.firstName}` })
.locator('td') .locator('td')
.nth(5) .nth(5)
@ -98,7 +98,7 @@ export class ApplicationsPage extends CommonRecruitingPage {
} }
async checkApplicationNotExist (applicationId: string): Promise<void> { async checkApplicationNotExist (applicationId: string): Promise<void> {
await expect(await this.textTableFirstCell.filter({ hasText: applicationId })).toHaveCount(0) await expect(this.textTableFirstCell.filter({ hasText: applicationId })).toHaveCount(0)
} }
async changeApplicationStatus (talentName: TalentName, status: string): Promise<void> { async changeApplicationStatus (talentName: TalentName, status: string): Promise<void> {

View File

@ -1,4 +1,4 @@
import { type Locator, type Page } from '@playwright/test' import { expect, type Locator, type Page } from '@playwright/test'
import { TalentName } from './types' import { TalentName } from './types'
import { generateId } from '../../utils' import { generateId } from '../../utils'
import { CommonRecruitingPage } from './common-recruiting-page' import { CommonRecruitingPage } from './common-recruiting-page'
@ -7,12 +7,14 @@ export class TalentsPage extends CommonRecruitingPage {
readonly page: Page readonly page: Page
readonly pageHeader: Locator readonly pageHeader: Locator
readonly buttonCreateTalent: Locator readonly buttonCreateTalent: Locator
readonly textTableFirstCell: Locator
constructor (page: Page) { constructor (page: Page) {
super(page) super(page)
this.page = page this.page = page
this.pageHeader = page.locator('span[class*="header"]', { hasText: 'Talents' }) this.pageHeader = page.locator('span[class*="header"]', { hasText: 'Talents' })
this.buttonCreateTalent = page.locator('div[class*="ac-header"] button > span', { hasText: 'Talent' }) this.buttonCreateTalent = page.locator('div[class*="ac-header"] button > span', { hasText: 'Talent' })
this.textTableFirstCell = page.locator('div[class$="firstCell"]')
} }
async createNewTalent (): Promise<TalentName> { async createNewTalent (): Promise<TalentName> {
@ -31,4 +33,8 @@ export class TalentsPage extends CommonRecruitingPage {
.locator('div[class$="firstCell"]') .locator('div[class$="firstCell"]')
.click() .click()
} }
async checkTalentNotExist (talentName: TalentName): Promise<void> {
await expect(this.page.locator('tr', { hasText: `${talentName.lastName} ${talentName.firstName}` })).toHaveCount(0)
}
} }

View File

@ -122,7 +122,7 @@ test.describe('Application tests', () => {
const applicationsDetailsPage = new ApplicationsDetailsPage(page) const applicationsDetailsPage = new ApplicationsDetailsPage(page)
const applicationId = await applicationsDetailsPage.getApplicationId() const applicationId = await applicationsDetailsPage.getApplicationId()
await applicationsDetailsPage.deleteApplication() await applicationsDetailsPage.deleteEntity()
expect(page.url()).toContain(applicationId) expect(page.url()).toContain(applicationId)
await navigationMenuPage.buttonApplications.click() await navigationMenuPage.buttonApplications.click()

View File

@ -91,4 +91,20 @@ test.describe('candidate/talents tests', () => {
const title = `Title-${generateId(4)}` const title = `Title-${generateId(4)}`
await talentDetailsPage.addTitle(title) await talentDetailsPage.addTitle(title)
}) })
test('Delete the Talent', async ({ page, context }) => {
const navigationMenuPage = new NavigationMenuPage(page)
await navigationMenuPage.buttonTalents.click()
const talentsPage = new TalentsPage(page)
const talentName = await talentsPage.createNewTalent()
await talentsPage.openTalentByTalentName(talentName)
const talentDetailsPage = new TalentDetailsPage(page)
await talentDetailsPage.inputLocation.fill('Awesome Location')
await talentDetailsPage.deleteEntity()
await navigationMenuPage.buttonTalents.click()
await talentsPage.checkTalentNotExist(talentName)
})
}) })