Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TESTS-102: feat(tests): done Label filter test #4885

Merged
merged 13 commits into from
Mar 8, 2024
2 changes: 1 addition & 1 deletion tests/sanity/tests/model/common-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class CommonPage {
}

async checkFromDropdown (page: Page, point: string): Promise<void> {
await page.locator('div.selectPopup span[class^="lines"]', { hasText: point }).click()
await page.locator('div.selectPopup span[class^="lines"]', { hasText: point }).first().click()
}

async pressYesDeletePopup (page: Page): Promise<void> {
Expand Down
17 changes: 11 additions & 6 deletions tests/sanity/tests/model/tracker/common-tracker-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,17 @@ export class CommonTrackerPage extends CalendarPage {
await this.buttonFilter.click()
await this.page.locator('div.selectPopup [class*="menu"]', { hasText: filter }).click()

if (filterSecondLevel !== null) {
if (filter === 'Title') {
await this.inputFilterTitle.fill(filterSecondLevel)
await this.buttonFilterApply.click()
} else {
await this.page.locator('div.selectPopup [class*="menu"]', { hasText: filterSecondLevel }).click()
if (filterSecondLevel !== null && typeof filterSecondLevel === 'string') {
switch (filter) {
case 'Title':
await this.inputFilterTitle.fill(filterSecondLevel)
await this.buttonFilterApply.click()
break
case 'Labels':
await this.selectFromDropdown(this.page, filterSecondLevel)
break
default:
await this.page.locator('div.selectPopup [class*="menu"]', { hasText: filterSecondLevel }).click()
}
}
}
Expand Down
27 changes: 27 additions & 0 deletions tests/sanity/tests/tracker/filter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -401,4 +401,31 @@ test.describe('Tracker filters tests', () => {
}
})
})

test('Label filter', async ({ page }) => {
const filterLabel = 'Filter Label'
const labelIssue: NewIssue = {
title: `Issue for the Label filter-${generateId()}`,
description: 'Issue for the Label filter',
labels: filterLabel,
createLabel: true
}

const leftSideMenuPage = new LeftSideMenuPage(page)
await leftSideMenuPage.buttonTracker.click()

const issuesPage = new IssuesPage(page)
await issuesPage.modelSelectorAll.click()
await issuesPage.createNewIssue(labelIssue)

await test.step('Check Label filter for exist Label', async () => {
await issuesPage.selectFilter('Labels', filterLabel)
await issuesPage.inputSearch.press('Escape')
await issuesPage.checkFilter('Labels', 'is', filterLabel)

for await (const issue of iterateLocator(issuesPage.issuesList)) {
await expect(issue.locator('div.compression-bar > div.label-box span.label')).toContainText(filterLabel)
}
})
})
})