diff --git a/tests/sanity/tests/model/common-page.ts b/tests/sanity/tests/model/common-page.ts index 55da551ee14..925278244d7 100644 --- a/tests/sanity/tests/model/common-page.ts +++ b/tests/sanity/tests/model/common-page.ts @@ -49,9 +49,11 @@ export class CommonPage { menuPopupItemButton = (itemText: string): Locator => this.page.locator('div.selectPopup button.menu-item', { hasText: itemText }) - buttonFilter = (): Locator => this.page.getByRole('button', { name: 'Filter' }) + buttonFilter = (): Locator => this.page.locator('.hulyHeader-container button:has-text("Filter")') inputFilterTitle = (): Locator => this.page.locator('div.selectPopup input[placeholder="Title"]') + inputFilterSource = (): Locator => this.page.locator('div.selectPopup input[placeholder="Source"]') inputFilterName = (): Locator => this.page.locator('div.selectPopup input[placeholder="Name"]') + inputFilter = (name: string): Locator => this.page.locator(`div.selectPopup input[placeholder="${name}"]`) inputSearch = (): Locator => this.page.locator('div.selectPopup input[placeholder="Search..."]') buttonFilterApply = (): Locator => this.page.locator('div.selectPopup button[type="button"]', { hasText: 'Apply' }) buttonClearFilters = (): Locator => this.page.locator('button > span', { hasText: 'Clear filters' }) @@ -227,22 +229,32 @@ export class CommonPage { case 'Labels': await this.selectFromDropdown(this.page, filterSecondLevel) break + case 'Location': + await this.inputFilter(filter).fill(filterSecondLevel) + await this.buttonFilterApply().click() + break case 'Skills': await this.inputSearch().fill(filterSecondLevel) await this.selectFromDropdown(this.page, filterSecondLevel) await this.page.keyboard.press('Escape') break + case 'Source': + await this.inputFilterSource().fill(filterSecondLevel) + await this.buttonFilterApply().click() + break default: await this.selectPopupMenu(filterSecondLevel).click() } } } - async filterOppositeCondition (filter: string, conditionBefore: string, conditionAfter: string): Promise { + async filterOppositeCondition (filter: string, conditionBefore: string, conditionAfter?: string): Promise { const filterSection = this.selectFilterSection(filter) await filterSection.locator('button', { hasText: conditionBefore }).isVisible() - await filterSection.locator('button[data-id="btnCondition"]').click() - await this.page.locator('div.selectPopup button.menu-item', { hasText: conditionAfter }).click() + if (typeof conditionAfter === 'string') { + await filterSection.locator('button[data-id="btnCondition"]').click() + await this.page.locator('div.selectPopup button.menu-item', { hasText: conditionAfter }).click() + } } async checkFilter (filter: string, filterSecondLevel?: string, filterThirdLevel?: string): Promise { @@ -255,6 +267,24 @@ export class CommonPage { } } + async checkFilterWithInitials (filter: string, filterSecondLevel?: string, filterThirdLevel?: string): Promise { + await expect(this.filterButton(1)).toHaveText(filter) + if (filterSecondLevel !== undefined) { + await expect(this.filterButton(2)).toContainText(filterSecondLevel) + } + if (filterThirdLevel !== undefined) { + const avatarWrapper = this.filterButton(3).locator(`[data-name="${filterThirdLevel}"]`) + + const content = avatarWrapper.evaluate((elem) => { + const computedStyle = window.getComputedStyle(elem, '::after') + return computedStyle.getPropertyValue('content') + }) + + // Pseudoelement returns content "\"AJ\" + expect(await content).toEqual(JSON.stringify(filterThirdLevel)) + } + } + async updateFilterDimension ( filterSecondLevel: string, dateStart?: string, diff --git a/tests/sanity/tests/model/planning/planning-page.ts b/tests/sanity/tests/model/planning/planning-page.ts index 575bd9d258f..03feb5f6f27 100644 --- a/tests/sanity/tests/model/planning/planning-page.ts +++ b/tests/sanity/tests/model/planning/planning-page.ts @@ -132,7 +132,7 @@ export class PlanningPage extends CalendarPage { const boundingBox = await this.selectTimeCell(targetTime, column).boundingBox() expect(boundingBox).toBeTruthy() if (boundingBox != null) { - await this.page.mouse.move(boundingBox.x + 10, size === 'bottom' ? boundingBox.y - 8 : boundingBox.y + 5) + await this.page.mouse.move(boundingBox.x + 10, size === 'bottom' ? boundingBox.y + 5 : boundingBox.y - 8) await this.page.mouse.up() } }).toPass(retryOptions) diff --git a/tests/sanity/tests/model/recruiting/common-recruiting-page.ts b/tests/sanity/tests/model/recruiting/common-recruiting-page.ts index 2b5e8d33141..6ffbafeff27 100644 --- a/tests/sanity/tests/model/recruiting/common-recruiting-page.ts +++ b/tests/sanity/tests/model/recruiting/common-recruiting-page.ts @@ -35,6 +35,9 @@ export class CommonRecruitingPage extends CalendarPage { readonly buttonContactLinkedIn = (): Locator => this.page.locator('div[class^="popupPanel-body"] div.horizontal button[id="contact:string:LinkedIn"]') + readonly buttonContactGithub = (): Locator => + this.page.locator('div[class^="popupPanel-body"] div.horizontal button[id="contact:string:GitHub"]') + readonly newTalentFirstName = (): Locator => this.page.locator('div.popup form[id="recruit:string:CreateTalent"] input[placeholder="First name"]') @@ -63,6 +66,7 @@ export class CommonRecruitingPage extends CalendarPage { readonly reviewItemLink = (reviewId: string): Locator => this.page.locator(`tr:has-text('${reviewId}') td a`) readonly twoMembersButton = (): Locator => this.page.locator('button:has-text("2 members")') readonly chenRosamundPopupButton = (): Locator => this.page.locator('.popup button:has-text("Chen Rosamund")') + readonly buttonClearFilters = (): Locator => this.page.locator('button > span', { hasText: 'Clear filters' }) async clickOnTitle (): Promise { await this.title().click() @@ -93,6 +97,11 @@ export class CommonRecruitingPage extends CalendarPage { await this.page.waitForSelector('form.antiCard', { state: 'detached' }) } + async confirmCreateReview (): Promise { + await this.createButton().click() + await this.page.waitForSelector('form.antiCard', { state: 'detached' }) + } + async selectReviewItem (reviewId: string): Promise { await this.reviewItemLink(reviewId).first().click() } @@ -142,14 +151,14 @@ export class CommonRecruitingPage extends CalendarPage { await this.pressYesDeletePopup(this.page) } - async addSocialLinks (link: string, linkDescription: string): Promise { + async openAddSocialLinksPopup (link: string, linkDescription: string): Promise { await this.buttonAddSocialLinks().click() await this.selectFromDropdown(this.page, link) await this.fillToDropdown(this.page, linkDescription) } async addSocialLink (social: SocialLink): Promise { - await this.addSocialLinks(social.type, social.value) + await this.openAddSocialLinksPopup(social.type, social.value) } async checkSocialLinks (link: string, value: string): Promise { @@ -172,6 +181,12 @@ export class CommonRecruitingPage extends CalendarPage { await expect(this.inputSocialValue()).toHaveValue(value) await this.buttonSocialSave().click() break + case 'Github': + await expect(this.buttonContactGithub()).toBeVisible() + await this.buttonContactGithub().click() + await expect(this.inputSocialValue()).toHaveValue(value) + await this.buttonSocialSave().click() + break default: throw new Error(`Unknown case ${link}`) } diff --git a/tests/sanity/tests/model/recruiting/recruiting-page.ts b/tests/sanity/tests/model/recruiting/recruiting-page.ts index b13d228551d..57a32672397 100644 --- a/tests/sanity/tests/model/recruiting/recruiting-page.ts +++ b/tests/sanity/tests/model/recruiting/recruiting-page.ts @@ -8,9 +8,7 @@ export class RecruitingPage { } recruitApplication = (): Locator => this.page.locator('[id="app-recruit\\:string\\:RecruitApplication"]') - talentsNavElement = (): Locator => this.page.locator('text=Talents') - reviews = (): Locator => this.page.locator('text=Reviews') - reviewButton = (): Locator => this.page.getByRole('button', { name: 'Review', exact: true }) + talentsNavElement = (): Locator => this.page.locator('.antiPanel-navigator').locator('text=Talents') frontendEngineerOption = (): Locator => this.page.locator('td:has-text("Frontend Engineer")') searchOrRunCommandInput = (): Locator => this.page.locator('[placeholder="Search\\ or\\ run\\ a\\ command\\.\\.\\."]') @@ -42,14 +40,6 @@ export class RecruitingPage { await this.recruitApplication().click() } - async clickOnReviews (): Promise { - await this.reviews().click() - } - - async clickOnReviewButton (): Promise { - await this.reviewButton().click() - } - async clickTalentsNavElement (): Promise { await this.talentsNavElement().click() } diff --git a/tests/sanity/tests/model/recruiting/reviews-page.ts b/tests/sanity/tests/model/recruiting/reviews-page.ts new file mode 100644 index 00000000000..74642f5ba1b --- /dev/null +++ b/tests/sanity/tests/model/recruiting/reviews-page.ts @@ -0,0 +1,159 @@ +import { expect, type Locator, type Page } from '@playwright/test' +import { CommonRecruitingPage } from './common-recruiting-page' +import { generateId } from '@hcengineering/core' +import { NewReview, TalentName } from './types' + +export class ReviewsPage extends CommonRecruitingPage { + readonly page: Page + + constructor (page: Page) { + super(page) + this.page = page + } + + readonly buttonReviews = (): Locator => this.page.locator('.antiPanel-navigator').locator('text=Reviews') + readonly buttonNewReview = (): Locator => this.page.getByRole('button', { name: 'Review', exact: true }) + readonly buttonPopupTalentByName = (talent: TalentName): Locator => + this.page.locator(`button:has-text("${talent.lastName} ${talent.firstName}")`) + + readonly inputVerdict = (): Locator => this.page.locator('input[placeholder="Verdict"]') + readonly buttonInputLocation = (): Locator => this.page.locator('span.labelOnPanel:has-text("Location") + div button') + readonly editorDescription = (description: string): Locator => this.page.locator(`.tiptap:has-text("${description}")`) + readonly buttonMenuDelete = (): Locator => this.page.locator('button.ap-menuItem span', { hasText: 'Delete' }) + + async checkReviewExist (reviewName: string): Promise { + await expect(this.page.locator('tr', { hasText: reviewName })).toHaveCount(1) + } + + async checkReviewNotExist (reviewName: string): Promise { + await expect(this.page.locator('tr', { hasText: reviewName })).toHaveCount(0) + } + + async deleteReview (reviewName: string): Promise { + await this.openReviews() + await this.page.locator('tr', { hasText: reviewName }).click({ button: 'right' }) + await this.buttonMenuDelete().click() + await this.pressYesForPopup(this.page) + } + + async addDescription (oldDescription: string, newDescription: string): Promise { + await this.editorDescription(oldDescription).fill(newDescription) + } + + async addLocation (location: string): Promise { + await this.buttonInputLocation().first().click() + await this.fillToSelectPopup(this.page, location) + } + + async openReviews (): Promise { + await this.buttonReviews().click() + } + + async enterTalent (talent: TalentName): Promise { + await this.clickTalent() + await this.buttonPopupTalentByName(talent).click() + } + + async clickOnReviewButton (): Promise { + await this.buttonNewReview().click() + } + + async checkIfHeaderOfReviewHasTalentName (talent: TalentName): Promise { + await expect( + this.page.locator(`.hulyHeader-titleGroup:has-text("${talent.lastName} ${talent.firstName}")`) + ).toBeVisible() + } + + // TODO: need to improve locator + async updateTitle (newTitle: string): Promise { + const input = this.page.locator('[placeholder="Type text..."]') + await input.click() + await input.fill(newTitle) + } + + async updateTalent (newTalent: TalentName): Promise { + await this.clickTalent() + await this.buttonPopupTalentByName(newTalent).click() + } + + async enterVerdict (verdict: string): Promise { + await this.inputVerdict().click() + await this.inputVerdict().clear() + await this.inputVerdict().fill(verdict) + } + + async enterLocation (location: string): Promise { + const input = this.page.locator('[placeholder="Location"]') + await input.click() + await input.fill(location) + } + + async enterDescription (description: string): Promise { + const input = this.page.locator('[data-placeholder="Add description"]') + await input.click() + await input.fill(description) + } + + async createReview ({ title, talent, location, description }: NewReview): Promise { + if (typeof title !== 'string') title = `Review ${generateId()}` + await this.openReviews() + await this.buttonNewReview().click() + + await this.clickOnTitle() + await this.fillTitle(title) + await this.enterTalent(talent) + + if (typeof location === 'string') { + await this.enterLocation(location) + } + + if (typeof description === 'string') { + await this.enterDescription(description) + } + + await this.confirmCreateReview() + return title + } + + async openAndCheckReview ({ title, talent, location, verdict, description }: NewReview): Promise { + if (typeof title !== 'string') title = `Review ${generateId()}` + await this.openReviews() + await this.selectReviewItem(title) + + await this.checkIfHeaderOfReviewHasTalentName(talent) + + if (typeof location === 'string') { + await expect(this.page.locator(`text=${location}`).first()).toBeVisible() + } + + if (typeof description === 'string') { + await expect(this.page.locator(`text=${description}`).first()).toBeVisible() + } + + if (typeof verdict === 'string') { + await expect(this.inputVerdict()).toHaveValue(verdict) + } + } + + async openAndUpdateReview (oldData: NewReview, newData: NewReview): Promise { + await this.openReviews() + await this.selectReviewItem(oldData.title) + + if (typeof newData.title === 'string') { + await this.updateTitle(newData.title) + await this.page.keyboard.press('Enter') + } + + if (typeof newData.location === 'string') { + await this.addLocation(newData.location) + } + + if (typeof oldData.description === 'string' && typeof newData.description === 'string') { + await this.addDescription(oldData.description, newData.description) + } + + if (typeof newData.verdict === 'string') { + await this.enterVerdict(newData.verdict) + } + } +} diff --git a/tests/sanity/tests/model/recruiting/talents-page.ts b/tests/sanity/tests/model/recruiting/talents-page.ts index e7ec6eac334..60845b1c76b 100644 --- a/tests/sanity/tests/model/recruiting/talents-page.ts +++ b/tests/sanity/tests/model/recruiting/talents-page.ts @@ -41,11 +41,25 @@ export class TalentsPage extends CommonRecruitingPage { recruitApplicationButton = (): Locator => this.page.locator('[id="app-recruit\\:string\\:RecruitApplication"]') - talentsTab = (): Locator => this.page.locator('text=Talents') + talentsTab = (): Locator => this.page.locator('.antiPanel-navigator').locator('text=Talents') newTalentButton = (): Locator => this.page.locator('button:has-text("New Talent")') addSocialLinksButton = (): Locator => this.page.locator('[id="presentation\\:string\\:AddSocialLinks"]') + emailSelectorButton = (): Locator => this.page.locator('.antiPopup').locator('text=Email') - confirmEmailButton = (): Locator => this.page.locator('#channel-ok.antiButton') + twitterSelectorButton = (): Locator => this.page.locator('.antiPopup').locator('text=Twitter') + linkedInSelectorButton = (): Locator => this.page.locator('.antiPopup').locator('text=LinkedIn') + githubSelectorButton = (): Locator => this.page.locator('.antiPopup').locator('text=GitHub') + facebookSelectorButton = (): Locator => this.page.locator('.antiPopup').locator('text=Facebook') + homePageSelectorButton = (): Locator => this.page.locator('.antiPopup').locator('text="Home page"') + whatsAppSelectorButton = (): Locator => this.page.locator('.antiPopup').locator('text=WhatsApp') + skypeAppSelectorButton = (): Locator => this.page.locator('.antiPopup').locator('text=Skype') + profileAppSelectorButton = (): Locator => this.page.locator('.antiPopup').locator('text=Profile') + telegramAppSelectorButton = (): Locator => this.page.locator('.antiPopup').locator('text=Telegram') + + buttonSocialLinkMenuItem = (title: string): Locator => + this.page.locator('.antiPopup').locator(`button:has-text("${title}")`) + + confirmSocialLinkButton = (): Locator => this.page.locator('#channel-ok.antiButton') createTalentButton = (): Locator => this.page.locator('.antiCard button:has-text("Create")') popupPanel = (): Locator => this.page.locator('.popupPanel') talentsLink = (): Locator => this.page.locator('text=Talents') @@ -150,7 +164,7 @@ export class TalentsPage extends CommonRecruitingPage { await input.fill(location) } - async addSocialLinks (): Promise { + async openAddSocialLinksPopup (): Promise { await this.addSocialLinksButton().click() } @@ -158,13 +172,21 @@ export class TalentsPage extends CommonRecruitingPage { await this.emailSelectorButton().click() } + async enterSocialInfo (name: string, value: string): Promise { + await this.addSocialLinksButton().click() + await this.buttonSocialLinkMenuItem(name).click() + const input = this.page.locator('.popup .editor-container input') + await input.fill(value) + await this.confirmSocialLinkButton().click() + } + async enterEmail (email: string): Promise { const input = this.page.locator('[placeholder="john\\.appleseed@apple\\.com"]') await input.fill(email) } async confirmEmail (): Promise { - await this.confirmEmailButton().click() + await this.confirmSocialLinkButton().click() } async createTalent (): Promise { @@ -207,6 +229,10 @@ export class TalentsPage extends CommonRecruitingPage { .click() } + async checkTalentExist (talentName: TalentName): Promise { + await expect(this.page.locator('tr', { hasText: `${talentName.lastName} ${talentName.firstName}` })).toHaveCount(1) + } + async checkTalentNotExist (talentName: TalentName): Promise { await expect(this.page.locator('tr', { hasText: `${talentName.lastName} ${talentName.firstName}` })).toHaveCount(0) } diff --git a/tests/sanity/tests/model/recruiting/types.ts b/tests/sanity/tests/model/recruiting/types.ts index bbd2347a2f0..499b5532839 100644 --- a/tests/sanity/tests/model/recruiting/types.ts +++ b/tests/sanity/tests/model/recruiting/types.ts @@ -36,3 +36,13 @@ export interface NewCompany { socials?: SocialLink[] location?: string } + +export interface NewReview { + title: string + talent: TalentName + location?: string + description?: string + applications?: string[] + participants?: string[] + verdict?: string +} diff --git a/tests/sanity/tests/model/recruiting/vacancies-page.ts b/tests/sanity/tests/model/recruiting/vacancies-page.ts index b7cc3ac4491..7a765508481 100644 --- a/tests/sanity/tests/model/recruiting/vacancies-page.ts +++ b/tests/sanity/tests/model/recruiting/vacancies-page.ts @@ -1,6 +1,7 @@ import { expect, type Locator, type Page } from '@playwright/test' import { NewVacancy } from './types' import { CommonRecruitingPage } from './common-recruiting-page' +import { generateId } from '../../utils' export class VacanciesPage extends CommonRecruitingPage { readonly page: Page @@ -44,7 +45,7 @@ export class VacanciesPage extends CommonRecruitingPage { readonly recruitApplicationButton = (): Locator => this.page.locator('[id="app-recruit\\:string\\:RecruitApplication"]') - readonly vacanciesMenuLink = (): Locator => this.page.locator('text=Vacancies') + readonly vacanciesMenuLink = (): Locator => this.page.locator('.antiPanel-navigator').locator('text=Vacancies') readonly createVacancyButton = (): Locator => this.page.locator('button:has-text("Vacancy")') readonly vacancyInputField = (): Locator => this.page.locator('form [placeholder="Software\\ Engineer"]') readonly createButton = (): Locator => this.page.locator('form button:has-text("Create")') @@ -62,7 +63,7 @@ export class VacanciesPage extends CommonRecruitingPage { readonly applicantJohn = (): Locator => this.page.locator('text=Multiseed John').first() readonly applicantAlex = (): Locator => this.page.locator('text=P. Alex').first() - async clickOnVacancy (): Promise { + async openVacancies (): Promise { await this.vacanciesMenuLink().click() } @@ -70,25 +71,31 @@ export class VacanciesPage extends CommonRecruitingPage { await this.vacancyButton().click() } - async fillSoftwareEngineerInput (vacancyId: string): Promise { - await this.softwareEngineerInput().fill(vacancyId) + async fillSoftwareEngineerInput (vacancyTitle: string): Promise { + await this.softwareEngineerInput().fill(vacancyTitle) } async clickOnVacanciesCreateButton (): Promise { await this.vacanciesCreateButton().click() } - async createVacancy (vacancyId: string): Promise { + async createVacancy (vacancyTitle?: string): Promise { + if (typeof vacancyTitle !== 'string') { + vacancyTitle = `Vacancy ${generateId()}` + } + await this.recruitApplicationButton().click() await this.vacanciesMenuLink().click() await this.createVacancyButton().click() - await this.vacancyInputField().fill(vacancyId) + await this.vacancyInputField().fill(vacancyTitle) await this.createButton().click() await this.page.waitForSelector('form.antiCard', { state: 'detached' }) + + return vacancyTitle } - async modifyVacancy (vacancyId: string): Promise { - await this.vacancyRow(vacancyId).click() + async modifyVacancy (vacancyTitle: string): Promise { + await this.vacancyRow(vacancyTitle).click() } async createApplicationVacencies (assigneeName: string): Promise { @@ -151,12 +158,12 @@ export class VacanciesPage extends CommonRecruitingPage { await this.popupOk().click() } - async checkVacancyNotExist (vacancyName: string, message: string): Promise { - await expect(this.page.locator('tr', { hasText: vacancyName }), message).toHaveCount(0) + async checkVacancyNotExist (vacancyName: string): Promise { + await expect(this.page.locator('tr', { hasText: vacancyName })).toHaveCount(0) } - async checkVacancyExist (vacancyName: string, message: string): Promise { - await expect(this.page.locator('tr', { hasText: vacancyName }), message).toHaveCount(1) + async checkVacancyExist (vacancyName: string): Promise { + await expect(this.page.locator('tr', { hasText: vacancyName })).toHaveCount(1) } async selectAll (): Promise { diff --git a/tests/sanity/tests/model/recruiting/vacancy-details-page.ts b/tests/sanity/tests/model/recruiting/vacancy-details-page.ts index e838adf4c89..9fc4025eafa 100644 --- a/tests/sanity/tests/model/recruiting/vacancy-details-page.ts +++ b/tests/sanity/tests/model/recruiting/vacancy-details-page.ts @@ -18,6 +18,7 @@ export class VacancyDetailsPage extends CommonRecruitingPage { readonly buttonInputDueDate = (): Locator => this.page.locator('button > div', { hasText: 'Due date' }) readonly buttonDatePopupSave = (): Locator => this.page.locator('div.popup button[type="submit"]') readonly inputComment = (): Locator => this.page.locator('div.text-input div.tiptap') + readonly inputMembers = (): Locator => this.page.locator('.labelOnPanel:has-text("Members") + div .antiButton') async addComment (comment: string): Promise { await this.inputComment().fill(comment) @@ -49,6 +50,12 @@ export class VacancyDetailsPage extends CommonRecruitingPage { await this.clickButtonDatePopupToday() } + async addMember (name: string): Promise { + await this.inputMembers().click() + await this.selectMenuItem(this.page, name) + await this.page.keyboard.press('Escape') + } + async fillInputDescription (description: string): Promise { await this.inputDescription().fill(description) } diff --git a/tests/sanity/tests/model/tracker/issues-details-page.ts b/tests/sanity/tests/model/tracker/issues-details-page.ts index 53fb1f555f5..0f8217bb0af 100644 --- a/tests/sanity/tests/model/tracker/issues-details-page.ts +++ b/tests/sanity/tests/model/tracker/issues-details-page.ts @@ -232,7 +232,7 @@ export class IssuesDetailsPage extends CommonTrackerPage { await expect(this.buttonComponent()).toHaveText(defaultComponent) } - async checkIfButtonCbuttonCreatedByHaveTextCreatedBy (createdBy: string): Promise { + async checkIfButtonCreatedByHaveTextCreatedBy (createdBy: string): Promise { await expect(this.buttonCreatedBy()).toHaveText(createdBy) } diff --git a/tests/sanity/tests/model/tracker/issues-page.ts b/tests/sanity/tests/model/tracker/issues-page.ts index 65a75c00894..c8db25c6fb8 100644 --- a/tests/sanity/tests/model/tracker/issues-page.ts +++ b/tests/sanity/tests/model/tracker/issues-page.ts @@ -408,7 +408,7 @@ export class IssuesPage extends CommonTrackerPage { await this.linkSidebarMyIssue().click() } - async createNewIssue (data: NewIssue, closeNotification: boolean = false): Promise { + async createNewIssue (data: NewIssue, closeNotification: boolean = false): Promise { await this.buttonCreateNewIssue().click() await this.fillNewIssueForm(data) await this.clickButtonCreateIssue() @@ -416,6 +416,7 @@ export class IssuesPage extends CommonTrackerPage { await this.closeNotification() } await attachScreenshot(`createdNewIssue-${data.title}.png`, this.page) + return data.title } async fillNewIssueForm (data: NewIssue): Promise { @@ -508,14 +509,17 @@ export class IssuesPage extends CommonTrackerPage { } async checkIssueNotExist (issueName: string): Promise { + await this.openAllCategories() await expect(this.issueNotExist(issueName)).toHaveCount(0) } async checkFilteredIssueExist (issueName: string): Promise { + await this.openAllCategories() await expect(this.linesFromList(issueName)).toHaveCount(1) } async checkFilteredIssueNotExist (issueName: string): Promise { + await this.openAllCategories() await expect(this.linesFromList(issueName)).toHaveCount(0) } @@ -557,6 +561,7 @@ export class IssuesPage extends CommonTrackerPage { } async checkIssuesCount (issueName: string, count: number, timeout?: number): Promise { + await this.openAllCategories() await expect(async () => { await expect(this.issueAnchorByName(issueName)).toHaveCount(count) }).toPass(retryOptions) diff --git a/tests/sanity/tests/planning/plan.spec.ts b/tests/sanity/tests/planning/plan.spec.ts index b1014f984b7..3fe37610639 100644 --- a/tests/sanity/tests/planning/plan.spec.ts +++ b/tests/sanity/tests/planning/plan.spec.ts @@ -291,7 +291,7 @@ test.describe('Planning ToDo tests', () => { }) }) - test.only('ToDo labels are exist in Tag list', async ({ page }) => { + test('ToDo labels are exist in Tag list', async ({ page }) => { const planningPage = new PlanningPage(page) const planningNavigationMenuPage = new PlanningNavigationMenuPage(page) @@ -355,25 +355,27 @@ test.describe('Planning ToDo tests', () => { slots: [ { dateStart: 'today', - timeStart: '1400', + timeStart: '0300', dateEnd: { day: dateEnd.getDate().toString(), month: (dateEnd.getMonth() + 1).toString(), year: dateEnd.getFullYear().toString() }, - timeEnd: '1500' + timeEnd: '0400' } ] } await test.step('Prepare ToDo', async () => { await planningNavigationMenuPage.clickOnButtonToDoAll() + await planningPage.page.locator('.calendar-container').hover() + await page.mouse.wheel(0, -1000) // Make target hours visible await planningPage.createNewToDo(toDoWithLabel) }) await test.step('Resize ToDo', async () => { - await planningPage.moveToDoBorderByMouse(toDoWithLabel.title, 1, '4pm', 'bottom') - await planningPage.moveToDoBorderByMouse(toDoWithLabel.title, 1, '1pm', 'top') + await planningPage.moveToDoBorderByMouse(toDoWithLabel.title, 1, '2am', 'top') + await planningPage.moveToDoBorderByMouse(toDoWithLabel.title, 1, '5am', 'bottom') }) await test.step('Check time changes', async () => { diff --git a/tests/sanity/tests/recruiting/applications.spec.ts b/tests/sanity/tests/recruiting/applications/application.spec.ts similarity index 90% rename from tests/sanity/tests/recruiting/applications.spec.ts rename to tests/sanity/tests/recruiting/applications/application.spec.ts index 5516249e928..0fed5e3a773 100644 --- a/tests/sanity/tests/recruiting/applications.spec.ts +++ b/tests/sanity/tests/recruiting/applications/application.spec.ts @@ -1,18 +1,18 @@ import { expect, test } from '@playwright/test' -import { generateId, PlatformSetting, PlatformURI } from '../utils' -import { NavigationMenuPage } from '../model/recruiting/navigation-menu-page' -import { ApplicationsPage } from '../model/recruiting/applications-page' -import { ApplicationsDetailsPage } from '../model/recruiting/applications-details-page' -import { VacancyDetailsPage } from '../model/recruiting/vacancy-details-page' -import { VacanciesPage } from '../model/recruiting/vacancies-page' -import { RecruitingPage } from '../model/recruiting/recruiting-page' -import { TalentsPage } from '../model/recruiting/talents-page' +import { generateId, PlatformSetting, PlatformURI } from '../../utils' +import { NavigationMenuPage } from '../../model/recruiting/navigation-menu-page' +import { ApplicationsPage } from '../../model/recruiting/applications-page' +import { ApplicationsDetailsPage } from '../../model/recruiting/applications-details-page' +import { VacancyDetailsPage } from '../../model/recruiting/vacancy-details-page' +import { VacanciesPage } from '../../model/recruiting/vacancies-page' +import { RecruitingPage } from '../../model/recruiting/recruiting-page' +import { TalentsPage } from '../../model/recruiting/talents-page' test.use({ storageState: PlatformSetting }) -test.describe('Application tests', () => { +test.describe('Recruiting. Application tests', () => { let recrutingPage: RecruitingPage let vacanciesPage: VacanciesPage let vacancyDetailsPage: VacancyDetailsPage @@ -37,7 +37,7 @@ test.describe('Application tests', () => { const vacancyId = 'My vacancy ' + generateId(4) await recrutingPage.clickRecruitApplication() await page.waitForLoadState('load') - await vacanciesPage.clickOnVacancy() + await vacanciesPage.openVacancies() await vacanciesPage.clickOnVacancyButton() await vacanciesPage.fillSoftwareEngineerInput(vacancyId) await vacanciesPage.clickOnVacanciesCreateButton() diff --git a/tests/sanity/tests/recruiting/companies/companies-filter.spec.ts b/tests/sanity/tests/recruiting/companies/companies-filter.spec.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/sanity/tests/recruiting/companies.spec.ts b/tests/sanity/tests/recruiting/companies/company.spec.ts similarity index 85% rename from tests/sanity/tests/recruiting/companies.spec.ts rename to tests/sanity/tests/recruiting/companies/company.spec.ts index 2265bd403de..3fcec0c0bd8 100644 --- a/tests/sanity/tests/recruiting/companies.spec.ts +++ b/tests/sanity/tests/recruiting/companies/company.spec.ts @@ -1,15 +1,15 @@ import { test } from '@playwright/test' -import { generateId, PlatformSetting, PlatformURI } from '../utils' -import { NavigationMenuPage } from '../model/recruiting/navigation-menu-page' -import { CompaniesPage } from '../model/recruiting/companies-page' -import { NewCompany } from '../model/recruiting/types' -import { CompanyDetailsPage } from '../model/recruiting/company-details-page' +import { generateId, PlatformSetting, PlatformURI } from '../../utils' +import { NavigationMenuPage } from '../../model/recruiting/navigation-menu-page' +import { CompaniesPage } from '../../model/recruiting/companies-page' +import { NewCompany } from '../../model/recruiting/types' +import { CompanyDetailsPage } from '../../model/recruiting/company-details-page' test.use({ storageState: PlatformSetting }) -test.describe('Companies tests', () => { +test.describe('Recruiting. Companies tests', () => { let navigationMenuPage: NavigationMenuPage let companiesPage: CompaniesPage let companyDetailsPage: CompanyDetailsPage diff --git a/tests/sanity/tests/recruiting/interview.spec.ts b/tests/sanity/tests/recruiting/interview.spec.ts deleted file mode 100644 index 1ca98a4399e..00000000000 --- a/tests/sanity/tests/recruiting/interview.spec.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { test } from '@playwright/test' -import { PlatformSetting, PlatformURI } from '../utils' - -test.use({ - storageState: PlatformSetting -}) - -test.describe('interview tests', () => { - test.beforeEach(async ({ page }) => { - await (await page.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished() - }) - - // test.skip('create-interview', async ({ page }) => { - // await page.locator('[id="app-recruit\\:string\\:RecruitApplication"]').click() - // - // const interviewId = 'My interview ' + generateId(4) - // - // await page.locator('[id="app-recruit\\:string\\:RecruitApplication"]').click() - // - // await page.click('text=Reviews') - // - // await page.click('button:has-text("Review")') - // - // await page.click('[placeholder="Title"]') - // - // await page.fill('[placeholder="Title"]', `Meet Peterson ${interviewId}`) - // - // await page.click('[placeholder="Location"]') - // - // await page.fill('[placeholder="Location"]', 'NSK') - // await page.click('form button:has-text("Talent")') - // await page.click('button:has-text("P. Andrey")') - // await page.click('text=Create') - // await page.waitForSelector('form.antiCard', { state: 'detached' }) - // await page.click('td:has-text("RVE-")') - // }) -}) diff --git a/tests/sanity/tests/recruiting/reviews.spec.ts b/tests/sanity/tests/recruiting/reviews.spec.ts deleted file mode 100644 index 31b495a77f5..00000000000 --- a/tests/sanity/tests/recruiting/reviews.spec.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { test } from '@playwright/test' -import { generateId, PlatformSetting, PlatformURI } from '../utils' -import { RecruitingPage } from '../model/recruiting/recruiting-page' -import { CommonRecruitingPage } from '../model/recruiting/common-recruiting-page' - -test.use({ - storageState: PlatformSetting -}) - -test.describe('review tests', () => { - let recruitingPage: RecruitingPage - let commonRecruitingPage: CommonRecruitingPage - - test.beforeEach(async ({ page }) => { - recruitingPage = new RecruitingPage(page) - commonRecruitingPage = new CommonRecruitingPage(page) - - await (await page.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished() - }) - - test('create-review', async ({ page }) => { - const reviewId = 'review-' + generateId() - await recruitingPage.clickRecruitApplication() - await recruitingPage.clickOnReviews() - await recruitingPage.clickOnReviewButton() - await commonRecruitingPage.clickOnTitle() - await commonRecruitingPage.fillTitle(reviewId) - await commonRecruitingPage.clickAppleseedJohn() - await commonRecruitingPage.clickChenRosamund() - await commonRecruitingPage.pressEscapeInSearch() - await commonRecruitingPage.clickTalent() - // Click button:has-text("Chen Rosamund") - await commonRecruitingPage.clickChenRosamund() - await commonRecruitingPage.createApplication() - await commonRecruitingPage.selectReviewItem(reviewId) - await commonRecruitingPage.clickTwoMembers() - await commonRecruitingPage.clickAppleseedJohn() - // ADD ASSERTION - }) -}) diff --git a/tests/sanity/tests/recruiting/reviews/review.spec.ts b/tests/sanity/tests/recruiting/reviews/review.spec.ts new file mode 100644 index 00000000000..6ad12c28f9d --- /dev/null +++ b/tests/sanity/tests/recruiting/reviews/review.spec.ts @@ -0,0 +1,56 @@ +import { test } from '@playwright/test' +import { generateId, PlatformSetting, PlatformURI } from '../../utils' +import { ReviewsPage } from '../../model/recruiting/reviews-page' +import { NewReview } from '../../model/recruiting/types' + +test.use({ + storageState: PlatformSetting +}) + +test.describe('Recruiting. Review tests', () => { + let reviewsPage: ReviewsPage + + const newReview: NewReview = { + title: 'Dynamic Review Name', + participants: ['Appleseed John', 'Chen Rosamund'], + talent: { firstName: 'Andrey', lastName: 'P.' }, + location: 'Monte Carlo', + description: 'Description of Review' + } + + test.beforeEach(async ({ page }) => { + reviewsPage = new ReviewsPage(page) + newReview.title = `Review ${generateId()}` + + await (await page.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished() + }) + + test('Create a Review', async ({ page }) => { + await reviewsPage.createReview(newReview) + await reviewsPage.openAndCheckReview(newReview) + }) + + test('Edit a Review', async ({ page }) => { + const reviewTitle = await reviewsPage.createReview(newReview) + + const updateReviewData: NewReview = { + title: 'Updated ' + reviewTitle, + description: 'Updated Review', + talent: { firstName: 'Andrey', lastName: 'P.' }, + location: 'New York', + verdict: 'He is a good candidate' + } + await reviewsPage.openAndUpdateReview(newReview, updateReviewData) + await reviewsPage.openReviews() + + await reviewsPage.openAndCheckReview(updateReviewData) + }) + + test('Delete a Review', async ({ page }) => { + const reviewTitle = await reviewsPage.createReview(newReview) + await reviewsPage.openReviews() + await reviewsPage.checkReviewExist(reviewTitle) + await reviewsPage.deleteReview(reviewTitle) + await reviewsPage.checkReviewNotExist(reviewTitle) + }) +}) diff --git a/tests/sanity/tests/recruiting/skills.spec.ts b/tests/sanity/tests/recruiting/skills/skills.spec.ts similarity index 91% rename from tests/sanity/tests/recruiting/skills.spec.ts rename to tests/sanity/tests/recruiting/skills/skills.spec.ts index c33488f025f..346ddca5954 100644 --- a/tests/sanity/tests/recruiting/skills.spec.ts +++ b/tests/sanity/tests/recruiting/skills/skills.spec.ts @@ -1,11 +1,11 @@ import { test } from '@playwright/test' -import { PlatformSetting, PlatformURI } from '../utils' +import { PlatformSetting, PlatformURI } from '../../utils' test.use({ storageState: PlatformSetting }) -test.describe('skill tests', () => { +test.describe('Recruiting. Kill tests', () => { test.beforeEach(async ({ page }) => { await (await page.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished() }) diff --git a/tests/sanity/tests/recruiting/talents.spec.ts b/tests/sanity/tests/recruiting/talents/talent.spec.ts similarity index 69% rename from tests/sanity/tests/recruiting/talents.spec.ts rename to tests/sanity/tests/recruiting/talents/talent.spec.ts index 50c47afae32..7d34a5c46d7 100644 --- a/tests/sanity/tests/recruiting/talents.spec.ts +++ b/tests/sanity/tests/recruiting/talents/talent.spec.ts @@ -1,15 +1,15 @@ import { test } from '@playwright/test' -import { generateId, PlatformSetting, PlatformURI } from '../utils' -import { NavigationMenuPage } from '../model/recruiting/navigation-menu-page' -import { TalentsPage } from '../model/recruiting/talents-page' -import { TalentDetailsPage } from '../model/recruiting/talent-details-page' -import { TalentName } from '../model/recruiting/types' +import { generateId, PlatformSetting, PlatformURI } from '../../utils' +import { NavigationMenuPage } from '../../model/recruiting/navigation-menu-page' +import { TalentsPage } from '../../model/recruiting/talents-page' +import { TalentDetailsPage } from '../../model/recruiting/talent-details-page' +import { TalentName } from '../../model/recruiting/types' test.use({ storageState: PlatformSetting }) -test.describe('candidate/talents tests', () => { +test.describe('Recruting. Talent tests', () => { let talentsPage: TalentsPage let navigationMenuPage: NavigationMenuPage let talentDetailsPage: TalentDetailsPage @@ -22,26 +22,46 @@ test.describe('candidate/talents tests', () => { await (await page.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished() }) - test('create-candidate', async () => { - const first = 'Elton-' + generateId(4) - const last = 'John-' + generateId(4) - const loc = 'Cupertino' - const email = `ej-${generateId(4)}@test.com` + test('Create a Talent', async () => { + const newTalent = { + firstName: 'Elton-' + generateId(4), + lastName: 'John-' + generateId(4), + location: 'Cupertino', + email: `ej-${generateId(4)}@test.com`, + socials: { + twitter: '@user_name', + linkedIn: 'https://www.linkedin.com/in/user_name/', + facebook: 'https://github.com/username', + whatsApp: '+7888888888', + skype: 'user_name', + profile: 'https://profile.com/username', + telegram: '@username' + } + } await talentsPage.clickRecruitApplication() await talentsPage.clickTalentsTab() await talentsPage.clickNewTalent() - await talentsPage.enterFirstName(first) - await talentsPage.enterLastName(last) + await talentsPage.enterFirstName(newTalent.firstName) + await talentsPage.enterLastName(newTalent.lastName) await talentsPage.enterTitle() - await talentsPage.enterLocation(loc) - await talentsPage.addSocialLinks() + await talentsPage.enterLocation(newTalent.location) + + // Add contact information + for (const social in newTalent.socials) { + await talentsPage.enterSocialInfo( + social.toUpperCase(), + newTalent.socials[social as keyof typeof newTalent.socials] + ) + } + + await talentsPage.openAddSocialLinksPopup() await talentsPage.selectEmail() - await talentsPage.enterEmail(email) + await talentsPage.enterEmail(newTalent.email) await talentsPage.confirmEmail() await talentsPage.createTalent() - await talentsPage.verifyTalentDetails(first, last, loc) - await talentsPage.verifyEmailInPopup(email) + await talentsPage.verifyTalentDetails(newTalent.firstName, newTalent.lastName, newTalent.location) + await talentsPage.verifyEmailInPopup(newTalent.email) }) test('Edit the Talent', async () => { @@ -55,12 +75,11 @@ test.describe('candidate/talents tests', () => { const skillTag = `React-${generateId(4)}` await talentDetailsPage.addSkill(skillTag, 'Description Java from Talent Description page') await talentDetailsPage.checkSkill(skillTag) - await talentDetailsPage.addSocialLinks('Phone', '123123213213') + await talentDetailsPage.openAddSocialLinksPopup('Phone', '123123213213') await talentDetailsPage.checkSocialLinks('Phone', '123123213213') await talentDetailsPage.inputLocation().fill('Awesome Location') const title = `Title-${generateId(4)}` await talentDetailsPage.addTitle(title) - // ADD ASSERTION }) test('Delete the Talent', async () => { @@ -87,7 +106,7 @@ test.describe('candidate/talents tests', () => { await talentDetailsPage.addTitle(titleTalent1) const sourceTalent1 = 'SourceTalent1' await talentDetailsPage.addSource(sourceTalent1) - await talentDetailsPage.addSocialLinks('Phone', '123123213213') + await talentDetailsPage.openAddSocialLinksPopup('Phone', '123123213213') // talent 2 await navigationMenuPage.clickButtonTalents() @@ -99,7 +118,7 @@ test.describe('candidate/talents tests', () => { await talentDetailsPage.addTitle(titleTalent2) const sourceTalent2 = 'SourceTalent2' await talentDetailsPage.addSource(sourceTalent2) - await talentDetailsPage.addSocialLinks('Email', 'test-merge-2@gmail.com') + await talentDetailsPage.openAddSocialLinksPopup('Email', 'test-merge-2@gmail.com') // merge await navigationMenuPage.clickButtonTalents() @@ -134,21 +153,4 @@ test.describe('candidate/talents tests', () => { await talentsPage.rightClickAction(talentName, 'Match to vacancy') await talentsPage.checkMatchVacancy(`${talentName.lastName} ${talentName.firstName}`, '0') }) - - test('Filtering talents by skills', async ({ page }) => { - const skillName = `Skill-${generateId(4)}` - const talentName = 'P. Andrey' - - await navigationMenuPage.clickButtonTalents() - await talentsPage.checkRowsInTableExist(talentName) - const talentsCount = await talentsPage.linesFromTable().count() - await talentsPage.openRowInTableByText(talentName) - await talentDetailsPage.addSkill(skillName, 'Skill Description') - await talentDetailsPage.buttonClosePanel().click() - await talentsPage.selectFilter('Skills', skillName) - await talentsPage.checkRowsInTableExist(talentName) - await talentsPage.filterOppositeCondition('Skill', 'is', 'is not') - await talentsPage.checkRowsInTableNotExist(talentName) - await talentsPage.checkRowsInTableExist('', talentsCount - 1) - }) }) diff --git a/tests/sanity/tests/recruiting/talents/talents-filter.spec.ts b/tests/sanity/tests/recruiting/talents/talents-filter.spec.ts new file mode 100644 index 00000000000..03e9125bf10 --- /dev/null +++ b/tests/sanity/tests/recruiting/talents/talents-filter.spec.ts @@ -0,0 +1,356 @@ +import { expect, test } from '@playwright/test' +import { generateId, PlatformSetting, PlatformURI } from '../../utils' +import { LeftSideMenuPage } from '../../model/left-side-menu-page' +import { TalentsPage } from '../../model/recruiting/talents-page' +import { TalentDetailsPage } from '../../model/recruiting/talent-details-page' +import { DateDivided } from '../../model/types' +import { TalentName } from '../../model/recruiting/types' + +test.use({ + storageState: PlatformSetting +}) + +test.describe('Recruiting. Talents filters tests', () => { + let leftSideMenuPage: LeftSideMenuPage + let talentsPage: TalentsPage + let talentDetailsPage: TalentDetailsPage + let talentName: TalentName + + test.beforeEach(async ({ page }) => { + leftSideMenuPage = new LeftSideMenuPage(page) + talentsPage = new TalentsPage(page) + talentDetailsPage = new TalentDetailsPage(page) + + await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished() + + await leftSideMenuPage.clickRecruiting() + await talentsPage.clickTalentsTab() + }) + + test('Filter by Modified date: Today', async () => { + talentName = await talentsPage.createNewTalent() + await talentsPage.selectFilter('Modified date', 'Today') + await talentsPage.checkFilter('Modified date', 'Today') + + await talentsPage.checkTalentExist(talentName) + }) + + test('Filter by Modified date: Yesterday', async () => { + talentName = await talentsPage.createNewTalent() + + await talentsPage.selectFilter('Modified date', 'Yesterday') + await talentsPage.checkFilter('Modified date', 'Yesterday') + + await talentsPage.checkTalentNotExist(talentName) + }) + + test('Filter by Modified date: This week', async () => { + talentName = await talentsPage.createNewTalent() + await talentsPage.selectFilter('Modified date', 'This week') + await talentsPage.checkFilter('Modified date', 'This week') + + await talentsPage.checkTalentExist(talentName) + }) + + test('Filter by Modified date: This month', async () => { + talentName = await talentsPage.createNewTalent() + await talentsPage.selectFilter('Modified date', 'This month') + await talentsPage.checkFilter('Modified date', 'This month') + + await talentsPage.checkTalentExist(talentName) + }) + + test('Filter by Modified date: Exact Today', async () => { + talentName = await talentsPage.createNewTalent() + await talentsPage.selectFilter('Modified date', 'Today') + await talentsPage.updateFilterDimension('Exact date', 'Today') + await talentsPage.checkFilter('Modified date', 'is', 'Today') + + await talentsPage.checkTalentExist(talentName) + }) + + test('Filter by Modified date: Before Today', async () => { + talentName = await talentsPage.createNewTalent() + + await talentsPage.selectFilter('Modified date', 'Today') + await talentsPage.updateFilterDimension('Before date', 'Today') + await talentsPage.checkFilter('Modified date', 'Before', 'Today') + + await talentsPage.checkTalentNotExist(talentName) + }) + + test('Filter by Modified date: After Today', async () => { + talentName = await talentsPage.createNewTalent() + + await talentsPage.selectFilter('Modified date', 'Today') + await talentsPage.updateFilterDimension('After date', 'Today') + await talentsPage.checkFilter('Modified date', 'After', 'Today') + + await talentsPage.checkTalentExist(talentName) + }) + + test('Filter by Modified date: Between dates', async () => { + talentName = await talentsPage.createNewTalent() + + await talentsPage.selectFilter('Modified date', 'Today') + await talentsPage.updateFilterDimension('Between dates') + + const dateYesterday = new Date() + dateYesterday.setDate(dateYesterday.getDate() - 1) + + const dateTomorrow = new Date() + dateTomorrow.setDate(dateTomorrow.getDate() + 1) + + const dateYesterdayDivided: DateDivided = { + day: dateYesterday.getDate().toString(), + month: (dateYesterday.getMonth() + 1).toString(), + year: dateYesterday.getFullYear().toString() + } + + const dateTomorrowDivided: DateDivided = { + day: dateTomorrow.getDate().toString(), + month: (dateTomorrow.getMonth() + 1).toString(), + year: dateTomorrow.getFullYear().toString() + } + + await talentsPage.fillBetweenDate(dateYesterdayDivided, dateTomorrowDivided) + await talentsPage.checkFilter('Modified date', 'is between', dateYesterday.getDate().toString()) + await talentsPage.checkFilter('Modified date', 'is between', dateTomorrow.getDate().toString()) + + await talentsPage.checkTalentExist(talentName) + }) + + test('Filter by Created date: Today', async () => { + talentName = await talentsPage.createNewTalent() + await talentsPage.selectFilter('Created date', 'Today') + await talentsPage.checkFilter('Created date', 'Today') + + await talentsPage.checkTalentExist(talentName) + }) + + test('Filter by Created date: Yesterday', async () => { + talentName = await talentsPage.createNewTalent() + + await talentsPage.selectFilter('Created date', 'Yesterday') + await talentsPage.checkFilter('Created date', 'Yesterday') + + await talentsPage.checkTalentNotExist(talentName) + }) + + test('Filter by Created date: This week', async () => { + talentName = await talentsPage.createNewTalent() + await talentsPage.selectFilter('Created date', 'This week') + await talentsPage.checkFilter('Created date', 'This week') + + await talentsPage.checkTalentExist(talentName) + }) + + test('Filter by Created date: This month', async () => { + talentName = await talentsPage.createNewTalent() + await talentsPage.selectFilter('Created date', 'This month') + await talentsPage.checkFilter('Created date', 'This month') + + await talentsPage.checkTalentExist(talentName) + }) + + test('Filter by Created date: Exact Today', async () => { + talentName = await talentsPage.createNewTalent() + await talentsPage.selectFilter('Created date', 'Today') + await talentsPage.updateFilterDimension('Exact date', 'Today') + await talentsPage.checkFilter('Created date', 'is', 'Today') + + await talentsPage.checkTalentExist(talentName) + }) + + test('Filter by Created date: Before Today', async () => { + talentName = await talentsPage.createNewTalent() + + await talentsPage.selectFilter('Created date', 'Today') + await talentsPage.updateFilterDimension('Before date', 'Today') + await talentsPage.checkFilter('Created date', 'Before', 'Today') + + await talentsPage.checkTalentNotExist(talentName) + }) + + test('Filter by Created date: After Today', async () => { + talentName = await talentsPage.createNewTalent() + + await talentsPage.selectFilter('Created date', 'Today') + await talentsPage.updateFilterDimension('After date', 'Today') + await talentsPage.checkFilter('Created date', 'After', 'Today') + + await talentsPage.checkTalentExist(talentName) + }) + + test('Filter by Created date: Between dates', async () => { + talentName = await talentsPage.createNewTalent() + + await talentsPage.selectFilter('Created date', 'Today') + await talentsPage.updateFilterDimension('Between dates') + + const dateYesterday = new Date() + dateYesterday.setDate(dateYesterday.getDate() - 1) + + const dateTomorrow = new Date() + dateTomorrow.setDate(dateTomorrow.getDate() + 1) + + const dateYesterdayDivided: DateDivided = { + day: dateYesterday.getDate().toString(), + month: (dateYesterday.getMonth() + 1).toString(), + year: dateYesterday.getFullYear().toString() + } + + const dateTomorrowDivided: DateDivided = { + day: dateTomorrow.getDate().toString(), + month: (dateTomorrow.getMonth() + 1).toString(), + year: dateTomorrow.getFullYear().toString() + } + + await talentsPage.fillBetweenDate(dateYesterdayDivided, dateTomorrowDivided) + await talentsPage.checkFilter('Created date', 'is between', dateYesterday.getDate().toString()) + await talentsPage.checkFilter('Created date', 'is between', dateTomorrow.getDate().toString()) + + await talentsPage.checkTalentExist(talentName) + }) + + test('Filter by Name', async () => { + talentName = await talentsPage.createNewTalent() + const unexpectedName = generateId() + + await talentsPage.selectFilter('Name', unexpectedName) + await talentsPage.checkFilter('Name', 'contains', unexpectedName) + + await expect(talentsPage.linesFromTable()).toHaveCount(0) + + await talentsPage.buttonClearFilters().click() + + await talentsPage.selectFilter('Name', talentName.firstName) + await talentsPage.checkFilter('Name', 'contains', talentName.firstName) + + await talentsPage.checkTalentExist(talentName) + }) + + test('Filter by Contact Info: Phone', async () => { + talentName = await talentsPage.createNewTalent() + const phone = generateId() + + await talentsPage.selectFilter('Contact Info', 'Phone') + await talentsPage.page.keyboard.press('Escape') + await talentsPage.checkTalentNotExist(talentName) + await talentsPage.buttonClearFilters().click() + await talentsPage.checkTalentExist(talentName) + + await talentsPage.openTalentByTalentName(talentName) + await talentDetailsPage.openAddSocialLinksPopup('Phone', phone) + await talentDetailsPage.checkSocialLinks('Phone', phone) + + await talentsPage.clickTalentsTab() + await talentsPage.selectFilter('Contact Info', 'Phone') + await talentsPage.page.keyboard.press('Escape') + await talentsPage.checkTalentExist(talentName) + }) + + test('Filter by Contact Info: Email', async () => { + talentName = await talentsPage.createNewTalent() + const email = `filter-${generateId()}@test.com` + + await talentsPage.selectFilter('Contact Info', 'Email') + await talentsPage.page.keyboard.press('Escape') + await talentsPage.checkTalentNotExist(talentName) + await talentsPage.buttonClearFilters().click() + await talentsPage.checkTalentExist(talentName) + + await talentsPage.openTalentByTalentName(talentName) + await talentDetailsPage.openAddSocialLinksPopup('Email', email) + await talentDetailsPage.checkSocialLinks('Email', email) + + await talentsPage.clickTalentsTab() + await talentsPage.selectFilter('Contact Info', 'Email') + await talentsPage.page.keyboard.press('Escape') + await talentsPage.checkTalentExist(talentName) + }) + + test('Filter by Contact Info: Github URL', async () => { + talentName = await talentsPage.createNewTalent() + const github = `https://github.com/${generateId()}` + await talentsPage.checkTalentExist(talentName) + + await talentsPage.openTalentByTalentName(talentName) + await talentDetailsPage.openAddSocialLinksPopup('Github', github) + await talentDetailsPage.checkSocialLinks('Github', github) + + await talentsPage.clickTalentsTab() + await talentsPage.selectFilter('Contact Info', 'GitHub') + await talentsPage.page.keyboard.press('Escape') + await talentsPage.checkTalentExist(talentName) + }) + + test('Filter by "Created by"', async () => { + talentName = await talentsPage.createNewTalent() + const createdBy = 'Appleseed John' + const createdByInitials = 'AJ' + + await talentsPage.selectFilter('Created by', createdBy) + await talentsPage.inputSearch().press('Escape') + + await talentsPage.checkFilterWithInitials('Created by', 'is', createdByInitials) + await talentsPage.checkTalentExist(talentName) + }) + + test('Filter by "Modified by"', async () => { + talentName = await talentsPage.createNewTalent() + const modifiedBy = 'Appleseed John' + const modifiedByInitials = 'AJ' + + await talentsPage.selectFilter('Modified by', modifiedBy) + await talentsPage.inputSearch().press('Escape') + + await talentsPage.checkFilterWithInitials('Modified by', 'is', modifiedByInitials) + await talentsPage.checkTalentExist(talentName) + }) + + test('Filter by Title', async () => { + talentName = await talentsPage.createNewTalent() + const talentTitle = `Title ${generateId()}` + + await talentsPage.checkTalentExist(talentName) + + await talentsPage.openTalentByTalentName(talentName) + await talentDetailsPage.addTitle(talentTitle) + + await talentsPage.clickTalentsTab() + await talentsPage.selectFilter('Title', talentTitle) + await talentsPage.page.keyboard.press('Escape') + await talentsPage.checkTalentExist(talentName) + }) + + test('Filter by Source', async () => { + talentName = await talentsPage.createNewTalent() + const talentSource = `Source ${generateId()}` + + await talentsPage.checkTalentExist(talentName) + + await talentsPage.openTalentByTalentName(talentName) + await talentDetailsPage.addSource(talentSource) + + await talentsPage.clickTalentsTab() + await talentsPage.selectFilter('Source', talentSource) + await talentsPage.page.keyboard.press('Escape') + await talentsPage.checkTalentExist(talentName) + }) + + test('Filter by Location', async () => { + talentName = await talentsPage.createNewTalent() + const location = `Location ${generateId()}` + + await talentsPage.checkTalentExist(talentName) + + await talentsPage.openTalentByTalentName(talentName) + await talentDetailsPage.enterLocation(location) + + await talentsPage.clickTalentsTab() + await talentsPage.selectFilter('Location', location) + await talentsPage.page.keyboard.press('Escape') + await talentsPage.checkTalentExist(talentName) + }) +}) diff --git a/tests/sanity/tests/recruiting/vacancies.spec.ts b/tests/sanity/tests/recruiting/vacancies.spec.ts deleted file mode 100644 index 4730d6e9dee..00000000000 --- a/tests/sanity/tests/recruiting/vacancies.spec.ts +++ /dev/null @@ -1,135 +0,0 @@ -import { test } from '@playwright/test' -import { generateId, PlatformSetting, PlatformURI } from '../utils' -import { NavigationMenuPage } from '../model/recruiting/navigation-menu-page' -import { VacanciesPage } from '../model/recruiting/vacancies-page' -import { VacancyDetailsPage } from '../model/recruiting/vacancy-details-page' -import { NewVacancy } from '../model/recruiting/types' - -test.use({ - storageState: PlatformSetting -}) - -test.describe('Vacancy tests', () => { - let navigationMenuPage: NavigationMenuPage - let vacanciesPage: VacanciesPage - let vacancyDetailsPage: VacancyDetailsPage - - test.beforeEach(async ({ page }) => { - navigationMenuPage = new NavigationMenuPage(page) - vacanciesPage = new VacanciesPage(page) - vacancyDetailsPage = new VacancyDetailsPage(page) - await (await page.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished() - }) - - test('create-vacancy', async () => { - const vacancyId = 'My vacancy ' + generateId(4) - await vacanciesPage.createVacancy(vacancyId) - await vacanciesPage.modifyVacancy(vacancyId) - await vacanciesPage.createApplicationVacencies('Alex') - }) - - test('use-kanban', async () => { - await vacanciesPage.navigateToSoftwareEngineerVacancies() - await vacanciesPage.selectApplicationsTab() - await vacanciesPage.verifyApplicantsVisibility() - - // test('application-search', async ({ page }) => { - // TODO: Application search is broken, since indexer now index from child to parent. - // await page.locator('[id="app-recruit\\:string\\:RecruitApplication"]').click() - - // await page.locator('text=Vacancies').click() - // await page.click('text=Software Engineer') - - // await expect(page.locator('text=M. Marina')).toBeVisible() - // expect(await page.locator('.antiTable-body__row').count()).toBeGreaterThan(2) - - // const searchBox = page.locator('[placeholder="Search"]') - // await searchBox.fill('Frontend Engineer') - // await searchBox.press('Enter') - - // await expect(page.locator('.antiTable-body__row')).toHaveCount(1) - - // await searchBox.fill('') - // await searchBox.press('Enter') - - // await expect(page.locator('text=M. Marina')).toBeVisible() - // expect(await page.locator('.antiTable-body__row').count()).toBeGreaterThan(2) - // }) - }) - - test('Edit a Vacancy', async () => { - const vacancyName = 'Edit Vacancy ' + generateId(4) - - await navigationMenuPage.clickButtonVacancies() - await vacanciesPage.createNewVacancy({ - title: vacancyName, - description: 'Vacancy description from Edit a Vacancy test', - location: 'Edit a Vacancy location' - }) - await vacanciesPage.openVacancyByName(vacancyName) - await vacancyDetailsPage.addComment('Test Vacancy Comment 12345') - await vacancyDetailsPage.checkCommentExist('Test Vacancy Comment 12345') - await vacancyDetailsPage.fillInputDescription('Edit a Vacancy description') - await vacancyDetailsPage.checkIfInputDescriptionHasText('Edit a Vacancy description') - await vacancyDetailsPage.addAttachments('cat.jpeg') - await vacancyDetailsPage.addDescription('Vacancy Description left-side menu') - await vacancyDetailsPage.addLocation('Edit Vacancy Location') - await vacancyDetailsPage.addCompany('Apple') - await vacancyDetailsPage.addDueDateToday() - }) - - test('Filter vacancies', async () => { - // viable when test set of vacancies fits to single page - const vacancyName = 'Archive Vacancy ' + generateId(5) - await navigationMenuPage.clickButtonVacancies() - await vacanciesPage.createNewVacancy({ - title: vacancyName, - description: 'Vacancy description from Filter vacancies test', - location: 'Filter vacancies location' - }) - await vacanciesPage.checkVacancyExist(vacancyName, `Created vacancy "${vacancyName}" visible by default.`) - await vacanciesPage.archiveVacancyByName(vacancyName) - await vacanciesPage.checkVacancyNotExist(vacancyName, `Archieved vacancy "${vacancyName}" not visible by default.`) - await vacanciesPage.showArchivedVacancy() - await vacanciesPage.checkVacancyExist( - vacancyName, - `Archieved vacancy "${vacancyName}" visible when hide archved off.` - ) - await vacanciesPage.clickOnHideArchivedVacancies() - await vacanciesPage.checkVacancyNotExist( - vacancyName, - `Archieved vacancy "${vacancyName}" not visible when hide archved back on.` - ) - }) - - test('Export vacancies', async () => { - await navigationMenuPage.clickButtonVacancies() - await vacanciesPage.selectAll() - await vacanciesPage.exportVacanciesWithCheck('Software Engineer', 2000) - }) - - test('Archive a Vacancy', async ({ page }) => { - const archiveVacancy: NewVacancy = { - title: `Archive Vacancy-${generateId(4)}`, - description: 'Vacancy description from Edit a Archive a Vacancy test', - location: 'Archive a Vacancy location' - } - - await navigationMenuPage.clickButtonVacancies() - await vacanciesPage.createNewVacancy(archiveVacancy) - await vacanciesPage.openVacancyByName(archiveVacancy.title) - await vacancyDetailsPage.moreActionOn('Archive') - await vacancyDetailsPage.pressYesForPopup(page) - await vacancyDetailsPage.checkActivityExist('Archived set to Yes') - await navigationMenuPage.clickButtonVacancies() - await vacanciesPage.checkVacancyNotExist( - archiveVacancy.title, - `Archieved vacancy "${archiveVacancy.title}" visible.` - ) - await vacanciesPage.showArchivedVacancy() - await vacanciesPage.checkVacancyExist( - archiveVacancy.title, - `Archieved vacancy "${archiveVacancy.title}" is not visible.` - ) - }) -}) diff --git a/tests/sanity/tests/recruiting/vacancies/vacancies-filter.spec.ts b/tests/sanity/tests/recruiting/vacancies/vacancies-filter.spec.ts new file mode 100644 index 00000000000..887e77362eb --- /dev/null +++ b/tests/sanity/tests/recruiting/vacancies/vacancies-filter.spec.ts @@ -0,0 +1,302 @@ +import { expect, test } from '@playwright/test' +import { generateId, PlatformSetting, PlatformURI } from '../../utils' +import { VacanciesPage } from '../../model/recruiting/vacancies-page' +import { VacancyDetailsPage } from '../../model/recruiting/vacancy-details-page' +// import { NewVacancy } from '../../model/recruiting/types' +import { LeftSideMenuPage } from '../../model/left-side-menu-page' +import { DateDivided } from '../../model/types' + +test.use({ + storageState: PlatformSetting +}) + +test.describe('Recruiting. Vacancies filters tests', () => { + let vacanciesPage: VacanciesPage + let vacancyDetailsPage: VacancyDetailsPage + let leftSideMenuPage: LeftSideMenuPage + let name: string + + test.beforeEach(async ({ page }) => { + leftSideMenuPage = new LeftSideMenuPage(page) + vacanciesPage = new VacanciesPage(page) + vacancyDetailsPage = new VacancyDetailsPage(page) + await (await page.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished() + + await leftSideMenuPage.clickRecruiting() + await vacanciesPage.openVacancies() + }) + + test('Filter by Modified date: Today', async () => { + name = await vacanciesPage.createVacancy() + await vacanciesPage.selectFilter('Modified date', 'Today') + await vacanciesPage.checkFilter('Modified date', 'Today') + + await vacanciesPage.checkVacancyExist(name) + }) + + test('Filter by Modified date: Yesterday', async () => { + name = await vacanciesPage.createVacancy() + + await vacanciesPage.selectFilter('Modified date', 'Yesterday') + await vacanciesPage.checkFilter('Modified date', 'Yesterday') + + await vacanciesPage.checkVacancyNotExist(name) + }) + + test('Filter by Modified date: This week', async () => { + name = await vacanciesPage.createVacancy() + + await vacanciesPage.selectFilter('Modified date', 'This week') + await vacanciesPage.checkFilter('Modified date', 'This week') + + await vacanciesPage.checkVacancyExist(name) + }) + + test('Filter by Modified date: This month', async () => { + name = await vacanciesPage.createVacancy() + + await vacanciesPage.selectFilter('Modified date', 'This month') + await vacanciesPage.checkFilter('Modified date', 'This month') + + await vacanciesPage.checkVacancyExist(name) + }) + + test('Filter by Modified date: Exact Today', async () => { + name = await vacanciesPage.createVacancy() + + await vacanciesPage.selectFilter('Modified date', 'Today') + await vacanciesPage.updateFilterDimension('Exact date', 'Today') + await vacanciesPage.checkFilter('Modified date', 'is', 'Today') + + await vacanciesPage.checkVacancyExist(name) + }) + + test('Filter by Modified date: Before Today', async () => { + name = await vacanciesPage.createVacancy() + + await vacanciesPage.selectFilter('Modified date', 'Today') + await vacanciesPage.updateFilterDimension('Before date', 'Today') + await vacanciesPage.checkFilter('Modified date', 'Before', 'Today') + + await vacanciesPage.checkVacancyNotExist(name) + }) + + test('Filter by Modified date: After Today', async () => { + name = await vacanciesPage.createVacancy() + + await vacanciesPage.selectFilter('Modified date', 'Today') + await vacanciesPage.updateFilterDimension('After date', 'Today') + await vacanciesPage.checkFilter('Modified date', 'After', 'Today') + + await vacanciesPage.checkVacancyExist(name) + }) + + test('Filter by Modified date: Between dates', async () => { + name = await vacanciesPage.createVacancy() + + await vacanciesPage.selectFilter('Modified date', 'Today') + await vacanciesPage.updateFilterDimension('Between dates') + + const dateYesterday = new Date() + dateYesterday.setDate(dateYesterday.getDate() - 1) + + const dateTomorrow = new Date() + dateTomorrow.setDate(dateTomorrow.getDate() + 1) + + const dateYesterdayDivided: DateDivided = { + day: dateYesterday.getDate().toString(), + month: (dateYesterday.getMonth() + 1).toString(), + year: dateYesterday.getFullYear().toString() + } + + const dateTomorrowDivided: DateDivided = { + day: dateTomorrow.getDate().toString(), + month: (dateTomorrow.getMonth() + 1).toString(), + year: dateTomorrow.getFullYear().toString() + } + + await vacanciesPage.fillBetweenDate(dateYesterdayDivided, dateTomorrowDivided) + await vacanciesPage.checkFilter('Modified date', 'is between', dateYesterday.getDate().toString()) + await vacanciesPage.checkFilter('Modified date', 'is between', dateTomorrow.getDate().toString()) + + await vacanciesPage.checkVacancyExist(name) + }) + + test('Filter by Created date: Today', async () => { + name = await vacanciesPage.createVacancy() + await vacanciesPage.selectFilter('Created date', 'Today') + await vacanciesPage.checkFilter('Created date', 'Today') + + await vacanciesPage.checkVacancyExist(name) + }) + + test('Filter by Created date: Yesterday', async () => { + name = await vacanciesPage.createVacancy() + + await vacanciesPage.selectFilter('Created date', 'Yesterday') + await vacanciesPage.checkFilter('Created date', 'Yesterday') + + await vacanciesPage.checkVacancyNotExist(name) + }) + + test('Filter by Created date: This week', async () => { + name = await vacanciesPage.createVacancy() + await vacanciesPage.selectFilter('Created date', 'This week') + await vacanciesPage.checkFilter('Created date', 'This week') + + await vacanciesPage.checkVacancyExist(name) + }) + + test('Filter by Created date: This month', async () => { + name = await vacanciesPage.createVacancy() + await vacanciesPage.selectFilter('Created date', 'This month') + await vacanciesPage.checkFilter('Created date', 'This month') + + await vacanciesPage.checkVacancyExist(name) + }) + + test('Filter by Created date: Exact Today', async () => { + name = await vacanciesPage.createVacancy() + await vacanciesPage.selectFilter('Created date', 'Today') + await vacanciesPage.updateFilterDimension('Exact date', 'Today') + await vacanciesPage.checkFilter('Created date', 'is', 'Today') + + await vacanciesPage.checkVacancyExist(name) + }) + + test('Filter by Created date: Before Today', async () => { + name = await vacanciesPage.createVacancy() + + await vacanciesPage.selectFilter('Created date', 'Today') + await vacanciesPage.updateFilterDimension('Before date', 'Today') + await vacanciesPage.checkFilter('Created date', 'Before', 'Today') + + await vacanciesPage.checkVacancyNotExist(name) + }) + + test('Filter by Created date: After Today', async () => { + name = await vacanciesPage.createVacancy() + + await vacanciesPage.selectFilter('Created date', 'Today') + await vacanciesPage.updateFilterDimension('After date', 'Today') + await vacanciesPage.checkFilter('Created date', 'After', 'Today') + + await vacanciesPage.checkVacancyExist(name) + }) + + test('Filter by Created date: Between dates', async () => { + name = await vacanciesPage.createVacancy() + + await vacanciesPage.selectFilter('Created date', 'Today') + await vacanciesPage.updateFilterDimension('Between dates') + + const dateYesterday = new Date() + dateYesterday.setDate(dateYesterday.getDate() - 1) + + const dateTomorrow = new Date() + dateTomorrow.setDate(dateTomorrow.getDate() + 1) + + const dateYesterdayDivided: DateDivided = { + day: dateYesterday.getDate().toString(), + month: (dateYesterday.getMonth() + 1).toString(), + year: dateYesterday.getFullYear().toString() + } + + const dateTomorrowDivided: DateDivided = { + day: dateTomorrow.getDate().toString(), + month: (dateTomorrow.getMonth() + 1).toString(), + year: dateTomorrow.getFullYear().toString() + } + + await vacanciesPage.fillBetweenDate(dateYesterdayDivided, dateTomorrowDivided) + await vacanciesPage.checkFilter('Created date', 'is between', dateYesterday.getDate().toString()) + await vacanciesPage.checkFilter('Created date', 'is between', dateTomorrow.getDate().toString()) + + await vacanciesPage.checkVacancyExist(name) + }) + + test('Filter by "Created by"', async () => { + name = await vacanciesPage.createVacancy() + const createdBy = 'Appleseed John' + const createdByInitials = 'AJ' + + await vacanciesPage.selectFilter('Created by', createdBy) + await vacanciesPage.inputSearch().press('Escape') + + await vacanciesPage.checkFilterWithInitials('Created by', 'is', createdByInitials) + await vacanciesPage.checkVacancyExist(name) + }) + + test('Filter by "Modified by"', async () => { + name = await vacanciesPage.createVacancy() + const modifiedBy = 'Appleseed John' + const modifiedByInitials = 'AJ' + + await vacanciesPage.selectFilter('Modified by', modifiedBy) + await vacanciesPage.inputSearch().press('Escape') + + await vacanciesPage.checkFilterWithInitials('Modified by', 'is', modifiedByInitials) + await vacanciesPage.checkVacancyExist(name) + }) + + test('Filter by Name', async () => { + name = await vacanciesPage.createVacancy() + const unexpectedName = generateId() + + await vacanciesPage.selectFilter('Name', unexpectedName) + await vacanciesPage.checkFilter('Name', 'contains', unexpectedName) + + await expect(vacanciesPage.linesFromTable()).toHaveCount(0) + + await vacanciesPage.buttonClearFilters().click() + + await vacanciesPage.selectFilter('Name', name) + await vacanciesPage.checkFilter('Name', 'contains', name) + + await vacanciesPage.checkVacancyExist(name) + }) + + test('Filter by Location', async () => { + name = await vacanciesPage.createVacancy() + const location = 'Moscow' + + await vacanciesPage.openVacancyByName(name) + await vacancyDetailsPage.addLocation(location) + + await vacanciesPage.openVacancies() + await vacanciesPage.selectFilter('Location', location) + await vacanciesPage.page.keyboard.press('Escape') + await vacanciesPage.checkVacancyExist(name) + }) + + test('Filter by Members', async () => { + name = await vacanciesPage.createVacancy() + const secondMember = 'Chen Rosamund' + + await vacanciesPage.selectFilter('Members', secondMember) + await vacanciesPage.page.keyboard.press('Escape') + await vacanciesPage.checkVacancyNotExist(name) + + await vacanciesPage.buttonClearFilters().click() + + await vacanciesPage.openVacancyByName(name) + await vacancyDetailsPage.addMember(secondMember) + + await vacanciesPage.openVacancies() + await vacanciesPage.selectFilter('Members', secondMember) + await vacanciesPage.page.keyboard.press('Escape') + await vacanciesPage.checkVacancyExist(name) + }) + + test('Filter by Archive', async () => { + name = await vacanciesPage.createVacancy() + + await vacanciesPage.checkVacancyExist(name) + await vacanciesPage.archiveVacancyByName(name) + await vacanciesPage.checkVacancyNotExist(name) + await vacanciesPage.showArchivedVacancy() + await vacanciesPage.checkVacancyExist(name) + await vacanciesPage.clickOnHideArchivedVacancies() + await vacanciesPage.checkVacancyNotExist(name) + }) +}) diff --git a/tests/sanity/tests/recruiting/vacancies/vacancy.spec.ts b/tests/sanity/tests/recruiting/vacancies/vacancy.spec.ts new file mode 100644 index 00000000000..6c7c995db18 --- /dev/null +++ b/tests/sanity/tests/recruiting/vacancies/vacancy.spec.ts @@ -0,0 +1,76 @@ +import { test } from '@playwright/test' +import { generateId, PlatformSetting, PlatformURI } from '../../utils' +import { NavigationMenuPage } from '../../model/recruiting/navigation-menu-page' +import { VacanciesPage } from '../../model/recruiting/vacancies-page' +import { VacancyDetailsPage } from '../../model/recruiting/vacancy-details-page' +import { NewVacancy } from '../../model/recruiting/types' + +test.use({ + storageState: PlatformSetting +}) + +test.describe('Recruiting. Vacancy tests', () => { + let navigationMenuPage: NavigationMenuPage + let vacanciesPage: VacanciesPage + let vacancyDetailsPage: VacancyDetailsPage + + test.beforeEach(async ({ page }) => { + navigationMenuPage = new NavigationMenuPage(page) + vacanciesPage = new VacanciesPage(page) + vacancyDetailsPage = new VacancyDetailsPage(page) + await (await page.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished() + }) + + test('Create a Vacancy', async () => { + const vacancyId = 'My vacancy ' + generateId(4) + await vacanciesPage.createVacancy(vacancyId) + await vacanciesPage.modifyVacancy(vacancyId) + await vacanciesPage.createApplicationVacencies('Alex') + }) + + test('Edit a Vacancy', async () => { + const vacancyName = 'Edit Vacancy ' + generateId(4) + + await navigationMenuPage.clickButtonVacancies() + await vacanciesPage.createNewVacancy({ + title: vacancyName, + description: 'Vacancy description from Edit a Vacancy test', + location: 'Edit a Vacancy location' + }) + await vacanciesPage.openVacancyByName(vacancyName) + await vacancyDetailsPage.addComment('Test Vacancy Comment 12345') + await vacancyDetailsPage.checkCommentExist('Test Vacancy Comment 12345') + await vacancyDetailsPage.fillInputDescription('Edit a Vacancy description') + await vacancyDetailsPage.checkIfInputDescriptionHasText('Edit a Vacancy description') + await vacancyDetailsPage.addAttachments('cat.jpeg') + await vacancyDetailsPage.addDescription('Vacancy Description left-side menu') + await vacancyDetailsPage.addLocation('Edit Vacancy Location') + await vacancyDetailsPage.addCompany('Apple') + await vacancyDetailsPage.addDueDateToday() + }) + + test('Export vacancies', async () => { + await navigationMenuPage.clickButtonVacancies() + await vacanciesPage.selectAll() + await vacanciesPage.exportVacanciesWithCheck('Software Engineer', 2000) + }) + + test('Archive a Vacancy', async ({ page }) => { + const archiveVacancy: NewVacancy = { + title: `Archive Vacancy-${generateId(4)}`, + description: 'Vacancy description from Edit a Archive a Vacancy test', + location: 'Archive a Vacancy location' + } + + await navigationMenuPage.clickButtonVacancies() + await vacanciesPage.createNewVacancy(archiveVacancy) + await vacanciesPage.openVacancyByName(archiveVacancy.title) + await vacancyDetailsPage.moreActionOn('Archive') + await vacancyDetailsPage.pressYesForPopup(page) + await vacancyDetailsPage.checkActivityExist('Archived set to Yes') + await navigationMenuPage.clickButtonVacancies() + await vacanciesPage.checkVacancyNotExist(archiveVacancy.title) + await vacanciesPage.showArchivedVacancy() + await vacanciesPage.checkVacancyExist(archiveVacancy.title) + }) +}) diff --git a/tests/sanity/tests/tracker/filter.spec.ts b/tests/sanity/tests/tracker/filter.spec.ts index 946e3e24a29..53a1f8b1d0c 100644 --- a/tests/sanity/tests/tracker/filter.spec.ts +++ b/tests/sanity/tests/tracker/filter.spec.ts @@ -15,227 +15,206 @@ test.describe('Tracker filters tests', () => { let leftSideMenuPage: LeftSideMenuPage let issuesPage: IssuesPage let issuesDetailsPage: IssuesDetailsPage + let issueData: NewIssue + let issueTitle: string test.beforeEach(async ({ page }) => { leftSideMenuPage = new LeftSideMenuPage(page) issuesPage = new IssuesPage(page) issuesDetailsPage = new IssuesDetailsPage(page) - await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished() - }) - - // TODO: We need to split them into separate one's and fix. - test.skip('Modified date', async () => { - const newIssue: NewIssue = { - title: `Issue for the Modified filter-${generateId()}`, - description: 'Issue for the Modified filter', - status: 'In Progress', - priority: 'Urgent', + issueData = { + title: `Issue for filtering-${generateId()}`, + description: 'Issue to filter', assignee: 'Appleseed John', - createLabel: true, - component: 'No component', - estimation: '2', - milestone: 'No Milestone', - duedate: 'today', - filePath: 'cat.jpeg' + status: 'In progress' } - await leftSideMenuPage.clickTracker() + await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished() + await leftSideMenuPage.clickTracker() await issuesPage.clickModelSelectorAll() - await issuesPage.createNewIssue(newIssue) + }) - await test.step('Check Filter Today', async () => { - await issuesPage.selectFilter('Modified date', 'Today') - await issuesPage.checkFilter('Modified date', 'Today') + test('Filter by Modified date: Today', async () => { + issueTitle = await issuesPage.createNewIssue(issueData) + await issuesPage.selectFilter('Modified date', 'Today') + await issuesPage.checkFilter('Modified date', 'Today') - await issuesPage.checkFilteredIssueExist(newIssue.title) - }) + await issuesPage.checkFilteredIssueExist(issueTitle) + }) - await test.step('Check Filter Yesterday', async () => { - await issuesPage.updateFilterDimension('Yesterday') - await issuesPage.checkFilter('Modified date', 'Yesterday') + test('Filter by Modified date: Yesterday', async () => { + issueTitle = await issuesPage.createNewIssue(issueData) + await issuesPage.selectFilter('Modified date', 'Yesterday') + await issuesPage.checkFilter('Modified date', 'Yesterday') - await issuesPage.checkFilteredIssueNotExist(newIssue.title) - }) + await issuesPage.checkFilteredIssueNotExist(issueTitle) + }) - await test.step('Check Filter This week', async () => { - await issuesPage.updateFilterDimension('This week') - await issuesPage.checkFilter('Modified date', 'This week') + test('Filter by Modified date: This week', async () => { + issueTitle = await issuesPage.createNewIssue(issueData) + await issuesPage.selectFilter('Modified date', 'This week') + await issuesPage.checkFilter('Modified date', 'This week') - await issuesPage.checkFilteredIssueExist(newIssue.title) - }) + await issuesPage.checkFilteredIssueExist(issueTitle) + }) - await test.step('Check Filter This month', async () => { - await issuesPage.updateFilterDimension('This month') - await issuesPage.checkFilter('Modified date', 'This month') + test('Filter by Modified date: This month', async () => { + issueTitle = await issuesPage.createNewIssue(issueData) + await issuesPage.selectFilter('Modified date', 'This month') + await issuesPage.checkFilter('Modified date', 'This month') - await issuesPage.checkFilteredIssueExist(newIssue.title) - }) + await issuesPage.checkFilteredIssueExist(issueTitle) + }) - await test.step('Check Filter Exact date - Today', async () => { - await issuesPage.updateFilterDimension('Exact date', 'Today') - await issuesPage.checkFilter('Modified date', 'is', 'Today') + test('Filter by Modified date: Exact Today', async () => { + issueTitle = await issuesPage.createNewIssue(issueData) + await issuesPage.selectFilter('Modified date', 'Today') + await issuesPage.updateFilterDimension('Exact date', 'Today') + await issuesPage.checkFilter('Modified date', 'is', 'Today') - await issuesPage.checkFilteredIssueExist(newIssue.title) - }) + await issuesPage.checkFilteredIssueExist(issueTitle) + }) - await test.step('Check Filter Before date - Today', async () => { - await issuesPage.updateFilterDimension('Before date') - await issuesPage.checkFilter('Modified date', 'Before', 'Today') + test('Filter by Modified date: Before Today', async () => { + issueTitle = await issuesPage.createNewIssue(issueData) + await issuesPage.selectFilter('Modified date', 'Today') + await issuesPage.updateFilterDimension('Before date', 'Today') + await issuesPage.checkFilter('Modified date', 'Before', 'Today') - await issuesPage.checkFilteredIssueNotExist(newIssue.title) - }) + await issuesPage.checkFilteredIssueNotExist(issueTitle) + }) - await test.step('Check Filter After date - Today', async () => { - await issuesPage.updateFilterDimension('After date') - await issuesPage.checkFilter('Modified date', 'After', 'Today') + test('Filter by Modified date: After Today', async () => { + issueTitle = await issuesPage.createNewIssue(issueData) + await issuesPage.selectFilter('Modified date', 'Today') + await issuesPage.updateFilterDimension('After date', 'Today') + await issuesPage.checkFilter('Modified date', 'After', 'Today') - await issuesPage.checkFilteredIssueExist(newIssue.title) - }) + await issuesPage.checkFilteredIssueExist(issueTitle) + }) - await test.step('Check Filter Between Dates', async () => { - await issuesPage.updateFilterDimension('Between dates') - const dateYesterday = new Date() - dateYesterday.setDate(dateYesterday.getDate() - 1) - const dateTomorrow = new Date() - dateTomorrow.setDate(dateTomorrow.getDate() + 1) - const dateYesterdayDivided: DateDivided = { - day: dateYesterday.getDate().toString(), - month: (dateYesterday.getMonth() + 1).toString(), - year: dateYesterday.getFullYear().toString() - } - const dateTomorrowDivided: DateDivided = { - day: dateTomorrow.getDate().toString(), - month: (dateTomorrow.getMonth() + 1).toString(), - year: dateTomorrow.getFullYear().toString() - } + test('Filter by Modified date: Between dates', async () => { + issueTitle = await issuesPage.createNewIssue(issueData) + await issuesPage.selectFilter('Modified date', 'Today') + await issuesPage.updateFilterDimension('Between dates') - await issuesPage.fillBetweenDate(dateYesterdayDivided, dateTomorrowDivided) - await issuesPage.checkFilter('Modified date', 'is between', dateYesterday.getDate().toString()) - await issuesPage.checkFilter('Modified date', 'is between', dateTomorrow.getDate().toString()) + const dateYesterday = new Date() + dateYesterday.setDate(dateYesterday.getDate() - 1) - await issuesPage.checkFilteredIssueExist(newIssue.title) - }) - }) + const dateTomorrow = new Date() + dateTomorrow.setDate(dateTomorrow.getDate() + 1) - // TODO: We need to split them into separate one's and fix. - test.skip('Created date', async () => { - const yesterdayIssueTitle = 'Issue for the Check Filter Yesterday' - const newIssue: NewIssue = { - title: `Issue for the Created filter-${generateId()}`, - description: 'Issue for the Created filter', - status: 'In Progress', - priority: 'Urgent', - assignee: 'Appleseed John', - createLabel: true, - component: 'No component', - estimation: '2', - milestone: 'No Milestone', - duedate: 'today', - filePath: 'cat.jpeg' + const dateYesterdayDivided: DateDivided = { + day: dateYesterday.getDate().toString(), + month: (dateYesterday.getMonth() + 1).toString(), + year: dateYesterday.getFullYear().toString() } - await leftSideMenuPage.clickTracker() + const dateTomorrowDivided: DateDivided = { + day: dateTomorrow.getDate().toString(), + month: (dateTomorrow.getMonth() + 1).toString(), + year: dateTomorrow.getFullYear().toString() + } - await issuesPage.clickModelSelectorAll() - await issuesPage.createNewIssue(newIssue) + await issuesPage.fillBetweenDate(dateYesterdayDivided, dateTomorrowDivided) + await issuesPage.checkFilter('Modified date', 'is between', dateYesterday.getDate().toString()) + await issuesPage.checkFilter('Modified date', 'is between', dateTomorrow.getDate().toString()) - await test.step('Check Filter Today', async () => { - await issuesPage.selectFilter('Created date', 'Today') - await issuesPage.checkFilter('Created date', 'Today') + await issuesPage.checkFilteredIssueExist(issueTitle) + }) - await issuesPage.checkFilteredIssueExist(newIssue.title) - await issuesPage.checkFilteredIssueNotExist(yesterdayIssueTitle) - }) + test('Filter by Created date: Today', async () => { + issueTitle = await issuesPage.createNewIssue(issueData) + await issuesPage.selectFilter('Created date', 'Today') + await issuesPage.checkFilter('Created date', 'Today') - await test.step('Check Filter Yesterday', async () => { - await issuesPage.updateFilterDimension('Yesterday') - await issuesPage.checkFilter('Created date', 'Yesterday') + await issuesPage.checkFilteredIssueExist(issueTitle) + }) - await issuesPage.checkFilteredIssueExist(yesterdayIssueTitle) - await issuesPage.checkFilteredIssueNotExist(newIssue.title) - }) + test('Filter by Created date: Yesterday', async () => { + issueTitle = await issuesPage.createNewIssue(issueData) + await issuesPage.selectFilter('Created date', 'Yesterday') + await issuesPage.checkFilter('Created date', 'Yesterday') - await test.step('Check Filter This week', async () => { - await issuesPage.updateFilterDimension('This week') - await issuesPage.checkFilter('Created date', 'This week') + await issuesPage.checkFilteredIssueNotExist(issueTitle) + }) - await issuesPage.checkFilteredIssueExist(newIssue.title) - // this week filter started on Monday, the yesterday created issue on Sunday - if (new Date().getDay() !== 1) { - await issuesPage.checkFilteredIssueExist(yesterdayIssueTitle) - } else { - await issuesPage.checkFilteredIssueNotExist(yesterdayIssueTitle) - } - }) + test('Filter by Created date: This week', async () => { + issueTitle = await issuesPage.createNewIssue(issueData) + await issuesPage.selectFilter('Created date', 'This week') + await issuesPage.checkFilter('Created date', 'This week') - await test.step('Check Filter This month', async () => { - await issuesPage.updateFilterDimension('This month') - await issuesPage.checkFilter('Created date', 'This month') + await issuesPage.checkFilteredIssueExist(issueTitle) + }) - await issuesPage.checkFilteredIssueExist(newIssue.title) - await issuesPage.checkFilteredIssueExist(yesterdayIssueTitle) - }) + test('Filter by Created date: This month', async () => { + issueTitle = await issuesPage.createNewIssue(issueData) + await issuesPage.selectFilter('Created date', 'This month') + await issuesPage.checkFilter('Created date', 'This month') - await test.step('Check Filter Exact date - Yesterday', async () => { - const dateYesterday = new Date() - dateYesterday.setDate(dateYesterday.getDate() - 1) - await issuesPage.updateFilterDimension('Exact date', dateYesterday.getDate().toString()) - await issuesPage.checkFilter('Created date', 'is', dateYesterday.getDate().toString()) + await issuesPage.checkFilteredIssueExist(issueTitle) + }) - await issuesPage.checkFilteredIssueExist(yesterdayIssueTitle) - await issuesPage.checkFilteredIssueNotExist(newIssue.title) - }) + test('Filter by Created date: Exact Today', async () => { + issueTitle = await issuesPage.createNewIssue(issueData) + await issuesPage.selectFilter('Created date', 'Today') + await issuesPage.updateFilterDimension('Exact date', 'Today') + await issuesPage.checkFilter('Created date', 'is', 'Today') - await test.step('Check Filter Exact date - Today', async () => { - await issuesPage.updateFilterDimension('Exact date', 'Today', true) - await issuesPage.checkFilter('Created date', 'is', 'Today') + await issuesPage.checkFilteredIssueExist(issueTitle) + }) - await issuesPage.checkFilteredIssueExist(newIssue.title) - await issuesPage.checkFilteredIssueNotExist(yesterdayIssueTitle) - }) + test('Filter by Created date: Before Today', async () => { + issueTitle = await issuesPage.createNewIssue(issueData) + await issuesPage.selectFilter('Created date', 'Today') + await issuesPage.updateFilterDimension('Before date', 'Today') + await issuesPage.checkFilter('Created date', 'Before', 'Today') - await test.step('Check Filter Before date - Today', async () => { - await issuesPage.updateFilterDimension('Before date') - await issuesPage.checkFilter('Created date', 'Before', 'Today') + await issuesPage.checkFilteredIssueNotExist(issueTitle) + }) - await issuesPage.checkFilteredIssueNotExist(newIssue.title) - }) + test('Filter by Created date: After Today', async () => { + issueTitle = await issuesPage.createNewIssue(issueData) + await issuesPage.selectFilter('Created date', 'Today') + await issuesPage.updateFilterDimension('After date', 'Today') + await issuesPage.checkFilter('Created date', 'After', 'Today') - await test.step('Check Filter After date - Today', async () => { - await issuesPage.updateFilterDimension('After date') - await issuesPage.checkFilter('Created date', 'After', 'Today') + await issuesPage.checkFilteredIssueExist(issueTitle) + }) - await issuesPage.checkFilteredIssueExist(newIssue.title) - }) + test('Filter by Created date: Between dates', async () => { + issueTitle = await issuesPage.createNewIssue(issueData) + await issuesPage.selectFilter('Created date', 'Today') + await issuesPage.updateFilterDimension('Between dates') - await test.step('Check Filter Between Dates', async () => { - await issuesPage.updateFilterDimension('Between dates') - const dateYesterday = new Date() - dateYesterday.setDate(dateYesterday.getDate() - 1) - const dateTomorrow = new Date() - dateTomorrow.setDate(dateTomorrow.getDate() + 1) - const dateYesterdayDivided: DateDivided = { - day: dateYesterday.getDate().toString(), - month: (dateYesterday.getMonth() + 1).toString(), - year: dateYesterday.getFullYear().toString() - } - const dateTomorrowDivided: DateDivided = { - day: dateTomorrow.getDate().toString(), - month: (dateTomorrow.getMonth() + 1).toString(), - year: dateTomorrow.getFullYear().toString() - } + const dateYesterday = new Date() + dateYesterday.setDate(dateYesterday.getDate() - 1) - await issuesPage.fillBetweenDate(dateYesterdayDivided, dateTomorrowDivided) - await issuesPage.checkFilter('Created date', 'is between', dateYesterday.getDate().toString()) - await issuesPage.checkFilter('Created date', 'is between', dateTomorrow.getDate().toString()) + const dateTomorrow = new Date() + dateTomorrow.setDate(dateTomorrow.getDate() + 1) - await issuesPage.checkFilteredIssueExist(newIssue.title) - }) + const dateYesterdayDivided: DateDivided = { + day: dateYesterday.getDate().toString(), + month: (dateYesterday.getMonth() + 1).toString(), + year: dateYesterday.getFullYear().toString() + } + + const dateTomorrowDivided: DateDivided = { + day: dateTomorrow.getDate().toString(), + month: (dateTomorrow.getMonth() + 1).toString(), + year: dateTomorrow.getFullYear().toString() + } + + await issuesPage.fillBetweenDate(dateYesterdayDivided, dateTomorrowDivided) + await issuesPage.checkFilter('Created date', 'is between', dateYesterday.getDate().toString()) + await issuesPage.checkFilter('Created date', 'is between', dateTomorrow.getDate().toString()) + + await issuesPage.checkFilteredIssueExist(issueTitle) }) - test('Status filter', async () => { + test('Filter by Status', async () => { await leftSideMenuPage.clickTracker() await issuesPage.linkSidebarAll().click() @@ -253,7 +232,7 @@ test.describe('Tracker filters tests', () => { } }) - test('Priority filter', async () => { + test('Filter by Priority', async () => { await leftSideMenuPage.clickTracker() await issuesPage.clickModelSelectorAll() @@ -269,7 +248,7 @@ test.describe('Tracker filters tests', () => { } }) - test('Created by filter', async () => { + test('Filter by "Created by"', async () => { const createdBy = 'Appleseed John' await leftSideMenuPage.clickTracker() @@ -282,12 +261,12 @@ test.describe('Tracker filters tests', () => { for await (const issue of iterateLocator(issuesPage.issuesList())) { await issue.locator('span.list > a').click() - await issuesDetailsPage.checkIfButtonCbuttonCreatedByHaveTextCreatedBy(createdBy) + await issuesDetailsPage.checkIfButtonCreatedByHaveTextCreatedBy(createdBy) await issuesDetailsPage.clickCloseIssueButton() } }) - test('Component filter', async () => { + test('Filter by component', async () => { const defaultComponent = 'Default component' await leftSideMenuPage.clickTracker() @@ -306,7 +285,7 @@ test.describe('Tracker filters tests', () => { } }) - test('Title filter', async () => { + test('Filter by Title', async () => { const firstSearch = 'issue' const secondSearch = 'done' await leftSideMenuPage.clickTracker() @@ -333,7 +312,7 @@ test.describe('Tracker filters tests', () => { }) }) - test('Modified by filter', async () => { + test('Filter by "Modified by"', async () => { const modifierName = 'Appleseed John' await leftSideMenuPage.clickTracker() @@ -352,70 +331,53 @@ test.describe('Tracker filters tests', () => { } }) - // TODO: We need to split them into separate one's and fix. - test.skip('Milestone filter', async () => { - const filterMilestoneName = 'Filter Milestone' - const milestoneIssue: NewIssue = { - title: `Issue for the Milestone filter-${generateId()}`, - description: 'Issue for the Milestone filter', - milestone: filterMilestoneName - } + test('Filter by Milestone: "Filter Milestone"', async () => { + const title = `Issue with milestone-${generateId()}` + const milestone = 'Filter Milestone' + await issuesPage.createNewIssue({ ...issueData, ...{ title, milestone } }) await leftSideMenuPage.clickTracker() - await issuesPage.clickModelSelectorAll() - await issuesPage.createNewIssue(milestoneIssue) - await test.step('Check Milestone filter for Filter Milestone', async () => { - await issuesPage.selectFilter('Milestone', filterMilestoneName) - await issuesPage.inputSearch().press('Escape') - await issuesPage.checkFilter('Milestone', 'is', '1 state') + await issuesPage.selectFilter('Milestone', milestone) + await issuesPage.page.keyboard.press('Escape') + await issuesPage.checkFilter('Milestone', 'is', '1 state') - for await (const issue of iterateLocator(issuesPage.issuesList())) { - await expect(issue.locator('div.compression-bar #milestone span.label')).toContainText(filterMilestoneName) - } - }) + for await (const issue of iterateLocator(issuesPage.issuesList())) { + await expect(issue.locator('div.compression-bar #milestone span.label')).toContainText(milestone) + } + }) - await test.step('Check Milestone filter for Not selected', async () => { - await issuesPage.buttonClearFilters().click() - await issuesPage.selectFilter('Milestone', 'Not selected') - await issuesPage.inputSearch().press('Escape') - await issuesPage.checkFilter('Milestone', 'is', '1 state') + test('Filter by Milestone: Not selected', async () => { + issueTitle = await issuesPage.createNewIssue(issueData) + await leftSideMenuPage.clickTracker() + await issuesPage.clickModelSelectorAll() - for await (const issue of iterateLocator(issuesPage.issuesList())) { - await issue.locator('span.list > a').click() - await expect(issuesDetailsPage.buttonMilestone()).toHaveText('Milestone') + await issuesPage.selectFilter('Milestone', 'Not selected') + await issuesPage.page.keyboard.press('Escape') + await issuesPage.checkFilter('Milestone', 'is', '1 state') - issuesDetailsPage.buttonCloseIssue() - } - }) + await issuesPage.checkFilteredIssueExist(issueTitle) }) - test('Label filter', async () => { - const filterLabel = 'Filter Label' - const labelIssue: NewIssue = { - title: `Issue for the Label filter-${generateId()}`, - description: 'Issue for the Label filter', - labels: filterLabel, - createLabel: true - } + test('Filter by label', async () => { + const labels = `Label ${generateId()}` + const createLabel = true - await leftSideMenuPage.clickTracker() - await issuesPage.clickModelSelectorAll() - await issuesPage.createNewIssue(labelIssue) + issueTitle = await issuesPage.createNewIssue({ ...issueData, ...{ labels, createLabel } }) await test.step('Check Label filter for exist Label', async () => { - await issuesPage.selectFilter('Labels', filterLabel) - await issuesPage.inputSearch().press('Escape') - await issuesPage.checkFilter('Labels', 'is', filterLabel) + await issuesPage.selectFilter('Labels', labels) + await issuesPage.page.keyboard.press('Escape') + await issuesPage.checkFilter('Labels', 'is', labels) for await (const issue of iterateLocator(issuesPage.issuesList())) { - await expect(issue.locator('div.compression-bar > div.label-box span.label')).toContainText(filterLabel) + await expect(issue.locator('div.compression-bar > div.label-box span.label')).toContainText(labels) } }) }) // TODO: We need to split them into separate one's and fix. - test.skip('Due date filter', async () => { + test('Filter by Due date', async () => { const plusSevenDate = new Date() const currentMonth = plusSevenDate.getMonth() plusSevenDate.setDate(plusSevenDate.getDate() + 7) @@ -441,13 +403,10 @@ test.describe('Tracker filters tests', () => { duedate: 'nextMonth' } - await leftSideMenuPage.clickTracker() - await issuesPage.clickModelSelectorAll() await issuesPage.createNewIssue(dueDateOverdueIssue) await issuesPage.createNewIssue(dueDateTodayIssue) await issuesPage.createNewIssue(dueDateNextWeekIssue) await issuesPage.createNewIssue(dueDateNextMonthIssue) - await issuesPage.openAllCategories() await test.step('Check Filter Overdue', async () => { await issuesPage.selectFilter('Due date', 'Overdue')