TESTS-98: feat(tests): done Created by filter test (#4161)

* feat(tests): TESTS-98 done Created by filter test
Signed-off-by: Alex Velichko <nestor_007@mail.ru>
This commit is contained in:
Alex Velichko 2023-12-08 11:43:44 +03:00 committed by GitHub
parent 7f7f494b80
commit 47b4f3f14d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 47 additions and 9 deletions

View File

@ -42,7 +42,7 @@ test.describe('actions tests', () => {
await page.click('div.actionsHeader input.actionsInput') await page.click('div.actionsHeader input.actionsInput')
await page.fill('div.actionsHeader input.actionsInput', 'go to ') await page.fill('div.actionsHeader input.actionsInput', 'go to ')
expect(await page.locator('div.selectPopup :text("Go To Vacancies")').count()).toBe(1) expect(await page.locator('div.selectPopup :text("Go To Vacancies")').count()).toBe(1)
await page.click('div.selectPopup :text("Go To Vacancies")') await page.click('div.selectPopup :text("Go To Vacancies")', { delay: 100 })
await expect(page).toHaveURL(`${PlatformURI}/workbench/sanity-ws/recruit/vacancies`) await expect(page).toHaveURL(`${PlatformURI}/workbench/sanity-ws/recruit/vacancies`)
}) })
@ -62,7 +62,7 @@ test.describe('actions tests', () => {
await page.click('div.actionsHeader input.actionsInput') await page.click('div.actionsHeader input.actionsInput')
await page.fill('div.actionsHeader input.actionsInput', 'go to ') await page.fill('div.actionsHeader input.actionsInput', 'go to ')
expect(await page.locator('div.selectPopup :text("Go To Applications")').count()).toBe(1) expect(await page.locator('div.selectPopup :text("Go To Applications")').count()).toBe(1)
await page.click('div.selectPopup :text("Go To Applications")') await page.click('div.selectPopup :text("Go To Applications")', { delay: 100 })
await expect(page).toHaveURL(`${PlatformURI}/workbench/sanity-ws/recruit/candidates`) await expect(page).toHaveURL(`${PlatformURI}/workbench/sanity-ws/recruit/candidates`)
}) })

View File

@ -63,4 +63,8 @@ export class CommonPage {
await expect(page.locator('div.popup button[type="submit"]')).toBeVisible() await expect(page.locator('div.popup button[type="submit"]')).toBeVisible()
await page.locator('div.popup button[type="submit"]').click() await page.locator('div.popup button[type="submit"]').click()
} }
async pressButtonBack (page: Page): Promise<void> {
await page.locator('div.history-box button:first-child').click()
}
} }

View File

@ -15,6 +15,8 @@ export class IssuesDetailsPage extends CommonTrackerPage {
readonly buttonMilestone: Locator readonly buttonMilestone: Locator
readonly textEstimation: Locator readonly textEstimation: Locator
readonly buttonEstimation: Locator readonly buttonEstimation: Locator
readonly buttonCreatedBy: Locator
readonly buttonCloseIssue: Locator
readonly buttonMoreActions: Locator readonly buttonMoreActions: Locator
readonly textParentTitle: Locator readonly textParentTitle: Locator
@ -32,6 +34,8 @@ export class IssuesDetailsPage extends CommonTrackerPage {
this.buttonMilestone = page.locator('(//span[text()="Milestone"]/../div/div/button)[3]') this.buttonMilestone = page.locator('(//span[text()="Milestone"]/../div/div/button)[3]')
this.textEstimation = page.locator('(//span[text()="Estimation"]/../div/button)[4]') this.textEstimation = page.locator('(//span[text()="Estimation"]/../div/button)[4]')
this.buttonEstimation = page.locator('(//span[text()="Estimation"]/../div/button)[3]') this.buttonEstimation = page.locator('(//span[text()="Estimation"]/../div/button)[3]')
this.buttonCreatedBy = page.locator('(//span[text()="Assignee"]/../div/button)[1]')
this.buttonCloseIssue = page.locator('div.popupPanel-title > button')
this.buttonMoreActions = page.locator('div.popupPanel-title div.flex-row-center > button:first-child') this.buttonMoreActions = page.locator('div.popupPanel-title div.flex-row-center > button:first-child')
this.textParentTitle = page.locator('span.issue-title') this.textParentTitle = page.locator('span.issue-title')
} }

View File

