mirror of
https://github.com/hcengineering/platform.git
synced 2025-06-06 07:46:32 +00:00
Fix uitests (#6804)
Signed-off-by: Alexander Platov <alexander.platov@hardcoreeng.com>
This commit is contained in:
parent
3ed53bfd37
commit
ec696d029b
@ -296,9 +296,8 @@ export class ChannelPage extends CommonPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async checkIfNameIsChanged (channel: string): Promise<void> {
|
async checkIfNameIsChanged (channel: string): Promise<void> {
|
||||||
await expect(this.channel(channel).nth(0)).toBeVisible()
|
await expect(this.channelContainers().filter({ hasText: channel })).toBeVisible()
|
||||||
await expect(this.channel(channel).nth(1)).toBeVisible()
|
await expect(this.buttonBreadcrumb(channel)).toBeVisible()
|
||||||
await expect(this.channel(channel).nth(2)).toBeVisible()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async makeActionWithChannelInMenu (channelName: string, action: string): Promise<void> {
|
async makeActionWithChannelInMenu (channelName: string, action: string): Promise<void> {
|
||||||
|
@ -12,6 +12,7 @@ export class CommonPage {
|
|||||||
selectPopupInputSearch = (): Locator => this.page.locator('div.popup input.search')
|
selectPopupInputSearch = (): Locator => this.page.locator('div.popup input.search')
|
||||||
selectPopupListItem = (name: string): Locator => this.page.locator('div.selectPopup div.list-item', { hasText: name })
|
selectPopupListItem = (name: string): Locator => this.page.locator('div.selectPopup div.list-item', { hasText: name })
|
||||||
selectPopupListItemFirst = (): Locator => this.page.locator('div.selectPopup div.list-item')
|
selectPopupListItemFirst = (): Locator => this.page.locator('div.selectPopup div.list-item')
|
||||||
|
selectPopupApMenuItem = (hasText: string): Locator => this.page.locator('div.popup button.ap-menuItem', { hasText })
|
||||||
selectPopupAddButton = (): Locator => this.page.locator('div.selectPopup button[data-id="btnAdd"]')
|
selectPopupAddButton = (): Locator => this.page.locator('div.selectPopup button[data-id="btnAdd"]')
|
||||||
selectPopupButton = (): Locator => this.page.locator('div.selectPopup button')
|
selectPopupButton = (): Locator => this.page.locator('div.selectPopup button')
|
||||||
selectPopupExpandButton = (): Locator => this.page.locator('div.selectPopup button[data-id="btnExpand"]')
|
selectPopupExpandButton = (): Locator => this.page.locator('div.selectPopup button[data-id="btnExpand"]')
|
||||||
@ -89,6 +90,7 @@ export class CommonPage {
|
|||||||
this.page.locator('div.date-popup-container div.input:last-child span.digit:nth-child(5)')
|
this.page.locator('div.date-popup-container div.input:last-child span.digit:nth-child(5)')
|
||||||
|
|
||||||
submitButton = (): Locator => this.page.locator('div.date-popup-container button[type="submit"]')
|
submitButton = (): Locator => this.page.locator('div.date-popup-container button[type="submit"]')
|
||||||
|
buttonBreadcrumb = (hasText?: string): Locator => this.page.locator('button.hulyBreadcrumb-container', { hasText })
|
||||||
|
|
||||||
async selectMenuItem (page: Page, name: string, fullWordFilter: boolean = false): Promise<void> {
|
async selectMenuItem (page: Page, name: string, fullWordFilter: boolean = false): Promise<void> {
|
||||||
if (name !== 'first') {
|
if (name !== 'first') {
|
||||||
@ -194,6 +196,10 @@ export class CommonPage {
|
|||||||
await this.selectPopupListItem(name).click({ delay: 100 })
|
await this.selectPopupListItem(name).click({ delay: 100 })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async selectPopupAp (name: string): Promise<void> {
|
||||||
|
await this.selectPopupApMenuItem(name).click({ delay: 100 })
|
||||||
|
}
|
||||||
|
|
||||||
async selectPopupItem (name: string): Promise<void> {
|
async selectPopupItem (name: string): Promise<void> {
|
||||||
await this.hulyPopupRowButton(name).click({ delay: 100 })
|
await this.hulyPopupRowButton(name).click({ delay: 100 })
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,20 @@ export class PlanningPage extends CalendarPage {
|
|||||||
|
|
||||||
readonly buttonMenuDelete = (): Locator => this.page.locator('button.ap-menuItem span', { hasText: 'Delete' })
|
readonly buttonMenuDelete = (): Locator => this.page.locator('button.ap-menuItem span', { hasText: 'Delete' })
|
||||||
readonly buttonPopupSelectDateNextMonth = (): Locator =>
|
readonly buttonPopupSelectDateNextMonth = (): Locator =>
|
||||||
this.popup().locator('div.header > div:last-child > button:last-child')
|
this.popup().locator('div.month-container > div.header > div:last-child > button:last-child')
|
||||||
|
|
||||||
|
readonly buttonPopupSelectDatePrevMonth = (): Locator =>
|
||||||
|
this.popup().locator('div.month-container > div.header > div:last-child > button:first-child')
|
||||||
|
|
||||||
|
readonly buttonPrevDayInSchedule = (): Locator =>
|
||||||
|
this.page
|
||||||
|
.locator('div.hulyHeader-container', { hasText: 'Schedule:' })
|
||||||
|
.locator('div.hulyHeader-buttonsGroup > button:first-child')
|
||||||
|
|
||||||
|
readonly buttonNextDayInSchedule = (): Locator =>
|
||||||
|
this.page
|
||||||
|
.locator('div.hulyHeader-container', { hasText: 'Schedule:' })
|
||||||
|
.locator('div.hulyHeader-buttonsGroup > button:last-child')
|
||||||
|
|
||||||
readonly selectInputToDo = (): Locator =>
|
readonly selectInputToDo = (): Locator =>
|
||||||
this.toDosContainer().getByPlaceholder('Add Action Item, press Enter to save')
|
this.toDosContainer().getByPlaceholder('Add Action Item, press Enter to save')
|
||||||
@ -102,6 +115,14 @@ export class PlanningPage extends CalendarPage {
|
|||||||
.locator('xpath=..')
|
.locator('xpath=..')
|
||||||
.locator('button.reference')
|
.locator('button.reference')
|
||||||
|
|
||||||
|
async clickButtonPrevDayInSchedule (): Promise<void> {
|
||||||
|
await this.buttonPrevDayInSchedule().click()
|
||||||
|
}
|
||||||
|
|
||||||
|
async clickButtonNextDayInSchedule (): Promise<void> {
|
||||||
|
await this.buttonNextDayInSchedule().click()
|
||||||
|
}
|
||||||
|
|
||||||
async dragToCalendar (title: string, column: number, time: string, addHalf: boolean = false): Promise<void> {
|
async dragToCalendar (title: string, column: number, time: string, addHalf: boolean = false): Promise<void> {
|
||||||
await this.toDosContainer().getByRole('button', { name: title }).hover()
|
await this.toDosContainer().getByRole('button', { name: title }).hover()
|
||||||
|
|
||||||
@ -224,7 +245,7 @@ export class PlanningPage extends CalendarPage {
|
|||||||
await row.locator('div.dateEditor-container:first-child > div.min-w-28:first-child .hulyButton').click()
|
await row.locator('div.dateEditor-container:first-child > div.min-w-28:first-child .hulyButton').click()
|
||||||
if (slot.dateStart === 'today') {
|
if (slot.dateStart === 'today') {
|
||||||
await this.buttonCalendarToday().click()
|
await this.buttonCalendarToday().click()
|
||||||
} else {
|
} else if (typeof slot.dateStart === 'string') {
|
||||||
if (slot.dateStart === '1') {
|
if (slot.dateStart === '1') {
|
||||||
await this.buttonPopupSelectDateNextMonth().click()
|
await this.buttonPopupSelectDateNextMonth().click()
|
||||||
}
|
}
|
||||||
@ -232,6 +253,28 @@ export class PlanningPage extends CalendarPage {
|
|||||||
.locator('div.popup div.calendar button.day')
|
.locator('div.popup div.calendar button.day')
|
||||||
.filter({ has: this.page.locator(`text="${slot.dateStart}"`) })
|
.filter({ has: this.page.locator(`text="${slot.dateStart}"`) })
|
||||||
.click()
|
.click()
|
||||||
|
} else {
|
||||||
|
const today = new Date()
|
||||||
|
const target = new Date(
|
||||||
|
parseInt(slot.dateStart.year, 10),
|
||||||
|
parseInt(slot.dateStart.month, 10) - 1,
|
||||||
|
parseInt(slot.dateStart.day, 10)
|
||||||
|
)
|
||||||
|
const before: boolean = target.getTime() < today.getTime()
|
||||||
|
const diffYear: number = Math.abs(target.getFullYear() - today.getFullYear())
|
||||||
|
const diffMonth: number =
|
||||||
|
diffYear === 0
|
||||||
|
? Math.abs(target.getMonth() - today.getMonth())
|
||||||
|
: (diffYear - 1) * 12 +
|
||||||
|
(before ? today.getMonth() + 12 - target.getMonth() : target.getMonth() + 12 - today.getMonth())
|
||||||
|
for (let i = 0; i < diffMonth; i++) {
|
||||||
|
if (before) await this.buttonPopupSelectDatePrevMonth().click()
|
||||||
|
else await this.buttonPopupSelectDateNextMonth().click()
|
||||||
|
}
|
||||||
|
await this.page
|
||||||
|
.locator('div.popup div.calendar button.day')
|
||||||
|
.filter({ has: this.page.locator(`text="${target.getDate()}"`) })
|
||||||
|
.click()
|
||||||
}
|
}
|
||||||
// timeStart
|
// timeStart
|
||||||
const hours = slot.timeStart.substring(0, 2)
|
const hours = slot.timeStart.substring(0, 2)
|
||||||
|
@ -10,13 +10,13 @@ export interface NewToDo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface Slot {
|
export interface Slot {
|
||||||
dateStart: string
|
dateStart: string | TDate
|
||||||
timeStart: string
|
timeStart: string
|
||||||
dateEnd: Date
|
dateEnd: TDate
|
||||||
timeEnd: string
|
timeEnd: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Date {
|
export interface TDate {
|
||||||
day: string
|
day: string
|
||||||
month: string
|
month: string
|
||||||
year: string
|
year: string
|
||||||
|
@ -53,6 +53,13 @@ export class SettingsPage extends CommonPage {
|
|||||||
asideFooterButton = (hasText: string): Locator =>
|
asideFooterButton = (hasText: string): Locator =>
|
||||||
this.page.locator('div.hulyModal-container.type-aside div.hulyModal-footer button', { hasText })
|
this.page.locator('div.hulyModal-container.type-aside div.hulyModal-footer button', { hasText })
|
||||||
|
|
||||||
|
buttonRoleInComponent = (hasText: string): Locator =>
|
||||||
|
this.page.locator('div.hulyComponent-content > div.flex-row-center', { hasText }).locator('button')
|
||||||
|
|
||||||
|
async clickButtonRoleInComponent (name: string): Promise<void> {
|
||||||
|
await this.buttonRoleInComponent(name).click()
|
||||||
|
}
|
||||||
|
|
||||||
async navigateToWorkspace (workspaceUrl: string): Promise<void> {
|
async navigateToWorkspace (workspaceUrl: string): Promise<void> {
|
||||||
const response = await this.page.goto(workspaceUrl)
|
const response = await this.page.goto(workspaceUrl)
|
||||||
if (response === null || response === undefined) {
|
if (response === null || response === undefined) {
|
||||||
|
@ -6,7 +6,8 @@ import {
|
|||||||
generateTestData,
|
generateTestData,
|
||||||
getTimeForPlanner,
|
getTimeForPlanner,
|
||||||
getSecondPageByInvite,
|
getSecondPageByInvite,
|
||||||
getInviteLink
|
getInviteLink,
|
||||||
|
convertDate
|
||||||
} from '../utils'
|
} from '../utils'
|
||||||
import { PlanningPage } from '../model/planning/planning-page'
|
import { PlanningPage } from '../model/planning/planning-page'
|
||||||
import { NewToDo } from '../model/planning/types'
|
import { NewToDo } from '../model/planning/types'
|
||||||
@ -344,23 +345,21 @@ test.describe('Planning ToDo tests', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
test.skip('Change ToDo start and end times by dragging', async ({ page }) => {
|
test('Change ToDo start and end times by dragging', async ({ page }) => {
|
||||||
const planningPage = new PlanningPage(page)
|
const planningPage = new PlanningPage(page)
|
||||||
const planningNavigationMenuPage = new PlanningNavigationMenuPage(page)
|
const planningNavigationMenuPage = new PlanningNavigationMenuPage(page)
|
||||||
const dateEnd = new Date()
|
const today = new Date()
|
||||||
|
const date = new Date()
|
||||||
|
date.setDate(date.getDate() + 3)
|
||||||
|
|
||||||
const toDoWithLabel: NewToDo = {
|
const toDoWithLabel: NewToDo = {
|
||||||
title: `ToDo to change duration-${generateId()}`,
|
title: `ToDo to change duration-${generateId()}`,
|
||||||
description: 'Description for ToDo to change duration',
|
description: 'Description for ToDo to change duration',
|
||||||
slots: [
|
slots: [
|
||||||
{
|
{
|
||||||
dateStart: 'today',
|
dateStart: convertDate(date),
|
||||||
timeStart: '1400',
|
timeStart: '1400',
|
||||||
dateEnd: {
|
dateEnd: convertDate(date),
|
||||||
day: dateEnd.getDate().toString(),
|
|
||||||
month: (dateEnd.getMonth() + 1).toString(),
|
|
||||||
year: dateEnd.getFullYear().toString()
|
|
||||||
},
|
|
||||||
timeEnd: '1500'
|
timeEnd: '1500'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -369,6 +368,12 @@ test.describe('Planning ToDo tests', () => {
|
|||||||
await test.step('Prepare ToDo', async () => {
|
await test.step('Prepare ToDo', async () => {
|
||||||
await planningNavigationMenuPage.clickOnButtonToDoAll()
|
await planningNavigationMenuPage.clickOnButtonToDoAll()
|
||||||
await planningPage.createNewToDo(toDoWithLabel)
|
await planningPage.createNewToDo(toDoWithLabel)
|
||||||
|
const diff = date.getTime() - today.getTime()
|
||||||
|
for (let i = 0; i < Math.abs(diff) / 86400000; i++) {
|
||||||
|
if (diff < 0) await planningPage.clickButtonPrevDayInSchedule()
|
||||||
|
else await planningPage.clickButtonNextDayInSchedule()
|
||||||
|
}
|
||||||
|
await planningPage.selectTimeCell('10am').scrollIntoViewIfNeeded()
|
||||||
})
|
})
|
||||||
|
|
||||||
await test.step('Resize ToDo', async () => {
|
await test.step('Resize ToDo', async () => {
|
||||||
|
@ -4,6 +4,8 @@ import { NavigationMenuPage } from '../model/recruiting/navigation-menu-page'
|
|||||||
import { VacanciesPage } from '../model/recruiting/vacancies-page'
|
import { VacanciesPage } from '../model/recruiting/vacancies-page'
|
||||||
import { VacancyDetailsPage } from '../model/recruiting/vacancy-details-page'
|
import { VacancyDetailsPage } from '../model/recruiting/vacancy-details-page'
|
||||||
import { NewVacancy } from '../model/recruiting/types'
|
import { NewVacancy } from '../model/recruiting/types'
|
||||||
|
import { SettingsPage } from '../model/settings-page'
|
||||||
|
import { WorkspaceSettingsPage } from '../model/workspace/workspace-settings-page'
|
||||||
|
|
||||||
test.use({
|
test.use({
|
||||||
storageState: PlatformSetting
|
storageState: PlatformSetting
|
||||||
@ -21,7 +23,20 @@ test.describe('Vacancy tests', () => {
|
|||||||
await (await page.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished()
|
await (await page.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished()
|
||||||
})
|
})
|
||||||
|
|
||||||
test('create-vacancy', async () => {
|
test('create-vacancy', async ({ page }) => {
|
||||||
|
const settingsPage: SettingsPage = new SettingsPage(page)
|
||||||
|
await settingsPage.profileButton().click()
|
||||||
|
await settingsPage.selectPopupAp('Settings')
|
||||||
|
const wsPage: WorkspaceSettingsPage = new WorkspaceSettingsPage(page)
|
||||||
|
await wsPage.owners().click()
|
||||||
|
await settingsPage.checkOpened('Owners')
|
||||||
|
await settingsPage.clickButtonRoleInComponent('Appleseed John')
|
||||||
|
await settingsPage.selectPopupMenu('Owner').click()
|
||||||
|
const count = await page.locator('div[id="workbench:component:WorkbenchTabs"] div.container.main').count()
|
||||||
|
for (let i = 1; i < count; i++) {
|
||||||
|
await page.locator('div[id="workbench:component:WorkbenchTabs"] div.container.main:first-child button').click()
|
||||||
|
}
|
||||||
|
|
||||||
const vacancyId = 'My vacancy ' + generateId(4)
|
const vacancyId = 'My vacancy ' + generateId(4)
|
||||||
await vacanciesPage.createVacancy(vacancyId)
|
await vacanciesPage.createVacancy(vacancyId)
|
||||||
await vacanciesPage.modifyVacancy(vacancyId)
|
await vacanciesPage.modifyVacancy(vacancyId)
|
||||||
|
@ -261,3 +261,11 @@ export async function createAccountAndWorkspace (page: Page, request: APIRequest
|
|||||||
await api.createWorkspaceWithLogin(data.workspaceName, data.userName, '1234')
|
await api.createWorkspaceWithLogin(data.workspaceName, data.userName, '1234')
|
||||||
await reLogin(page, data)
|
await reLogin(page, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const convertDate = (date: Date): { day: string, month: string, year: string } => {
|
||||||
|
return {
|
||||||
|
day: date.getDate().toString(),
|
||||||
|
month: (date.getMonth() + 1).toString(),
|
||||||
|
year: date.getFullYear().toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user