From 13d391bde5f337c5b41f125d86be42b32c14333d Mon Sep 17 00:00:00 2001 From: Alex Velichko Date: Tue, 5 Mar 2024 08:38:55 +0300 Subject: [PATCH] TESTS-103: feat(tests): done Title filter test (#4863) Signed-off-by: Alex Velichko --- .../model/tracker/common-tracker-page.ts | 14 ++++++++- tests/sanity/tests/tracker/filter.spec.ts | 30 ++++++++++++++++++- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/tests/sanity/tests/model/tracker/common-tracker-page.ts b/tests/sanity/tests/model/tracker/common-tracker-page.ts index 169da659f4..c9fb40d109 100644 --- a/tests/sanity/tests/model/tracker/common-tracker-page.ts +++ b/tests/sanity/tests/model/tracker/common-tracker-page.ts @@ -19,6 +19,9 @@ export class CommonTrackerPage extends CalendarPage { readonly linkInActivity: Locator readonly inputCommentFile: Locator readonly commentImg: Locator + readonly inputFilterTitle: Locator + readonly buttonFilterApply: Locator + readonly buttonClearFilters: Locator constructor (page: Page) { super(page) @@ -39,13 +42,22 @@ export class CommonTrackerPage extends CalendarPage { this.linkInActivity = page.locator('div[id="activity:string:Activity"] a') this.inputCommentFile = page.locator('input#file') this.commentImg = page.locator('div.activityMessage div.content img') + this.inputFilterTitle = page.locator('div.selectPopup input[placeholder="Title"]') + this.buttonFilterApply = page.locator('div.selectPopup button[type="button"]', { hasText: 'Apply' }) + this.buttonClearFilters = page.locator('button > span', { hasText: 'Clear filters' }) } async selectFilter (filter: string, filterSecondLevel?: string): Promise { await this.buttonFilter.click() await this.page.locator('div.selectPopup [class*="menu"]', { hasText: filter }).click() + if (filterSecondLevel !== null) { - await this.page.locator('div.selectPopup [class*="menu"]', { hasText: filterSecondLevel }).click() + if (filter === 'Title') { + await this.inputFilterTitle.fill(filterSecondLevel) + await this.buttonFilterApply.click() + } else { + await this.page.locator('div.selectPopup [class*="menu"]', { hasText: filterSecondLevel }).click() + } } } diff --git a/tests/sanity/tests/tracker/filter.spec.ts b/tests/sanity/tests/tracker/filter.spec.ts index ecf353e945..36c5428829 100644 --- a/tests/sanity/tests/tracker/filter.spec.ts +++ b/tests/sanity/tests/tracker/filter.spec.ts @@ -155,7 +155,6 @@ test.describe('Tracker filters tests', () => { await issuesPage.checkFilter('Created date', 'This week') await issuesPage.checkFilteredIssueExist(newIssue.title) - // this week filter started on Monday, the yesterday created issue on Sunday if (new Date().getDay() !== 1) { await issuesPage.checkFilteredIssueExist(yesterdayIssueTitle) @@ -309,4 +308,33 @@ test.describe('Tracker filters tests', () => { await issuesDetailsPage.buttonCloseIssue.click() } }) + + test('Title filter', async ({ page }) => { + const firstSearch = 'issue' + const secondSearch = 'done' + const leftSideMenuPage = new LeftSideMenuPage(page) + await leftSideMenuPage.buttonTracker.click() + + const issuesPage = new IssuesPage(page) + await issuesPage.modelSelectorAll.click() + + await test.step(`Check Title filter for ${firstSearch}`, async () => { + await issuesPage.selectFilter('Title', firstSearch) + await issuesPage.checkFilter('Title', 'contains', firstSearch) + + for await (const issue of iterateLocator(issuesPage.issuesList)) { + await expect(issue.locator('span.presenter-label > a')).toContainText(firstSearch, { ignoreCase: true }) + } + }) + + await test.step(`Check Title filter for ${secondSearch}`, async () => { + await issuesPage.buttonClearFilters.click() + await issuesPage.selectFilter('Title', secondSearch) + await issuesPage.checkFilter('Title', 'contains', secondSearch) + + for await (const issue of iterateLocator(issuesPage.issuesList)) { + await expect(issue.locator('span.presenter-label > a')).toContainText(secondSearch, { ignoreCase: true }) + } + }) + }) })