feat(tests): Added Change & Save all States test (#3863)

Signed-off-by: Alex Velichko <nestor_007@mail.ru>
This commit is contained in:
Alex Velichko 2023-10-23 18:25:04 +03:00 committed by GitHub
parent dfbd48cc7a
commit 26f533bc88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 57 additions and 5 deletions

View File

@ -14,6 +14,7 @@ export class ApplicationsDetailsPage extends CommonPage {
readonly textApplicationId: Locator
readonly buttonMoreActions: Locator
readonly buttonDelete: Locator
readonly buttonState: Locator
constructor (page: Page) {
super()
@ -28,6 +29,10 @@ export class ApplicationsDetailsPage extends CommonPage {
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' })
this.buttonState = page
.locator('div[class*="collapsed-container"]')
.nth(0)
.locator('div[class*="aside-grid"] > div:nth-of-type(1) > button')
}
async addComment (comment: string): Promise<void> {
@ -56,7 +61,7 @@ export class ApplicationsDetailsPage extends CommonPage {
async getApplicationId (): Promise<string> {
const applicationId = await this.textApplicationId.textContent()
expect(applicationId !== null).toBeTruthy()
await expect(applicationId !== null).toBeTruthy()
return applicationId != null ? applicationId : ''
}
@ -65,4 +70,10 @@ export class ApplicationsDetailsPage extends CommonPage {
await this.buttonDelete.click()
await this.pressYesDeletePopup(this.page)
}
async changeState (status: string): Promise<void> {
await this.buttonState.click()
await this.selectFromDropdown(this.page, status)
await expect(await this.buttonState).toContainText(status)
}
}

View File

@ -74,8 +74,7 @@ export class ApplicationsPage extends CommonPage {
async openApplicationByTalentName (talentName: TalentName): Promise<void> {
await this.page
.locator('span.ap-label', { hasText: `${talentName.lastName} ${talentName.firstName}` })
.locator('xpath=../../../../..')
.locator('tr', { hasText: `${talentName.lastName} ${talentName.firstName}` })
.locator('div[class*="firstCell"]')
.click()
}
@ -83,14 +82,31 @@ export class ApplicationsPage extends CommonPage {
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('tr', { hasText: `${talentName.lastName} ${talentName.firstName}` })
.locator('td')
.nth(6)
).toHaveText(done)
}
async checkApplicationState (talentName: TalentName, done: string): Promise<void> {
await expect(
await this.page
.locator('tr', { hasText: `${talentName.lastName} ${talentName.firstName}` })
.locator('td')
.nth(5)
).toHaveText(done)
}
async checkApplicationNotExist (applicationId: string): Promise<void> {
await expect(await this.textTableFirstCell.filter({ hasText: applicationId })).toHaveCount(0)
}
async changeApplicationStatus (talentName: TalentName, status: string): Promise<void> {
await this.page
.locator('tr', { hasText: `${talentName.lastName} ${talentName.firstName}` })
.locator('td')
.nth(5)
.click()
await this.selectFromDropdown(this.page, status)
}
}

View File

@ -128,4 +128,29 @@ test.describe('Application tests', () => {
await navigationMenuPage.buttonApplications.click()
await applicationsPage.checkApplicationNotExist(applicationId)
})
test('Change & Save all States', 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.checkApplicationState(talentName, 'HR Interview')
await applicationsPage.openApplicationByTalentName(talentName)
let applicationsDetailsPage = new ApplicationsDetailsPage(page)
await applicationsDetailsPage.changeState('Technical Interview')
await navigationMenuPage.buttonApplications.click()
await applicationsPage.checkApplicationState(talentName, 'Technical Interview')
await applicationsPage.changeApplicationStatus(talentName, 'Test task')
await applicationsPage.checkApplicationState(talentName, 'Test task')
await applicationsPage.openApplicationByTalentName(talentName)
applicationsDetailsPage = new ApplicationsDetailsPage(page)
await applicationsDetailsPage.changeState('Offer')
})
})