feat(tests): TESTS-93 updated Created date filter test (#4862)

Signed-off-by: Alex Velichko <alex@hardcoreeng.com>
This commit is contained in:
Alex Velichko 2024-03-03 19:47:26 +03:00 committed by GitHub
parent 643015a664
commit 164a258f75
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 30 additions and 3 deletions

View File

@ -11,3 +11,6 @@
./tool.sh configure sanity-ws --enable=*
./tool.sh configure sanity-ws --list
# setup issue createdOn for yesterday
./tool.sh change-field sanity-ws --objectId 65e47f1f1b875b51e3b4b983 --objectClass tracker:class:Issue --attribute createdOn --value $(($(date +%s)*1000 - 86400000)) --type number --domain task

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -59,17 +59,25 @@ export class CommonTrackerPage extends CalendarPage {
}
}
async updateFilterDimension (filterSecondLevel: string, dateStart?: string): Promise<void> {
async updateFilterDimension (
filterSecondLevel: string,
dateStart?: string,
needToOpenCalendar: boolean = false
): Promise<void> {
await this.page.locator('div.filter-section button:nth-child(2)').click()
await this.page.locator('div.selectPopup [class*="menu"]', { hasText: filterSecondLevel }).click()
if (dateStart !== undefined) {
if (needToOpenCalendar) {
await this.page.locator('div.filter-section button:nth-child(3)').click()
}
switch (dateStart) {
case 'Today':
await this.page.locator('div.popup div.calendar button.day.today').click()
break
default:
await this.page.locator('div.popup div.calendar button.day', { hasText: dateStart }).click()
await this.page.locator('div.popup div.calendar button.day').locator(`text="${dateStart}"`).click()
break
}
}

View File

@ -112,6 +112,7 @@ test.describe('Tracker filters tests', () => {
})
test('Created date', async ({ page }) => {
const yesterdayIssueTitle = 'Issue for the Check Filter Yesterday'
const newIssue: NewIssue = {
title: `Issue for the Created filter-${generateId()}`,
description: 'Issue for the Created filter',
@ -138,12 +139,14 @@ test.describe('Tracker filters tests', () => {
await issuesPage.checkFilter('Created date', 'Today')
await issuesPage.checkFilteredIssueExist(newIssue.title)
await issuesPage.checkFilteredIssueNotExist(yesterdayIssueTitle)
})
await test.step('Check Filter Yesterday', async () => {
await issuesPage.updateFilterDimension('Yesterday')
await issuesPage.checkFilter('Created date', 'Yesterday')
await issuesPage.checkFilteredIssueExist(yesterdayIssueTitle)
await issuesPage.checkFilteredIssueNotExist(newIssue.title)
})
@ -152,6 +155,7 @@ test.describe('Tracker filters tests', () => {
await issuesPage.checkFilter('Created date', 'This week')
await issuesPage.checkFilteredIssueExist(newIssue.title)
await issuesPage.checkFilteredIssueExist(yesterdayIssueTitle)
})
await test.step('Check Filter This month', async () => {
@ -159,13 +163,25 @@ test.describe('Tracker filters tests', () => {
await issuesPage.checkFilter('Created date', 'This month')
await issuesPage.checkFilteredIssueExist(newIssue.title)
await issuesPage.checkFilteredIssueExist(yesterdayIssueTitle)
})
await test.step('Check Filter Exact date - Yesterday', async () => {
const dateYesterday = new Date()
dateYesterday.setDate(dateYesterday.getDate() - 1)
await issuesPage.updateFilterDimension('Exact date', dateYesterday.getDate().toString())
await issuesPage.checkFilter('Created date', 'is', dateYesterday.getDate().toString())
await issuesPage.checkFilteredIssueExist(yesterdayIssueTitle)
await issuesPage.checkFilteredIssueNotExist(newIssue.title)
})
await test.step('Check Filter Exact date - Today', async () => {
await issuesPage.updateFilterDimension('Exact date', 'Today')
await issuesPage.updateFilterDimension('Exact date', 'Today', true)
await issuesPage.checkFilter('Created date', 'is', 'Today')
await issuesPage.checkFilteredIssueExist(newIssue.title)
await issuesPage.checkFilteredIssueNotExist(yesterdayIssueTitle)
})
await test.step('Check Filter Before date - Today', async () => {