From 049c3125b6432c83af965489ab5874907ed9cef6 Mon Sep 17 00:00:00 2001 From: Alex Velichko Date: Wed, 6 Mar 2024 18:37:37 +0300 Subject: [PATCH] TESTS-101: feat(tests): done Modified by filter test (#4871) Signed-off-by: Alex Velichko --- .../model/tracker/common-tracker-page.ts | 6 +++++ .../model/tracker/issues-details-page.ts | 2 +- tests/sanity/tests/tracker/filter.spec.ts | 22 +++++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/tests/sanity/tests/model/tracker/common-tracker-page.ts b/tests/sanity/tests/model/tracker/common-tracker-page.ts index c9fb40d109..75aa7a8ab4 100644 --- a/tests/sanity/tests/model/tracker/common-tracker-page.ts +++ b/tests/sanity/tests/model/tracker/common-tracker-page.ts @@ -22,6 +22,7 @@ export class CommonTrackerPage extends CalendarPage { readonly inputFilterTitle: Locator readonly buttonFilterApply: Locator readonly buttonClearFilters: Locator + readonly textCategoryHeader: Locator constructor (page: Page) { super(page) @@ -45,6 +46,7 @@ export class CommonTrackerPage extends CalendarPage { 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' }) + this.textCategoryHeader = page.locator('div.category-container > div.categoryHeader span[class*="label"]') } async selectFilter (filter: string, filterSecondLevel?: string): Promise { @@ -206,4 +208,8 @@ export class CommonTrackerPage extends CalendarPage { const srcset = await this.commentImg.getAttribute('srcset') expect(srcset).toContain(fileName) } + + async checkCategoryHeader (categoryHeader: string): Promise { + await expect(this.textCategoryHeader).toHaveText(categoryHeader) + } } diff --git a/tests/sanity/tests/model/tracker/issues-details-page.ts b/tests/sanity/tests/model/tracker/issues-details-page.ts index 832dc88aeb..f0a461fb4e 100644 --- a/tests/sanity/tests/model/tracker/issues-details-page.ts +++ b/tests/sanity/tests/model/tracker/issues-details-page.ts @@ -41,7 +41,7 @@ export class IssuesDetailsPage extends CommonTrackerPage { this.buttonMilestone = page.locator('//span[text()="Milestone"]/following-sibling::div[1]/div/button') this.textEstimation = page.locator('//span[text()="Estimation"]/following-sibling::div[1]/button/span') this.buttonEstimation = page.locator('(//span[text()="Estimation"]/../div/button)[3]') - this.buttonCreatedBy = page.locator('(//span[text()="Assignee"]/../div/button)[1]') + this.buttonCreatedBy = page.locator('//span[text()="Created by"]/following-sibling::div[1]/button') this.buttonCloseIssue = page.locator('#btnPClose') this.textParentTitle = page.locator('span.issue-title') this.buttonAddSubIssue = page.locator('#add-sub-issue') diff --git a/tests/sanity/tests/tracker/filter.spec.ts b/tests/sanity/tests/tracker/filter.spec.ts index 36c5428829..043328a60c 100644 --- a/tests/sanity/tests/tracker/filter.spec.ts +++ b/tests/sanity/tests/tracker/filter.spec.ts @@ -337,4 +337,26 @@ test.describe('Tracker filters tests', () => { } }) }) + + test('Modified by filter', async ({ page }) => { + const modifierName = 'Appleseed John' + const leftSideMenuPage = new LeftSideMenuPage(page) + await leftSideMenuPage.buttonTracker.click() + + const issuesPage = new IssuesPage(page) + await issuesPage.modelSelectorAll.click() + + await issuesPage.selectFilter('Modified by', modifierName) + await issuesPage.inputSearch.press('Escape') + await issuesPage.checkFilter('Modified by', 'is') + + for await (const issue of iterateLocator(issuesPage.issuesList)) { + await issue.locator('span.list > a').click() + + const issuesDetailsPage = new IssuesDetailsPage(page) + await expect(issuesDetailsPage.buttonCreatedBy).toHaveText(modifierName) + + await issuesDetailsPage.buttonCloseIssue.click() + } + }) })