@ -27,6 +27,7 @@ export class IssuesPage extends CommonTrackerPage {
readonly linkSidebarAll: Locator readonly linkSidebarAll: Locator
readonly linkSidebarMyIssue: Locator readonly linkSidebarMyIssue: Locator
readonly buttonClearFilers: Locator readonly buttonClearFilers: Locator
readonly issuesList: Locator
readonly buttonPopupCreateNewIssueParent: Locator readonly buttonPopupCreateNewIssueParent: Locator
constructor (page: Page) { constructor (page: Page) {
@ -65,6 +66,7 @@ export class IssuesPage extends CommonTrackerPage {
this.linkSidebarAll = page.locator('a[href$="all-issues"]') this.linkSidebarAll = page.locator('a[href$="all-issues"]')
this.linkSidebarMyIssue = page.locator('a[href$="my-issues"]') this.linkSidebarMyIssue = page.locator('a[href$="my-issues"]')
this.buttonClearFilers = page.locator('div.search-start > div:first-child button') this.buttonClearFilers = page.locator('div.search-start > div:first-child button')
this.issuesList = page.locator('div.listGrid')
this.buttonPopupCreateNewIssueParent = page.locator('div#parentissue-editor button') this.buttonPopupCreateNewIssueParent = page.locator('div#parentissue-editor button')
} }
@ -150,7 +152,7 @@ export class IssuesPage extends CommonTrackerPage {
async checkAllIssuesInStatus (statusId: string | undefined): Promise<void> { async checkAllIssuesInStatus (statusId: string | undefined): Promise<void> {
if (statusId === undefined) throw new Error(`Unknown status id ${statusId}`) if (statusId === undefined) throw new Error(`Unknown status id ${statusId}`)
for await (const locator of iterateLocator(this.page.locator('div.listGrid'))) { for await (const locator of iterateLocator(this.issuesList)) {
await expect(locator.locator('div[class*="square"] > svg')).toHaveAttribute('id', statusId) await expect(locator.locator('div[class*="square"] > svg')).toHaveAttribute('id', statusId)
} }
} }
@ -170,7 +172,7 @@ export class IssuesPage extends CommonTrackerPage {
} }
async checkAllIssuesByPriority (priorityName: string): Promise<void> { async checkAllIssuesByPriority (priorityName: string): Promise<void> {
for await (const locator of iterateLocator(this.page.locator('div.listGrid'))) { for await (const locator of iterateLocator(this.issuesList)) {
const href = await locator.locator('div.priority-container use').getAttribute('href') const href = await locator.locator('div.priority-container use').getAttribute('href')
expect(href).toContain(priorityName) expect(href).toContain(priorityName)
} }

View File

@ -4,6 +4,8 @@ import { NavigationMenuPage } from '../model/recruiting/navigation-menu-page'
import { ApplicationsPage } from '../model/recruiting/applications-page' import { ApplicationsPage } from '../model/recruiting/applications-page'
import { ApplicationsDetailsPage } from '../model/recruiting/applications-details-page' import { ApplicationsDetailsPage } from '../model/recruiting/applications-details-page'
import { allure } from 'allure-playwright' import { allure } from 'allure-playwright'
import { VacancyDetailsPage } from '../model/recruiting/vacancy-details-page'
import { VacanciesPage } from '../model/recruiting/vacancies-page'
test.use({ test.use({
storageState: PlatformSetting storageState: PlatformSetting
@ -28,11 +30,15 @@ test.describe('Application tests', () => {
await page.click('button:has-text("Vacancy")') await page.click('button:has-text("Vacancy")')
await page.fill('[placeholder="Software\\ Engineer"]', vacancyId) await page.fill('[placeholder="Software\\ Engineer"]', vacancyId)
await page.click('button:has-text("Create")') await page.click('button:has-text("Create")')
await page.click(`tr > :has-text("${vacancyId}")`)
await page.click('text=Talents') const vacanciesPage = new VacanciesPage(page)
await vacanciesPage.openVacancyByName(vacancyId)
const vacancyDetailsPage = new VacancyDetailsPage(page)
await expect(vacancyDetailsPage.inputComment).toBeVisible()
const navigationMenuPage = new NavigationMenuPage(page)
await navigationMenuPage.buttonTalents.click()
await page.click('text=Talents')
await page.click('text=P. Andrey') await page.click('text=P. Andrey')
// Click on Add button // Click on Add button

View File

@ -1,10 +1,11 @@
import { test } from '@playwright/test' import { expect, test } from '@playwright/test'
import { generateId, PlatformSetting, PlatformURI } from '../utils' import { generateId, iterateLocator, PlatformSetting, PlatformURI } from '../utils'
import { LeftSideMenuPage } from '../model/left-side-menu-page' import { LeftSideMenuPage } from '../model/left-side-menu-page'
import { IssuesPage } from '../model/tracker/issues-page' import { IssuesPage } from '../model/tracker/issues-page'
import { NewIssue } from '../model/tracker/types' import { NewIssue } from '../model/tracker/types'
import { allure } from 'allure-playwright' import { allure } from 'allure-playwright'
import { DEFAULT_STATUSES, DEFAULT_STATUSES_ID, PRIORITIES } from './tracker.utils' import { DEFAULT_STATUSES, DEFAULT_STATUSES_ID, PRIORITIES } from './tracker.utils'
import { IssuesDetailsPage } from '../model/tracker/issues-details-page'
test.use({ test.use({
storageState: PlatformSetting storageState: PlatformSetting
@ -243,4 +244,25 @@ test.describe('Tracker filters tests', () => {
}) })
} }
}) })
test('Created by filter', async ({ page }) => {
const createdBy = 'Appleseed John'
const leftSideMenuPage = new LeftSideMenuPage(page)
await leftSideMenuPage.buttonTracker.click()
const issuesPage = new IssuesPage(page)
await issuesPage.modelSelectorAll.click()
await issuesPage.selectFilter('Created by', createdBy)
await issuesPage.inputSearch.press('Escape')
await issuesPage.checkFilter('Created by', 'is')
for await (const issue of iterateLocator(issuesPage.issuesList)) {
await issue.locator('span.list > a').click()
const issuesDetailsPage = new IssuesDetailsPage(page)
await expect(issuesDetailsPage.buttonCreatedBy).toHaveText(createdBy)
await issuesDetailsPage.buttonCloseIssue.click()
}
})
}) })