mirror of
https://github.com/hcengineering/platform.git
synced 2025-05-10 09:22:23 +00:00
Merge 61b89cb783
into 0ecbbe8126
This commit is contained in:
commit
1d42ba059c
@ -65,8 +65,13 @@ export class CommonPage {
|
|||||||
buttonFilterApply = (): Locator => this.page.locator('div.selectPopup button[type="button"]', { hasText: 'Apply' })
|
buttonFilterApply = (): Locator => this.page.locator('div.selectPopup button[type="button"]', { hasText: 'Apply' })
|
||||||
buttonClearFilters = (): Locator => this.page.locator('button > span', { hasText: 'Clear filters' })
|
buttonClearFilters = (): Locator => this.page.locator('button > span', { hasText: 'Clear filters' })
|
||||||
filterButton = (index: number): Locator => this.page.locator(`div.filter-section button:nth-child(${index})`)
|
filterButton = (index: number): Locator => this.page.locator(`div.filter-section button:nth-child(${index})`)
|
||||||
|
filterRow = (): Locator => this.page.locator('div.filterbar-container')
|
||||||
selectFilterSection = (label: string): Locator =>
|
selectFilterSection = (label: string): Locator =>
|
||||||
this.page.locator('div.filterbar-container div.filter-section', { hasText: label })
|
this.filterRow().locator('div.filter-section', { hasText: label })
|
||||||
|
|
||||||
|
filterCloseButton = (label: string): Locator => this.selectFilterSection(label).locator('button .btn-icon')
|
||||||
|
|
||||||
|
addFilterButton = (): Locator => this.filterRow().locator('div.add-filter')
|
||||||
|
|
||||||
selectPopupMenu = (filter: string): Locator =>
|
selectPopupMenu = (filter: string): Locator =>
|
||||||
this.page.locator('div.selectPopup [class*="menu"]', { hasText: filter })
|
this.page.locator('div.selectPopup [class*="menu"]', { hasText: filter })
|
||||||
@ -231,8 +236,8 @@ export class CommonPage {
|
|||||||
await this.menuPopupItemButton(itemText).first().click()
|
await this.menuPopupItemButton(itemText).first().click()
|
||||||
}
|
}
|
||||||
|
|
||||||
async selectFilter (filter: string, filterSecondLevel?: string): Promise<void> {
|
async selectFilter (filter: string, filterSecondLevel?: string, addButton: Locator = this.buttonFilter()): Promise<void> {
|
||||||
await this.buttonFilter().click()
|
await addButton.click()
|
||||||
await this.selectPopupMenu(filter).click()
|
await this.selectPopupMenu(filter).click()
|
||||||
|
|
||||||
if (filterSecondLevel !== null && typeof filterSecondLevel === 'string') {
|
if (filterSecondLevel !== null && typeof filterSecondLevel === 'string') {
|
||||||
@ -340,4 +345,8 @@ export class CommonPage {
|
|||||||
async pressEscape (): Promise<void> {
|
async pressEscape (): Promise<void> {
|
||||||
await this.page.keyboard.press('Escape')
|
await this.page.keyboard.press('Escape')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async removeFilterOption (label: string): Promise<void> {
|
||||||
|
await this.filterCloseButton(label).click()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,14 @@ export class PlanningNavigationMenuPage {
|
|||||||
readonly accordionContainerToDoUnplanned = (): Locator =>
|
readonly accordionContainerToDoUnplanned = (): Locator =>
|
||||||
this.page.locator('div.toDos-container div.hulyAccordionItem-container', { hasText: 'Unplanned' })
|
this.page.locator('div.toDos-container div.hulyAccordionItem-container', { hasText: 'Unplanned' })
|
||||||
|
|
||||||
|
readonly toDoPanelContainer = (): Locator => this.page.locator('div.toDos-container')
|
||||||
|
|
||||||
|
readonly accordionContainerByName = (toDoCategoryName: string): Locator =>
|
||||||
|
this.toDoPanelContainer().locator('div.hulyAccordionItem-container', { hasText: toDoCategoryName })
|
||||||
|
|
||||||
|
readonly categoryProjectContainer = (category: string, project: string): Locator =>
|
||||||
|
this.accordionContainerByName(category).locator(`div.hulyAccordionItem-container:has(button:has-text("${project}"))`)
|
||||||
|
|
||||||
async clickOnButtonToDoAll (): Promise<void> {
|
async clickOnButtonToDoAll (): Promise<void> {
|
||||||
await this.buttonToDoAll().click()
|
await this.buttonToDoAll().click()
|
||||||
}
|
}
|
||||||
@ -43,4 +51,8 @@ export class PlanningNavigationMenuPage {
|
|||||||
const accCount = await this.accordionContainerToDoUnplanned().locator('button.hulyToDoLine-container').count()
|
const accCount = await this.accordionContainerToDoUnplanned().locator('button.hulyToDoLine-container').count()
|
||||||
expect(accCount).toBe(navCount)
|
expect(accCount).toBe(navCount)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async checkToDoCategory (toDoName: string, category: string, project: string): Promise<void> {
|
||||||
|
await expect(this.categoryProjectContainer(category, project).locator(`div.hulyAccordionItem-content:has-text("${toDoName}")`)).toBeVisible()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -115,6 +115,8 @@ export class PlanningPage extends CalendarPage {
|
|||||||
.locator('xpath=..')
|
.locator('xpath=..')
|
||||||
.locator('button.reference')
|
.locator('button.reference')
|
||||||
|
|
||||||
|
readonly buttonPanelSpaceSelector = (): Locator => this.panel().locator('button[id="space.selector"]')
|
||||||
|
|
||||||
async clickButtonPrevDayInSchedule (): Promise<void> {
|
async clickButtonPrevDayInSchedule (): Promise<void> {
|
||||||
await this.buttonPrevDayInSchedule().click()
|
await this.buttonPrevDayInSchedule().click()
|
||||||
}
|
}
|
||||||
@ -417,4 +419,13 @@ export class PlanningPage extends CalendarPage {
|
|||||||
row.locator('div.dateEditor-container:first-child > div.min-w-28:first-child .hulyButton')
|
row.locator('div.dateEditor-container:first-child > div.min-w-28:first-child .hulyButton')
|
||||||
).toContainText(dateEnd)
|
).toContainText(dateEnd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async selectLstItem (itemLabel: string): Promise<void> {
|
||||||
|
await this.popup().locator('div.list-container button.menu-item', { hasText: itemLabel }).click()
|
||||||
|
}
|
||||||
|
|
||||||
|
public async addEventToSpace (projectName: string): Promise<void> {
|
||||||
|
await this.buttonPanelSpaceSelector().click()
|
||||||
|
await this.selectLstItem(projectName)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,11 @@ export class CompaniesPage extends CommonRecruitingPage {
|
|||||||
readonly inputCreateOrganizationModalCreate = (): Locator =>
|
readonly inputCreateOrganizationModalCreate = (): Locator =>
|
||||||
this.page.locator('form[id="contact:string:CreateOrganization"] button[type="submit"]')
|
this.page.locator('form[id="contact:string:CreateOrganization"] button[type="submit"]')
|
||||||
|
|
||||||
readonly companyByName = (companyName: string): Locator => this.page.locator('tr a', { hasText: companyName })
|
readonly companyPanel = (): Locator =>
|
||||||
|
this.page.locator('xpath=//div[@data-id="contentPanel" and .//button[.//text()="Company"]]')
|
||||||
|
|
||||||
|
readonly companyByName = (companyName: string): Locator =>
|
||||||
|
this.companyPanel().locator('tr a', { hasText: companyName })
|
||||||
|
|
||||||
async createNewCompany (data: NewCompany): Promise<void> {
|
async createNewCompany (data: NewCompany): Promise<void> {
|
||||||
await expect(this.pageHeader()).toBeVisible()
|
await expect(this.pageHeader()).toBeVisible()
|
||||||
@ -43,7 +47,15 @@ export class CompaniesPage extends CommonRecruitingPage {
|
|||||||
await this.companyByName(companyName).click()
|
await this.companyByName(companyName).click()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async checkCompanyRowCount (companyName: string, count: number = 0): Promise<void> {
|
||||||
|
await expect(this.companyByName(companyName)).toHaveCount(count)
|
||||||
|
}
|
||||||
|
|
||||||
async checkCompanyNotExist (companyName: string): Promise<void> {
|
async checkCompanyNotExist (companyName: string): Promise<void> {
|
||||||
await expect(this.companyByName(companyName)).toHaveCount(0)
|
await this.checkCompanyRowCount(companyName)
|
||||||
|
}
|
||||||
|
|
||||||
|
async checkCompanyExist (companyName: string): Promise<void> {
|
||||||
|
await this.checkCompanyRowCount(companyName, 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -396,4 +396,34 @@ test.describe('Planning ToDo tests', () => {
|
|||||||
await sidebarPage.checkIfPlanerSidebarTabIsOpen(true)
|
await sidebarPage.checkIfPlanerSidebarTabIsOpen(true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('Moving ToDo in scheduler panel', async ({ page }) => {
|
||||||
|
const planningNavigationMenuPage = new PlanningNavigationMenuPage(page)
|
||||||
|
await planningNavigationMenuPage.clickOnButtonToDoAll()
|
||||||
|
const toDoName = `ToDo to moving in scheduler panel ${generateId()}`
|
||||||
|
const planningPage = new PlanningPage(page)
|
||||||
|
const unplannedCategory = 'Unplanned'
|
||||||
|
const defaultSubCategory = 'Without project'
|
||||||
|
await test.step(`New ToDo in "${unplannedCategory}" category "${defaultSubCategory}" subcategory`, async () => {
|
||||||
|
await planningPage.createNewToDoFromInput(toDoName)
|
||||||
|
await planningNavigationMenuPage.checkToDoCategory(toDoName, unplannedCategory, defaultSubCategory)
|
||||||
|
})
|
||||||
|
const projectName = 'Second Project'
|
||||||
|
await test.step(`ToDo joined to project change "${projectName}" subcategory`, async () => {
|
||||||
|
await planningPage.openToDoByName(toDoName)
|
||||||
|
await planningPage.addEventToSpace(projectName)
|
||||||
|
await planningNavigationMenuPage.checkToDoCategory(toDoName, unplannedCategory, projectName)
|
||||||
|
})
|
||||||
|
const scheduledCategory = 'Scheduled'
|
||||||
|
await test.step(`Scheduled ToDo to "${scheduledCategory}" category`, async () => {
|
||||||
|
await planningPage.openToDoByName(toDoName)
|
||||||
|
await planningPage.clickButtonCreateAddSlot()
|
||||||
|
await planningNavigationMenuPage.checkToDoCategory(toDoName, scheduledCategory, projectName)
|
||||||
|
})
|
||||||
|
const completedCategory = 'Done'
|
||||||
|
await test.step(`completed ToDo move to "${completedCategory}" category`, async () => {
|
||||||
|
await planningPage.markDoneInToDos(toDoName)
|
||||||
|
await planningNavigationMenuPage.checkToDoCategory(toDoName, completedCategory, projectName)
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
@ -4,6 +4,7 @@ import { NavigationMenuPage } from '../model/recruiting/navigation-menu-page'
|
|||||||
import { CompaniesPage } from '../model/recruiting/companies-page'
|
import { CompaniesPage } from '../model/recruiting/companies-page'
|
||||||
import { NewCompany } from '../model/recruiting/types'
|
import { NewCompany } from '../model/recruiting/types'
|
||||||
import { CompanyDetailsPage } from '../model/recruiting/company-details-page'
|
import { CompanyDetailsPage } from '../model/recruiting/company-details-page'
|
||||||
|
import { DEFAULT_USER } from '../tracker/tracker.utils'
|
||||||
|
|
||||||
test.use({
|
test.use({
|
||||||
storageState: PlatformSetting
|
storageState: PlatformSetting
|
||||||
@ -86,4 +87,36 @@ test.describe('Companies tests', () => {
|
|||||||
await navigationMenuPage.clickButtonCompanies()
|
await navigationMenuPage.clickButtonCompanies()
|
||||||
await companiesPage.checkCompanyNotExist(deleteCompany.name)
|
await companiesPage.checkCompanyNotExist(deleteCompany.name)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('Filtering companies', async ({ page }) => {
|
||||||
|
const firstCompany: NewCompany = {
|
||||||
|
name: `Company for filtering one-${generateId()}`
|
||||||
|
}
|
||||||
|
const secondCompany: NewCompany = {
|
||||||
|
name: `Company for filtering two-${generateId()}`
|
||||||
|
}
|
||||||
|
await test.step('Create companies', async () => {
|
||||||
|
await navigationMenuPage.clickButtonCompanies()
|
||||||
|
await companiesPage.createNewCompany(firstCompany)
|
||||||
|
await companiesPage.checkCompanyExist(firstCompany.name)
|
||||||
|
await companiesPage.createNewCompany(secondCompany)
|
||||||
|
await companiesPage.checkCompanyExist(secondCompany.name)
|
||||||
|
})
|
||||||
|
await test.step('Filtering by creator', async () => {
|
||||||
|
await companiesPage.selectFilter('Created by', DEFAULT_USER)
|
||||||
|
await companiesPage.pressEscape()
|
||||||
|
await companiesPage.checkCompanyExist(firstCompany.name)
|
||||||
|
await companiesPage.checkCompanyExist(secondCompany.name)
|
||||||
|
})
|
||||||
|
await test.step('Filtering by name', async () => {
|
||||||
|
await companiesPage.selectFilter('Name', firstCompany.name, companiesPage.addFilterButton())
|
||||||
|
await companiesPage.checkCompanyExist(firstCompany.name)
|
||||||
|
await companiesPage.checkCompanyNotExist(secondCompany.name)
|
||||||
|
})
|
||||||
|
await test.step('Remove name filter', async () => {
|
||||||
|
await companiesPage.removeFilterOption('Name')
|
||||||
|
await companiesPage.checkCompanyExist(firstCompany.name)
|
||||||
|
await companiesPage.checkCompanyExist(secondCompany.name)
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user