Added and fixed UI tests (#6276)

Signed-off-by: Alexander Platov <alexander.platov@hardcoreeng.com>
This commit is contained in:
Alexander Platov 2024-08-07 09:42:49 +03:00 committed by GitHub
parent 954a3bb9e7
commit c577282192
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
23 changed files with 171 additions and 142 deletions

View File

@ -75,12 +75,20 @@
icon={action.icon}
kind={'tertiary'}
size={'extra-small'}
dataId={action.label}
tooltip={{ label: action.label, direction: 'top' }}
on:click={(evt) => action.action({}, evt)}
/>
{/if}
{/each}
<ButtonIcon icon={IconMoreH} kind={'tertiary'} size={'extra-small'} pressed={hovered} on:click={onMenuClick} />
<ButtonIcon
icon={IconMoreH}
kind={'tertiary'}
size={'extra-small'}
pressed={hovered}
dataId={'btnDocMore'}
on:click={onMenuClick}
/>
</svelte:fragment>
<svelte:fragment slot="dropbox">
<slot />

View File

@ -416,6 +416,7 @@ test.describe('channel tests', () => {
})
test('Checking backlinks in the Chat', async ({ browser, page }) => {
await api.createAccount(newUser2.email, newUser2.password, newUser2.firstName, newUser2.lastName)
await leftSideMenuPage.openProfileMenu()
await leftSideMenuPage.inviteToWorkspace()
await leftSideMenuPage.getInviteLink()
@ -424,10 +425,10 @@ test.describe('channel tests', () => {
const page2 = await browser.newPage()
const leftSideMenuPageSecond = new LeftSideMenuPage(page2)
const channelPageSecond = new ChannelPage(page2)
await api.createAccount(newUser2.email, newUser2.password, newUser2.firstName, newUser2.lastName)
await page2.goto(linkText ?? '')
const joinPage = new SignInJoinPage(page2)
await joinPage.join(newUser2)
await leftSideMenuPageSecond.clickChunter()
await leftSideMenuPage.clickChunter()
await channelPage.clickChannel('general')
@ -435,7 +436,6 @@ test.describe('channel tests', () => {
await channelPage.sendMention(mentionName)
await channelPage.checkMessageExist(`@${mentionName}`, true, `@${mentionName}`)
await leftSideMenuPageSecond.clickChunter()
await channelPageSecond.clickChannel('general')
await channelPageSecond.checkMessageExist(`@${mentionName}`, true, `@${mentionName}`)
await page2.close()

View File

@ -69,11 +69,7 @@ test.describe('Collaborative test for issue', () => {
await issuesPageSecond.openIssueByName(newIssue.title)
const issuesDetailsPageSecond = new IssuesDetailsPage(userSecondPage)
await issuesDetailsPageSecond.checkIssue({
...newIssue,
milestone: 'Milestone',
estimation: '2h'
})
await issuesDetailsPageSecond.checkIssue(newIssue)
await closePages()
})
@ -176,7 +172,7 @@ test.describe('Collaborative test for issue', () => {
await issuesPageSecond.openIssueByName(issue.title)
const issuesDetailsPageSecond = new IssuesDetailsPage(userSecondPage)
await issuesDetailsPageSecond.checkIssue({ ...issue })
await issuesDetailsPageSecond.checkIssue(issue)
})
await closePages()

View File

@ -150,4 +150,23 @@ test.describe('Documents tests', () => {
await documentContentPage.addLinkToText(contentLink, 'test/link/123456')
await documentContentPage.checkLinkInTheText(contentLink, 'test/link/123456')
})
test('Locked document and checking URL', async ({ page, context }) => {
const newDocument: NewDocument = {
title: `New Document-${generateId()}`,
space: 'Default'
}
await leftSideMenuPage.clickDocuments()
await documentsPage.clickOnButtonCreateDocument()
await documentsPage.createDocument(newDocument)
await documentsPage.selectMoreActionOfDocument(newDocument.title, 'Lock')
await documentsPage.selectMoreActionOfDocument(newDocument.title, 'Copy document URL to clipboard')
await context.grantPermissions(['clipboard-read'])
const handle = await page.evaluateHandle(() => navigator.clipboard.readText())
const clipboardContent = await handle.jsonValue()
await page.goto(`${clipboardContent}`)
await documentContentPage.checkDocumentTitle(newDocument.title)
await documentContentPage.checkDocumentLocked()
})
})

View File

@ -1,5 +1,5 @@
import { test } from '@playwright/test'
import { PlatformURI, generateTestData } from '../utils'
import { PlatformURI, generateTestData, getTimeForPlanner, attachScreenshot } from '../utils'
import { LeftSideMenuPage } from '../model/left-side-menu-page'
import { ApiEndpoint } from '../API/Api'
import { LoginPage } from '../model/login-page'
@ -13,6 +13,8 @@ import { ChannelPage } from '../model/channel-page'
import { UserProfilePage } from '../model/profile/user-profile-page'
import { MenuItems, NotificationsPage } from '../model/profile/notifications-page'
import { SelectWorkspacePage } from '../model/select-workspace-page'
import { PlanningPage } from '../model/planning/planning-page'
import { TeamPage } from '../model/team-page'
test.describe('Inbox tests', () => {
let leftSideMenuPage: LeftSideMenuPage
@ -49,11 +51,7 @@ test.describe('Inbox tests', () => {
test('User is able to create a task, assign a himself and see it inside the inbox', async ({ page }) => {
const newIssue = createNewIssueData(data.firstName, data.lastName)
await prepareNewIssueWithOpenStep(page, newIssue)
await issuesDetailsPage.checkIssue({
...newIssue,
milestone: 'Milestone',
estimation: '2h'
})
await issuesDetailsPage.checkIssue(newIssue)
await leftSideMenuPage.clickTracker()
await leftSideMenuPage.clickNotification()
@ -63,44 +61,28 @@ test.describe('Inbox tests', () => {
test('User is able to create a task, assign a himself and open it from inbox', async ({ page }) => {
const newIssue = createNewIssueData(data.firstName, data.lastName)
await prepareNewIssueWithOpenStep(page, newIssue)
await issuesDetailsPage.checkIssue({
...newIssue,
milestone: 'Milestone',
estimation: '2h'
})
await issuesDetailsPage.checkIssue(newIssue)
await leftSideMenuPage.clickTracker()
await leftSideMenuPage.clickNotification()
await inboxPage.checkIfTaskIsPresentInInbox(newIssue.title)
await inboxPage.clickOnToDo(newIssue.title)
await inboxPage.clickLeftSidePanelOpen()
await issuesDetailsPage.checkIssue({
...newIssue,
milestone: 'Milestone',
estimation: '2h'
})
await issuesDetailsPage.checkIssue(newIssue)
})
test.skip('User is able to create a task, assign a himself and close it from inbox', async ({ page }) => {
const newIssue = createNewIssueData(data.firstName, data.lastName)
await prepareNewIssueWithOpenStep(page, newIssue)
await issuesDetailsPage.checkIssue({
...newIssue,
milestone: 'Milestone',
estimation: '2h'
})
await issuesDetailsPage.checkIssue(newIssue)
await leftSideMenuPage.clickTracker()
await leftSideMenuPage.clickNotification()
await inboxPage.checkIfTaskIsPresentInInbox(newIssue.title)
await inboxPage.clickOnToDo(newIssue.title)
await inboxPage.clickLeftSidePanelOpen()
await issuesDetailsPage.checkIssue({
...newIssue,
milestone: 'Milestone',
estimation: '2h'
})
await issuesDetailsPage.checkIssue(newIssue)
await inboxPage.clickCloseLeftSidePanel()
// ADD ASSERT ONCE THE ISSUE IS FIXED
})
@ -120,11 +102,7 @@ test.describe('Inbox tests', () => {
const newIssue = createNewIssueData(newUser2.firstName, newUser2.lastName)
await prepareNewIssueWithOpenStep(page, newIssue)
await issuesDetailsPage.checkIssue({
...newIssue,
milestone: 'Milestone',
estimation: '2h'
})
await issuesDetailsPage.checkIssue(newIssue)
await leftSideMenuPageSecond.clickTracker()
await leftSideMenuPageSecond.clickNotification()
await inboxPageSecond.checkIfTaskIsPresentInInbox(newIssue.title)
@ -147,21 +125,13 @@ test.describe('Inbox tests', () => {
const newIssue = createNewIssueData(newUser2.firstName, newUser2.lastName)
await prepareNewIssueWithOpenStep(page, newIssue)
await issuesDetailsPage.checkIssue({
...newIssue,
milestone: 'Milestone',
estimation: '2h'
})
await issuesDetailsPage.checkIssue(newIssue)
await leftSideMenuPageSecond.clickTracker()
await leftSideMenuPageSecond.clickNotification()
await inboxPageSecond.checkIfTaskIsPresentInInbox(newIssue.title)
await inboxPageSecond.clickOnToDo(newIssue.title)
await inboxPageSecond.clickLeftSidePanelOpen()
await issuesDetailsPageSecond.checkIssue({
...newIssue,
milestone: 'Milestone',
estimation: '2h'
})
await issuesDetailsPageSecond.checkIssue(newIssue)
await page2.close()
})
test.skip('User is able to create a task, assign a other user and close it from inbox', async ({ page, browser }) => {
@ -180,21 +150,13 @@ test.describe('Inbox tests', () => {
const newIssue = createNewIssueData(newUser2.firstName, newUser2.lastName)
await prepareNewIssueWithOpenStep(page, newIssue)
await issuesDetailsPage.checkIssue({
...newIssue,
milestone: 'Milestone',
estimation: '2h'
})
await issuesDetailsPage.checkIssue(newIssue)
await leftSideMenuPageSecond.clickTracker()
await leftSideMenuPageSecond.clickNotification()
await inboxPageSecond.checkIfTaskIsPresentInInbox(newIssue.title)
await inboxPageSecond.clickOnToDo(newIssue.title)
await inboxPageSecond.clickLeftSidePanelOpen()
await issuesDetailsPageSecond.checkIssue({
...newIssue,
milestone: 'Milestone',
estimation: '2h'
})
await issuesDetailsPageSecond.checkIssue(newIssue)
await inboxPage.clickCloseLeftSidePanel()
// ADD ASSERT ONCE THE ISSUE IS FIXED
await page2.close()
@ -285,11 +247,7 @@ test.describe('Inbox tests', () => {
const newIssue = createNewIssueData(newUser2.firstName, newUser2.lastName)
await prepareNewIssueWithOpenStep(page, newIssue)
await issuesDetailsPage.checkIssue({
...newIssue,
milestone: 'Milestone',
estimation: '2h'
})
await issuesDetailsPage.checkIssue(newIssue)
await leftSideMenuPageSecond.clickTracker()
await leftSideMenuPageSecond.clickNotification()
await inboxPageSecond.clickOnInboxFilter('Channels')
@ -300,4 +258,51 @@ test.describe('Inbox tests', () => {
await inboxPageSecond.checkIfInboxChatExists('Channel general', false)
await page2.close()
})
test('Checking the ability to receive a task and schedule it', async ({ page, browser }) => {
await leftSideMenuPage.openProfileMenu()
await leftSideMenuPage.inviteToWorkspace()
await leftSideMenuPage.getInviteLink()
const linkText = await page.locator('.antiPopup .link').textContent()
await leftSideMenuPage.clickOnCloseInvite()
const page2 = await browser.newPage()
await page2.goto(linkText ?? '')
const joinPage = new SignInJoinPage(page2)
await joinPage.join(newUser2)
const newIssue = createNewIssueData(data.firstName, data.lastName, {
status: 'Todo',
assignee: `${newUser2.lastName} ${newUser2.firstName}`,
estimation: '0'
})
await prepareNewIssueWithOpenStep(page, newIssue)
await issuesDetailsPage.checkIssue(newIssue)
const leftSideMenuPageSecond = new LeftSideMenuPage(page2)
const inboxPageSecond = new InboxPage(page2)
const issuesDetailsPageSecond = new IssuesDetailsPage(page2)
const planningPageSecond = new PlanningPage(page2)
await leftSideMenuPageSecond.clickNotification()
await inboxPageSecond.checkIfIssueIsPresentInInbox(newIssue.title)
await inboxPageSecond.clickIssuePresentInInbox(newIssue.title)
await inboxPageSecond.clickLeftSidePanelOpen()
await issuesDetailsPageSecond.checkIssue(newIssue)
await leftSideMenuPageSecond.clickPlanner()
await planningPageSecond.closeNotification()
await planningPageSecond.dragdropTomorrow(newIssue.title, getTimeForPlanner())
await planningPageSecond.eventInSchedule(newIssue.title).isVisible()
await attachScreenshot('Recive_task_and_scheduled.png', page2)
await attachScreenshot('Recive_task_and_scheduled-Detail.png', page)
await issuesDetailsPage.checkIssue({ ...newIssue, status: 'In Progress' })
await leftSideMenuPage.clickTeam()
const teamPage = new TeamPage(page)
await teamPage.checkTeamPageIsOpened()
await teamPage.selectTeam('Default')
await teamPage.buttonNextDay().click()
await attachScreenshot('Recive_task_and_scheduled-Tomorrow.png', page)
await teamPage.getItemByText('Tomorrow', newIssue.title).isVisible()
await page2.close()
})
})

View File

@ -31,7 +31,7 @@ export class CommonPage {
tagsStringAddTagButtonSubmit = (): Locator =>
this.page.locator('div.popup form[id="tags:string:AddTag"] button[type="submit"]')
notifyContainerButton = (): Locator => this.page.locator('div.notify-container button[type="button"].small').nth(0)
notifyContainerButton = (): Locator => this.page.locator('div.notifyPopup button[data-id="btnNotifyClose"]').first()
errorSpan = (): Locator => this.page.locator('div.ERROR span')
infoSpan = (): Locator => this.page.locator('div.INFO span')
popupSubmitButton = (): Locator => this.page.locator('div.popup button[type="submit"]')
@ -165,8 +165,10 @@ export class CommonPage {
await this.selectPopupSpanLines(point).click()
}
async closeNotification (page: Page): Promise<void> {
await this.notifyContainerButton().click()
async closeNotification (): Promise<void> {
while (await this.notifyContainerButton().isVisible()) {
await this.notifyContainerButton().click()
}
}
async checkError (page: Page, errorMessage: string): Promise<void> {

View File

@ -19,6 +19,8 @@ export class DocumentContentPage extends CommonPage {
readonly buttonMoreActions = (): Locator =>
this.page.locator('div.hulyHeader-buttonsGroup button#btn-doc-title-open-more')
readonly buttonLockedInTitle = (): Locator => this.page.getByRole('button', { name: 'Locked' })
readonly popupPanel = (): Locator => this.page.locator('div.popupPanel-title')
readonly popupPanelH1 = (): Locator => this.page.locator('div.antiPopup > h1')
@ -26,6 +28,10 @@ export class DocumentContentPage extends CommonPage {
await expect(this.buttonDocumentTitle()).toHaveValue(title)
}
async checkDocumentLocked (): Promise<void> {
await expect(this.buttonLockedInTitle()).toBeVisible({ timeout: 1000 })
}
async addContentToTheNewLine (newContent: string): Promise<string> {
await expect(this.inputContent()).toBeVisible()
await expect(this.inputContent()).toHaveJSProperty('contentEditable', 'true')

View File

@ -20,6 +20,9 @@ export class DocumentsPage extends CommonPage {
readonly buttonCreateDocument = (): Locator =>
this.page.locator('div[data-float="navigator"] button[id="new-document"]')
readonly buttonDocument = (name: string): Locator =>
this.page.locator('button.hulyNavItem-container > span[class*="label"]', { hasText: name })
readonly divTeamspacesParent = (): Locator =>
this.page.locator('div#navGroup-tree-teamspaces').locator('xpath=../button[1]')
@ -97,7 +100,13 @@ export class DocumentsPage extends CommonPage {
}
async openDocument (name: string): Promise<void> {
await this.page.locator('button.hulyNavItem-container > span[class*="label"]', { hasText: name }).click()
await this.buttonDocument(name).click()
}
async selectMoreActionOfDocument (name: string, popupItem: string): Promise<void> {
await this.buttonDocument(name).hover()
await this.page.getByRole('button', { name }).getByRole('button').nth(2).click()
await this.selectFromDropdown(this.page, popupItem)
}
async openDocumentForTeamspace (spaceName: string, documentName: string): Promise<void> {

View File

@ -12,7 +12,7 @@ export class InboxPage {
readonly leftSidePanelOpen = (): Locator => this.page.locator('#btnPAside')
readonly leftSidePanelClose = (): Locator => this.page.locator('#btnPClose')
readonly inboxChat = (text: string): Locator => this.page.getByText(text)
readonly issueTitle = (issueTitle: string): Locator => this.page.getByTitle(issueTitle)
readonly issueTitle = (issueTitle: string): Locator => this.page.getByText(issueTitle).first()
// ACTIONS
@ -48,6 +48,10 @@ export class InboxPage {
await expect(this.issueTitle(issueTitle)).toBeVisible()
}
async clickIssuePresentInInbox (issueTitle: string): Promise<void> {
await this.issueTitle(issueTitle).click()
}
async checkIfInboxChatExists (text: string, exists: boolean): Promise<void> {
if (exists) {
await expect(this.inboxChat(text)).toBeVisible()

View File

@ -16,6 +16,9 @@ export class TeamPage extends CommonPage {
buttonNextDay = (): Locator =>
this.page.locator('div.hulyComponent div.hulyHeader-container .actions button[data-id="btnNext"]')
getItemByText = (column: string, title: string): Locator =>
this.page.locator('div.hulyComponent div.item', { hasText: column }).locator('div.item', { hasText: title })
async checkTeamPageIsOpened (): Promise<void> {
await expect(this.appHeader()).toBeVisible()
}

View File

@ -1,6 +1,7 @@
import { expect, type Locator, type Page } from '@playwright/test'
import { CommonTrackerPage } from './common-tracker-page'
import { Issue, NewIssue } from './types'
import { convertEstimation } from '../../tracker/tracker.utils'
export class IssuesDetailsPage extends CommonTrackerPage {
readonly page: Page
@ -139,10 +140,10 @@ export class IssuesDetailsPage extends CommonTrackerPage {
await expect(this.buttonComponent()).toHaveText(data.component)
}
if (data.milestone != null) {
await expect(this.buttonMilestone()).toHaveText(data.milestone)
await expect(this.buttonMilestone()).toHaveText(data.milestone === 'No Milestone' ? 'Milestone' : data.milestone)
}
if (data.estimation != null) {
await expect(this.textEstimation()).toHaveText(data.estimation)
await expect(this.textEstimation()).toHaveText(convertEstimation(data.estimation))
}
if (data.parentIssue != null) {
await expect(this.textParentTitle()).toHaveText(data.parentIssue)

View File

@ -412,7 +412,7 @@ export class IssuesPage extends CommonTrackerPage {
await this.fillNewIssueForm(data)
await this.clickButtonCreateIssue()
if (closeNotification) {
await this.closeNotification(this.page)
await this.closeNotification()
}
await attachScreenshot(`createdNewIssue-${data.title}.png`, this.page)
}

View File

@ -1,6 +1,7 @@
import { expect, type Locator } from '@playwright/test'
import { CommonTrackerPage } from './common-tracker-page'
import { Issue, NewIssue } from './types'
import { convertEstimation } from '../../tracker/tracker.utils'
export class TemplateDetailsPage extends CommonTrackerPage {
inputTitle = (): Locator => this.page.locator('div.popupPanel-body input[type="text"]')
@ -34,7 +35,7 @@ export class TemplateDetailsPage extends CommonTrackerPage {
await expect(this.buttonComponent()).toHaveText(data.component)
}
if (data.estimation != null) {
await expect(this.buttonEstimation()).toHaveText(data.estimation)
await expect(this.buttonEstimation()).toHaveText(convertEstimation(data.estimation))
}
}

View File

@ -1,5 +1,5 @@
import { test } from '@playwright/test'
import { generateId, PlatformSetting, PlatformURI, generateTestData } from '../utils'
import { generateId, PlatformSetting, PlatformURI, generateTestData, getTimeForPlanner } from '../utils'
import { PlanningPage } from '../model/planning/planning-page'
import { NewToDo } from '../model/planning/types'
import { PlanningNavigationMenuPage } from '../model/planning/planning-navigation-menu-page'
@ -179,12 +179,7 @@ test.describe('Planning ToDo tests', () => {
}
const titleV = `Visible ToDo ${generateId()}`
const titleI = `Inisible ToDo ${generateId()}`
let hour = new Date().getHours()
const ampm = hour < 13 ? 'am' : 'pm'
hour = hour < 1 ? 1 : hour >= 11 && hour < 13 ? 11 : hour >= 22 ? 10 : hour > 12 ? hour - 12 : hour
const time = `${hour}${ampm}`
// const timeI = `${hour + 1}${ampm}`
const time = getTimeForPlanner()
const leftSideMenuPage: LeftSideMenuPage = new LeftSideMenuPage(page)
const loginPage: LoginPage = new LoginPage(page)

View File

@ -26,7 +26,7 @@ export async function prepareNewIssueWithOpenStep (page: Page, issue: NewIssue):
})
}
export function createNewIssueData (firstName: string, lastName: string): NewIssue {
export function createNewIssueData (firstName: string, lastName: string, replace?: object): NewIssue {
return {
title: faker.lorem.words(3),
description: faker.lorem.sentence(),
@ -39,6 +39,7 @@ export function createNewIssueData (firstName: string, lastName: string): NewIss
estimation: '2',
milestone: 'No Milestone',
duedate: 'today',
filePath: 'cat.jpeg'
filePath: 'cat.jpeg',
...replace
}
}

View File

@ -46,11 +46,7 @@ test.describe('Tracker issue tests', () => {
}
await prepareNewIssueWithOpenStep(page, newIssue)
await issuesDetailsPage.checkIssue({
...newIssue,
milestone: 'Milestone',
estimation: '2h'
})
await issuesDetailsPage.checkIssue(newIssue)
})
test('Edit an issue', async ({ page }) => {
@ -74,34 +70,19 @@ test.describe('Tracker issue tests', () => {
await issuesDetailsPage.checkIssue({
...newIssue,
...editIssue,
estimation: '1d'
...editIssue
})
const estimations = new Map([
['0', '0h'],
['1', '1h'],
['1.25', '1h 15m'],
['1.259', '1h 15m'],
['1.26', '1h 15m'],
['1.27', '1h 16m'],
['1.5', '1h 30m'],
['1.75', '1h 45m'],
['2', '2h'],
['7', '7h'],
['8', '1d'],
['9', '1d 1h'],
['9.5', '1d 1h 30m']
])
const estimations = ['0', '1', '1.25', '1.259', '1.26', '1.27', '1.5', '1.75', '2', '7', '8', '9', '9.5']
for (const [input, expected] of estimations.entries()) {
for (const input of estimations) {
await issuesDetailsPage.editIssue({
estimation: input
})
await issuesDetailsPage.checkIssue({
...newIssue,
...editIssue,
estimation: expected
estimation: input
})
}
})
@ -222,7 +203,7 @@ test.describe('Tracker issue tests', () => {
title: `New Issue-${generateId(4)}`,
description: 'New Issue',
priority: 'Medium',
estimation: '1d',
estimation: '8',
component: 'Default component',
milestone: 'Edit Milestone'
}

View File

@ -57,8 +57,6 @@ test.describe('Tracker related issue tests', () => {
await issuesDetailsPage.checkIssue({
...newIssue,
...relatedIssue,
milestone: 'Milestone',
estimation: '1d 4h',
relatedIssue: 'TSK'
})
})

View File

@ -94,8 +94,6 @@ test.describe('Tracker sub-issues tests', () => {
await issuesDetailsPage.checkIssue({
...newSubIssue,
...editSubIssue,
milestone: 'Milestone',
estimation: '1d',
parentIssue: newIssue.title
})
})

View File

@ -41,10 +41,7 @@ test.describe('Tracker template tests', () => {
await trackerNavigationMenuPage.openTemplateForProject('Default')
await templatePage.createNewTemplate(newTemplate)
await templatePage.openTemplate(newTemplate.title)
await templateDetailsPage.checkTemplate({
...newTemplate,
estimation: '2h'
})
await templateDetailsPage.checkTemplate(newTemplate)
})
test('Edit a Template', async ({ page }) => {
@ -69,36 +66,21 @@ test.describe('Tracker template tests', () => {
await templateDetailsPage.editTemplate(editTemplate)
await templateDetailsPage.checkTemplate({
...newTemplate,
...editTemplate,
estimation: '1d'
...editTemplate
})
await templateDetailsPage.checkActivityContent(`New template: ${newTemplate.title}`)
const estimations = new Map([
['0', '0h'],
['1', '1h'],
['1.25', '1h 15m'],
['1.259', '1h 15m'],
['1.26', '1h 15m'],
['1.27', '1h 16m'],
['1.5', '1h 30m'],
['1.75', '1h 45m'],
['2', '2h'],
['7', '7h'],
['8', '1d'],
['9', '1d 1h'],
['9.5', '1d 1h 30m']
])
const estimations = ['0', '1', '1.25', '1.259', '1.26', '1.27', '1.5', '1.75', '2', '7', '8', '9', '9.5']
for (const [input, expected] of estimations.entries()) {
for (const input of estimations) {
await templateDetailsPage.editTemplate({
estimation: input
})
await templateDetailsPage.checkTemplate({
...newTemplate,
...editTemplate,
estimation: expected
estimation: input
})
}
})

View File

@ -168,7 +168,7 @@ test.describe('Tracker tests', () => {
status: 'Todo',
priority: 'Urgent',
assignee: 'Appleseed John',
estimation: '1h',
estimation: '1',
dueDate: '24'
})
})

View File

@ -204,7 +204,7 @@ export async function checkIssueDraft (page: Page, props: IssueProps): Promise<v
}
if (props.estimation !== undefined) {
await expect(page.locator('#estimation-editor')).toHaveText(props.estimation)
await expect(page.locator('#estimation-editor')).toHaveText(convertEstimation(props.estimation))
}
if (props.dueDate !== undefined) {
@ -271,3 +271,19 @@ export async function performPanelTest (page: Page, statuses: string[], panel: s
).toContainText(getIssueName(status), { timeout: 15000 })
}
}
export function convertEstimation (estimation: number | string): string {
const hoursInWorkingDay = 8
const value = typeof estimation === 'string' ? parseFloat(estimation) : estimation
const days = Math.floor(value / hoursInWorkingDay)
const hours = Math.floor(value % hoursInWorkingDay)
const minutes = Math.floor((value % 1) * 60)
const result = [
...(days === 0 ? [] : [`${days}d`]),
...(hours === 0 ? [] : [`${hours}h`]),
...(minutes === 0 ? [] : [`${minutes}m`])
].join(' ')
return result === '' ? '0h' : result
}

View File

@ -30,6 +30,14 @@ export function generateTestData (): TestData {
}
}
export function getTimeForPlanner (): string {
let hour = new Date().getHours()
const ampm = hour < 13 ? 'am' : 'pm'
hour = hour < 1 ? 1 : hour >= 11 && hour < 13 ? 11 : hour >= 22 ? 10 : hour > 12 ? hour - 12 : hour
return `${hour}${ampm}`
}
// Consistent data
export const workspaceName = faker.lorem.word()
export const userName = faker.internet.userName()

View File

@ -82,11 +82,7 @@ test.describe('Workspace tests', () => {
await issuesPage.openIssueByName(newIssue.title)
const issuesDetailsPage = new IssuesDetailsPage(page)
await issuesDetailsPage.checkIssue({
...newIssue,
milestone: 'Milestone',
estimation: '2h'
})
await issuesDetailsPage.checkIssue(newIssue)
})
test('Check validation steps description for the create flow', async ({ page }) => {