-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TESTS-18: feat(tests): added edit vacancy test (#3901)
Signed-off-by: Alex Velichko <nestor_007@mail.ru>
- Loading branch information
1 parent
156741c
commit b9a9c8c
Showing
7 changed files
with
151 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { expect, type Locator, type Page } from '@playwright/test' | ||
import { NewVacancy } from './types' | ||
import { CommonRecruitingPage } from './common-recruiting-page' | ||
|
||
export class VacanciesPage extends CommonRecruitingPage { | ||
readonly page: Page | ||
readonly pageHeader: Locator | ||
readonly buttonCreateNewVacancy: Locator | ||
readonly textTableFirstCell: Locator | ||
readonly inputCreateVacancyTitle: Locator | ||
readonly inputCreateVacancyDescription: Locator | ||
readonly buttonCreateVacancyLocation: Locator | ||
readonly buttonCreateVacancy: Locator | ||
|
||
constructor (page: Page) { | ||
super(page) | ||
this.page = page | ||
this.pageHeader = page.locator('span[class*="header"]', { hasText: 'Vacancies' }) | ||
this.buttonCreateNewVacancy = page.locator('button > span', { hasText: 'Vacancy' }) | ||
this.textTableFirstCell = page.locator('div[class$="firstCell"]') | ||
this.inputCreateVacancyTitle = page.locator('form[id="recruit:string:CreateVacancy"] input[type="text"]') | ||
this.inputCreateVacancyDescription = page.locator('form[id="recruit:string:CreateVacancy"] div.text-editor-view') | ||
this.buttonCreateVacancyLocation = page.locator('form[id="recruit:string:CreateVacancy"] button span', { | ||
hasText: 'Location' | ||
}) | ||
this.buttonCreateVacancy = page.locator('form[id="recruit:string:CreateVacancy"] button[type="submit"]') | ||
} | ||
|
||
async createNewVacancy ({ title, description, location }: NewVacancy): Promise<void> { | ||
await this.buttonCreateNewVacancy.click() | ||
|
||
await this.inputCreateVacancyTitle.fill(title) | ||
await this.inputCreateVacancyDescription.fill(description) | ||
if (location != null) { | ||
await this.buttonCreateVacancyLocation.click() | ||
await this.fillToSelectPopup(this.page, location) | ||
} | ||
|
||
await this.buttonCreateVacancy.click() | ||
} | ||
|
||
async openVacancyByName (vacancyName: string): Promise<void> { | ||
await this.page.locator('tr', { hasText: vacancyName }).locator('div[class$="firstCell"]').click() | ||
} | ||
|
||
async checkVacancyNotExist (vacancyName: string): Promise<void> { | ||
await expect(this.page.locator('tr', { hasText: vacancyName })).toHaveCount(0) | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
tests/sanity/tests/model/recruiting/vacancy-details-page.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { expect, type Locator, type Page } from '@playwright/test' | ||
import { CommonRecruitingPage } from './common-recruiting-page' | ||
import path from 'path' | ||
|
||
export class VacancyDetailsPage extends CommonRecruitingPage { | ||
readonly page: Page | ||
readonly inputDescription: Locator | ||
readonly buttonInputDescription: Locator | ||
readonly buttonInputLocation: Locator | ||
readonly inputAttachFile: Locator | ||
readonly buttonInputCompany: Locator | ||
readonly buttonInputDueDate: Locator | ||
readonly buttonDatePopupToday: Locator | ||
readonly buttonDatePopupSave: Locator | ||
readonly inputComment: Locator | ||
|
||
constructor (page: Page) { | ||
super(page) | ||
this.page = page | ||
this.inputDescription = page.locator('div[class*="full"] div.tiptap') | ||
this.buttonInputDescription = page.locator('button > span', { hasText: 'Description' }) | ||
this.buttonInputLocation = page.locator('button > span', { hasText: 'Location' }) | ||
this.inputAttachFile = page.locator('div[class*="full"] input[name="file"]') | ||
this.buttonInputCompany = page.locator('button > div', { hasText: 'Company' }) | ||
this.buttonInputDueDate = page.locator('button > div', { hasText: 'Due date' }) | ||
this.buttonDatePopupToday = page.locator('div.popup div.today') | ||
this.buttonDatePopupSave = page.locator('div.popup button[type="submit"]') | ||
this.inputComment = page.locator('div.text-input div.tiptap') | ||
} | ||
|
||
async addComment (comment: string): Promise<void> { | ||
await this.inputComment.fill(comment) | ||
await this.buttonSendComment.click() | ||
} | ||
|
||
async addAttachments (filePath: string): Promise<void> { | ||
await this.inputAttachFile.setInputFiles(path.join(__dirname, `../../files/${filePath}`)) | ||
await expect(await this.textAttachmentName.filter({ hasText: filePath })).toBeVisible() | ||
} | ||
|
||
async addDescription (description: string): Promise<void> { | ||
await this.buttonInputDescription.click() | ||
await this.fillToSelectPopup(this.page, description) | ||
} | ||
|
||
async addLocation (location: string): Promise<void> { | ||
await this.buttonInputLocation.click() | ||
await this.fillToSelectPopup(this.page, location) | ||
} | ||
|
||
async addCompany (company: string): Promise<void> { | ||
await this.buttonInputCompany.click() | ||
await this.selectMenuItem(this.page, company) | ||
} | ||
|
||
async addDueDateToday (): Promise<void> { | ||
await this.buttonInputDueDate.click() | ||
await this.buttonDatePopupToday.click() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters