TESTS-103: feat(tests): done Title filter test (#4863)

Signed-off-by: Alex Velichko <alex@hardcoreeng.com>
This commit is contained in:
Alex Velichko 2024-03-05 08:38:55 +03:00 committed by GitHub
parent bbe4a3a6d6
commit 13d391bde5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 42 additions and 2 deletions

View File

@ -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<void> {
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()
}
}
}

View File

@ -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 })
}
})
})
})