From d8e5426bf0fff9a8b046103425a1e9ee609d04bc Mon Sep 17 00:00:00 2001 From: Rostislav Nazmeev Date: Fri, 27 Sep 2024 16:21:00 +0200 Subject: [PATCH 1/8] Add filling all social link to new talent Signed-off-by: Rostislav Nazmeev --- .../recruiting/common-recruiting-page.ts | 4 +- .../tests/model/recruiting/talents-page.ts | 28 ++++++++-- tests/sanity/tests/recruiting/talents.spec.ts | 52 +++++++++++++------ 3 files changed, 63 insertions(+), 21 deletions(-) diff --git a/tests/sanity/tests/model/recruiting/common-recruiting-page.ts b/tests/sanity/tests/model/recruiting/common-recruiting-page.ts index 2b5e8d33141..0d0fc34fe43 100644 --- a/tests/sanity/tests/model/recruiting/common-recruiting-page.ts +++ b/tests/sanity/tests/model/recruiting/common-recruiting-page.ts @@ -142,14 +142,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 { diff --git a/tests/sanity/tests/model/recruiting/talents-page.ts b/tests/sanity/tests/model/recruiting/talents-page.ts index e7ec6eac334..3c1d556817a 100644 --- a/tests/sanity/tests/model/recruiting/talents-page.ts +++ b/tests/sanity/tests/model/recruiting/talents-page.ts @@ -44,8 +44,22 @@ export class TalentsPage extends CommonRecruitingPage { talentsTab = (): Locator => this.page.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 { diff --git a/tests/sanity/tests/recruiting/talents.spec.ts b/tests/sanity/tests/recruiting/talents.spec.ts index 50c47afae32..a0db694af67 100644 --- a/tests/sanity/tests/recruiting/talents.spec.ts +++ b/tests/sanity/tests/recruiting/talents.spec.ts @@ -9,7 +9,7 @@ test.use({ storageState: PlatformSetting }) -test.describe('candidate/talents tests', () => { +test.describe('Talents 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.only('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,7 +75,7 @@ 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)}` @@ -87,7 +107,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 +119,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() From a96d3d9180b4c7aa445c35f433a0e41e1b64758c Mon Sep 17 00:00:00 2001 From: Rostislav Nazmeev Date: Fri, 27 Sep 2024 22:04:42 +0200 Subject: [PATCH 2/8] Refactor of Tracker filter tests, add filter tests to talents Signed-off-by: Rostislav Nazmeev --- tests/sanity/tests/model/common-page.ts | 15 +- .../recruiting/common-recruiting-page.ts | 1 + .../model/tracker/issues-details-page.ts | 2 +- tests/sanity/tests/recruiting/talents.spec.ts | 60 ++- tests/sanity/tests/tracker/filter.spec.ts | 426 +++++++++--------- 5 files changed, 263 insertions(+), 241 deletions(-) diff --git a/tests/sanity/tests/model/common-page.ts b/tests/sanity/tests/model/common-page.ts index 55da551ee14..6cde6494f04 100644 --- a/tests/sanity/tests/model/common-page.ts +++ b/tests/sanity/tests/model/common-page.ts @@ -49,9 +49,10 @@ 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.getByRole('button', { name: 'Filter', exact: true }) inputFilterTitle = (): Locator => this.page.locator('div.selectPopup input[placeholder="Title"]') 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,6 +228,10 @@ 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) @@ -238,11 +243,13 @@ export class CommonPage { } } - 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 { diff --git a/tests/sanity/tests/model/recruiting/common-recruiting-page.ts b/tests/sanity/tests/model/recruiting/common-recruiting-page.ts index 0d0fc34fe43..acd15014230 100644 --- a/tests/sanity/tests/model/recruiting/common-recruiting-page.ts +++ b/tests/sanity/tests/model/recruiting/common-recruiting-page.ts @@ -63,6 +63,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() diff --git a/tests/sanity/tests/model/tracker/issues-details-page.ts b/tests/sanity/tests/model/tracker/issues-details-page.ts index 270646f99b9..927e3f3e710 100644 --- a/tests/sanity/tests/model/tracker/issues-details-page.ts +++ b/tests/sanity/tests/model/tracker/issues-details-page.ts @@ -227,7 +227,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/recruiting/talents.spec.ts b/tests/sanity/tests/recruiting/talents.spec.ts index a0db694af67..2c73a1e97b2 100644 --- a/tests/sanity/tests/recruiting/talents.spec.ts +++ b/tests/sanity/tests/recruiting/talents.spec.ts @@ -22,7 +22,7 @@ test.describe('Talents tests', () => { await (await page.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished() }) - test.only('Create a Talent', async () => { + test('Create a Talent', async () => { const newTalent = { firstName: 'Elton-' + generateId(4), lastName: 'John-' + generateId(4), @@ -80,7 +80,6 @@ test.describe('Talents tests', () => { await talentDetailsPage.inputLocation().fill('Awesome Location') const title = `Title-${generateId(4)}` await talentDetailsPage.addTitle(title) - // ADD ASSERTION }) test('Delete the Talent', async () => { @@ -155,20 +154,55 @@ test.describe('Talents tests', () => { await talentsPage.checkMatchVacancy(`${talentName.lastName} ${talentName.firstName}`, '0') }) - test('Filtering talents by skills', async ({ page }) => { + test('Filter talents', async ({ page }) => { const skillName = `Skill-${generateId(4)}` const talentName = 'P. Andrey' + const location = 'Monte Carlo' + + await test.step('Add attributest for filtering to talent', async () => { + await navigationMenuPage.clickButtonTalents() + await talentsPage.checkRowsInTableExist(talentName) + await talentsPage.openRowInTableByText(talentName) + await talentDetailsPage.addSkill(skillName, 'Skill Description') + await talentDetailsPage.buttonClosePanel().click() + }) - 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) + + await test.step('Filter by Talents properties', async () => { + const filtersWithSelection = [ + { name: 'Skills', panelName: 'Skill', value: skillName }, + { name: 'Remote', panelName: 'Remote', value: 'Yes' } + // { name: 'Onsite', panelName: 'Onsite', value: 'Yes' } + ] + + const filtersWithText = [ + { name: 'Location', panelName: 'Location', value: location }, + { name: 'Name', panelName: 'Name', value: 'Andrey' } + ] + + // const filtersWithUser = [ + // { name: 'Modified by', panelName: 'Modified by', value: 'Appleseed John' }, + // { name: 'Created by', panelName: 'Created by', value: 'Appleseed John' }, + // ] + + for (const { name, panelName, value } of filtersWithSelection) { + await talentsPage.selectFilter(name, value) + await talentsPage.page.keyboard.press('Escape') + await talentsPage.checkRowsInTableExist(talentName) + await talentsPage.filterOppositeCondition(panelName, 'is', 'is not') + await talentsPage.checkRowsInTableNotExist(talentName) + await talentsPage.checkRowsInTableExist('', talentsCount - 1) + await talentsPage.buttonClearFilters().click() + } + + for (const { name, panelName, value } of filtersWithText) { + await talentsPage.selectFilter(name, value) + await talentsPage.checkRowsInTableExist(talentName) + await talentsPage.filterOppositeCondition(panelName, 'contains') + await talentsPage.checkRowsInTableExist(talentName) + await talentsPage.buttonClearFilters().click() + } + }) }) }) diff --git a/tests/sanity/tests/tracker/filter.spec.ts b/tests/sanity/tests/tracker/filter.spec.ts index 946e3e24a29..fbd308132b8 100644 --- a/tests/sanity/tests/tracker/filter.spec.ts +++ b/tests/sanity/tests/tracker/filter.spec.ts @@ -11,10 +11,16 @@ test.use({ storageState: PlatformSetting }) -test.describe('Tracker filters tests', () => { +test.describe.only('Tracker filters tests', () => { let leftSideMenuPage: LeftSideMenuPage let issuesPage: IssuesPage let issuesDetailsPage: IssuesDetailsPage + const initialIssue: NewIssue = { + title: `Issue for filtering-${generateId()}`, + description: 'Issue to filter', + assignee: 'Appleseed John', + status: 'In progress' + } test.beforeEach(async ({ page }) => { leftSideMenuPage = new LeftSideMenuPage(page) @@ -22,220 +28,211 @@ test.describe('Tracker filters tests', () => { issuesDetailsPage = new IssuesDetailsPage(page) await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished() + + await leftSideMenuPage.clickTracker() + await issuesPage.clickModelSelectorAll() }) - // 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', - assignee: 'Appleseed John', - createLabel: true, - component: 'No component', - estimation: '2', - milestone: 'No Milestone', - duedate: 'today', - filePath: 'cat.jpeg' - } + // Modified date tests - await leftSideMenuPage.clickTracker() + test('Filter by Modified date: Today', async () => { + const title = `Issue ${generateId()}` + await issuesPage.createNewIssue({ ...initialIssue, ...{ title } }) + await issuesPage.selectFilter('Modified date', 'Today') + await issuesPage.checkFilter('Modified date', 'Today') - await issuesPage.clickModelSelectorAll() - await issuesPage.createNewIssue(newIssue) + await issuesPage.checkFilteredIssueExist(title) + }) - await test.step('Check Filter Today', async () => { - await issuesPage.selectFilter('Modified date', 'Today') - await issuesPage.checkFilter('Modified date', 'Today') + test('Filter by Modified date: Yesterday', async () => { + const title = `Issue ${generateId()}` - await issuesPage.checkFilteredIssueExist(newIssue.title) - }) + await issuesPage.createNewIssue({ ...initialIssue, ...{ title } }) + await issuesPage.selectFilter('Modified date', 'Yesterday') + await issuesPage.checkFilter('Modified date', 'Yesterday') - await test.step('Check Filter Yesterday', async () => { - await issuesPage.updateFilterDimension('Yesterday') - await issuesPage.checkFilter('Modified date', 'Yesterday') + await issuesPage.checkFilteredIssueNotExist(title) + }) - await issuesPage.checkFilteredIssueNotExist(newIssue.title) - }) + test('Filter by Modified date: This week', async () => { + const title = `Issue ${generateId()}` + await issuesPage.createNewIssue({ ...initialIssue, ...{ title } }) + await issuesPage.selectFilter('Modified date', 'This week') + await issuesPage.checkFilter('Modified date', 'This week') - await test.step('Check Filter This week', async () => { - await issuesPage.updateFilterDimension('This week') - await issuesPage.checkFilter('Modified date', 'This week') + await issuesPage.checkFilteredIssueExist(title) + }) - await issuesPage.checkFilteredIssueExist(newIssue.title) - }) + test('Filter by Modified date: This month', async () => { + const title = `Issue ${generateId()}` + await issuesPage.createNewIssue({ ...initialIssue, ...{ title } }) + await issuesPage.selectFilter('Modified date', 'This month') + await issuesPage.checkFilter('Modified date', 'This month') - await test.step('Check Filter This month', async () => { - await issuesPage.updateFilterDimension('This month') - await issuesPage.checkFilter('Modified date', 'This month') + await issuesPage.checkFilteredIssueExist(title) + }) - await issuesPage.checkFilteredIssueExist(newIssue.title) - }) + test('Filter by Modified date: Exact Today', async () => { + const title = `Issue ${generateId()}` + await issuesPage.createNewIssue({ ...initialIssue, ...{ title } }) + await issuesPage.selectFilter('Modified date', 'Today') + await issuesPage.updateFilterDimension('Exact date', 'Today') + await issuesPage.checkFilter('Modified date', 'is', 'Today') - await test.step('Check Filter Exact date - Today', async () => { - await issuesPage.updateFilterDimension('Exact date', 'Today') - await issuesPage.checkFilter('Modified date', 'is', 'Today') + await issuesPage.checkFilteredIssueExist(title) + }) - await issuesPage.checkFilteredIssueExist(newIssue.title) - }) + test('Filter by Modified date: Before Today', async () => { + const title = `Issue ${generateId()}` + await issuesPage.createNewIssue({ ...initialIssue, ...{ title } }) + await issuesPage.selectFilter('Modified date', 'Today') + await issuesPage.updateFilterDimension('Before date', 'Today') + await issuesPage.checkFilter('Modified date', 'Before', 'Today') - await test.step('Check Filter Before date - Today', async () => { - await issuesPage.updateFilterDimension('Before date') - await issuesPage.checkFilter('Modified date', 'Before', 'Today') + await issuesPage.checkFilteredIssueNotExist(title) + }) - await issuesPage.checkFilteredIssueNotExist(newIssue.title) - }) + test('Filter by Modified date: After Today', async () => { + const title = `Issue ${generateId()}` + await issuesPage.createNewIssue({ ...initialIssue, ...{ title } }) + await issuesPage.selectFilter('Modified date', 'Today') + await issuesPage.updateFilterDimension('After date', 'Today') + await issuesPage.checkFilter('Modified date', 'After', 'Today') - await test.step('Check Filter After date - Today', async () => { - await issuesPage.updateFilterDimension('After date') - await issuesPage.checkFilter('Modified date', 'After', 'Today') + await issuesPage.checkFilteredIssueExist(title) + }) - await issuesPage.checkFilteredIssueExist(newIssue.title) - }) + test('Filter by Modified date: Between dates', async () => { + const title = `Issue ${generateId()}` + await issuesPage.createNewIssue({ ...initialIssue, ...{ title } }) + await issuesPage.selectFilter('Modified 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('Modified date', 'is between', dateYesterday.getDate().toString()) - await issuesPage.checkFilter('Modified 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() + } - // 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 dateTomorrowDivided: DateDivided = { + day: dateTomorrow.getDate().toString(), + month: (dateTomorrow.getMonth() + 1).toString(), + year: dateTomorrow.getFullYear().toString() } - await leftSideMenuPage.clickTracker() + 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 issuesPage.clickModelSelectorAll() - await issuesPage.createNewIssue(newIssue) + await issuesPage.checkFilteredIssueExist(title) + }) - await test.step('Check Filter Today', async () => { - await issuesPage.selectFilter('Created date', 'Today') - await issuesPage.checkFilter('Created date', 'Today') + // Created date tests - await issuesPage.checkFilteredIssueExist(newIssue.title) - await issuesPage.checkFilteredIssueNotExist(yesterdayIssueTitle) - }) + test('Filter by Created date: Today', async () => { + const title = `Issue ${generateId()}` + await issuesPage.createNewIssue({ ...initialIssue, ...{ title } }) + 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(title) + }) - await issuesPage.checkFilteredIssueExist(yesterdayIssueTitle) - await issuesPage.checkFilteredIssueNotExist(newIssue.title) - }) + test('Filter by Created date: Yesterday', async () => { + const title = `Issue ${generateId()}` + await issuesPage.createNewIssue({ ...initialIssue, ...{ title } }) + 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(title) + }) - 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 () => { + const title = `Issue ${generateId()}` + await issuesPage.createNewIssue({ ...initialIssue, ...{ title } }) + 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(title) + }) - await issuesPage.checkFilteredIssueExist(newIssue.title) - await issuesPage.checkFilteredIssueExist(yesterdayIssueTitle) - }) + test('Filter by Created date: This month', async () => { + const title = `Issue ${generateId()}` + await issuesPage.createNewIssue({ ...initialIssue, ...{ title } }) + 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(title) + }) - await issuesPage.checkFilteredIssueExist(yesterdayIssueTitle) - await issuesPage.checkFilteredIssueNotExist(newIssue.title) - }) + test('Filter by Created date: Exact Today', async () => { + const title = `Issue ${generateId()}` + await issuesPage.createNewIssue({ ...initialIssue, ...{ title } }) + 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(title) + }) - await issuesPage.checkFilteredIssueExist(newIssue.title) - await issuesPage.checkFilteredIssueNotExist(yesterdayIssueTitle) - }) + test('Filter by Created date: Before Today', async () => { + const title = `Issue ${generateId()}` + await issuesPage.createNewIssue({ ...initialIssue, ...{ title } }) + 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(title) + }) - await issuesPage.checkFilteredIssueNotExist(newIssue.title) - }) + test('Filter by Created date: After Today', async () => { + const title = `Issue ${generateId()}` + await issuesPage.createNewIssue({ ...initialIssue, ...{ title } }) + 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(title) + }) - await issuesPage.checkFilteredIssueExist(newIssue.title) - }) + test('Filter by Created date: Between dates', async () => { + const title = `Issue ${generateId()}` + await issuesPage.createNewIssue({ ...initialIssue, ...{ title } }) + 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(title) }) - test('Status filter', async () => { + test('Filter by Status', async () => { await leftSideMenuPage.clickTracker() await issuesPage.linkSidebarAll().click() @@ -253,7 +250,7 @@ test.describe('Tracker filters tests', () => { } }) - test('Priority filter', async () => { + test('Filter by Priority', async () => { await leftSideMenuPage.clickTracker() await issuesPage.clickModelSelectorAll() @@ -269,7 +266,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 +279,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 +303,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 +330,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 +349,56 @@ 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({ ...initialIssue, ...{ 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 () => { + const title = `Issue without milestone-${generateId()}` - for await (const issue of iterateLocator(issuesPage.issuesList())) { - await issue.locator('span.list > a').click() - await expect(issuesDetailsPage.buttonMilestone()).toHaveText('Milestone') + await issuesPage.createNewIssue({ ...initialIssue, ...{ title } }) + await leftSideMenuPage.clickTracker() + await issuesPage.clickModelSelectorAll() - issuesDetailsPage.buttonCloseIssue() - } - }) + await issuesPage.selectFilter('Milestone', 'Not selected') + await issuesPage.page.keyboard.press('Escape') + await issuesPage.checkFilter('Milestone', 'is', '1 state') + + await issuesPage.checkFilteredIssueExist(title) }) - 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 = 'Filter Label' + const title = `Issue with label ${generateId()}` + const createLabel = true - await leftSideMenuPage.clickTracker() - await issuesPage.clickModelSelectorAll() - await issuesPage.createNewIssue(labelIssue) + await issuesPage.createNewIssue({ ...initialIssue, ...{ title, 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 +424,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') From 528b83be88909ebbd172131a82ff64b9c9063cf2 Mon Sep 17 00:00:00 2001 From: Rostislav Nazmeev Date: Sun, 29 Sep 2024 20:36:42 +0200 Subject: [PATCH 3/8] Add talents filter tests, refactor issues filters tests Signed-off-by: Rostislav Nazmeev --- tests/sanity/tests/model/common-page.ts | 5 + .../recruiting/common-recruiting-page.ts | 9 + .../tests/model/recruiting/talents-page.ts | 6 +- .../sanity/tests/model/tracker/issues-page.ts | 3 +- .../application.spec.ts} | 18 +- .../applications/applications-list.spec.ts | 0 .../companies/companies-list.spec.ts | 0 .../company.spec.ts} | 12 +- .../sanity/tests/recruiting/interview.spec.ts | 37 -- .../review.spec.ts} | 8 +- .../recruiting/reviews/reviews-list.spec.ts | 0 .../recruiting/{ => skills}/skills.spec.ts | 4 +- .../talent.spec.ts} | 12 +- .../recruiting/talents/talents-list.spec.ts | 366 ++++++++++++++++++ .../vacancies/vacancies-list.spec.ts | 0 .../vacancy.spec.ts} | 12 +- tests/sanity/tests/tracker/filter.spec.ts | 113 +++--- 17 files changed, 466 insertions(+), 139 deletions(-) rename tests/sanity/tests/recruiting/{applications.spec.ts => applications/application.spec.ts} (90%) create mode 100644 tests/sanity/tests/recruiting/applications/applications-list.spec.ts create mode 100644 tests/sanity/tests/recruiting/companies/companies-list.spec.ts rename tests/sanity/tests/recruiting/{companies.spec.ts => companies/company.spec.ts} (85%) delete mode 100644 tests/sanity/tests/recruiting/interview.spec.ts rename tests/sanity/tests/recruiting/{reviews.spec.ts => reviews/review.spec.ts} (82%) create mode 100644 tests/sanity/tests/recruiting/reviews/reviews-list.spec.ts rename tests/sanity/tests/recruiting/{ => skills}/skills.spec.ts (91%) rename tests/sanity/tests/recruiting/{talents.spec.ts => talents/talent.spec.ts} (95%) create mode 100644 tests/sanity/tests/recruiting/talents/talents-list.spec.ts create mode 100644 tests/sanity/tests/recruiting/vacancies/vacancies-list.spec.ts rename tests/sanity/tests/recruiting/{vacancies.spec.ts => vacancies/vacancy.spec.ts} (92%) diff --git a/tests/sanity/tests/model/common-page.ts b/tests/sanity/tests/model/common-page.ts index 6cde6494f04..a562bcdb6f4 100644 --- a/tests/sanity/tests/model/common-page.ts +++ b/tests/sanity/tests/model/common-page.ts @@ -51,6 +51,7 @@ export class CommonPage { buttonFilter = (): Locator => this.page.getByRole('button', { name: 'Filter', exact: true }) 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..."]') @@ -237,6 +238,10 @@ export class CommonPage { 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() } diff --git a/tests/sanity/tests/model/recruiting/common-recruiting-page.ts b/tests/sanity/tests/model/recruiting/common-recruiting-page.ts index acd15014230..cec854643da 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"]') @@ -173,6 +176,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/talents-page.ts b/tests/sanity/tests/model/recruiting/talents-page.ts index 3c1d556817a..60845b1c76b 100644 --- a/tests/sanity/tests/model/recruiting/talents-page.ts +++ b/tests/sanity/tests/model/recruiting/talents-page.ts @@ -41,7 +41,7 @@ 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"]') @@ -229,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/tracker/issues-page.ts b/tests/sanity/tests/model/tracker/issues-page.ts index 65a75c00894..1332370e075 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 { 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..87a0836623e 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('Recruting. Application tests', () => { let recrutingPage: RecruitingPage let vacanciesPage: VacanciesPage let vacancyDetailsPage: VacancyDetailsPage diff --git a/tests/sanity/tests/recruiting/applications/applications-list.spec.ts b/tests/sanity/tests/recruiting/applications/applications-list.spec.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/sanity/tests/recruiting/companies/companies-list.spec.ts b/tests/sanity/tests/recruiting/companies/companies-list.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..58dcc4ae565 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('Recruting. 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/review.spec.ts similarity index 82% rename from tests/sanity/tests/recruiting/reviews.spec.ts rename to tests/sanity/tests/recruiting/reviews/review.spec.ts index 31b495a77f5..d803d8ec967 100644 --- a/tests/sanity/tests/recruiting/reviews.spec.ts +++ b/tests/sanity/tests/recruiting/reviews/review.spec.ts @@ -1,13 +1,13 @@ 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' +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', () => { +test.describe('Recruting. Review tests', () => { let recruitingPage: RecruitingPage let commonRecruitingPage: CommonRecruitingPage diff --git a/tests/sanity/tests/recruiting/reviews/reviews-list.spec.ts b/tests/sanity/tests/recruiting/reviews/reviews-list.spec.ts new file mode 100644 index 00000000000..e69de29bb2d 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..7ef32cae93d 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('Recruting. 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 95% rename from tests/sanity/tests/recruiting/talents.spec.ts rename to tests/sanity/tests/recruiting/talents/talent.spec.ts index 2c73a1e97b2..07cd4db197c 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('Talents tests', () => { +test.describe('Recruting. Talents tests', () => { let talentsPage: TalentsPage let navigationMenuPage: NavigationMenuPage let talentDetailsPage: TalentDetailsPage diff --git a/tests/sanity/tests/recruiting/talents/talents-list.spec.ts b/tests/sanity/tests/recruiting/talents/talents-list.spec.ts new file mode 100644 index 00000000000..f674737b5eb --- /dev/null +++ b/tests/sanity/tests/recruiting/talents/talents-list.spec.ts @@ -0,0 +1,366 @@ +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('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' + + await talentsPage.selectFilter('Created by', 'System') + await talentsPage.inputSearch().press('Escape') + + await talentsPage.checkTalentNotExist(talentName) + await talentsPage.buttonClearFilters().click() + + await talentsPage.selectFilter('Created by', createdBy) + await talentsPage.inputSearch().press('Escape') + + await talentsPage.checkFilter('Created by', 'is') + await talentsPage.checkTalentExist(talentName) + }) + + test('Filter by "Modified by"', async () => { + talentName = await talentsPage.createNewTalent() + const createdBy = 'Appleseed John' + + await talentsPage.selectFilter('Modified by', 'System') + await talentsPage.inputSearch().press('Escape') + + await talentsPage.checkTalentNotExist(talentName) + await talentsPage.buttonClearFilters().click() + + await talentsPage.selectFilter('Modified by', createdBy) + await talentsPage.inputSearch().press('Escape') + + await talentsPage.checkFilter('Modified by', 'is') + 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/vacancies-list.spec.ts b/tests/sanity/tests/recruiting/vacancies/vacancies-list.spec.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/sanity/tests/recruiting/vacancies.spec.ts b/tests/sanity/tests/recruiting/vacancies/vacancy.spec.ts similarity index 92% rename from tests/sanity/tests/recruiting/vacancies.spec.ts rename to tests/sanity/tests/recruiting/vacancies/vacancy.spec.ts index 4730d6e9dee..ba0cf788ab1 100644 --- a/tests/sanity/tests/recruiting/vacancies.spec.ts +++ b/tests/sanity/tests/recruiting/vacancies/vacancy.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 { VacanciesPage } from '../model/recruiting/vacancies-page' -import { VacancyDetailsPage } from '../model/recruiting/vacancy-details-page' -import { NewVacancy } from '../model/recruiting/types' +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', () => { +test.describe('Recruting. Vacancy tests', () => { let navigationMenuPage: NavigationMenuPage let vacanciesPage: VacanciesPage let vacancyDetailsPage: VacancyDetailsPage diff --git a/tests/sanity/tests/tracker/filter.spec.ts b/tests/sanity/tests/tracker/filter.spec.ts index fbd308132b8..4529327872c 100644 --- a/tests/sanity/tests/tracker/filter.spec.ts +++ b/tests/sanity/tests/tracker/filter.spec.ts @@ -11,100 +11,92 @@ test.use({ storageState: PlatformSetting }) -test.describe.only('Tracker filters tests', () => { +test.describe('Tracker filters tests', () => { let leftSideMenuPage: LeftSideMenuPage let issuesPage: IssuesPage let issuesDetailsPage: IssuesDetailsPage - const initialIssue: NewIssue = { - title: `Issue for filtering-${generateId()}`, - description: 'Issue to filter', - assignee: 'Appleseed John', - status: 'In progress' - } + let issueData: NewIssue + let issueTitle: string test.beforeEach(async ({ page }) => { leftSideMenuPage = new LeftSideMenuPage(page) issuesPage = new IssuesPage(page) issuesDetailsPage = new IssuesDetailsPage(page) + issueData = { + title: `Issue for filtering-${generateId()}`, + description: 'Issue to filter', + assignee: 'Appleseed John', + status: 'In progress' + } + await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished() await leftSideMenuPage.clickTracker() await issuesPage.clickModelSelectorAll() }) - // Modified date tests - test('Filter by Modified date: Today', async () => { - const title = `Issue ${generateId()}` - await issuesPage.createNewIssue({ ...initialIssue, ...{ title } }) + issueTitle = await issuesPage.createNewIssue(issueData) await issuesPage.selectFilter('Modified date', 'Today') await issuesPage.checkFilter('Modified date', 'Today') - await issuesPage.checkFilteredIssueExist(title) + await issuesPage.checkFilteredIssueExist(issueTitle) }) test('Filter by Modified date: Yesterday', async () => { - const title = `Issue ${generateId()}` - - await issuesPage.createNewIssue({ ...initialIssue, ...{ title } }) + issueTitle = await issuesPage.createNewIssue(issueData) await issuesPage.selectFilter('Modified date', 'Yesterday') await issuesPage.checkFilter('Modified date', 'Yesterday') - await issuesPage.checkFilteredIssueNotExist(title) + await issuesPage.checkFilteredIssueNotExist(issueTitle) }) test('Filter by Modified date: This week', async () => { - const title = `Issue ${generateId()}` - await issuesPage.createNewIssue({ ...initialIssue, ...{ title } }) + issueTitle = await issuesPage.createNewIssue(issueData) await issuesPage.selectFilter('Modified date', 'This week') await issuesPage.checkFilter('Modified date', 'This week') - await issuesPage.checkFilteredIssueExist(title) + await issuesPage.checkFilteredIssueExist(issueTitle) }) test('Filter by Modified date: This month', async () => { - const title = `Issue ${generateId()}` - await issuesPage.createNewIssue({ ...initialIssue, ...{ title } }) + issueTitle = await issuesPage.createNewIssue(issueData) await issuesPage.selectFilter('Modified date', 'This month') await issuesPage.checkFilter('Modified date', 'This month') - await issuesPage.checkFilteredIssueExist(title) + await issuesPage.checkFilteredIssueExist(issueTitle) }) test('Filter by Modified date: Exact Today', async () => { - const title = `Issue ${generateId()}` - await issuesPage.createNewIssue({ ...initialIssue, ...{ title } }) + 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(title) + await issuesPage.checkFilteredIssueExist(issueTitle) }) test('Filter by Modified date: Before Today', async () => { - const title = `Issue ${generateId()}` - await issuesPage.createNewIssue({ ...initialIssue, ...{ title } }) + 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(title) + await issuesPage.checkFilteredIssueNotExist(issueTitle) }) test('Filter by Modified date: After Today', async () => { - const title = `Issue ${generateId()}` - await issuesPage.createNewIssue({ ...initialIssue, ...{ title } }) + 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(title) + await issuesPage.checkFilteredIssueExist(issueTitle) }) test('Filter by Modified date: Between dates', async () => { - const title = `Issue ${generateId()}` - await issuesPage.createNewIssue({ ...initialIssue, ...{ title } }) + issueTitle = await issuesPage.createNewIssue(issueData) await issuesPage.selectFilter('Modified date', 'Today') await issuesPage.updateFilterDimension('Between dates') @@ -130,80 +122,70 @@ test.describe.only('Tracker filters tests', () => { await issuesPage.checkFilter('Modified date', 'is between', dateYesterday.getDate().toString()) await issuesPage.checkFilter('Modified date', 'is between', dateTomorrow.getDate().toString()) - await issuesPage.checkFilteredIssueExist(title) + await issuesPage.checkFilteredIssueExist(issueTitle) }) - // Created date tests - test('Filter by Created date: Today', async () => { - const title = `Issue ${generateId()}` - await issuesPage.createNewIssue({ ...initialIssue, ...{ title } }) + issueTitle = await issuesPage.createNewIssue(issueData) await issuesPage.selectFilter('Created date', 'Today') await issuesPage.checkFilter('Created date', 'Today') - await issuesPage.checkFilteredIssueExist(title) + await issuesPage.checkFilteredIssueExist(issueTitle) }) test('Filter by Created date: Yesterday', async () => { - const title = `Issue ${generateId()}` - await issuesPage.createNewIssue({ ...initialIssue, ...{ title } }) + issueTitle = await issuesPage.createNewIssue(issueData) await issuesPage.selectFilter('Created date', 'Yesterday') await issuesPage.checkFilter('Created date', 'Yesterday') - await issuesPage.checkFilteredIssueNotExist(title) + await issuesPage.checkFilteredIssueNotExist(issueTitle) }) test('Filter by Created date: This week', async () => { - const title = `Issue ${generateId()}` - await issuesPage.createNewIssue({ ...initialIssue, ...{ title } }) + issueTitle = await issuesPage.createNewIssue(issueData) await issuesPage.selectFilter('Created date', 'This week') await issuesPage.checkFilter('Created date', 'This week') - await issuesPage.checkFilteredIssueExist(title) + await issuesPage.checkFilteredIssueExist(issueTitle) }) test('Filter by Created date: This month', async () => { - const title = `Issue ${generateId()}` - await issuesPage.createNewIssue({ ...initialIssue, ...{ title } }) + issueTitle = await issuesPage.createNewIssue(issueData) await issuesPage.selectFilter('Created date', 'This month') await issuesPage.checkFilter('Created date', 'This month') - await issuesPage.checkFilteredIssueExist(title) + await issuesPage.checkFilteredIssueExist(issueTitle) }) test('Filter by Created date: Exact Today', async () => { - const title = `Issue ${generateId()}` - await issuesPage.createNewIssue({ ...initialIssue, ...{ title } }) + 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 issuesPage.checkFilteredIssueExist(title) + await issuesPage.checkFilteredIssueExist(issueTitle) }) test('Filter by Created date: Before Today', async () => { - const title = `Issue ${generateId()}` - await issuesPage.createNewIssue({ ...initialIssue, ...{ title } }) + 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 issuesPage.checkFilteredIssueNotExist(title) + await issuesPage.checkFilteredIssueNotExist(issueTitle) }) test('Filter by Created date: After Today', async () => { - const title = `Issue ${generateId()}` - await issuesPage.createNewIssue({ ...initialIssue, ...{ title } }) + 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 issuesPage.checkFilteredIssueExist(title) + await issuesPage.checkFilteredIssueExist(issueTitle) }) test('Filter by Created date: Between dates', async () => { - const title = `Issue ${generateId()}` - await issuesPage.createNewIssue({ ...initialIssue, ...{ title } }) + issueTitle = await issuesPage.createNewIssue(issueData) await issuesPage.selectFilter('Created date', 'Today') await issuesPage.updateFilterDimension('Between dates') @@ -229,7 +211,7 @@ test.describe.only('Tracker filters tests', () => { await issuesPage.checkFilter('Created date', 'is between', dateYesterday.getDate().toString()) await issuesPage.checkFilter('Created date', 'is between', dateTomorrow.getDate().toString()) - await issuesPage.checkFilteredIssueExist(title) + await issuesPage.checkFilteredIssueExist(issueTitle) }) test('Filter by Status', async () => { @@ -353,7 +335,7 @@ test.describe.only('Tracker filters tests', () => { const title = `Issue with milestone-${generateId()}` const milestone = 'Filter Milestone' - await issuesPage.createNewIssue({ ...initialIssue, ...{ title, milestone } }) + await issuesPage.createNewIssue({ ...issueData, ...{ title, milestone } }) await leftSideMenuPage.clickTracker() await issuesPage.clickModelSelectorAll() @@ -367,9 +349,7 @@ test.describe.only('Tracker filters tests', () => { }) test('Filter by Milestone: Not selected', async () => { - const title = `Issue without milestone-${generateId()}` - - await issuesPage.createNewIssue({ ...initialIssue, ...{ title } }) + issueTitle = await issuesPage.createNewIssue(issueData) await leftSideMenuPage.clickTracker() await issuesPage.clickModelSelectorAll() @@ -377,15 +357,14 @@ test.describe.only('Tracker filters tests', () => { await issuesPage.page.keyboard.press('Escape') await issuesPage.checkFilter('Milestone', 'is', '1 state') - await issuesPage.checkFilteredIssueExist(title) + await issuesPage.checkFilteredIssueExist(issueTitle) }) test('Filter by label', async () => { const labels = 'Filter Label' - const title = `Issue with label ${generateId()}` const createLabel = true - await issuesPage.createNewIssue({ ...initialIssue, ...{ title, labels, createLabel } }) + issueTitle = await issuesPage.createNewIssue({ ...issueData, ...{ labels, createLabel } }) await test.step('Check Label filter for exist Label', async () => { await issuesPage.selectFilter('Labels', labels) From 99f5c3d488bdc27106d7ade73b9d4ca22bca4e9a Mon Sep 17 00:00:00 2001 From: Rostislav Nazmeev Date: Sun, 29 Sep 2024 21:00:27 +0200 Subject: [PATCH 4/8] Update and add new vacancies filter tests Signed-off-by: Rostislav Nazmeev --- .../tests/model/recruiting/vacancies-page.ts | 31 +- .../model/recruiting/vacancy-details-page.ts | 7 + .../applications/application.spec.ts | 4 +- .../companies-filter.spec.ts} | 0 .../companies/companies-list.spec.ts | 0 .../recruiting/companies/company.spec.ts | 2 +- .../tests/recruiting/reviews/review.spec.ts | 2 +- .../recruiting/reviews/reviews-list.spec.ts | 0 .../tests/recruiting/skills/skills.spec.ts | 2 +- .../tests/recruiting/talents/talent.spec.ts | 54 +-- ...ts-list.spec.ts => talents-filter.spec.ts} | 2 +- .../vacancies/vacancies-filter.spec.ts | 312 ++++++++++++++++++ .../vacancies/vacancies-list.spec.ts | 0 .../recruiting/vacancies/vacancy.spec.ts | 67 +--- 14 files changed, 349 insertions(+), 134 deletions(-) rename tests/sanity/tests/recruiting/{applications/applications-list.spec.ts => companies/companies-filter.spec.ts} (100%) delete mode 100644 tests/sanity/tests/recruiting/companies/companies-list.spec.ts delete mode 100644 tests/sanity/tests/recruiting/reviews/reviews-list.spec.ts rename tests/sanity/tests/recruiting/talents/{talents-list.spec.ts => talents-filter.spec.ts} (99%) create mode 100644 tests/sanity/tests/recruiting/vacancies/vacancies-filter.spec.ts delete mode 100644 tests/sanity/tests/recruiting/vacancies/vacancies-list.spec.ts 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/recruiting/applications/application.spec.ts b/tests/sanity/tests/recruiting/applications/application.spec.ts index 87a0836623e..0fed5e3a773 100644 --- a/tests/sanity/tests/recruiting/applications/application.spec.ts +++ b/tests/sanity/tests/recruiting/applications/application.spec.ts @@ -12,7 +12,7 @@ test.use({ storageState: PlatformSetting }) -test.describe('Recruting. Application tests', () => { +test.describe('Recruiting. Application tests', () => { let recrutingPage: RecruitingPage let vacanciesPage: VacanciesPage let vacancyDetailsPage: VacancyDetailsPage @@ -37,7 +37,7 @@ test.describe('Recruting. 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/applications/applications-list.spec.ts b/tests/sanity/tests/recruiting/companies/companies-filter.spec.ts similarity index 100% rename from tests/sanity/tests/recruiting/applications/applications-list.spec.ts rename to tests/sanity/tests/recruiting/companies/companies-filter.spec.ts diff --git a/tests/sanity/tests/recruiting/companies/companies-list.spec.ts b/tests/sanity/tests/recruiting/companies/companies-list.spec.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/sanity/tests/recruiting/companies/company.spec.ts b/tests/sanity/tests/recruiting/companies/company.spec.ts index 58dcc4ae565..3fcec0c0bd8 100644 --- a/tests/sanity/tests/recruiting/companies/company.spec.ts +++ b/tests/sanity/tests/recruiting/companies/company.spec.ts @@ -9,7 +9,7 @@ test.use({ storageState: PlatformSetting }) -test.describe('Recruting. Companies tests', () => { +test.describe('Recruiting. Companies tests', () => { let navigationMenuPage: NavigationMenuPage let companiesPage: CompaniesPage let companyDetailsPage: CompanyDetailsPage diff --git a/tests/sanity/tests/recruiting/reviews/review.spec.ts b/tests/sanity/tests/recruiting/reviews/review.spec.ts index d803d8ec967..52e379a726c 100644 --- a/tests/sanity/tests/recruiting/reviews/review.spec.ts +++ b/tests/sanity/tests/recruiting/reviews/review.spec.ts @@ -7,7 +7,7 @@ test.use({ storageState: PlatformSetting }) -test.describe('Recruting. Review tests', () => { +test.describe('Recruiting. Review tests', () => { let recruitingPage: RecruitingPage let commonRecruitingPage: CommonRecruitingPage diff --git a/tests/sanity/tests/recruiting/reviews/reviews-list.spec.ts b/tests/sanity/tests/recruiting/reviews/reviews-list.spec.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/sanity/tests/recruiting/skills/skills.spec.ts b/tests/sanity/tests/recruiting/skills/skills.spec.ts index 7ef32cae93d..346ddca5954 100644 --- a/tests/sanity/tests/recruiting/skills/skills.spec.ts +++ b/tests/sanity/tests/recruiting/skills/skills.spec.ts @@ -5,7 +5,7 @@ test.use({ storageState: PlatformSetting }) -test.describe('Recruting. Kill 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/talent.spec.ts b/tests/sanity/tests/recruiting/talents/talent.spec.ts index 07cd4db197c..7d34a5c46d7 100644 --- a/tests/sanity/tests/recruiting/talents/talent.spec.ts +++ b/tests/sanity/tests/recruiting/talents/talent.spec.ts @@ -9,7 +9,7 @@ test.use({ storageState: PlatformSetting }) -test.describe('Recruting. Talents tests', () => { +test.describe('Recruting. Talent tests', () => { let talentsPage: TalentsPage let navigationMenuPage: NavigationMenuPage let talentDetailsPage: TalentDetailsPage @@ -153,56 +153,4 @@ test.describe('Recruting. Talents tests', () => { await talentsPage.rightClickAction(talentName, 'Match to vacancy') await talentsPage.checkMatchVacancy(`${talentName.lastName} ${talentName.firstName}`, '0') }) - - test('Filter talents', async ({ page }) => { - const skillName = `Skill-${generateId(4)}` - const talentName = 'P. Andrey' - const location = 'Monte Carlo' - - await test.step('Add attributest for filtering to talent', async () => { - await navigationMenuPage.clickButtonTalents() - await talentsPage.checkRowsInTableExist(talentName) - await talentsPage.openRowInTableByText(talentName) - await talentDetailsPage.addSkill(skillName, 'Skill Description') - await talentDetailsPage.buttonClosePanel().click() - }) - - const talentsCount = await talentsPage.linesFromTable().count() - - await test.step('Filter by Talents properties', async () => { - const filtersWithSelection = [ - { name: 'Skills', panelName: 'Skill', value: skillName }, - { name: 'Remote', panelName: 'Remote', value: 'Yes' } - // { name: 'Onsite', panelName: 'Onsite', value: 'Yes' } - ] - - const filtersWithText = [ - { name: 'Location', panelName: 'Location', value: location }, - { name: 'Name', panelName: 'Name', value: 'Andrey' } - ] - - // const filtersWithUser = [ - // { name: 'Modified by', panelName: 'Modified by', value: 'Appleseed John' }, - // { name: 'Created by', panelName: 'Created by', value: 'Appleseed John' }, - // ] - - for (const { name, panelName, value } of filtersWithSelection) { - await talentsPage.selectFilter(name, value) - await talentsPage.page.keyboard.press('Escape') - await talentsPage.checkRowsInTableExist(talentName) - await talentsPage.filterOppositeCondition(panelName, 'is', 'is not') - await talentsPage.checkRowsInTableNotExist(talentName) - await talentsPage.checkRowsInTableExist('', talentsCount - 1) - await talentsPage.buttonClearFilters().click() - } - - for (const { name, panelName, value } of filtersWithText) { - await talentsPage.selectFilter(name, value) - await talentsPage.checkRowsInTableExist(talentName) - await talentsPage.filterOppositeCondition(panelName, 'contains') - await talentsPage.checkRowsInTableExist(talentName) - await talentsPage.buttonClearFilters().click() - } - }) - }) }) diff --git a/tests/sanity/tests/recruiting/talents/talents-list.spec.ts b/tests/sanity/tests/recruiting/talents/talents-filter.spec.ts similarity index 99% rename from tests/sanity/tests/recruiting/talents/talents-list.spec.ts rename to tests/sanity/tests/recruiting/talents/talents-filter.spec.ts index f674737b5eb..55f7f5d06b7 100644 --- a/tests/sanity/tests/recruiting/talents/talents-list.spec.ts +++ b/tests/sanity/tests/recruiting/talents/talents-filter.spec.ts @@ -10,7 +10,7 @@ test.use({ storageState: PlatformSetting }) -test.describe('Talents filters tests', () => { +test.describe('Recruiting. Talents filters tests', () => { let leftSideMenuPage: LeftSideMenuPage let talentsPage: TalentsPage let talentDetailsPage: TalentDetailsPage 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..866e976d425 --- /dev/null +++ b/tests/sanity/tests/recruiting/vacancies/vacancies-filter.spec.ts @@ -0,0 +1,312 @@ +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' + + await vacanciesPage.selectFilter('Created by', 'System') + await vacanciesPage.inputSearch().press('Escape') + + await vacanciesPage.checkVacancyNotExist(name) + await vacanciesPage.buttonClearFilters().click() + + await vacanciesPage.selectFilter('Created by', createdBy) + await vacanciesPage.inputSearch().press('Escape') + + await vacanciesPage.checkFilter('Created by', 'is') + await vacanciesPage.checkVacancyExist(name) + }) + + test('Filter by "Modified by"', async () => { + name = await vacanciesPage.createVacancy() + const createdBy = 'Appleseed John' + + await vacanciesPage.selectFilter('Modified by', 'System') + await vacanciesPage.inputSearch().press('Escape') + + await vacanciesPage.checkVacancyNotExist(name) + await vacanciesPage.buttonClearFilters().click() + + await vacanciesPage.selectFilter('Modified by', createdBy) + await vacanciesPage.inputSearch().press('Escape') + + await vacanciesPage.checkFilter('Modified by', 'is') + 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/vacancies-list.spec.ts b/tests/sanity/tests/recruiting/vacancies/vacancies-list.spec.ts deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/sanity/tests/recruiting/vacancies/vacancy.spec.ts b/tests/sanity/tests/recruiting/vacancies/vacancy.spec.ts index ba0cf788ab1..6c7c995db18 100644 --- a/tests/sanity/tests/recruiting/vacancies/vacancy.spec.ts +++ b/tests/sanity/tests/recruiting/vacancies/vacancy.spec.ts @@ -9,7 +9,7 @@ test.use({ storageState: PlatformSetting }) -test.describe('Recruting. Vacancy tests', () => { +test.describe('Recruiting. Vacancy tests', () => { let navigationMenuPage: NavigationMenuPage let vacanciesPage: VacanciesPage let vacancyDetailsPage: VacancyDetailsPage @@ -21,42 +21,13 @@ test.describe('Recruting. Vacancy tests', () => { await (await page.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished() }) - test('create-vacancy', async () => { + test('Create a 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) @@ -78,30 +49,6 @@ test.describe('Recruting. Vacancy tests', () => { 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() @@ -122,14 +69,8 @@ test.describe('Recruting. Vacancy tests', () => { 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.checkVacancyNotExist(archiveVacancy.title) await vacanciesPage.showArchivedVacancy() - await vacanciesPage.checkVacancyExist( - archiveVacancy.title, - `Archieved vacancy "${archiveVacancy.title}" is not visible.` - ) + await vacanciesPage.checkVacancyExist(archiveVacancy.title) }) }) From 1a563d74a7adf306bacd7f6e62e89764c97b2d37 Mon Sep 17 00:00:00 2001 From: Rostislav Nazmeev Date: Wed, 2 Oct 2024 15:36:05 +0200 Subject: [PATCH 5/8] Fix of a review editing test Signed-off-by: Rostislav Nazmeev --- tests/sanity/tests/model/recruiting/reviews-page.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/sanity/tests/model/recruiting/reviews-page.ts b/tests/sanity/tests/model/recruiting/reviews-page.ts index d2b5ecd7e98..74642f5ba1b 100644 --- a/tests/sanity/tests/model/recruiting/reviews-page.ts +++ b/tests/sanity/tests/model/recruiting/reviews-page.ts @@ -78,6 +78,7 @@ export class ReviewsPage extends CommonRecruitingPage { async enterVerdict (verdict: string): Promise { await this.inputVerdict().click() + await this.inputVerdict().clear() await this.inputVerdict().fill(verdict) } @@ -130,7 +131,7 @@ export class ReviewsPage extends CommonRecruitingPage { } if (typeof verdict === 'string') { - await expect(this.page.locator(`text=${verdict}`).first()).toBeVisible() + await expect(this.inputVerdict()).toHaveValue(verdict) } } From f26f8b1b450c30fea03286132f68f035c201c555 Mon Sep 17 00:00:00 2001 From: Rostislav Nazmeev Date: Wed, 2 Oct 2024 23:01:49 +0200 Subject: [PATCH 6/8] Fix bugs in filtering tests Signed-off-by: Rostislav Nazmeev --- tests/sanity/tests/model/common-page.ts | 2 +- tests/sanity/tests/model/tracker/issues-page.ts | 4 ++++ tests/sanity/tests/tracker/filter.spec.ts | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/sanity/tests/model/common-page.ts b/tests/sanity/tests/model/common-page.ts index 743b283c06f..925278244d7 100644 --- a/tests/sanity/tests/model/common-page.ts +++ b/tests/sanity/tests/model/common-page.ts @@ -49,7 +49,7 @@ 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', exact: true }) + 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"]') diff --git a/tests/sanity/tests/model/tracker/issues-page.ts b/tests/sanity/tests/model/tracker/issues-page.ts index 1332370e075..c8db25c6fb8 100644 --- a/tests/sanity/tests/model/tracker/issues-page.ts +++ b/tests/sanity/tests/model/tracker/issues-page.ts @@ -509,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) } @@ -558,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/tracker/filter.spec.ts b/tests/sanity/tests/tracker/filter.spec.ts index 4529327872c..53a1f8b1d0c 100644 --- a/tests/sanity/tests/tracker/filter.spec.ts +++ b/tests/sanity/tests/tracker/filter.spec.ts @@ -361,7 +361,7 @@ test.describe('Tracker filters tests', () => { }) test('Filter by label', async () => { - const labels = 'Filter Label' + const labels = `Label ${generateId()}` const createLabel = true issueTitle = await issuesPage.createNewIssue({ ...issueData, ...{ labels, createLabel } }) From 8a3a13d3bbc720a71710a8c9434da9f5fd5c1945 Mon Sep 17 00:00:00 2001 From: Rostislav Nazmeev Date: Wed, 2 Oct 2024 23:43:58 +0200 Subject: [PATCH 7/8] Fix unstable dragging test Signed-off-by: Rostislav Nazmeev --- tests/sanity/tests/model/planning/planning-page.ts | 2 +- tests/sanity/tests/planning/plan.spec.ts | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) 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/planning/plan.spec.ts b/tests/sanity/tests/planning/plan.spec.ts index c152cc25f73..3fe37610639 100644 --- a/tests/sanity/tests/planning/plan.spec.ts +++ b/tests/sanity/tests/planning/plan.spec.ts @@ -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 () => { From 483a01db47f50e9b9d2169bf578563fb0fc21dc2 Mon Sep 17 00:00:00 2001 From: Rostislav Nazmeev Date: Thu, 3 Oct 2024 00:34:05 +0200 Subject: [PATCH 8/8] Improve Talents locator to fix flaky actions tests Signed-off-by: Rostislav Nazmeev --- tests/sanity/tests/model/recruiting/recruiting-page.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/sanity/tests/model/recruiting/recruiting-page.ts b/tests/sanity/tests/model/recruiting/recruiting-page.ts index bc633ee5997..57a32672397 100644 --- a/tests/sanity/tests/model/recruiting/recruiting-page.ts +++ b/tests/sanity/tests/model/recruiting/recruiting-page.ts @@ -8,7 +8,7 @@ export class RecruitingPage { } recruitApplication = (): Locator => this.page.locator('[id="app-recruit\\:string\\:RecruitApplication"]') - talentsNavElement = (): Locator => this.page.locator('text=Talents') + 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\\.\\.\\."]')