mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-12 20:57:45 +02:00
feat(tests): TESTS-95 done Status filter test (#4150)
Signed-off-by: Alex Velichko <nestor_007@mail.ru>
This commit is contained in:
@@ -2,6 +2,7 @@ import { expect, type Locator, type Page } from '@playwright/test'
|
||||
import { NewIssue } from './types'
|
||||
import path from 'path'
|
||||
import { CommonTrackerPage } from './common-tracker-page'
|
||||
import { iterateLocator } from '../../utils'
|
||||
|
||||
export class IssuesPage extends CommonTrackerPage {
|
||||
readonly page: Page
|
||||
@@ -25,6 +26,7 @@ export class IssuesPage extends CommonTrackerPage {
|
||||
readonly inputSearch: Locator
|
||||
readonly linkSidebarAll: Locator
|
||||
readonly linkSidebarMyIssue: Locator
|
||||
readonly buttonClearFilers: Locator
|
||||
|
||||
constructor (page: Page) {
|
||||
super(page)
|
||||
@@ -61,6 +63,7 @@ export class IssuesPage extends CommonTrackerPage {
|
||||
this.inputSearch = page.locator('input[placeholder="Search"]')
|
||||
this.linkSidebarAll = page.locator('a[href$="all-issues"]')
|
||||
this.linkSidebarMyIssue = page.locator('a[href$="my-issues"]')
|
||||
this.buttonClearFilers = page.locator('div.search-start > div:first-child button')
|
||||
}
|
||||
|
||||
async createNewIssue (data: NewIssue): Promise<void> {
|
||||
@@ -137,4 +140,12 @@ export class IssuesPage extends CommonTrackerPage {
|
||||
async checkFilteredIssueNotExist (issueName: string): Promise<void> {
|
||||
await expect(this.page.locator('div.row span', { hasText: issueName })).toHaveCount(0)
|
||||
}
|
||||
|
||||
async checkAllIssuesInStatus (statusId: string | undefined): Promise<void> {
|
||||
if (statusId === undefined) throw new Error(`Unknown status id ${statusId}`)
|
||||
|
||||
for await (const locator of iterateLocator(this.page.locator('div.listGrid'))) {
|
||||
await expect(locator.locator('div[class*="square"] > svg')).toHaveAttribute('id', statusId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import { LeftSideMenuPage } from '../model/left-side-menu-page'
|
||||
import { IssuesPage } from '../model/tracker/issues-page'
|
||||
import { NewIssue } from '../model/tracker/types'
|
||||
import { allure } from 'allure-playwright'
|
||||
import { DEFAULT_STATUSES, DEFAULT_STATUSES_ID } from './tracker.utils'
|
||||
|
||||
test.use({
|
||||
storageState: PlatformSetting
|
||||
@@ -206,32 +207,21 @@ test.describe('Tracker filters tests', () => {
|
||||
})
|
||||
|
||||
test('Status filter', async ({ page }) => {
|
||||
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 leftSideMenuPage = new LeftSideMenuPage(page)
|
||||
await leftSideMenuPage.buttonTracker.click()
|
||||
|
||||
const issuesPage = new IssuesPage(page)
|
||||
await issuesPage.modelSelectorAll.click()
|
||||
await issuesPage.createNewIssue(newIssue)
|
||||
|
||||
await test.step('Check Filter Today', async () => {
|
||||
await issuesPage.selectFilter('Created date', 'Today')
|
||||
await issuesPage.checkFilter('Created date', 'Today')
|
||||
for (const status of DEFAULT_STATUSES) {
|
||||
await test.step(`Status Filter ${status}`, async () => {
|
||||
await issuesPage.selectFilter('Status', status)
|
||||
await issuesPage.inputSearch.press('Escape')
|
||||
|
||||
await issuesPage.checkFilteredIssueExist(newIssue.title)
|
||||
})
|
||||
await issuesPage.checkFilter('Status', 'is')
|
||||
await issuesPage.checkAllIssuesInStatus(DEFAULT_STATUSES_ID.get(status))
|
||||
await issuesPage.buttonClearFilers.click()
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { test } from '@playwright/test'
|
||||
import { test, expect } from '@playwright/test'
|
||||
import { IssuesPage } from '../model/tracker/issues-page'
|
||||
import { PlatformSetting, PlatformURI } from '../utils'
|
||||
import { allure } from 'allure-playwright'
|
||||
@@ -15,10 +15,9 @@ test('check-status-loading', async ({ page }) => {
|
||||
const issuesPage = new IssuesPage(page)
|
||||
await issuesPage.modelSelectorAll.click()
|
||||
|
||||
// TODO: Test should create issues before checking for status loading
|
||||
// await expect(page.locator('.categoryHeader :text-is("In Progress")').first()).toBeVisible()
|
||||
// await expect(page.locator('.categoryHeader :text-is("Backlog")').first()).toBeVisible()
|
||||
// await expect(page.locator('.categoryHeader :text-is("Todo")').first()).toBeVisible()
|
||||
// await expect(page.locator('.categoryHeader :text-is("Done")').first()).toBeVisible()
|
||||
// await expect(page.locator('.categoryHeader :text-is("Canceled")').first()).toBeVisible()
|
||||
await expect(page.locator('.categoryHeader :text-is("In Progress")').first()).toBeVisible()
|
||||
await expect(page.locator('.categoryHeader :text-is("Backlog")').first()).toBeVisible()
|
||||
await expect(page.locator('.categoryHeader :text-is("Todo")').first()).toBeVisible()
|
||||
await expect(page.locator('.categoryHeader :text-is("Done")').first()).toBeVisible()
|
||||
await expect(page.locator('.categoryHeader :text-is("Canceled")').first()).toBeVisible()
|
||||
})
|
||||
|
||||
@@ -23,6 +23,14 @@ export const PRIORITIES = ['No priority', 'Urgent', 'High', 'Medium', 'Low']
|
||||
export const DEFAULT_STATUSES = ['Backlog', 'Todo', 'In Progress', 'Done', 'Canceled']
|
||||
export const DEFAULT_USER = 'Appleseed John'
|
||||
|
||||
export const DEFAULT_STATUSES_ID = new Map([
|
||||
['Backlog', 'tracker:issueStatusCategory:Backlog'],
|
||||
['Todo', 'tracker:issueStatusCategory:Unstarted'],
|
||||
['In Progress', 'tracker:issueStatusCategory:Started'],
|
||||
['Done', 'tracker:issueStatusCategory:Completed'],
|
||||
['Canceled', 'tracker:issueStatusCategory:Canceled']
|
||||
])
|
||||
|
||||
export async function navigate (page: Page): Promise<void> {
|
||||
await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished()
|
||||
await page.click('[id="app-tracker\\:string\\:TrackerApplication"]')
|
||||
|
||||
@@ -68,3 +68,9 @@ export function expectToContainsOrdered (val: Locator, text: string[], timeout?:
|
||||
const origIssuesExp = new RegExp('.*' + text.join('.*') + '.*')
|
||||
return expect(val).toHaveText(origIssuesExp, { timeout })
|
||||
}
|
||||
|
||||
export async function * iterateLocator (locator: Locator): AsyncGenerator<Locator> {
|
||||
for (let index = 0; index < (await locator.count()); index++) {
|
||||
yield locator.nth(index)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user